SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    please registration script not working

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Reacheasy - Foremost website for easy reach of things globally</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <link href="members.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
    <div id="outer">
    <div id="page">
    <div id="header">
    <h1>Reacheasy</h1>
    <ul id="nav">
    <li class="current"><a href="index.php">Home</a></li>
    <li><a href="women.php">Women</a></li>
    <li><a href="men.php">Men</a></li>
    <li><a href="children.php">Children</a></li>
    <li><a href="homeandappliances.php">Home&amp;Appliances</a></li>
    <li><a href="visionandsound.php">Vision&amp;Sounds</a></li>
    <li><a href="motoring.php">Motoring</a></li>
    <li><a href="homemore.php">More</a></li>
    <li><a href="homecontact.php">Contact us</a></li>
    <li><a href=" rl.php">Register/Log in</a></li>
    </ul>
    </div> <!--end of navigation div -->
    </div>

    <div id="bodycontent">
    <div>
    PHP Code:
    <?php
    echo "<h2>Register</h2>";

    $submit $_POST['Register'];
    //form data
    $fullname addslashes(strip_tags($_POST['fullname']));
    $username strtolower(strip_tags($_POST['username']));
    $password addslashes(strip_tags($_POST['password']));
    $repeatpassword strip_tags($_POST['repeatpassword']);
    $email addslashes(strip_tags($_POST['email']));

    if (
    $submit)
    {
    //open database
    $connect mysql_connect("xxxx","xxxxx","xxxxx");
    mysql_select_db("xxxxx");
    //select database

    $namecheck mysql_query("SELECT username FROM reusers WHERE username='$username'");
    $count mysql_num_rows($namecheck);

    if(
    $count!=0)
    {
    die(
    "Username already taken!");

    }


    //check for registration form details
            
    if ($fullname&&$username&&$password&&$repeatpassword&&$email)
    {

    if (
    $password==$repeatpassword)
    {
    //check char lenght of username and fullname
    if (strlen($username)>25||strlen($fullname)>25)
    {
    echo 
    "Lenght of username or fullname is too long";
    }
    else
    {
    //check password length
    if(strlen($password)>25||strlen($password)<6)
    {
    echo
    "Password must be between 6 and 25 characters";
    }
    else
        {
           
    //generate random code
           
    $code rand(11111111,99999999);
           
           
    //send activation email
           
    $to $email;
           
    $subject "Activate your account";
           
    $headers "From: donotreply[MENTION=324137]rea[/MENTION]cheasy.co.uk";
           
    $body "Hello $username,\n\nYou registered and need to activate your account. Click the link below or paste it into the URL bar of your browser\n\nhttp://reacheasy.co.uk/activate.php?code=$code\n\nThanks!";

           if (!
    mail($to,$subject,$body,$headers))
               echo 
    "We couldn't sign you up at this time. Please try again later.";

    else

    {
    //register the user!
    //encript password
    $password md5($password);
    $repeatpassword md5($repeatpassword);


    $queryreg mysql_query("

    INSERT INTO reusers VALUES ('','
    $fullname','$username','$password','$email','$code','0')

    "
    );

    die(
    "You have been registered successfully! Please check your email ($email) to activate your account<a href='rl.php'>Return to login page</a>");
    }
    }
    }
    }
    else
            echo
    "Your passwords do not match!";

    }
    else
                    echo 
    "Please fill in <b>all</> fields!";

    }
    ?>
    </div>
    <p>
    <form action='reregister.php' method='Post' class='rl'>
            <div>
            <label for='fullname' class='fixedwidth'>Your full name</label>
            <input type='text' name='fullname' id='username' value='<?php echo $fullname?>'/>
            </div>
           
            <div>
            <label for='username' class='fixedwidth'>Choose a user name</label>
            <input type='text' name='username' id='username' value='<?php echo $username?>'/>
            </div>
           
            <div>
            <label for='password' class='fixedwidth'>Choose a password</label>
            <input type='password' name='password' id='password'/>
            </div>
           
            <div>
            <label for='repeatpassword' class='fixedwidth'>Repeat your password</label>
            <input type='password' name='repeatpassword' id='repeatpassword'/>
            </div>
           
            <div>
            <label for='email' class='fixedwidth'>E-mail</label>
            <input type='text' name='email' id='email'/>
            </div>
           
            <div class='buttonarea'>
                            <p>
                            <input type='submit' name='submit' value='Register'>
                            </p>
                            </div>
                            </p>

    </form>
    </div>
    </div>
    <div id="footer">
    <ul id="footlink">
    <li><a href="contact.html">Contact us</a></li>
    <li><a href="termsandcondition.html">Terms&amp;Condition</a></li>
    <li><a href="right.html">Copyright</a></li>
    <li><a href="faq.html">Faq</a>
    </li>
    </ul>
    </div>
    </body>
    </html>

  2. #2
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    What error messages are you getting?

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    no error messages the page simply relods with the default data like user name and full name still in their box

  4. #4
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Where is the element whose name = 'Register' ?

  5. #5
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    the button area on the form

  6. #6
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    All I see is a button whose value is 'Register'. I don't see an element whose name is 'Register'. Your php code is referring to an element whose name = 'Register'.

    At the top of your php code, echo to the screen the values of all the sent form parameters and your error should become clear.

  7. #7
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    please ow do i echo that

  8. #8
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by lostty84 View Post
    please ow do i echo that
    If you need to ask that question then you're going to be hard pressed to convince me you actually wrote that code, because you already have echo statements in your code.

    And you still haven't shown which element has name = 'Register' which your code refers to.

  9. #9
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    wrote the code, but not a professional, will categorise myself as a beginner, learnt with building website as a pro using html, and php academy.
    am trying to incoporate the email activation into the registration form, but now the scripts doesnt work.
    when you use the word element
    the only thing that strikes is the button area
    <input type='submit' name='submit' value='Register'>
    which i have changed to
    <input type='submit' name='register' value='Register'>
    but still no difference

  10. #10
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    i have cleared my cache and the registration page is working now thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •