Example #1
0
function do_register1()
{
    global $db, $globals;
    if ($_POST["acceptlegal"] !== 'accept') {
        register_error(_("no has aceptado las condiciones de uso"));
        return;
    }
    if (!check_user_fields()) {
        return;
    }
    echo '<br style="clear:both" />';
    echo '<form action="register.php" method="post" id="thisform">' . "\n";
    echo '<fieldset><legend><span class="sign">' . _(validación) . '</span></legend>' . "\n";
    ts_print_form();
    echo '<input type="submit" name="submit" value="' . _('continuar') . '" />';
    echo '<input type="hidden" name="process" value="2" />';
    echo '<input type="hidden" name="email" value="' . clean_input_string($_POST["email"]) . '" />';
    // extra sanity, in fact not needed
    echo '<input type="hidden" name="username" value="' . clean_input_string($_POST["username"]) . '" />';
    // extra sanity, in fact not needed
    echo '<input type="hidden" name="password" value="' . clean_input_string($_POST["password"]) . '" />';
    // extra sanity, in fact not needed
    echo '<input type="hidden" name="password2" value="' . clean_input_string($_POST["password2"]) . '" />';
    // extra sanity, in fact not needed
    echo '</fieldset></form>' . "\n";
}
function do_register1() {
	global $db, $globals;

	$error = false;

	if(!isset($_POST["username"]) || strlen($_POST["username"]) < 3) {
		register_error(_("Nombre de usuario erróneo, debe ser de 3 o más caracteres alfanuméricos"));
		$error=true;
	}
	if(!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $_POST["username"])) {
		register_error(_("Nombre de usuario erróneo, caracteres no admitidos"));
		$error=true;
	}
	if(user_exists(trim($_POST["username"])) ) {
		register_error(_("El usuario ya existe"));
		$error=true;
	}
	if(!check_email(trim($_POST["email"]))) {
		register_error(_("El correo electrónico no es correcto"));
		$error=true;
	}
	if(email_exists(trim($_POST["email"])) ) {
		register_error(_("Ya existe otro usuario con esa dirección de correo"));
		$error=true;
	}
	if(preg_match('/[ \']/', $_POST["password"]) || preg_match('/[ \']/', $_POST["password2"]) ) {
		register_error(_("Caracteres inválidos en la clave"));
		$error=true;
	}
	if(strlen($_POST["password"]) < 5 ) {
		register_error(_("Clave demasiado corta, debe ser de 5 o más caracteres"));
		$error=true;
	}
	if($_POST["password"] !== $_POST["password2"] ) {
		register_error(_("Las claves no coinciden"));
		$error=true;
	}
	$user_ip = $globals['user_ip'];
	$from = time() - 86400*2;
	$last_register = $db->get_var("select count(*) from users where user_date > from_unixtime($from) and user_ip = '$user_ip'");
	if($last_register > 0) {
		register_error(_("Para registrar otro usuario desde la misma dirección debes esperar 48 horas."));
		$error=true;
	}
	if ($error) return;
	echo '<br style="clear:both" />';
// 	echo '<div id="contents-wide">' . "\n";
	//echo '<div id="capform">' . "\n";


	echo '<form action="/register.php" method="post" id="thisform">' . "\n";
	echo '<fieldset><legend><span class="sign">'._(validación).'</span></legend>'."\n";
	ts_print_form();
	/*
	echo _("introduzca el código que ve en la imagen:")."<br/><br/>\n";
	echo '<table><tr><td>';
	$ts_random=rand();
	echo '<input type="hidden" name="ts_random" value="'.$ts_random.'" />';
	echo '<img src="/images/code.php?ts_random='.$ts_random.'" class="ch2" /></td>';
	echo '<tr><td><input type="text" size="20" name="ts_code" /></td></tr></table><br/>'."\n";
	*/
	echo '<input type="submit" name="submit" value="'._('continuar').'" />';
	echo '<input type="hidden" name="process" value="2" />';
	echo '<input type="hidden" name="email" value="'.preg_replace('/ /', '_', $_POST["email"]).'" />'; // extra sanity, in fact not needed
	echo '<input type="hidden" name="username" value="'.preg_replace('/ /', '_', $_POST["username"]).'" />'; // extra sanity, in fact not needed
	echo '<input type="hidden" name="password" value="'.preg_replace('/ /', '_', $_POST["password"]).'" />'; // extra sanity, in fact not needed
	echo '</fieldset></form>'."\n";
	//echo '</div>';
// 	echo '</div>'."\n";
}
function do_recover() {
	global $site_key, $globals;
	require_once(mnminclude.'ts.php');

	echo '<fieldset>'."\n";
	echo '<legend><span class="sign">'._("recuperación de contraseñas").'</span></legend>'."\n";

	if(!empty($_POST['recover'])) {
		if (!ts_is_human()) {
			recover_error(_('El código de seguridad no es correcto!'));
		} else {
			require_once(mnminclude.'user.php');
			$user=new User();
			$user->username=$_POST['username'];
			if(!$user->read()) {
				recover_error(_('el usuario no existe'));
				return false;
			}
			if($user->level == 'disabled') {
				recover_error(_('cuenta deshabilitada'));
				return false;
			}
			require_once(mnminclude.'mail.php');
			$sent = send_recover_mail($user);
		}
	}
	if (!$sent) {
		echo '<form action="/login.php" id="thisform-recover" method="post">'."\n";
		echo '<label for="name">'._('usuario').':</label><br />'."\n";
		echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="'.$username.'" />'."\n";
		echo '<p class="nobold">'._('(recibirás un e-mail para cambiar la contraseña)').'</p>';
		echo '<input type="hidden" name="recover" value="1"/>'."\n";
		echo '<input type="hidden" name="return" value="'.htmlspecialchars(preg_replace('/ /', '', $_REQUEST['return'])).'"/>'."\n";
		ts_print_form();
		echo '<br /><input type="submit" value="'._('recibir e-mail').'" class="genericsubmit" />'."\n";
		echo '</form>'."\n";
	}
	echo '</fieldset>'."\n";
}
Example #4
0
function do_recover()
{
    global $site_key, $globals;
    echo '<div class="genericform">' . "\n";
    echo '<fieldset>' . "\n";
    echo '<legend><span class="sign">' . _("recuperación de contraseñas") . '</span></legend>' . "\n";
    if (!empty($_POST['recover'])) {
        if (!ts_is_human()) {
            recover_error(_('el código de seguridad no es correcto'));
        } else {
            $error = false;
            $user = new User();
            if (preg_match('/.+@.+\\..+$/', $_POST['email'])) {
                // It's an email address
                $user->email = $_POST['email'];
            } else {
                recover_error(_('el email no es válido'));
                $error = true;
            }
            if (!$error && !$user->read()) {
                recover_error(_('el email no está relacionado con ninguna cuenta'));
                $error = true;
            }
            if (!$error && $user->disabled()) {
                recover_error(_('cuenta deshabilitada'));
                $error = true;
            }
            if (!$error) {
                require_once mnminclude . 'mail.php';
                $sent = send_recover_mail($user);
            }
        }
    }
    if (!$sent) {
        echo '<form action="login.php" id="thisform-recover" method="post">' . "\n";
        echo '<label for="name" style="font-size:120%">' . _('indica el email de la cuenta') . ':</label><br />' . "\n";
        echo '<input type="text" name="email" size="25" tabindex="1" id="name" value="' . htmlspecialchars($_POST['email']) . '" />' . "\n";
        echo '<p>' . _('(recibirás un e-mail que te permitirá editar tus datos)') . '</p>&nbsp;<br/>';
        echo '<input type="hidden" name="recover" value="1"/>' . "\n";
        echo '<input type="hidden" name="return" value="' . htmlspecialchars($_REQUEST['return']) . '"/>' . "\n";
        ts_print_form();
        echo '<br /><input type="submit" value="' . _('recibir e-mail') . '" class="button" />' . "\n";
        echo '</form>' . "\n";
    }
    echo '</fieldset>' . "\n";
    echo '</div>' . "\n";
}
Example #5
0
function do_register1() {
	global $db, $globals;

	if($_POST["acceptlegal"] !== 'accept' ) {
		register_error(_("no has aceptado las condiciones de uso"));
		return;
	}

	if (!check_user_fields()) return;
	echo '<br style="clear:both" />';

	// f**k spammers
	$re_test = Array();
	preg_match("/.*(outlook.com)|(fr)|(co.uk)|(ru)|(ua)|(aol.com)|(.tk)|(hotmail.*)$/i", clean_input_string($_POST["email"]), $re_test);

	if($re_test || !empty($_POST['email2'])) {
		register_error(_("Dominio nom permitido. Ponte em contato com nos em chuza.gl@gmail.com"));
		return;
	}

	echo '<form action="'.get_auth_link().'register.php" method="post" id="thisform">' . "\n";
	echo '<fieldset><legend><span class="sign">'._('validación').'</span></legend>'."\n";
	ts_print_form();
	echo '<input type="submit" name="submit" class="button" value="'._('continuar').'" />';
	echo '<input type="hidden" name="process" value="2" />';
	echo '<input type="hidden" name="email" value="'.clean_input_string($_POST["email"]).'" />'; // extra sanity, in fact not needed
	echo '<input type="hidden" name="username" value="'.clean_input_string($_POST["username"]).'" />'; // extra sanity, in fact not needed
	echo '<input type="hidden" name="password" value="'.clean_input_string($_POST["password"]).'" />'; // extra sanity, in fact not needed
	echo '<input type="hidden" name="password2" value="'.clean_input_string($_POST["password2"]).'" />'; // extra sanity, in fact not needed
	echo '<input type="hidden" name="standard" value="'.clean_input_string($_POST["standard"]).'" />'; // extra sanity, in fact not needed
	get_form_auth_ip();
	echo '</fieldset></form>'."\n";
}
Example #6
0
function do_recover()
{
    global $site_key, $globals;
    if (!empty($_POST['recover'])) {
        if (!ts_is_human()) {
            recover_error(_('el código de seguridad no es correcto'));
        } else {
            $error = false;
            $user = new User();
            if (preg_match('/.+@.+/', $_POST['email'])) {
                $user->email = $_POST['email'];
            } else {
                recover_error(_('el email no es válido'));
                $error = true;
            }
            if (!$error && !$user->read()) {
                recover_error(_('el email no está relacionado con ninguna cuenta'));
                $error = true;
            }
            if (!$error && $user->disabled()) {
                recover_error(_('cuenta deshabilitada'));
                $error = true;
            }
            if (!$error) {
                require_once mnminclude . 'mail.php';
                $sent = send_recover_mail($user);
            }
        }
    }
    if (!$sent) {
        echo '<form action="login.php" method="post">' . "\n";
        echo '<label for="name">' . _('indica el email de la cuenta') . ':</label><br />' . "\n";
        echo '<input type="text" name="email" size="25" id="name" value="' . htmlspecialchars($_POST['email']) . '" />' . "\n";
        echo '<p>' . _('(recibirás un e-mail que te permitirá editar tus datos)') . '</p>&nbsp;<br/>';
        echo '<input type="hidden" name="recover" value="1"/>' . "\n";
        echo '<input type="hidden" name="return" value="' . htmlspecialchars($_REQUEST['return']) . '"/>' . "\n";
        ts_print_form();
        echo '<br /><input type="submit" value="' . _('recibir e-mail') . '"/>' . "\n";
        echo '</form>' . "\n";
    }
}
Example #7
0
function do_register1()
{
    global $db, $globals;
    if ($_POST["acceptlegal"] !== 'accept') {
        register_error(_("no has aceptado las condiciones de uso"));
        return;
    }
    if (!check_user_fields()) {
        return;
    }
    echo '<br style="clear:both" />';
    echo '<form action="' . get_auth_link() . 'register" method="post" id="thisform">' . "\n";
    echo '<fieldset><legend><span class="sign">' . _('validación') . '</span></legend>' . "\n";
    ts_print_form();
    echo '<input type="submit" name="submit" class="button" value="' . _('continuar') . '" />';
    echo '<input type="hidden" name="process" value="2" />';
    echo '<input type="hidden" name="email" value="' . clean_input_string($_POST["email"]) . '" />';
    // extra sanity, in fact not needed
    echo '<input type="hidden" name="username" value="' . clean_input_string($_POST["username"]) . '" />';
    // extra sanity, in fact not needed
    echo '<input type="hidden" name="password" value="' . clean_input_string($_POST["password"]) . '" />';
    // extra sanity, in fact not needed
    echo '<input type="hidden" name="password2" value="' . clean_input_string($_POST["password2"]) . '" />';
    // extra sanity, in fact not needed
    get_form_auth_ip();
    echo '</fieldset></form>';
    // Add extra check: base_key is added on submit
    echo '<script type="text/javascript">addPostCode(function () { $("#thisform").submit(function () { $(this).append($("<input>", { type: "hidden", name: "base_key", value: base_key})); return true; });})</script>';
}
Example #8
0
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
include mnminclude . 'html1.php';
include_once mnminclude . 'recaptcha2.php';
do_header("test de captcha");
echo '<br/><form action="" method="post">';
if ($_POST["g-recaptcha-response"]) {
    if (ts_is_human()) {
        echo "Captcha OK<br/>";
    } else {
        echo "Failed!<br/>";
    }
}
ts_print_form();
echo '<br/> <input type="submit" value="submit" /> </form> </body>';
do_footer();