mikemanx2 Posted February 21, 2006 Share Posted February 21, 2006 I Need A lot of help i have a sql database but i dont no how to make a regester user and login plz can i have some help im prety shure i need to use php the only langugese i know is html,qbasic,and the basics of php plz help!!! Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 21, 2006 Author Share Posted February 21, 2006 Can Anyone help Me Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 22, 2006 Author Share Posted February 22, 2006 Ok i got the login but now i dont no how to do a register can anyone plz help me Link to comment Share on other sites More sharing options...
Armed Rebel Posted February 22, 2006 Share Posted February 22, 2006 You'll have to edit details, along with adding your db connection. <html><head><title>Register</title></head><body><?if ($_POST['submit']){ $un = $_POST['username']; $pass = $_POST['password']; $passc = $_POST['passwordc']; $pass2 = $_POST['password']; $un = stripslashes($un); $pass = stripslashes($pass); $passc = stripslashes($passc); if ($un == "") { $error=true; } if ($pass == "") { $error=true; } if ($passc == "") { $error=true; } if ($pass != $passc) { $error=true; } if($error) { echo "The following errors have occured:<br /><ul>"; if ($un == "") { echo "There is no username.<br />"; } if ($pass == "") { echo "There is no password.<br />"; } if ($passc == "") { echo "There is no password confirmation.<br />"; } if ($pass != $passc) { echo "Passwords don't match.<br />"; } echo "</ul>"; } else { $pass=md5($pass); $sql="INSERT INTO users (username, password) VALUES ('$un', '$pass')"; $query=mysql_query($sql); if($query) { echo "You are now registered, you can now <a href='login.php'>Login</a>."; } else { echo "There was a problem with registration, if the problem persists, please contact the admin"; } exit; }}?> <form action="" method="post"><table><tr><td>Username:</td><td><input name="username" type="text" maxlength="20" value="<? echo $_POST['username']; ?>" /></td></tr><tr><td>Password:</td><td><input name="password" type="password" maxlength="16" value="<? echo $_POST['password']; ?>" /></td></tr><tr><td>Confirm Password:</td><td><input name="passwordc" type="password" maxlength="16" value="<? echo $_POST['passwordc']; ?>" /></td></tr><tr><td><input type="submit" value="register" name="submit" /></td></tr></table></form></body></html> Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 22, 2006 Author Share Posted February 22, 2006 Thx but would i save this as a .php or .html Link to comment Share on other sites More sharing options...
pulpfiction Posted February 22, 2006 Share Posted February 22, 2006 you have to save it as .php Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 22, 2006 Author Share Posted February 22, 2006 thx guys for all your help Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 22, 2006 Author Share Posted February 22, 2006 sry just one more thing ware do i put in my data base connection and that stuff Link to comment Share on other sites More sharing options...
pulpfiction Posted February 22, 2006 Share Posted February 22, 2006 Put it in the starting of the PHP code. after the body tag and above the if statement. Link to comment Share on other sites More sharing options...
pulpfiction Posted February 22, 2006 Share Posted February 22, 2006 This should give you an idea, look for the example in the bottom of the pagehttp://www.w3schools.com/php/php_db_odbc.asp Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 22, 2006 Author Share Posted February 22, 2006 Its Still Not Working This is my register page Register.phpIt Wont Even Load Now Link to comment Share on other sites More sharing options...
pulpfiction Posted February 22, 2006 Share Posted February 22, 2006 Can you post the code? it will be easy to locate the error Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 22, 2006 Author Share Posted February 22, 2006 Im also using bravenet premem with the my sql database and hat i think its not conecting right so well heres my cody for register.php <html><head><title>Register</title></head><center><h2>Register</h2><hr><body><?php$conn=sql2.bravehost.com('northwind','','');if (!$conn) {exit("Connection Failed: " . $conn);}$sql="SELECT * FROM customers";$rs=($conn,$sql);if (!$rs) {exit("Error in SQL");}<?if ($_POST['submit']){$un = $_POST['username'];$pass = $_POST['password'];$passc = $_POST['passwordc'];$pass2 = $_POST['password'];$un = stripslashes($un);$pass = stripslashes($pass);$passc = stripslashes($passc);if ($un == "") { $error=true; }if ($pass == "") { $error=true; }if ($passc == "") { $error=true; }if ($pass != $passc) { $error=true; }if($error){ echo "The following errors have occured:<br /><ul>"; if ($un == "") { echo "There is no username.<br />"; } if ($pass == "") { echo "There is no password.<br />"; } if ($passc == "") { echo "There is no password confirmation.<br />"; } if ($pass != $passc) { echo "Passwords don't match.<br />"; } echo "</ul>";}else{ $pass=md5($pass); $sql="INSERT INTO users (username, password) VALUES ('$un', '$pass')"; $query=sql2.bravehost.com($sql); if($query) { echo "You are now registered!, You can now <a href='login.php'>Login</a>."; } else { echo "Sorry There was an Error Try Later and it mite be fixed or contact me mikemanx2@hotmail.com"; } exit; }}?><form action="" method="post"><table><tr><td>Username:</td><td><input name="username" type="text" maxlength="20" value="" /></td></tr><tr><td>Password:</td><td><input name="password" type="password" maxlength="16" value="" /></td></tr><tr><td>Confirm Password:</td><td><input name="passwordc" type="password" maxlength="16" value="" /></td></tr><tr><td><input type="submit" value="register" name="submit" /></td></tr></table></form></body></html> Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 23, 2006 Author Share Posted February 23, 2006 Can Someone Help Me Fix My code Link to comment Share on other sites More sharing options...
Armed Rebel Posted February 23, 2006 Share Posted February 23, 2006 I beleive your connection is wrong. $dblocation = ""; $dbusername = ""; $dbpassword = ""; $dbdatabase = ""; $dbconn = mysql_connect("$dblocation","$dbusername","$dbpassword") or die ("Could not connect to MySQL");$lol = mysql_select_db($dbdatabase,$dbconn) or die ("Could not open database"); Try that, again inputing your own details. Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 23, 2006 Author Share Posted February 23, 2006 It still dusent work register.php Link to comment Share on other sites More sharing options...
hacknsack Posted February 24, 2006 Share Posted February 24, 2006 Since this is the code sent to the client, <html><head><title>Register</title></head><center><body> We should start at the beginning.Have you set up your own tables in your own database on your host?Can you point us to a support page ( at bravenet ) that contains info regarding mysql connections?Here is an excellent tutorial that might be helpful PHP/MySql.And the writer provides a zip file here example.zip.-hs Link to comment Share on other sites More sharing options...
Armed Rebel Posted February 25, 2006 Share Posted February 25, 2006 Does your host support PHP? Link to comment Share on other sites More sharing options...
mikemanx2 Posted February 26, 2006 Author Share Posted February 26, 2006 Yes my host suports php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now