Discuss Problelms with registration script in the PHP Development forum on Dev Shed. Problelms with registration script PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
Posts: 17
Time spent in forums: 5 h 35 m 29 sec
Reputation 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.";
}
?>
Posts: 29
Time spent in forums: 16 h 22 m 30 sec
Reputation 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.
Posts: 2,476
Time spent in forums: 1 Month 2 Weeks 2 Days 6 h 20 m 11 sec
Reputation Power: 2194
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!
Posts: 29
Time spent in forums: 16 h 22 m 30 sec
Reputation Power: 0
Quote:
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.
Posts: 1
Time spent in forums: 17 m 9 sec
Reputation 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!