Jump to content


Photo

register code ..not work


  • Please log in to reply
5 replies to this topic

#1 honeyboy_20

honeyboy_20
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 06 October 2006 - 06:28 AM

hello guys,
register code not work with me  and contains some logical error , when i write password it appear as it
not hidden
and i am not able to make all condition of script in rigth sequences and how i can develope script by
adding cookies


here's database
==================================
CREATE TABLE `users` (                   
`id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
`name` VARCHAR( 35 ) NOT NULL ,           
`password` VARCHAR( 35 ) NOT NULL ,       
`password1` VARCHAR( 35 ) NOT NULL ,     
`email` VARCHAR( 35 ) NOT NULL ,           
PRIMARY KEY ( `id` )                       
) TYPE = MYISAM ;
==================================


code
=====
<?php


session_start();
?>
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>register</title>
</head>
<body bgcolor=yellow>
<table border=1 cellspacing=1 cellpadding=10 width=100 align=center>
<td><h2 align="center">register</h2></td>
</table>
<?php

  //____________________________________________________________________________

    $host="localhost";           //the name of localhost
    $user_root="";             //the name of user admin
    $password="";             //the name of password admin for database
    $database="";           //the name of database
    $table="users";       //the name of table
 //_____________________________________________________________________________
     $user=$_POST['user'];
     $pass=$_POST['pass'];
     $pass1=$_POST['pass1'];
     $mail=$_POST['email'];

     //user must enter all fields to be register
     if($user &&$pass && $pass1 && $email)
     {
    //connect to database
    $connect=mysql_connect($host,$user_root,$password)or print"Unable to Connect<br>";
    //select dtabase
    mysql_select_db($database,$connect);
     //ensure first that email is vaild then see in database
     if($email)
     {
         eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)",$email);
     }
    /*we must make query in database to ensure that the name which user enter is not found
    so user can register with the new name and we can increase this proceess if we take his mail
    and make check also*/

    $result = mysql_query("SELECT * FROM $table WHERE name LIKE '$user' AND email like '$email'");
    
    //so we will make condition now for the process check
    if(mysql_num_rows($result)==0)
    {
     $result=mysql_query("INSERT INTO $table(name,password,password1,email)VALUES('$user',PASSWORD('$pass'),PASSWORD('$pass1'),'$email'");
    }
    //if user input is true
    if($result)
    {
       $logged_in_user=$user;
       session_register("logged_in_user");
       echo("Your details Has been added to database<br><br>");
       echo("<a href='main.php'>click here to go to main page</a><br><br>");
       echo("<a href='logout.php'>Click Here To Be logout<br><br></a>");
}
elseif($user||$pass ||$pass1 ||$email){
    echo"please fill all fields<br><br>";
}else{
    echo"the username has been taken before...plz chosse another name<br><br>";
}
}
?>
<form method=post action="<?$_SERVER['PHP_SELF']?>">
<pre>
username         <input type=text name="user" maxlength=20 size=20>
<br>
<br>
password         <input type=text name="pass" maxlength=10 size=20>
<br>
<br>
confirm password <input type=text name="pass2" maxlength=10 size=20>
<br>
<br>
emails           <input type=text name="email" maxlength=25 size=20>

<br>
                        <input type="submit" value="submit">
</form>
</body>
</html>
================================= 

#2 paul2463

paul2463
  • Members
  • PipPipPip
  • Advanced Member
  • 955 posts
  • LocationUK

Posted 06 October 2006 - 06:51 AM

Hello
to sort your first problem out try this
<form method=post action="<?$_SERVER['PHP_SELF']?>">
<pre>
username         <input type=text name="user" maxlength=20 size=20>
<br>
<br>
password         <input type=password name="pass" maxlength=10 size=20>
<br>
<br>
confirm password <input type=password name="pass2" maxlength=10 size=20>
<br>
<br>
emails           <input type=text name="email" maxlength=25 size=20>

<br>
                        <input type="submit" value="submit">
</form>
</body>
</html>

you cannot affect the past but you can ruin a perfectly good present by worrying about the future

*********************************************************************
The <A HREF="http://www.php.net/d...php">MANUAL</A> is actually a useful resource

#3 xux

xux
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 06 October 2006 - 10:54 AM

Your password was showing plain test because
<br>
password         <input type=text name="pass" maxlength=10 size=20>
<br>
<br>
confirm password <input type=text name="pass2" maxlength=10 size=20>
<br>
should be
<br>
password         <input type=password name="pass" maxlength=10 size=20>
<br>
<br>
confirm password <input type=password name="pass2" maxlength=10 size=20>
<br>
Cheers


#4 honeyboy_20

honeyboy_20
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 06 October 2006 - 03:31 PM

thanks more but

i am not able to make all condition of script in rigth sequences and how i can develope script by
adding cookies

wat i do to work well /?

#5 honeyboy_20

honeyboy_20
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 07 October 2006 - 03:20 AM

plz help me

#6 honeyboy_20

honeyboy_20
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 07 October 2006 - 02:59 PM

[move]...................؟[/move]
............................................................؟




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users