Jump to content

login help


mikemanx2
 Share

Recommended Posts

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...