this is the login.php
Code: Select all
<?
// includes
include("config.php");
// check login and password
// connect and execute query
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
$query = "SELECT id, username, password from user WHERE username = '$frmuser' AND password = PASSWORD('$frmpass')";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
// if row exists - login/pass is correct
if (mysql_num_rows($result) == 1)
{
// initiate a session
session_start();
// register the user's ID
session_register("SESSION_UID");
list($id, $username, $password) = mysql_fetch_row($result);
$SESSION_UID = $id;
// redirect to main page
header("Location:out.php");
mysql_free_result ($result);
// close connection
mysql_close($connection);
}
else
// login/pass check failed
{
mysql_free_result ($result);
mysql_close($connection);
// redirect to error page
header("Location: error.php?ec=0");
exit;
}
?>Code: Select all
<?php
$database="988_polls";
$user = "988_polls";
$pass = "ea14325";
$hostname = "mysql";
// location of file repository
// this should ideally be outside the Web server root
// make sure the server has permissions to read/write files!
$dataDir = "/data/";
// list of allowed file types
$allowedFileTypes = array("image/gif", "text/html", "text/plain", "image/jpeg", "image/pjpeg", "image/png");
// function to format mySQL DATETIME values
function fixDate($val)
{
//split it up into components
$arr = explode(" ", $val);
$timearr = explode(":", $arr[1]);
$datearr = explode("-", $arr[0]);
// create a timestamp with mktime(), format it with date()
return date("d M Y (H:i)", mktime($timearr[0], $timearr[1], $timearr[2], $datearr[1], $datearr[2], $datearr[0]));
}
?>Code: Select all
<?
// includes
include("config.php");
switch ($ec)
{
// login failure
case 0:
$message = "There was an error logging you in. <a href=start.html>Please try again.</a>";
break;
// session problem
case 1:
$message = "Please <a href=start.html>log in</a> again.";
break;
// malformed variable/failed query
case 2:
$message = "There was an error performing the requested action. Please <a href=start.html>log in</a> again.";
break;
// file not uploaded
case 11:
$message = "Please upload a valid document.";
break;
// rights not assigned
case 12:
$message = "You must assign view/modify rights to at least one user.";
break;
// illegal file type
case 13:
$message = "That file type is not currently supported.<p>Please upload a document conforming to any of the following file types:<br><ul align=left>";
foreach($allowedFileTypes as $line)
{
$message .= "<li>$line";
}
$message .= "</ul>";
break;
default:
$message = "There was an error performing the requested action. Please <a href=start.html>log in</a> again.";
break;
}
?>
<html>
<head>
<basefont face="Verdana">
</head>
<body bgcolor="White">
<!-- main menu -->
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><a href="/vault/start.html"><img src="images/logo.jpg" width=144 height=72 alt="The Vault" border=0></a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td bgcolor="#0000A0">
<b><font face="Arial" color="White">Error</font></b>
</td>
</tr>
</table>
<p>
<? echo $message; ?>
</body>
</html>it keeps giving me my error[0]
and that means its not logging in, but it connects to the database because i dont get the sql error...so i dont know whats going on...