#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    17
    Rep Power
    0

    Problelms with registration script


    <html>
    <body>
    <form method="post" action="register.php" >
    Enter your user name:
    <input name="user" type=" text" /><br /><br />


    Plesse enter your password:
    <input name="password" type="password" /><br /><br />


    Please enter your Email
    <input name="email" type="text" />

    <br />
    <br />
    Do you wish to recieve email from use
    <input name="recieveEmail" type="radio" value="1" checked="checked" ? />yes
    <input name="recieveEmail" type="radio" value="0" /> NO<br />

    <input type="submit" value="register" />
    </form>
    include("abakwa.inc");
    <?php
    function dbconnect(){
    $db = mysql_pconnect("localhost", "admin","anthony")or die ("cannot connet to your database");
    mysql_select_db("abakwa",$db)or die ("cannot select database");
    }
    function isValidEmail($email){
    return eregi("^[a-z0-9_]+@[a-z0-9\-]+\.+[a-z0-9\-\.]+$",$email);
    }

    $user = $_POST["user"];
    $password = $_POST["password"];
    $email = $_POST["email"];
    $user = addslashes($user);
    $email = addslashes($email);
    $password=addslashes($password);
    if($user and $password and $email){
    if(isValidEmail($email)){
    dbconnect();
    $query="SELECT * FROM user WHERE name='".$user."'";
    $result=mysql_query("$query")or die("query was not successful");
    if(mysql_num_rows($result)==0){
    $results=mysql_query("INSERT INTO user(name,passward) VALUES('$user','$password')");
    if($results){
    $logged_in_user==$user;
    sesion_register("logged_in_user");
    $result=mysql_query("SELECT * FROM user WHERE name ='".name .'');
    if(!$result)fail("select query fail on register page ");
    $record=mysql_fetch_assoc($result);
    $logged_userID=$result["userID"];
    setup_page("Register","Registration complete");
    echo "Your details have been added to the database"."$logged_in_user";
    echo "Your details have been register";
    echo "<a href='main.php'>Click here to proceed to main page</a>" ."<br />
    <br />";
    echo "<a href='logg_out.php'>click here to logg out</a>";
    exit;
    echo" <br /><br />";
    }
    else
    {
    fail("database query fail,registration page",true );
    }
    } else
    {
    echo "sorry that user name has been taken please try another";
    }
    }
    else{
    setup_page("Registration","invalid registration");
    echo "Please submit a valid email address.";
    }
    }

    elseif($user||$password||$email){
    echo "please fill all fields";
    }else
    {
    // setup_page("Registratiom","Registration");
    echo "Please enter your details to register.";
    }
    ?>

    </body>
    </html>

    Comments on this post

    • ptr2void disagrees : Read the damn New User Guide!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0
    as I see,your code has problem.Because,eregi function has been depreceated by php...latter,session_register is so as well.The main problem,what is your question?,I couldn't understand it..

    You should use strpos or preg_match instead of eregi function.
  4. #3
  5. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,555
    Rep Power
    2338
    How many more posts will it take before you actually use code tags? And maybe read the New User Guide?

    Just posting code with no explanation is crap.

    And maximas, when someone does this, don't give them any help. They need to learn to actually ask a question, or they'll keep posting crap threads like this.
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0
    Originally Posted by ptr2void
    How many more posts will it take before you actually use code tags? And maybe read the New User Guide?

    Just posting code with no explanation is crap.

    And maximas, when someone does this, don't give them any help. They need to learn to actually ask a question, or they'll keep posting crap threads like this.
    @ptr2void
    okey.thanks for your advice.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    India
    Posts
    1
    Rep Power
    0
    Its all jumbled up. You can refer to this site:
    simplecodecs.com/simple-php-login-system
    The register.php contains the info on registering. Simple query has to be run to register the value. The forum is not allowing me to highlight the link.Damn!

IMN logo majestic logo threadwatch logo seochat tools logo