Está funcionando con bootstrap

El formulario está casi terminado, falta acomodar un poco el script de php
y mejorar la validación
This commit is contained in:
root 2017-09-01 15:16:19 -03:00
parent 5812172bbb
commit 8253f3e188
13 changed files with 935 additions and 107 deletions

View File

@ -1,2 +1,2 @@
Nombre,Apellido,TipoDoc,Documento,Direccion,Pais,Ciudad,Telefono,Email,Profesión,Financiación,"Detalle Financiación"
German,Correa,C.I,4596793-2,"Salvador Garcia Pintos 1114",Uruguay,Montevideo,091432378,german.correa.balier@gmail.com,Estudiante,no,
Nombre,Apellido,TipoDoc,Documento,Direccion,Pais,Ciudad,Telefono,Email,Profesión,"Trabaja en",Financiación,"Detalle Financiación"
German,Correa,Otro,234,"Salvador Garcia Pintos 1114",Alemania,Montevideo,091432378,german.correa.balier@gmail.com,Estudiante,Primaria,no,

1 Nombre Apellido TipoDoc Documento Direccion Pais Ciudad Telefono Email Profesión Trabaja en Financiación Detalle Financiación
2 German Correa C.I Otro 4596793-2 234 Salvador Garcia Pintos 1114 Uruguay Alemania Montevideo 091432378 german.correa.balier@gmail.com Estudiante Primaria no

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 748 KiB

BIN
img/pmu15-tapa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -20,7 +20,7 @@
<div id="site_content" class="container">
<div class="row">
<div id="content" class="col-xs-12 col-sm-8">
<h1><strong>Bienvenidos al 6º Coloquio Uruguayo de Matemática 2017</strong></h1>
<h1 id="welcome"><strong>Bienvenidos!</strong></h1>
<div class="col-xs-12">
@ -48,10 +48,22 @@
Ezequiel Maderna
Martín Reiris
</p>
<p>
A 20 años de la creación del Centro de Matemática este propuso comenzar a realizar un evento periódico que promoviera el desarrollo de la investigación en Matemática y a su vez estimulara y organizara el estudio de esta tanto a nivel de grado como de posgrado e influyera en su desarrollo en todos sus niveles. Así fue que en el año 2007 el CMAT en conjunto con el IMERL comenzó a organizar está serie de Coloquios bianuales de Matemática orientados al público matemático en general, sean investigadores, estudiantes de grado y posgrado de matemática, docentes universitarios y de secundaria, estudiantes de profesorado (IPA, CERP), etc. El evento es de carácter gratuito y cuenta con cursos para docentes, para estudiantes de grado y posgrado y varias conferencias dictadas por investigadores tanto nacionales como invitados extranjeros.
</p>
<div class="col-xs-12">
<div class="media">
<div class="media-left media-top">
<img src="img/pmu15-tapa.png" class="media-object" style="width:110px">
</div>
<div class="media-body">
<h4 class="media-heading">Publicaciones Matemática del Uruguay (PMU)</h4>
<p>Los Coloquios se publican regularmente en las PMU.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="sidebar" class="sidebar col-xs-12 col-sm-4"></div>
</div>

159
js/app.js
View File

@ -11,8 +11,34 @@ function showmsg(msgTxt,ok){
}
$("#statusmsg").show();
}
function inputvalidate(){
var parent = $(this).parents("div.form-group");
if($(this).is(":invalid"))
parent.addClass("has-error");
else{
parent.removeClass("has-error");
//parent.removeClass("has-warning");
parent.addClass("has-success");
}
}
function validateTextarea(){
if($(this).val() == ""){
//$('#detallefinan').removeClass("has-warning");
$('#detallefinan').addClass("has-error");
$("#detallefinan textarea").tooltip("hide");
$("#detallefinan textarea").tooltip("destroy");
}
else{
//$('#detallefinan').removeClass("has-warning");
$('#detallefinan').removeClass("has-error");
$('#detallefinan').addClass("has-success");
}
}
$(document).ready(function(){
var ruta = window.location.pathname;
$("#statusmsg").hide();
$("#header").load("snippets/header.html");
$("#footer").load("snippets/footer.html");
@ -20,9 +46,18 @@ $(document).ready(function(){
$("#menu li a").click(function(){
$(this).addClass("selected").siblings().removeClass("selected");
});
$('input').focusin(inputvalidate);
$('input').focusout(inputvalidate);
$('input').keyup(inputvalidate);
$("#detallefinan textarea").focusin(validateTextarea);
$("#detallefinan textarea").focusout(validateTextarea);
$("#detallefinan textarea").keyup(validateTextarea);
//$('input:invalid').parents('div.form-group').addClass('has-warning');
$('#contactform').submit(function(event){
$("#statusmsg").hide();
event.preventDefault();
var post = $.post('contact.php', $(this).serialize());
post.done(function(data){
data = $.parseJSON(data);
@ -41,35 +76,116 @@ $(document).ready(function(){
});
});
$("#detallefinan").hide();
$("#detallefinan textarea").val("");
$('input:radio[name="financiacion"]').change(function(){
if($(this).is(':checked') && $(this).val() == "si"){
$("#detallefinan").show();
$('#detallefinan textarea').prop('required',true);
$("#detallefinan textarea").addClass("has-error");
}
else{
else
$("#detallefinan").hide();
$('#detallefinan textarea').prop('required',false);
$("#detallefinan textarea").value("");
}
});
$('#doctype').change(function(){
if(this.value == "C.I"){
$('#txtdocnro').attr('placeholder',"1234567-0");
}
if(this.value == "Otro"){
$('#txtdocnro').attr('placeholder',"Escriba su documento de identidad");
}
if(this.value == "Tipo:"){
$('#txtdocnro').attr('placeholder',"Seleccion un tipo de documento");
}
var tipodoc;
$('#tipodoc li a').click(function(event){
event.preventDefault();
$('#btntipodoc').tooltip("hide");
$('btnpais').tooltip("destroy");
tipodoc = $(this).text();
$("#btntipodoc").text($(this).text());
$("#btntipodoc").val($(this).text());
if(tipodoc == "Otro"){
$("#txtdocnro").attr('placeholder', 'Escriba su documento');
$("#txtdocnro").removeAttr('pattern');
}
if(tipodoc == "C.I."){
$("#txtdocnro").attr('placeholder', '1234567-0');
$("#txtdocnro").attr('pattern', '[0-9]{5,7}-[0-9]');
}
});
var pais;
$('#lstpais li a').click(function(event){
event.preventDefault();
pais = $(this).text();
$('#btnpais').tooltip("hide");
$('btnpais').tooltip("destroy");
$("#btnpais").text($(this).text());
$("#btnpais").val($(this).text());
});
var trabaja;
$('#lsttrabaja li a').click(function(event){
event.preventDefault();
trabaja = $(this).text();
$('#btntrabaja').tooltip("hide");
$('btnpais').tooltip("destroy");
$("#btntrabaja").text($(this).text());
$("#btntrabaja").val($(this).text());
});
$('#registerform').submit(function(event){
var fail = false;
$("#statusmsg").hide();
event.preventDefault();
var post = $.post('register.php', $(this).serialize());
post.done(function(data){
if(tipodoc == null){
$('#btntipodoc').tooltip({
"title":"Seleccione Tipo de Documento",
"html":true,
"pacement":"auto left",
"trigger":"manual",
"delay":{"show":100,"hide":2000}
});
$('#btntipodoc').tooltip("show");
fail=true;
}
if(pais == null){
$('#btnpais').tooltip({
"title":"Seleccione País",
"html":true,
"pacement":"auto left",
"trigger":"manual",
"delay":{"show":100,"hide":2000}
});
$('#btnpais').tooltip("show");
fail=true;
}
if(trabaja == null){
$('#btntrabaja').tooltip({
"title":"Especifique donde trabaja",
"html":true,
"pacement":"auto left",
"trigger":"manual",
"delay":{"show":100,"hide":2000}
});
$('#btntrabaja').tooltip("show");
fail=true;
}
if($("#detallefinan textarea").val()=="" &&
$('input:radio[name="financiacion"]:checked').val()=="si"){
$("#detallefinan textarea").tooltip({
"title":"Escriba el detalle",
"html":true,
"pacement":"auto left",
"trigger":"manual"
});
$("#detallefinan textarea").tooltip("show");
fail=true;
}
if(!fail){
$("#txtpais").val(pais);
$("#txttipodoc").val(tipodoc);
$("#txttrabaja").val(trabaja);
console.log($(this).serialize());
var post = $.post('register.php', $(this).serialize());
post.done(function(data){
console.log(data);
data = $.parseJSON(data);
if(data.success){
showmsg(data.message,true);
@ -82,10 +198,11 @@ $(document).ready(function(){
}
console.log(data)
});
post.fail(function(error){
console.log(error)
});
post.fail(function(error){
console.log(error)
});
});
}
});
});

277
lib/recaptchalib.php Normal file
View File

@ -0,0 +1,277 @@
<?php
/*
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* http://recaptcha.net/plugins/php/
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
* AUTHORS:
* Mike Crawford
* Ben Maurer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* The reCAPTCHA server URL's
*/
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
/**
* Encodes the given data into a query string format
* @param $data - array of string elements to be encoded
* @return string - encoded request
*/
function _recaptcha_qsencode ($data) {
$req = "";
foreach ( $data as $key => $value )
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
// Cut the last '&'
$req=substr($req,0,strlen($req)-1);
return $req;
}
/**
* Submits an HTTP POST to a reCAPTCHA server
* @param string $host
* @param string $path
* @param array $data
* @param int port
* @return array response
*/
function _recaptcha_http_post($host, $path, $data, $port = 80) {
$req = _recaptcha_qsencode ($data);
$http_request = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
$http_request .= "\r\n";
$http_request .= $req;
$response = '';
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
die ('Could not open socket');
}
fwrite($fs, $http_request);
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
return $response;
}
/**
* Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget
* is embedded within the HTML form it was called from.
* @param string $pubkey A public key for reCAPTCHA
* @param string $error The error given by reCAPTCHA (optional, default is null)
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
* @return string - The HTML to be embedded in the user's form.
*/
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{
if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
} else {
$server = RECAPTCHA_API_SERVER;
}
$errorpart = "";
if ($error) {
$errorpart = "&amp;error=" . $error;
}
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
<noscript>
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>';
}
/**
* A ReCaptchaResponse is returned from recaptcha_check_answer()
*/
class ReCaptchaResponse {
var $is_valid;
var $error;
}
/**
* Calls an HTTP POST function to verify if the user's guess was correct
* @param string $privkey
* @param string $remoteip
* @param string $challenge
* @param string $response
* @param array $extra_params an array of extra variables to post to the server
* @return ReCaptchaResponse
*/
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
{
if ($privkey == null || $privkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($remoteip == null || $remoteip == '') {
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
}
//discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
$recaptcha_response = new ReCaptchaResponse();
$recaptcha_response->is_valid = false;
$recaptcha_response->error = 'incorrect-captcha-sol';
return $recaptcha_response;
}
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array (
'privatekey' => $privkey,
'remoteip' => $remoteip,
'challenge' => $challenge,
'response' => $response
) + $extra_params
);
$answers = explode ("\n", $response [1]);
$recaptcha_response = new ReCaptchaResponse();
if (trim ($answers [0]) == 'true') {
$recaptcha_response->is_valid = true;
}
else {
$recaptcha_response->is_valid = false;
$recaptcha_response->error = $answers [1];
}
return $recaptcha_response;
}
/**
* gets a URL where the user can sign up for reCAPTCHA. If your application
* has a configuration page where you enter a key, you should provide a link
* using this function.
* @param string $domain The domain where the page is hosted
* @param string $appname The name of your application
*/
function recaptcha_get_signup_url ($domain = null, $appname = null) {
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
}
function _recaptcha_aes_pad($val) {
$block_size = 16;
$numpad = $block_size - (strlen ($val) % $block_size);
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
}
/* Mailhide related code */
function _recaptcha_aes_encrypt($val,$ky) {
if (! function_exists ("mcrypt_encrypt")) {
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
}
$mode=MCRYPT_MODE_CBC;
$enc=MCRYPT_RIJNDAEL_128;
$val=_recaptcha_aes_pad($val);
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
}
function _recaptcha_mailhide_urlbase64 ($x) {
return strtr(base64_encode ($x), '+/', '-_');
}
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
}
$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
}
/**
* gets the parts of the email to expose to the user.
* eg, given johndoe@example,com return ["john", "example.com"].
* the email is then displayed as john...@example.com
*/
function _recaptcha_mailhide_email_parts ($email) {
$arr = preg_split("/@/", $email );
if (strlen ($arr[0]) <= 4) {
$arr[0] = substr ($arr[0], 0, 1);
} else if (strlen ($arr[0]) <= 6) {
$arr[0] = substr ($arr[0], 0, 3);
} else {
$arr[0] = substr ($arr[0], 0, 4);
}
return $arr;
}
/**
* Gets html to display an email address given a public an private key.
* to get a key, go to:
*
* http://www.google.com/recaptcha/mailhide/apikey
*/
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
$emailparts = _recaptcha_mailhide_email_parts ($email);
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
}
?>

85
register-old.html Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE HTML>
<html>
<head>
<title>6to Coloquio Uruguayo de Matémática</title>
<meta name="description" content="website description" />
<meta name="keywords" content="website keywords, website keywords" />
<meta http-equiv="content-type" content="text/html; charset=utf8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style/style.css" />
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/app.js"></script>
</head>
<body>
<div id="main">
<header id="header"></div>
<div id="site_content" class="container">
<div class="row">
<div id="content" class="col-xs-12 col-sm-8">
<h1>Registrarse</h1>
<form id="registerform" action="register.php" method="post">
<div class="form_settings">
<p class="inline-input">
<span>Nombre</span>
<!--bel for="nombre" class="control-label">Nombre</label>-->
<input placeholder="Juan" name="nombre" type="text" class="form-control" id="nombre" required>
<label for="apellido" class="control-label">Apellido</label>
<input name="apellido" placeholder="Rodriguez" type="text" class="form-control" id="apellido" required>
</p>
<p class="inline-input">
<span>Documento:</span>
<select class="small" name="doctype" required id="doctype">
<option>C.I</option>
<option>Otro</option>
</select>
<label for="docnro" class="control-label">Nro.</label>
<input type="text" id="txtdocnro" name="docnro" placeholder="1234567-0" required>
</p>
<p>
<span>Dirección:</span>
<input name="dir" placeholder="18 de Julio 1544" type="text" name="dir" required>
</p>
<p class="inline-input">
<span>Pais: </span>
<!--<label for="pais" class="control-label">Pais</label>-->
<input placeholder="Uruguay" type="text" class="form-control" name="pais" required>
<label for="estado" class="control-label">Ciudad</label>
<input placeholder="Montevideo" type="text" name="ciudad" required>
</p>
<p><span>Teléfono:</span><input placeholder="099 123 456" class="contact" type="text" name="tel" required /></p>
<p><span>Email:</span><input placeholder="mail@example.com" class="contact" type="email" name="email" value="" required/></p>
<p><span>Profesión:</span><input placeholder="Estudiante, Docente, Profesor" class="contact" type="text" name="profesion" required/></p>
<p>
<span style="width:150px;">Precisa financiación?</span>
<label>Si</label><input type="radio" name="financiacion" value="si" id="sifinan"/>
<label>No</label><input type="radio" checked="True" name="financiacion" value="no" id="nofinan"/>
</p>
<br/>
<p id="detallefinan">
<span>Detalle, con estimación de costo:</span>
<textarea class="contact textarea" type="text" rows="8" cols="50" name="detallefinan"></textarea>
</p>
<p style="padding-top: 15px"><span>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
</div>
</form>
<div id="statusmsg" class="alert alert-success">
<strong>Success!</strong> Indicates a successful or positive action.
</div>
</div>
<div id="sidebar" class="sidebar col-xs-12 col-sm-4"></div>
</div>
</div>
<footer id="footer">
</footer>
</div>
</body>
</html>

View File

@ -9,65 +9,158 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style/style.css" />
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/app.js"></script>
<script src='https://www.google.com/recaptcha/api.js?hl=es'></script>
</head>
<body>
<div id="main">
<header id="header"></div>
<div id="site_content" class="container">
<div class="row">
<div id="content" class="col-xs-12 col-sm-8">
<header id="header"></header>
<div id="site_content" class="container">
<div class="row">
<div id="content" class="col-xs-12 col-sm-8">
<h1>Registrarse</h1>
<form id="registerform" action="register.php" method="post">
<div class="form_settings">
<p class="inline-input">
<span>Nombre</span>
<!--bel for="nombre" class="control-label">Nombre</label>-->
<input placeholder="Juan" name="nombre" type="text" class="form-control" id="nombre" required>
<label for="apellido" class="control-label">Apellido</label>
<input name="apellido" placeholder="Rodriguez" type="text" class="form-control" id="apellido" required>
</p>
<p class="inline-input">
<span>Documento:</span>
<form id="registerform" action="register.php" method="post" class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="txtnombre">Nombre:</label>
<div class="col-sm-8">
<input id="txtnombre" class="form-control" name="nombre"
placeholder="Juan" type="text" pattern="^[a-zA-Z][a-zA-Z\s\-.'`áéíóú]*[a-zA-Z]$" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtapellido">Apellido:</label>
<div class="col-sm-8">
<input id="txtapellido" class="form-control" name="apellido"
placeholder="Perez" type="text" pattern="^[a-zA-Z][a-zA-Z\s\-.'`áéíóú]*[a-zA-Z]$" required>
</div>
</div>
<!-- Selector de Documento mas nro-->
<div class="form-group row">
<label class="col-sm-2 control-label" for="txtdocnro">Documento:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-btn">
<button id="btntipodoc" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Tipo <span class="caret"></span></button>
<ul id="tipodoc" class="dropdown-menu">
<li><a href="#">C.I.</a></li>
<li><a href="#">Otro</a></li>
<input id="txttipodoc" name="doctype" type="hidden">
</ul>
</div><!-- /btn-group -->
<select class="small" name="doctype" required id="doctype">
<option>C.I</option>
<option>Otro</option>
</select>
<label for="docnro" class="control-label">Nro.</label>
<input type="text" id="txtdocnro" name="docnro" placeholder="1234567-0" required>
</p>
<p>
<span>Dirección:</span>
<input name="dir" placeholder="18 de Julio 1544" type="text" name="dir" required>
</p>
<p class="inline-input">
<span>Pais: </span>
<!--<label for="pais" class="control-label">Pais</label>-->
<input placeholder="Uruguay" type="text" class="form-control" name="pais" required>
<label for="estado" class="control-label">Ciudad</label>
<input placeholder="Montevideo" type="text" name="ciudad" required>
</p>
<p><span>Teléfono:</span><input placeholder="099 123 456" class="contact" type="text" name="tel" required /></p>
<p><span>Email:</span><input placeholder="mail@example.com" class="contact" type="email" name="email" value="" required/></p>
<p><span>Profesión:</span><input placeholder="Estudiante, Docente, Profesor" class="contact" type="text" name="profesion" required/></p>
<input id="txtdocnro" name="docnro" class="form-control"
placeholder="Seleccione Tipo de Documento..." type="text" required>
</div><!-- /input-group -->
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 control-label" for="txtdir">Pais:</label>
<div class="col-sm-2">
<button id="btnpais" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Pais <span class="caret"></span></button>
<ul id="lstpais" class="dropdown-menu">
<li><a href="#">Uruguay</a></li>
<li><a href="#">Alemania</a></li>
<li><a href="#">Austria</a></li>
<li><a href="#">Argentina</a></li>
<li><a href="#">Bolivia</a></li>
<li><a href="#">Brasil</a></li>
<li><a href="#">Canadá</a></li>
<li><a href="#">Chile</a></li>
<li><a href="#">Colombia</a></li>
<li><a href="#">Ecuador</a></li>
<li><a href="#">España</a></li>
<li><a href="#">Estados Unidos</a></li>
<li><a href="#">Francia</a></li>
<li><a href="#">Inglaterra</a></li>
<li><a href="#">Italia</a></li>
<li><a href="#">México</a></li>
<li><a href="#">Paraguay</a></li>
<li><a href="#">Perú</a></li>
<li><a href="#">Suiza</a></li>
<li><a href="#">Venezuela</a></li>
<li><a href="#">Otro</a></li>
</ul>
<input id="txtpais" name="pais" type="hidden">
</div>
<label class="col-sm-2 control-label" for="txtciudad">Ciudad:</label>
<div class="col-sm-4">
<input id="txtciudad" name="ciudad" class="form-control"
placeholder="Montevideo" type="text" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtdir">Direccion:</label>
<div class="col-sm-8">
<input id="txtdir" class="form-control" name="dir"
placeholder="18 de Julio 1432 apto 302" type="text" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtel">Telefono:</label>
<div class="col-sm-8">
<input id="txttel" class="form-control" name="tel"
placeholder="099123456" type="text" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtmail">Email:</label>
<div class="col-sm-8">
<input id="txtmail" class="form-control" name="email"
placeholder="mail@example.com" type="email" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtprof">Profesión:</label>
<div class="col-sm-8">
<input id="txtprof" class="form-control" name="profesion"
placeholder="Profesor, Docente o Estudiante, etc" type="text" pattern="[a-zA-Z]*" required>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 control-label" for="txttrabaja">Trabaja en:</label>
<div class="col-sm-8">
<button id="btntrabaja" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Seleccione <span class="caret"></span></button>
<ul id="lsttrabaja" class="dropdown-menu">
<li><a href="#">Primaria</a></li>
<li><a href="#">Secundaria</a></li>
<li><a href="#">Universidad</a></li>
<li><a href="#">UTU</a></li>
<li><a href="#">UTEC</a></li>
<li><a href="#">IPA/CERP</a></li>
<li><a href="#">Sector Privado</a></li>
<li><a href="#">Sector Público</a></li>
<li><a href="#">No trabaja</a></li>
</ul>
<input id="txttrabaja" name="trabaja" type="hidden">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="rdfinan">Financiación?</label>
<div class="col-sm-8">
<label class="radio-inline"><input id="sifinan" type="radio" name="financiacion" value="si"></label>
<label class="radio-inline"><input id="nofinan" type="radio" checked="true" name="financiacion" value="no">No</label>
</div>
</div>
<div id="detallefinan" class="form-group">
<label class="control-label col-sm-2" for="detallefinan">Detalle estimación de costo:</label>
<div class="col-sm-8">
<textarea class="form-control" name="detallefinan" row="10" style="height:200px;">
</textarea>
<p>
<span style="width:150px;">Precisa financiación?</span>
<label>Si</label><input type="radio" name="financiacion" value="si" id="sifinan"/>
<label>No</label><input type="radio" checked="True" name="financiacion" value="no" id="nofinan"/>
</p>
<br/>
<p id="detallefinan">
<span>Detalle, con estimación de costo:</span>
<textarea class="contact textarea" type="text" rows="8" cols="50" name="detallefinan"></textarea>
</p>
<p style="padding-top: 15px"><span>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
</div>
</div>
<div class="form-group">
<div class="g-recaptcha" data-sitekey="6LeLxy4UAAAAALcrNXxcOiW1B3QgcfgZ6u4l52kZ"></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8 text-right">
<button type="submit" class="btn btn-primary">Registrar</button>
</div>
</div>
</form>
<div id="statusmsg" class="alert alert-success">
@ -77,9 +170,12 @@
<div id="sidebar" class="sidebar col-xs-12 col-sm-4"></div>
</div>
</div>
<footer id="footer">
<footer id="footer">
</footer>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,14 +1,29 @@
<?php
$errors = array(); // array to hold validation errors
$data = array(); // array to pass back data
$filename = "2021y22";
function verifyCaptcha(){
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = array(
'secret' => '6LeLxy4UAAAAABClplWLJUjZ1_nhX_-SI7CuNcm8',
'response' => $_POST["g-recaptcha-response"]
);
$options = array(
'http' => array (
'header' => 'Content-Type: application/x-www-form-urlencoded\r\n',
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$verify = file_get_contents($url, false, $context);
$captcha_success=json_decode($verify);
return captcha_success;
}
function setheaders() {
$fp = fopen("2021y22.csv", 'w');
$cabezal = array('Nombre', 'Apellido','TipoDoc','Documento',
'Direccion','Pais','Ciudad', 'Telefono', 'Email',
'Profesión','Financiación','Detalle Financiación');
'Profesión','Trabaja en','Financiación','Detalle Financiación');
if($fp){
fputcsv($fp,$cabezal);
fclose($fp);
@ -23,6 +38,9 @@ function registrar($fila) {
if($fp){
fputcsv($fp,$fila);
fclose($fp);
exec("git add 2021y22.csv");
$cmd = "git commit -m 'Se registra a '".$fila[0]." ".$fila[1]."-".$fila[3];
exec($cmd);
}
else{
die("unable to open file");
@ -30,6 +48,10 @@ function registrar($fila) {
}
$errors = array(); // array to hold validation errors
$data = array(); // array to pass back data
$filename = "2021y22";
// validate the variables ======================================================
$data['nombre'] = $_POST['nombre'];
$data['apellido'] = $_POST['apellido'];
@ -41,6 +63,7 @@ $data['ciudad'] = $_POST['ciudad'];
$data['telefono'] = $_POST['tel'];
$data['email'] = $_POST['email'];
$data['profesion'] = $_POST['profesion'];
$data['trabaja'] = $_POST['trabaja'];
$data['financiacion'] = $_POST['financiacion'];
$data['detallefinan'] = $_POST['detallefinan'];
@ -74,6 +97,28 @@ if (empty($_POST['email']))
if (empty($_POST['profesion']))
$errors['email'] = 'indique profesion';
if (empty($_POST['trabaja']))
$errors['trabaja'] = 'Indique en el sector que trabaja';
if(empty($_POST['g-recaptcha-response'])){
$errors['recaptcha'] = 'Debe validar el captcha';
}
else if(!verifyCaptcha()){
$errors['recaptcha'] = 'Error en la validación de ReCaptcha';
}
/*if ($_POST['g-recaptcha-response']){
$response = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
if($response == null || !$response->sucess)
$errors['captcha'] = 'no captcha seleceted';
}
else{
echo "falta el captcha";
}*/
if( !file_exists("2021y22.csv"))
setheaders();

180
register2.html Normal file
View File

@ -0,0 +1,180 @@
<!DOCTYPE HTML>
<html>
<head>
<title>6to Coloquio Uruguayo de Matémática</title>
<meta name="description" content="website description" />
<meta name="keywords" content="website keywords, website keywords" />
<meta http-equiv="content-type" content="text/html; charset=utf8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style/style.css" />
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/app.js"></script>
<script src='https://www.google.com/recaptcha/api.js?hl=es'></script>
</head>
<body>
<div id="main">
<header id="header"></header>
<div id="site_content" class="container">
<div class="row">
<div id="content" class="col-xs-12 col-sm-8">
<h1>Registrarse</h1>
<form id="registerform" action="register.php" method="post" class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="txtnombre">Nombre:</label>
<div class="col-sm-8">
<input id="txtnombre" class="form-control" name="nombre"
placeholder="Juan" type="text" pattern="^[a-zA-Z][a-zA-Z\s\-.'`áéíóú]*[a-zA-Z]$" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtapellido">Apellido:</label>
<div class="col-sm-8">
<input id="txtapellido" class="form-control" name="apellido"
placeholder="Perez" type="text" pattern="^[a-zA-Z][a-zA-Z\s\-.'`áéíóú]*[a-zA-Z]$" required>
</div>
</div>
<!-- Selector de Documento mas nro-->
<div class="form-group row">
<label class="col-sm-2 control-label" for="txtdocnro">Documento:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-btn">
<button id="btntipodoc" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Tipo <span class="caret"></span></button>
<ul id="tipodoc" class="dropdown-menu">
<li><a href="#">C.I.</a></li>
<li><a href="#">Otro</a></li>
<input id="txttipodoc" name="doctype" type="hidden">
</ul>
</div><!-- /btn-group -->
<input id="txtdocnro" name="docnro" class="form-control"
placeholder="Seleccione Tipo de Documento..." type="text" required>
</div><!-- /input-group -->
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 control-label" for="txtdir">Pais:</label>
<div class="col-sm-2">
<button id="btnpais" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Pais <span class="caret"></span></button>
<ul id="lstpais" class="dropdown-menu">
<li><a href="#">Uruguay</a></li>
<li><a href="#">Alemania</a></li>
<li><a href="#">Austria</a></li>
<li><a href="#">Argentina</a></li>
<li><a href="#">Bolivia</a></li>
<li><a href="#">Brasil</a></li>
<li><a href="#">Canadá</a></li>
<li><a href="#">Chile</a></li>
<li><a href="#">Colombia</a></li>
<li><a href="#">Ecuador</a></li>
<li><a href="#">España</a></li>
<li><a href="#">Estados Unidos</a></li>
<li><a href="#">Francia</a></li>
<li><a href="#">Inglaterra</a></li>
<li><a href="#">Italia</a></li>
<li><a href="#">México</a></li>
<li><a href="#">Paraguay</a></li>
<li><a href="#">Perú</a></li>
<li><a href="#">Suiza</a></li>
<li><a href="#">Venezuela</a></li>
<li><a href="#">Otro</a></li>
</ul>
<input id="txtpais" name="pais" type="hidden">
</div>
<label class="col-sm-2 control-label" for="txtciudad">Ciudad:</label>
<div class="col-sm-4">
<input id="txtciudad" name="ciudad" class="form-control"
placeholder="Montevideo" type="text" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtdir">Direccion:</label>
<div class="col-sm-8">
<input id="txtdir" class="form-control" name="dir"
placeholder="18 de Julio 1432 apto 302" type="text" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtel">Telefono:</label>
<div class="col-sm-8">
<input id="txttel" class="form-control" name="tel"
placeholder="099123456" type="text" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtmail">Email:</label>
<div class="col-sm-8">
<input id="txtmail" class="form-control" name="email"
placeholder="mail@example.com" type="email" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="txtprof">Profesión:</label>
<div class="col-sm-8">
<input id="txtprof" class="form-control" name="profesion"
placeholder="Profesor, Docente o Estudiante, etc" type="text" pattern="[a-zA-Z]*" required>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 control-label" for="txttrabaja">Trabaja en:</label>
<div class="col-sm-8">
<button id="btntraba" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Pais <span class="caret"></span></button>
<ul id="lsttrabaja" class="dropdown-menu">
<li><a href="#">Primaria</a></li>
<li><a href="#">Secundaria</a></li>
<li><a href="#">Universidad</a></li>
<li><a href="#">UTU</a></li>
<li><a href="#">UTEC</a></li>
<li><a href="#">IPA/CERP</a></li>
<li><a href="#">Sector Privado</a></li>
<li><a href="#">Sector Público</a></li>
</ul>
<input id="txttrabaja" name="trabaja" type="hidden">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="rdfinan">Financiación?</label>
<div class="col-sm-8">
<label class="radio-inline"><input id="sifinan" type="radio" name="financiacion" value="si"></label>
<label class="radio-inline"><input id="nofinan" type="radio" checked="true" name="financiacion" value="no">No</label>
</div>
</div>
<div id="detallefinan" class="form-group">
<label class="control-label col-sm-2" for="detallefinan">Detalle estimación de costo:</label>
<div class="col-sm-8">
<textarea class="form-control" name="detallefinan" row="10" style="height:200px;">
</textarea>
</div>
</div>
<div class="form-group">
<div class="g-recaptcha" data-sitekey="6LeLxy4UAAAAALcrNXxcOiW1B3QgcfgZ6u4l52kZ"></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8 text-right">
<button type="submit" class="btn btn-primary">Registrar</button>
</div>
</div>
</form>
<div id="statusmsg" class="alert alert-success">
<strong>Success!</strong> Indicates a successful or positive action.
</div>
</div>
<div id="sidebar" class="sidebar col-xs-12 col-sm-4"></div>
</div>
</div>
<footer id="footer">
</footer>
</div>
</div>
</body>
</html>

View File

@ -1,2 +0,0 @@
Nombre,Apellido,TipoDoc,Documento,Direccion,Pais,Ciudad,Telefono,Email,Profesión,Financiación,"Detalle Financiación"
German,Correa,C.I,4596793-2,"Salvador Garcia Pintos 1114",Uruguay,Montevideo,091432378,german.correa.balier@gmail.com,Estudiante,no,
1 Nombre Apellido TipoDoc Documento Direccion Pais Ciudad Telefono Email Profesión Financiación Detalle Financiación
2 German Correa C.I 4596793-2 Salvador Garcia Pintos 1114 Uruguay Montevideo 091432378 german.correa.balier@gmail.com Estudiante no

View File

@ -3,17 +3,17 @@
<div id="logo_text">
<!-- class="logo_colour", allows you to change the colour of the text -->
<h1><a href="/"><span class="logo_init">VI</span><span class="logo_colour"> Coloquio Uruguayo<br/> de Matemática</span></a></h1>
<h2 style="font-size:29px;"><strong>20, 21 y 22 de Diciembre</strong></h2>
<h2 style="font-size:29px;"><strong>20, 21 y 22 de Diciembre, 2017</strong></h2>
</div>
</div>
<nav class="navbar navbar-inverse" id="menubar">
<div class="container">
<ul class="nav navbar-nav" id="menu">
<li class="selected"><a href="/">Inicio</a></li>
<li><a href="contact.html">Contacto</a></li>
<li><a href="register.html">Registrarse</a></li>
<li><a href="location.html">Mapa</a></li>
</ul>
<ul class="nav navbar-nav" id="menu">
<li class="selected"><a href="/">Inicio</a></li>
<li><a href="register.html">Registrarse</a></li>
<li><a href="location.html">Mapa</a></li>
<li><a href="contact.html">Contacto</a></li>
</ul>
</div>
</nav>

View File

@ -30,6 +30,9 @@ h1, h2, h3, h4, h5, h6
margin: 0 0 15px 0;
padding: 15px 0 5px 0;}
h1#welcome{
font-size:300%;
}
h2
{ font: normal 160% 'century gothic', arial, sans-serif;
color: #43423F;}
@ -123,6 +126,7 @@ ol li
{ /*width: 860px;*/
/*position: relative*/;
/*height: 200px;*/
padding:10px 0px;
background:inherit;}
#logo #logo_text
@ -167,11 +171,16 @@ ol li
{
border-radius: 0px;
}
@media screen and (max-width: 768px){
@media screen and (max-width: 600px){
ul#menu{
margin:auto!important;
float:none!important;
}
#logo_text h1{font-size:30px;}
#logo_text h2{font-size:20px!important;}
#logo_text h1 a .logo_init{font-size:60px;}
#logo_text h1 a .logo_colour{font-size:30px;}
.logo_colour{font-size:30px;}
}
ul#menu
{ /*float: right;
@ -201,6 +210,18 @@ ul#menu li a
color: #FFF;
border: none;}
ul.dropdown-menu{
margin:0px;
min-width:100px;
}
ul.dropdown-menu li{
background:none!important;
padding:0px!important;
}
ul.dropdown-menu li a{
border:none;
}
ul#menu li.selected a
{ height: 20px;
padding: 7px 15px 4px 15px;
@ -237,11 +258,8 @@ ul.interest-links li a{
padding: 0 15px 20px 15px;
border: 1px solid;
}
@media screen and (max-width: 640px){
.sidebar {
border:none;
}
}
#afiche{
display:block;
margin-top:15px;