Page 1 of 1

Nothing Loading When I Login?

Posted: Mon Nov 19, 2007 10:46 am
by 4Boredom
When I go to the website below

http://nhforhealthcarepurplepoints.org

and login... nothing happens... here are the codes... any help?

Code: Select all

<h3>Please Login!</h3>

<FORM ACTION="process_login.php" METHOD="post" name="loginform"> 
  <DIV ALIGN="justify"><?php if(isset($error)){print('<font color="red"><center>'.$error.'</center></font><br>');} ?> 
    <center><TABLE WIDTH="70%" BORDER="0"  CELLPADDING="4" CELLSPACING="0" align="center"> 
      <TR>  
        <TD WIDTH="28%">Username</TD> 
        <TD WIDTH="72%"><INPUT name="username"  id="username" value="<?php if(isset($remember)){print($remember);} ?>"></TD> 
      </TR> 
      <TR>  
        <TD>Password</TD> 
        <TD><input name="password" type="password" id="password" /></TD>
      </TR>
      <TR>
        <TD><label>
          <input name="remember" type="checkbox" id="remember" value="checked" <?php if(isset($remember)){print("checked=\"checked\"");} else { print(""); } ?> />
         <small><b> Remember Me</label></small></b></TD>
		  <td>
		              <p>
              <input name="destination" type="hidden" value="<?php if(isset($destination)){print($destination);} ?>" />
     </p>
       
              <INPUT TYPE="submit" name="Submit" VALUE="Login"></td>
      </TR> 
    </TABLE> 
	</center>
  </DIV> 
</FORM>

process_login.php

Code: Select all

<?php
require_once("/home/nhforhealthcare/public_html/main.php");
if(isset($_POST['remember'])){
	if($_POST['remember']!="checked"){
		setcookie('RememberMe', '',  time() - 3600);
		unset($_COOKIE['RememberMe']);
	} else {
		$inTwoMonths = 60 * 60 * 24 * 60 + time(); 
		setcookie('RememberMe', $_POST['username'], $inTwoMonths); 
	}
}
if(isset($_POST['destination'])){
	$destination = $_POST['destination'];
}

if(isset($_POST['username'])){
	if(!isset($_POST['password'])){
		print('That username/password combination is invalid. Either click here to log in as a different user or sign up and get an account at our signup page.');
		include 'index.php'; 
		exit;
	} elseif(empty($_POST['password']) || ""==$_POST['password']){
		print('That username/password combination is invalid. Either click here to log in as a different user or sign up and get an account at our signup page.');
		include 'index.php'; 
		exit;
	}
	
	$username = $_POST['username'];
	// Get Passwords (Submitted and In database)
	$get_pass = mysql_query("SELECT * FROM userbase WHERE username = '{$username}' ");
	if(!$get_pass){
		print("Error in database connection.");
	}
	$get_pass = mysql_fetch_array($get_pass);
	$database_pass = $get_pass['password'];
	$pass = $_POST['password'];
	//If password is not vaild display error message 
	if($pass != $database_pass){
		print('That username/password combination is invalid. Either click here to log in as a different user or sign up and get an account at our signup page.');
		include 'index.php'; 
		exit;
	} elseif($pass == $database_pass) {
	//Sign-in
	
	
	$date = date('m d, Y');
	$time = time();
	$_SESSION['username'] = $username;
	$_SESSION['password'] = $_POST['password'];
	$_SESSION['login_time'] = $time;
	$_SESSION['login_date'] = $date;
	$_SESSION['loggedin'] = 1;
	
	// Send to locaton
	if(!$destination){
		header("Location: usermenu.php");
		echo "<meta http-equiv=\"refresh\" content=\"0;url=usercp.php\">";
	} else {
		$destination =  base64_decode($destination); 
		header("Location: $destination");
		echo "<meta http-equiv=\"refresh\" content=\"0;url=$destination\">";
	}
}


} else {
// Otherwise just show login.php
	include 'index.php'; 
	header("Location: login");
}
ob_flush();
?>

Posted: Mon Nov 19, 2007 11:21 am
by John Cartwright
I don't see a session_start() anywhere

Posted: Mon Nov 19, 2007 12:01 pm
by 4Boredom
it is an old code that I have recycled from the past.

I did a test of this code

Code: Select all

<? php
echo 'Hello World';
?>
and the page still sits blank at http://www.nhforhealthcarepurplepoints. ... pdated.php

What could be the issue here? Is it my host? What should I say to them?

Posted: Mon Nov 19, 2007 12:09 pm
by John Cartwright
The sample file you just created has a php error (the space between <? and php)

You need to turn on display_errors and error reporting to atleast E_ALL in your php.ini or .htaccess to be able to see the error messages. Otherwise, you can check your error log.

.htaccess

Code: Select all

php flag display_errors 1
php flag error_reporting E_ALL