Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[PHP]registering a user

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Thu Jul 10, 2008 11:47 pm    Post subject: [PHP]registering a user Reply with quote

I'm trying to make php code to register a user and I think I have an error at one specific part of code.

Code:

<?php
$username = $_POST[username];
$password = $_POST[password];
$vpasswrods = $_POST[vpassword];
include('connect.php');
$usercheck = "SELECT * FROM accounts WHERE username = ".$username; //error here?
if(mysql_num_rows(mysql_query($usercheck, $con) = 1) {
   echo "Username already exists!";
   exit();
}
elseif(username = "") {
   echo "Username is not filled in!";
   exit();
}
elseif(password = "") {
   echo "Password is not filled in!";
   exit();
}
elseif(vpassword != password) {
   echo "Verification password is not correct!";
   exit();
}
mysql_close($con);
?>

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
thephoneguy
Grandmaster Cheater
Reputation: 1

Joined: 17 Mar 2007
Posts: 873

PostPosted: Fri Jul 11, 2008 3:05 am    Post subject: Reply with quote

there is alot wrong with this for one you forgot to define the variables throughout with $ there are several parse errors ill work on it now and see if i can get it working for ya.
_________________
If you see me posting referring to an earlier conversation 9/10 times it was in the chatbox at baby Very Happy.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Fri Jul 11, 2008 4:16 am    Post subject: Reply with quote

Yeah ^, all the variables need $ before them whenever they are used.
Back to top
View user's profile Send private message MSN Messenger
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Jul 11, 2008 8:20 am    Post subject: Reply with quote

Code:

<?php
$username = $_POST[username];
$password = $_POST[password];
$vpasswrods = $_POST[vpassword];
include('connect.php');
$usercheck = "SELECT * FROM accounts WHERE username = ".$username; //error here?
if(mysql_num_rows(mysql_query($usercheck, $con) = 1) {
   echo "Username already exists!";
   exit();
}
elseif($username = "") {
   echo "Username is not filled in!";
   exit();
}
elseif($password = "") {
   echo "Password is not filled in!";
   exit();
}
elseif($vpassword != $password) {
   echo "Verification password is not correct!";
   exit();
}
mysql_close($con);
?>

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Jul 11, 2008 8:41 am    Post subject: Reply with quote

I don't know PHP, but don't you need to use 2 equal signs? (==)
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Jul 11, 2008 8:43 am    Post subject: Reply with quote

Yea figured that out. Lol, during my tutorial I was tired so I only saw one equal sign during conditional statements, but when I look back at it it had two Laughing
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Jul 11, 2008 8:45 am    Post subject: Reply with quote

You also declared "vpasswrods" and used it as "vpassword"

Edit: And why are you using if else? use if's only, wouldn't it be simpler to tell all the errors at once?


Last edited by Symbol on Fri Jul 11, 2008 8:47 am; edited 1 time in total
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Jul 11, 2008 8:46 am    Post subject: Reply with quote

lol thx for pointing out my typo
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Fri Jul 11, 2008 9:01 am    Post subject: Reply with quote

$usercheck = "SELECT * FROM accounts WHERE username = $username";

^^ Wont that work?? or...

$usercheck = "SELECT * FROM accounts WHERE username=$username";

amrite?

_________________
Back to top
View user's profile Send private message MSN Messenger
Mussy69
Grandmaster Cheater
Reputation: 0

Joined: 09 Mar 2007
Posts: 842
Location: Sydney

PostPosted: Fri Jul 11, 2008 9:06 am    Post subject: Reply with quote

If your still having problems you can ask for help on MSN ( you have me ) because i think i might know th eproblems Rolling Eyes
_________________
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites