Help Needed In This Registration Form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help Needed In This Registration Form

    Pleease all wapmaster in the house i need your help here.
    I have been trying to get this for a long time but all my effort is failing because there is no one to guide me through and i am just a learner or begginer in coding.
    I want to code a form for my site registration like this Link
    whereby guest have to confirmed his email, and then a the real registration link will be sent to the confirmed email.
    I thought i could use forgot password form to manipulate and get what i needed but all proof fruitless

    I have tried, tried and tried but am not geting it. Always errors.

    Please Admins and moderators don't delect this thread. Please i need this help badly. I am using johncms script.

    Here is the code i am trying to fix.


    PHP Code:
    <?php

    /**
    * @package     JohnCMS
    * @link        http://johncms.com
    * @copyright   Copyright (C) 2008-2011 JohnCMS Community
    * @license     LICENSE.txt (see attached file)
    * @version     VERSION.txt (see attached file)
    * @author      http://johncms.com/about
    */

    define('_IN_JOHNCMS'1);

    require(
    '../incfiles/core.php');
    $lng_pass core::load_lng('registration');
    $textl $lng['registration'];
    require(
    '../incfiles/head.php');

    function 
    passgen($length) {
    $vals "abcdefghijklmnopqrstuvwxyz0123456789";
    $result '';
    for (
    $i 1$i <= $length$i  ) {
    $result .= $vals{rand(0strlen($vals))};
    }
    return 
    $result;
    }

    switch (
    $act) {
    case 
    'sent':
    /*
    -----------------------------------------------------------------
    Отправляем E-mail Ñ Ð¸Ð½ÑÑ‚рукциями Ð¿Ð¾ Ð²Ð¾ÑÑÑ‚ановлению Ð¿Ð°Ñ€Ð¾Ð»Ñ
    -----------------------------------------------------------------
    */
    $nick = isset($_POST['nick']) ? functions::rus_lat(mb_strtolower(functions::check($_POST['nick']))) : '';
    $email = isset($_POST['email']) ? htmlspecialchars(trim($_POST['email'])) : '';
    $code = isset($_POST['code']) ? trim($_POST['code']) : '';
    $check_code md5(rand(10009999));
    $error false;
    if (!
    $nick || !$email || !$code)
    $error $lng['error_empty_fields'];
    elseif (!isset(
    $_SESSION['code']) || mb_strlen($code) < || $code != $_SESSION['code'])
    $error $lng_pass['error_code'];
    unset(
    $_SESSION['code']);
    if (!
    $error) {
    // ÐŸÑ€Ð¾Ð²ÐµÑ€ÑÐµÐ¼ Ð´Ð°Ð½Ð½Ñ‹Ðµ Ð¿Ð¾ Ð±Ð°Ð·Ðµ
    $req mysql_query("SELECT * FROM `users` WHERE `name_lat` = '$nick' LIMIT 1");
    if (
    mysql_num_rows($req) == 1) {
    $res mysql_fetch_array($req);
    if (empty(
    $res['mail']) || $res['mail'] != $email)
    $error $lng_pass['error_email'];
    if (
    $res['rest_time'] > time() - 86400)
    $error $lng_pass['restore_timelimit'];
    } else {
    $error $lng['error_user_not_exist'];
    }
    }
    if (!
    $error) {
    // Ð’ысылаем Ð¸Ð½ÑÑ‚рукции Ð½Ð° E-mail
    $subject $lng_pass['password_restore'];
    $mail $lng_pass['restore_help1'] . ', ' $res['name'] . "\r\n" $lng_pass['restore_help2'] . ' ' $set['homeurl'] . "\r\n";
    $mail .= $lng_pass['restore_help3'] . ": \r\n" $set['homeurl'] . "/users/skl.php?act=set&id=" $res['id'] . "&code=" $check_code "\n\n";
    $mail .= $lng_pass['restore_help4'] . "\r\n";
    $mail .= $lng_pass['restore_help5'];
    $adds "From: <" $set['email'] . ">\r\n";
    $adds .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
    if (
    mail($res['mail'], $subject$mail$adds)) {
    mysql_query("UPDATE `users` SET `rest_code` = '" $check_code "', `rest_time` = '" time() . "' WHERE `id` = '" $res['id'] . "'");
    echo 
    '<div class="gmenu"><p>' $lng_pass['restore_help6'] . '</p></div>';
    } else {
    echo 
    '<div class="rmenu"><p>' $lng_pass['error_email_sent'] . '</p></div>';
    }
    } else {
    // Ð’ыводим ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ðµ Ð¾Ð± Ð¾ÑˆÐ¸Ð±ÐºÐµ
    echo functions::display_error($error'<a href="skl.php">' $lng['back'] . '</a>');
    }
    break;

    case 
    'set':
    /*
    -----------------------------------------------------------------
    Устанавливаем Ð½Ð¾Ð²Ñ‹Ð¹ Ð¿Ð°Ñ€Ð¾Ð»ÑŒ
    -----------------------------------------------------------------
    */
    $code = isset($_GET['code']) ? trim($_GET['code']) : '';
    $error false;
    if (!
    $id || !$code)
    $error $lng['error_wrong_data'];
    $req mysql_query("SELECT * FROM `users` WHERE `id` = '$id'");
    if (
    mysql_num_rows($req)) {
    $res mysql_fetch_assoc($req);
    if (empty(
    $res['rest_code']) || empty($res['rest_time'])) {
    $error $lng_pass['error_fatal'];
    }
    if (!
    $error && ($res['rest_time'] < time() - 3600 || $code != $res['rest_code'])) {
    $error $lng_pass['error_timelimit'];
    mysql_query("UPDATE `users` SET `rest_code` = '', `rest_time` = '' WHERE `id` = '$id'");
    }
    } else {
    $error $lng['error_user_not_exist'];
    }
    if (!
    $error) {
    // Ð’ысылаем Ð¿Ð°Ñ€Ð¾Ð»ÑŒ Ð½Ð° E-mail
    $pass passgen(4);
    $subject $lng_pass['your_new_password'];
    $mail $lng_pass['restore_help1'] . ', ' $res['name'] . "\r\n" $lng_pass['restore_help8'] . ' ' $set['homeurl'] . "\r\n";
    $mail .= $lng_pass['your_new_password'] . ": $pass\r\n";
    $mail .= $lng_pass['restore_help7'];
    $adds "From: <" $set['email'] . ">\n";
    $adds .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
    if (
    mail($res['mail'], $subject$mail$adds)) {
    mysql_query("UPDATE `users` SET `rest_code` = '', `password` = '" md5(md5($pass)) . "' WHERE `id` = '$id'");
    echo 
    '<div class="phdr">' $lng_pass['change_password'] . '</div>';
    echo 
    '<div class="gmenu"><p>' $lng_pass['change_password_conf'] . '</p></div>';
    } else {
    echo 
    '<div class="rmenu"><p>' $lng_pass['error_email_sent'] . '</p></div>';
    }
    } else {
    // Ð’ыводим ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ðµ Ð¾Ð± Ð¾ÑˆÐ¸Ð±ÐºÐµ
    echo functions::display_error($error);
    }
    break;

    default:
    /*
    -----------------------------------------------------------------
    Форма Ð´Ð»Ñ Ð²Ð¾ÑÑÑ‚ановления Ð¿Ð°Ñ€Ð¾Ð»Ñ
    -----------------------------------------------------------------
    */
    echo '<div class="mainblok"><div class="phdr"><b>' $lng_pass['password_restore'] . '</b></div>';
    echo 
    '<form action="skl.php?act=sent" method="post">';
    echo 
    '<p>' $lng_pass['your_login'] . ':<br/><input type="text" name="nick" /><br/>';
    echo 
    $lng_pass['your_email'] . ':<br/><input type="text" name="email" /></p>';
    echo 
    '<p><img src="../captcha.php?r=' rand(10009999) . '" alt="' $lng_pass['captcha'] . '"/><br />';
    echo 
    '<input type="text" size="5" maxlength="5"  name="code"/>*' $lng_pass['enter_code'] . '</p>';
    echo 
    '<p><input type="submit" value="' $lng_pass['sent'] . '"/></p></form></div>';
    echo 
    '<div class="mainblok"><div class="phdr"><small>' $lng_pass['restore_help'] . '</small></div></div>';
    break;
    }

    require(
    '../incfiles/end.php');
    ?>
    Last edited by arnage; 06.07.13, 08:26. Reason: Please use php tags when posting codes

    #2
    Originally posted by Storm View Post
    Pleease all wapmaster in the house i need your help here.
    I have been trying to get this for a long time but all my effort is failing because there is no one to guide me through and i am just a learner or begginer in coding.
    I want to code a form for my site registration like this Link
    whereby guest have to confirmed his email, and then a the real registration link will be sent to the confirmed email.
    I thought i could use forgot password form to manipulate and get what i needed but all proof fruitless

    I have tried, tried and tried but am not geting it. Always errors.

    Please Admins and moderators don't delect this thread. Please i need this help badly. I am using johncms script.

    Here is the code i am trying to fix.


    PHP Code:
    <?php

    /**
    * @package     JohnCMS
    * @link        http://johncms.com
    * @copyright   Copyright (C) 2008-2011 JohnCMS Community
    * @license     LICENSE.txt (see attached file)
    * @version     VERSION.txt (see attached file)
    * @author      http://johncms.com/about
    */

    define('_IN_JOHNCMS'1);

    require(
    '../incfiles/core.php');
    $lng_pass core::load_lng('registration');
    $textl $lng['registration'];
    require(
    '../incfiles/head.php');

    function 
    passgen($length) {
    $vals "abcdefghijklmnopqrstuvwxyz0123456789";
    $result '';
    for (
    $i 1$i <= $length$i  ) {
    $result .= $vals{rand(0strlen($vals))};
    }
    return 
    $result;
    }

    switch (
    $act) {
    case 
    'sent':
    /*
    -----------------------------------------------------------------
    Отправляем E-mail Ñ Ð¸Ð½ÑÑ‚рукциями Ð¿Ð¾ Ð²Ð¾ÑÑÑ‚ановлению Ð¿Ð°Ñ€Ð¾Ð»Ñ
    -----------------------------------------------------------------
    */
    $nick = isset($_POST['nick']) ? functions::rus_lat(mb_strtolower(functions::check($_POST['nick']))) : '';
    $email = isset($_POST['email']) ? htmlspecialchars(trim($_POST['email'])) : '';
    $code = isset($_POST['code']) ? trim($_POST['code']) : '';
    $check_code md5(rand(10009999));
    $error false;
    if (!
    $nick || !$email || !$code)
    $error $lng['error_empty_fields'];
    elseif (!isset(
    $_SESSION['code']) || mb_strlen($code) < || $code != $_SESSION['code'])
    $error $lng_pass['error_code'];
    unset(
    $_SESSION['code']);
    if (!
    $error) {
    // ÐŸÑ€Ð¾Ð²ÐµÑ€ÑÐµÐ¼ Ð´Ð°Ð½Ð½Ñ‹Ðµ Ð¿Ð¾ Ð±Ð°Ð·Ðµ
    $req mysql_query("SELECT * FROM `users` WHERE `name_lat` = '$nick' LIMIT 1");
    if (
    mysql_num_rows($req) == 1) {
    $res mysql_fetch_array($req);
    if (empty(
    $res['mail']) || $res['mail'] != $email)
    $error $lng_pass['error_email'];
    if (
    $res['rest_time'] > time() - 86400)
    $error $lng_pass['restore_timelimit'];
    } else {
    $error $lng['error_user_not_exist'];
    }
    }
    if (!
    $error) {
    // Ð’ысылаем Ð¸Ð½ÑÑ‚рукции Ð½Ð° E-mail
    $subject $lng_pass['password_restore'];
    $mail $lng_pass['restore_help1'] . ', ' $res['name'] . "\r\n" $lng_pass['restore_help2'] . ' ' $set['homeurl'] . "\r\n";
    $mail .= $lng_pass['restore_help3'] . ": \r\n" $set['homeurl'] . "/users/skl.php?act=set&id=" $res['id'] . "&code=" $check_code "\n\n";
    $mail .= $lng_pass['restore_help4'] . "\r\n";
    $mail .= $lng_pass['restore_help5'];
    $adds "From: <" $set['email'] . ">\r\n";
    $adds .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
    if (
    mail($res['mail'], $subject$mail$adds)) {
    mysql_query("UPDATE `users` SET `rest_code` = '" $check_code "', `rest_time` = '" time() . "' WHERE `id` = '" $res['id'] . "'");
    echo 
    '<div class="gmenu"><p>' $lng_pass['restore_help6'] . '</p></div>';
    } else {
    echo 
    '<div class="rmenu"><p>' $lng_pass['error_email_sent'] . '</p></div>';
    }
    } else {
    // Ð’ыводим ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ðµ Ð¾Ð± Ð¾ÑˆÐ¸Ð±ÐºÐµ
    echo functions::display_error($error'<a href="skl.php">' $lng['back'] . '</a>');
    }
    break;

    case 
    'set':
    /*
    -----------------------------------------------------------------
    Устанавливаем Ð½Ð¾Ð²Ñ‹Ð¹ Ð¿Ð°Ñ€Ð¾Ð»ÑŒ
    -----------------------------------------------------------------
    */
    $code = isset($_GET['code']) ? trim($_GET['code']) : '';
    $error false;
    if (!
    $id || !$code)
    $error $lng['error_wrong_data'];
    $req mysql_query("SELECT * FROM `users` WHERE `id` = '$id'");
    if (
    mysql_num_rows($req)) {
    $res mysql_fetch_assoc($req);
    if (empty(
    $res['rest_code']) || empty($res['rest_time'])) {
    $error $lng_pass['error_fatal'];
    }
    if (!
    $error && ($res['rest_time'] < time() - 3600 || $code != $res['rest_code'])) {
    $error $lng_pass['error_timelimit'];
    mysql_query("UPDATE `users` SET `rest_code` = '', `rest_time` = '' WHERE `id` = '$id'");
    }
    } else {
    $error $lng['error_user_not_exist'];
    }
    if (!
    $error) {
    // Ð’ысылаем Ð¿Ð°Ñ€Ð¾Ð»ÑŒ Ð½Ð° E-mail
    $pass passgen(4);
    $subject $lng_pass['your_new_password'];
    $mail $lng_pass['restore_help1'] . ', ' $res['name'] . "\r\n" $lng_pass['restore_help8'] . ' ' $set['homeurl'] . "\r\n";
    $mail .= $lng_pass['your_new_password'] . ": $pass\r\n";
    $mail .= $lng_pass['restore_help7'];
    $adds "From: <" $set['email'] . ">\n";
    $adds .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
    if (
    mail($res['mail'], $subject$mail$adds)) {
    mysql_query("UPDATE `users` SET `rest_code` = '', `password` = '" md5(md5($pass)) . "' WHERE `id` = '$id'");
    echo 
    '<div class="phdr">' $lng_pass['change_password'] . '</div>';
    echo 
    '<div class="gmenu"><p>' $lng_pass['change_password_conf'] . '</p></div>';
    } else {
    echo 
    '<div class="rmenu"><p>' $lng_pass['error_email_sent'] . '</p></div>';
    }
    } else {
    // Ð’ыводим ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ðµ Ð¾Ð± Ð¾ÑˆÐ¸Ð±ÐºÐµ
    echo functions::display_error($error);
    }
    break;

    default:
    /*
    -----------------------------------------------------------------
    Форма Ð´Ð»Ñ Ð²Ð¾ÑÑÑ‚ановления Ð¿Ð°Ñ€Ð¾Ð»Ñ
    -----------------------------------------------------------------
    */
    echo '<div class="mainblok"><div class="phdr"><b>' $lng_pass['password_restore'] . '</b></div>';
    echo 
    '<form action="skl.php?act=sent" method="post">';
    echo 
    '<p>' $lng_pass['your_login'] . ':<br/><input type="text" name="nick" /><br/>';
    echo 
    $lng_pass['your_email'] . ':<br/><input type="text" name="email" /></p>';
    echo 
    '<p><img src="../captcha.php?r=' rand(10009999) . '" alt="' $lng_pass['captcha'] . '"/><br />';
    echo 
    '<input type="text" size="5" maxlength="5"  name="code"/>*' $lng_pass['enter_code'] . '</p>';
    echo 
    '<p><input type="submit" value="' $lng_pass['sent'] . '"/></p></form></div>';
    echo 
    '<div class="mainblok"><div class="phdr"><small>' $lng_pass['restore_help'] . '</small></div></div>';
    break;
    }

    require(
    '../incfiles/end.php');
    ?>
    What Error are you actually getting, Error code and Line Number maybe ? This kind of information is needed to effectively help you

    Comment


      #3
      I had a similar error with this site https://gbapps.net/fmwhatsapp-apk-download/ page and I also tried hard to fix it but I can't because there nothing which help me to fix this error, but now after visiting this post I think I am able to fix it...thanks for sharing this info...

      Comment

      Working...
      X