Problem assigning value to variable in "IF" function


Posted on 16th Feb 2014 07:03 pm by admin

Does this script makes sense? I am trying to take the value that is set to "authenticat" and write it to authentication.

I think it is getting messes up by the $authenticat = "1" part.

Thanks
function check_username_pin($USERID, $PIN)
{
$query="SELECT id FROM users WHERE ( userid = '$USERID' AND pin = '$PIN' )";
// dont return pin because of hackers
$result=mysql_query($query);
if(mysql_num_rows($result)>0)
{
$authenticat = "1"
}
$query="SELECT id FROM users WHERE ( useris = '$USERID' )";
// dont return pin because of hackers
$result=mysql_query($query);
if(mysql_num_rows($result)==0)
{
$authenticat = "2"; // bad id
}
$query="SELECT id FROM users WHERE ( pin = '$PIN' )";
// dont return pin because of hackers
$result=mysql_query($query);
if(mysql_num_rows($result)==0)
{
$authenticat = "3"; //bad pin
}
}

write("SET VARIABLE authentication $authenticat");

No comments posted yet

Your Answer:

Login to answer
308 Like 20 Dislike
Previous forums Next forums
Other forums

User input in to variable
Hi all,

I'm sure this is very easy but I'm having another brain freeze!

At the end of

PHP header help!
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 48

Basic Question Regarding PHP Includes
Hi

Just starting out with PHP.

Working on a site that uses some basic includes, these

PHP search multiple input field box help
I am having a problem with my search script. At current it will simply search by a selected date whi

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but e

How do i do multi uploads?.
Hey i would like to do this : http://hosting.mrkrabz.net/

I've got the base down you can uplo

How to store checkbox array in a session, and then be able to add to it?
I'm trying to store an array of checkbox values into a session array, sort of like a shopping cart,

Text Not Displaying Correctly With PHP:GD
I recently moved servers and since then I have noticed that one line of text is showing weirdly.

Connect to database that isn't localhost
I am currently doing a small script for a company that doesn't have mySql support on there hosting.

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash