Jump to content

registration help


dark k58

Recommended Posts

I used this code in my registration page

 

but I allways get these errors

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'attrac10'@'cl66.justhost.com' (using password: YES) in /home/attrac10/public_html/register.php on line 33

 

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'attrac10'@'localhost' (using password: NO) in /home/attrac10/public_html/register.php on line 34

 

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/attrac10/public_html/register.php on line 34

 

 

and the user is not created in my database can anyone help me to get this code to work

 

 

 

 

this is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="we show most of Mark padua's work" />
<meta name="keywords" content="gallery,painting discription,history of artist" />
<meta name="artistr" content="Mark padua" />
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mark's gallery</title>
<link href="style.css" rel="stylesheet" type="text/css" />

</head>
<body>
</div>
<div id="wrapper">
  <div id="header"></div>
  <div id="menu">
     <p><a href="index.html">Homepage</a><a href="Gallery.html">Gallery</a><a href="Contactus.html">Contact us</a><a href="register.php"> Register</a><a href="login.html">Login</a></p>
</div>
  <div id="content"></div>
  <form method=post action=register.php?action=register  name=s>
<table>
<tr><td>Username:</td><td><input type=text name=user></td></tr>
<tr><td>Email:</td><td><input type=text name=email></td></tr>
<tr><td>Password:</td><td><input type=password name=pass></td></tr>
<tr><td>Verify Pass:</td><td><input type=password name=vpass></td></tr>
<tr><td colspan=2 align=center><input type=submit value=Register></td></tr>
</table>
</form>
<?php

//Login to your database. Make the fields of course..
mysql_connect("attractivegallery.net","dark k58","************");
mysql_select_db("user");
//end

//if registering, fields.
if ($action == register) {

if (!$user || !$pass || !$email || !$vpass) {
print "You must fill out all fields.";

exit;
}
$dupe1 = mysql_num_rows(mysql_query("select * from table where user='$user'"));

if ($dupe1 > 0) {
print "Someone already has that username.";

exit;
}
$dupe2 = mysql_num_rows(mysql_query("select * from table where email='$email'"));
if ($dupe2 > 0) {
print "Someone already has that email.";

exit;
}

//check if passwords are the same
if ($pass != $vpass) {
print "The passwords do not match.";

exit;
}
//end
//insert
mysql_query("insert into table (user, email, pass) values('$user','$email','$pass')");
print "You are now registered. Login.";
}
?>
  <div id="footer"></div>
</div>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/187786-registration-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.