Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to check for registered user?


Veirdo

Recommended Posts

Posted

Hey all... been working on a osCo site for a while and it is almost ready! Love this cart. I need some help checking if a user is registered or not, regardless of whether they are logged on or not. Here's some code I almost have working:

////////////////// USER AUTHENTICATION/REGISTRATION PLACEHOLDER /////////////////
//This is where you will add a username/password check against your local database or
//.htaccess file, such as:

$user_id=$HTTP_GET_VARS['Username'];
$password=$HTTP_GET_VARS['Password'];
$query = "SELECT COUNT(customers_email_address) FROM customers WHERE customers_email_address='$user_id' AND customers_password='$password'";
$results = mysql_query($query);
$isUser = mysql_num_rows($results);
if ($isUser != 1){
 header("Location: Console.html?errorMessage=Invalid username or password");
 exit();
}

//If the user is authenticated, it will continue processing the code below. Otherwise the
//user is given an error message and/or redirected to the login page to try again.	
/////////// END OF USER AUTHENTICATION/REGISTRATION PLACEHOLDER ///////////////////

I'm stuck at this point, does anyone see my error? Thanks a billion. I also have an .htpasswd file that I would like to check for user/pass as well. Is this possible???

Posted

Forgot to mention, of course before the Authentication routine, I have

require('http://www.websitename.com/includes/application_top.php');

Posted

You only need:

 

<?php
 require('includes/application_top.php');

 if (tep_session_is_registered('customer_id')) {

// YOUR_CODE

}
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
?>

 

Matti

  • 2 months later...
Posted

how would i check if they had under 5 items at the same time?

 

cos this don't work...

 

 

  if ($cart->count_contents() < 5) && (tep_session_is_registered('customer_id') {
// MY CODE
 }

Vincenzo Nardone

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...