...

View Full Version : Need Help with login page erro



xxdanielxx
02-02-2007, 07:35 PM
Hi I am using dreamweaver as web tool and phpdev5 as testserver I already have them up and running. When I try to preview the login page I get a bunch of errors on the page this is the script i used any help would be grate. Also I entered the errors I get at the very end.


<?php virtual('/Connections/db.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?><?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/index.html";
$MM_redirectLoginFailed = "/login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_db, $db);

$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $db) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#Layer1 { position:absolute;
left:70px;
top:106px;
width:637px;
height:84px;
z-index:1;
}
-->
</style>
</head>

<body>
<div id="Layer1">
<div align="center">
<form action="<?php echo $loginFormAction; ?>" method="POST" name="form1" id="form1">
<table width="400" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="100">Username:</td>
<td><input name="username" type="text" id="username" /></td>
</tr>
<tr>
<td width="100">Password:</td>
<td><input name="password" type="password" id="password" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>

Warning: Cannot send session cookie - headers already sent in c:\phpdev5\www\login.php on line 10

Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev5\www\login.php:10) in c:\phpdev5\www\login.php on line 10

Warning: open(/tmp\sess_3e99c8161c6f5b3f7912d40d6d20a9cd, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\login.php on line 10

Warning: open(/tmp\sess_3e99c8161c6f5b3f7912d40d6d20a9cd, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

CFMaBiSmAd
02-02-2007, 07:48 PM
There is a newline between the first closing ?> tag and the next opening <?php tag -

<?php virtual('/Connections/db.php'); ?> <---- newline
<?php This is being output to the browser and prevents any further headers for cookies/sessions/redirect... from being sent.

Repeatedly switching into and out of php mode by closing/opening tags where it does not serve any purpose, is poor programming practice.

The meaning of the session save path errors are given in the error messages...

SNC-Zach
02-05-2007, 03:16 PM
Why are you making a virtual() call? Just use include() or require_once().



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum