Jump to content
GIGN Forum

Webspell V4.0 Registracija


snikers
 Share

Recommended Posts

tas var nomainit register.php

vot mans ar activation + country

<?php


eval ("\$title_register = \"".gettemplate("title_register")."\";");
echo $title_register;

if($_POST['save']) {



  $username = htmlspecialchars($_POST['username']);
  $nickname = htmlspecialchars($_POST['nickname']);
  $pwd1 = $_POST['pwd1'];
  $pwd2 = $_POST['pwd2'];
  $mail = $_POST['mail'];
  $country = $_POST['country'];
    $CAPCLASS = new Captcha;
    if(!$CAPCLASS->check_captcha($_POST['captcha'], $_POST['captcha_hash'])) $error[]="The security code was wrong!";


    $ergebnis = safe_query("SELECT * FROM ".PREFIX."user WHERE username = '$username' ");
    $num = mysql_num_rows($ergebnis);
    if($num) $error[]="username already in use!";


    $ergebnis = safe_query("SELECT * FROM ".PREFIX."user WHERE email = '$mail' ");
    $num = mysql_num_rows($ergebnis);
    if($num) $error[]="mailadress already in use!";

    $ergebnis = safe_query("SELECT * FROM ".PREFIX."user WHERE nickname = '$nickname' ");
    $num = mysql_num_rows($ergebnis);
    if($num) $error[]="nickname already in use!";

    if(!(strlen(trim($username)))) $error[]="you have to enter a username!";
    elseif( strlen(trim($username)) > 30 ) $error[]="your username is too long! (max 30 chars)";

    if($pwd1 == $pwd2) {
        if(!(strlen(trim($pwd1)))) $error[]="Вы не ввели пароль!";
    }
    else $error[]="Пароли не совпадают!";


    $sem = '^[a-z0-9_\.-]+@[a-z0-9_-]+\.[a-z0-9_\.-]+$';
    if(!(eregi($sem, $mail))) $error[]="Ваш емайл введен не правильно!";


    if(!(strlen(trim($nickname)))) $error[]="Вы не ввели ваш ник!";

    if(is_array($error)) {
        echo'<b>Ошибка!</b><br><br>';
        foreach($error as $err) {
            echo'<li>'.$err.'</li>';
        }
        echo'<br><br><input type="button" class="button" onClick="java script:history.back()" value="Назад">';
    }
    else {
        // insert in db
        $md5pwd = md5($pwd1);
        $registerdate=time();

      $activationkey = 1;

        safe_query("INSERT INTO `".PREFIX."user` (`registerdate`, `lastlogin`, `username`, `password`, `nickname`, `email`, `newsletter`, `activated`, `country`) VALUES ('$registerdate', '$registerdate', '$username', '$md5pwd', '$nickname', '$mail', '1', '".$activationkey."', '$country')");

        $insertid = mysql_insert_id();

        // insert in user_groups
        safe_query("INSERT INTO ".PREFIX."user_groups ( userID ) values('$insertid' )");
echo "Вы успешно зарегистрировались на сайте. Теперь вы можите войти!";

}}
elseif($_GET['key']) {

    safe_query("UPDATE `".PREFIX."user` SET activated='1' WHERE activated='".$_GET['key']."'");
    if(mysql_affected_rows()) redirect('index.php?site=login','Your account has been activated successfully.<br>You are now able to login.');
    else redirect('index.php?site=login','Your activation key ist wrong!');

}
else {
    $bg1=BG_1;
    $bg2=BG_2;
    $bg3=BG_3;
    $bg4=BG_4;

    $CAPCLASS = new Captcha;
    $captcha = $CAPCLASS->create_captcha();
    $hash = $CAPCLASS->get_hash();
    $CAPCLASS->clear_oldcaptcha();

    eval ("\$register = \"".gettemplate("register")."\";");
    echo $register;
}

?>

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...