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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.