Jump to content

Recommended Posts

this is for a log-in and all I get is a blank page?  It does connect to the database because I can populate it.

 


<?php
error_reporting(E_ALL);

require_once ( 'settings.php' );

if ( array_key_exists ( '_submit_check', $_POST ) )
{
	if ( $_POST['username'] != '' && $_POST['password'] != '' )
	{
		$query = 'SELECT ID, Username, Active, Password FROM ' . DBPREFIX . 'users WHERE Username = ' . $db->qstr ( $_POST['username'] ) . ' AND Password = ' . $db->qstr ( md5 ( $_POST['password'] ) );

		if ( $db->RecordCount ( $query ) == 1 )
		{
			$row = $db->getRow ( $query );
			if ( $row->Active == 1 )
			{
				set_login_sessions ( $row->ID, $row->Password, ( $_POST['remember'] ) ? TRUE : FALSE );
				header ( "Location: " . REDIRECT_AFTER_LOGIN );
			}
			elseif ( $row->Active == 0 ) {
				$error = 'Your membership was not activated. Please open the email that we sent and click on the activation link.';
			}
			elseif ( $row->Active == 2 ) {
				$error = 'You are suspended!';
			}
		}
		else {		
			$error = 'Login failed!';		
		}
	}
	else {
		$error = 'Please use both your username and password to access your account';
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>login</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="log">
<?php if ( isset( $error ) ) { echo '			<p class="error">' . $error . '</p>' . "\n";}?>
</div>
<div id="container" style="width:230px;">

	<form class="form" action="<?=$_SERVER['PHP_SELF']?>" method="post">

		<input type="hidden" name="_submit_check" value="1"/> 

		<div style="margin-top:12px; margin-bottom:10px">
			<img src="images/username.gif" alt="username" border="0" />
			<input class="input" type="text" name="username" id="username" size="25" maxlength="40" value="" />
		</div>
		<div style="margin-bottom:6px">
			<img src="images/password.gif" alt="password" border="0" />
			<input class="input" type="password" name="password" id="password" size="25" maxlength="32" />
		</div>
		<?php if ( ALLOW_REMEMBER_ME ):?>
		<div style="margin-bottom:6px">
			<input type="checkbox" name="remember" id="remember" />
			<label for="remember">Remember me</label>
		</div>
		<?php endif;?>
		<input type="image" name="Login" value="Login"  class="submit-btn" src="images/btn.gif" alt="submit" title="submit" />
		<br class="clear" />
		<a href="register.php">Register</a> / <a href="forgot_password.php">Password recovery?</a>

	</form>


</div>

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/132596-solved-all-i-am-getting-is-a-blank-page/
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.