Jump to content
Sign in to follow this  
gtilflm

Login for new module

Recommended Posts

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

 

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

 

 

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×