Jump to content

Privte Server


Recommended Posts

hello all

been trying for some time to make a web page with a new player register

on it so they don't have to wait for me to add them.

i'm been trying to do it in php keep hanging up on the password part

was going to use the one in the Source Code but i seen that it use a .cgi

file that was not there to go by

i got most of it ok but when it add the password it wont hash in the db

any help

Link to comment
Share on other sites

You're not actually connecting and running the query.

Add the following after you declare $sql, your query string:

// Connect to the database
$conn = mysql_connect(your_mysql_address, mysql_user, mysql_password);
// Open the user database
mysql_select_db("net7_user", $conn);
// You need to check if the username is already taken here
$query = "SELECT * FROM accounts WHERE username = '$username';";
$result = $mysql_query($query, $conn) or die("MySQL fail!");
if (mysql_num_rows($result) > 0)
  die("Username taken!");
// Execute the query the insert the account record
mysql_query($sql, $conn)) or
  // Tell the user it failed
  die("Something went crazy with the databse!\nSQL Error (" . mysql_errno . "): " . mysql_error());
// Tell the user it succeeded

I'm not really a PHP programmer, so I might have made a mistake, but I'm fairly certain that should work for everything you need.

Also, I have to ask. How many people are connecting to your server that you need a registration script? lol

Link to comment
Share on other sites

You will need to match the passwords too.

$query = "SELECT * FROM accounts WHERE username = '$_REQUEST['username'] and password=MD5($_REQUEST['password']";
$result = $mysql_query($query, $conn) or die("MySQL fail!");

A hashed password from the sign in page should match the MD5 hashed password in the database.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...