Jump to content

MySQL PHP login problem.


SupremeBeing

Recommended Posts

Hello again guys, am having trouble with a login script I have been working on.  Have crawled the web for answers so thought i would post here again for some help.

 

A brief run down on what the script is intended to do:

 

1.) The script checks to see if a user is logged in, and asks them to if their not.

2.) If theuser is logged in their userid is grabbed from $_SESSION and assigned to $userid

3.) Connection to the database is made and the field premium is updated with value "1" where userid = $userid

 

A error message is supposed to be shown if the query has an error, but currently an error is not produced, the premium field remains NULL and the echo is shown.

 

Can't for the the life of me fiqure out why it isn't working, but i think it is quite simple.

 

Heres my script

 

<?php
if (!is_authed()) 
{
echo 'You are not logged-in. Please login so we can add your purchased video to your account.';
include 'login_form.inc.php';
}

else {
include 'cp/config.php';
include 'cp/opendb.php';

$_SESSION['userid'] = $userid;

$query = "UPDATE user
SET premium='1'
WHERE userid='$userid'";
mysql_query($query) or die('Error, query failed : ' . mysql_error()); 
echo 'Thank You for purchasing our series. We have added it to your account so you can use it straight away.';
}
?>

 

For some reason the

Link to comment
https://forums.phpfreaks.com/topic/225632-mysql-php-login-problem/
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.