Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Login for new module


gtilflm

Recommended Posts

Posted

I run a math tutoring business and I'm developing "side module" where the tutors I hire can login and do various things.

 

I've basically copy/pasted the relevant code from login.php, to the Tutor Login page, but tep_validate_password is continuously returning an error when I correctly enter a password and login.

 

My section of code below contains the error checking lines of...

 

I run a math tutoring business and I'm developing "side module" where the tutors I hire can login and do various things.
I've basically copy/pasted the relevant code from login.php, to the Tutor Login page, but tep_validate_password is continuously returning an error when I correctly enter a password and login.
My section of code below contains the error checking lines of...

 

The relevant code then is...

 

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

// Redirect to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
 if ($session_started == false) {
    tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
 }
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);
 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
    $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
    $password = tep_db_prepare_input($HTTP_POST_VARS['password']);
// Check if email exists
    $check_tutor_query = tep_db_query("select * from tutors where tutor_email = '" . tep_db_input($email_address) . "'");
    if (!tep_db_num_rows($check_tutor_query)) {
	  $error = true;
    } else {
	  $check_tutor = tep_db_fetch_array($check_tutor_query);
// Check that password is good
	  if (!tep_validate_password($password, $check_tutor['password'])) {
		    $error = true;
 echo $password . '------' . $check_tutor['password'];
 print_r ($check_tutor);
	  } else {
		    if (SESSION_RECREATE == 'True') {
			  tep_session_recreate();
		    }
		    $tutors_id = $check_tutor['tutors_id'];
		    tep_session_register('tutors_id');

 //Redirect to the tutor_portal
		    tep_redirect(tep_href_link('tutor_portal.php'));
		    echo $tutors_id;
 echo $email_address;
	  }
    }
 }
?>

 

The crazy thing is that the echo $password . '------' . $check_tutor['password']; line shows that the plain password matches the encrypted one.

 

 

Please help as this is driving me crazy!

 

Thanks.

Posted

Correction. From the above post, the code section below, "My section of code below contains the error checking lines of..." should actually be...

 

echo $password . '------' . $check_tutor['password'];
 print_r ($check_tutor);

 

I messed up in copy/pasting from another post. Sorry.

Archived

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

×
×
  • Create New...