Alright well ive search around here but nothing specifically answers my problem so im posting this. Ok im using this tutorial
http://www.howthenetworks.org/view.php?id=2 so ive done all the 1st page and the form and everything, but it doesnt work. Ok here are my questions, the 1st part of the tutorial says to make a table inside my DB, so does that code go in with the form.html one? or in the page where i have my DB script? i put it in the form one. Second my db name is 'deadfingers' so instead of were it says 'user' i put deadfingers correct? well i did all that yet when i uploaded it, the page says There was an error. The user account was not created., or this
Parse error: parse error, unexpected T_VARIABLE in /home/sites/ur-fragged.co.uk/public_html/deadfingers/signup.php on line 19 what the heck? i got that second error when i closed up some spaces, like i had
$user = addslahes($user)
$pass = addslahes($pass)
so i closed up the spaces where the '=' was then it said that, are there some parts of the script that need to have spaces like that? in the tutorial everything has a space so idk. how can i fix this?
Comments
$user = addslahes($user);
$pass = addslahes($pass);
The Royal Ram
[PHP]$user=addslashes($user);
$pass=addslashes($pass);[/PHP]
so yeah now it has nothing wrong scriptwise now i had a lol of things missing and some misspellings :eek: lol i did this pretty late at night heh. anyways now it wont work, it says "user/pass was not long enough" but i put
[PHP]$min_len=6;
if(strlen($user) < $min_len || strlen($pass) < $min_len);
{
die("the User/Password was not long enough");
}[/PHP]
even when i put a user like
deadfingers
password
so whats going on? the $min_len=6; is supposed to mean the minimum length must be like 6 characters long at least no? whats wrong? im lost now
heres the link to what im practicing www.ur-fragged.co.uk/formt.html
Now it goes to the last 'echo' function yet i have no reason why, im thinking im overseeing this very small thing i messed up on and thats why its doing that
[PHP] mysql_select_db("deadfingers");
$pass=md5($pass);
$request="INSERT INTO users values (0,'".$user."','".$pass."')";
$results = mysql_query($request,$conn);
if ($results)
{
echo "Account created succesfully";
}
else
{
echo "there was an error, user account not created";
}
?>[/PHP]
sorry if thats too long but does anyone notice any problems with this part of the script? when i input my user and pass it goes to "there was an error, user account not created" rrr oh well im getting there little by little
IF x = y then do THIS
ELSE do THAT
You just have:
IF x do THIS
Else do THAT
You havent specified when to do this and that... If you get what I mean.
$results = mysql_query($request);
Then it should work.
[PHP]$conn = mysql_connect("localhost","username","password");
//now choose the database to use
mysql_select_db("deadfingers");
//encrypt the users password so it cannot be retrieved by anyone!
$pass=md5($pass);
//the function md5 creates a unique 32 character string,
//no matter what the length of the data you encrypt!
//Save the request in SQL syntax to a string
$request = "INSERT INTO users values(0,'".$user."','".$pass."')";
//Pass the request to the mysql connection,
//and the data is returned in a blob and
//saved in $results
$results = mysql_query($request,$conn);
if($results)
{
echo "User account created";
}
else
{
echo "There was an error. The user account was not created.";
}
//End PHP file signup.php
?>
[/PHP]
ok there it is cept it has username and password instead of my stuff, so whats going on? hopefully theres something i forgot and not just a bad tutorial i was reading thanx! :rog:
Thats just my method...
[PHP]if(mysql_num_rows($result) > 0){[/PHP] thats line 18, so whats missing? i replaced all my code wit just that code u put up, so it has all that code in the 'signup.php' i think im gonna use one from 'spoono.com' just need to get around to it lol