walkie
05-31-2011, 09:13 AM
Dear Coders,
I'm having a problem with a PHP script. I get this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, support@one.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
I don't have a .htaccess file, but I know that this is what often causes an error like this.
My hope is that one of you maybe can see what causes this error, because I have tried for a long time now - with no luck :s
Thanks,
walkie
Below you can see the page on which the error occures and the pages included:
Sitout.php:
<?
require('includes/gen_inc.php');
require('includes/inc_sitout.php');
?>
<html>
<head>
<title><? echo TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/poker.css" type="text/css">
<script language="JavaScript" type="text/JavaScript" >
function countdown(passcount){
if(passcount > 0){
document.getElementById('sitout').innerHTML = '<font color="black" size="4"><b>'+passcount+'</b></font>';
passcount = (passcount-1);
var e = passcount;
setTimeout(function(){countdown(passcount)},1000);
}else{
parent.document.location.href = "lobby.php";
}
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" onLoad="countdown('<? echo $start; ?>');">
<table width="772" border="0" cellspacing="0" cellpadding="2" align="center" bgcolor="#1B1B1B">
<tr>
<td valign="top" bgcolor="#333333">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td>
<? require('includes/scores.php'); ?>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td class="fieldsethead" align="center"><b>
<? echo SITOUT_TIMER; ?>
</b></td>
</tr>
<tr>
<td>
<div align="center">
<table width="60%" border="0" cellspacing="0" cellpadding="5" bgcolor="#FFFF99">
<tr>
<td align="center">
<div id="sitout"><font face="Verdana, Arial, Helvetica, sans-serif" size="6"></font></div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="650" class="fieldsethead" valign="top" height="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td bgcolor="#333333"><b><font size="3"><i><? echo SITOUT; ?></i></font></b></td>
</tr>
</table>
<b><font size="3"><br>
</font></b>
<b><font size="3"> </font></b><br>
</td>
</tr>
</table>
</body>
</html>
gen_inc.php:
<? require('configure.php');
$host = DB_SERVER;
$ln = DB_SERVER_USERNAME;
$pw = DB_SERVER_PASSWORD;
$db = DB_DATABASE;
mysql_connect("$host", "$ln", "$pw") or die("Unable to connect to database");
mysql_select_db("$db") or die("Unable to select database");
require('tables.php');
require('settings.php');
session_start();
$plyrname = addslashes($_SESSION['playername']);
$SGUID = addslashes($_SESSION['SGUID']);
$valid = false;
$ADMIN = false;
$gID = '';
if (($plyrname != '') && ($SGUID != '')) {
$idq = mysql_query("select GUID, banned, gID, vID from " . DB_PLAYERS . " where username = '" . $plyrname . "' and GUID = '" . $SGUID . "' ");
$idr = mysql_fetch_array($idq);
$gID = $idr['gID'];
$gameID = $idr['vID'];
if ((mysql_num_rows($idq) == 1) && ($idr['banned'] != 1)) $valid = true;
$siteadmin = ADMIN_USERS;
if ($plyrname != '') {
$time = time();
$admins = array();
$adminraw = explode(',', $siteadmin);
$i = 0;
while ($adminraw[$i] != '') {
$admins[$i] = $adminraw[$i];
$i++;
}
if (in_array($plyrname, $admins)) $ADMIN = true;
}
}
require('p_inc.php');
require('language.php');
if (($_SESSION[SESSNAME] != '') && (MEMMOD == 1) && ($plyrname == '')) {
$time = time();
$sessname = addslashes($_SESSION[SESSNAME]);
$usrq = mysql_query("select username from " . DB_PLAYERS . " where sessname = '" . $sessname . "' ");
if (mysql_num_rows($usrq) == 1) {
$usrr = mysql_fetch_array($usrq);
$usr = $usrr['username'];
$GUID = randomcode(32);
$_SESSION['playername'] = $usr;
$_SESSION['SGUID'] = $GUID;
$ip = $_SERVER['REMOTE_ADDR'];
$result = mysql_query("update " . DB_PLAYERS . " set ipaddress = '" . $ip . "', lastlogin = '" . $time . "' , GUID = '" . $GUID . "' where username = '" . $usr . "' ");
$valid = true;
}
}
$time = time();
$tq = mysql_query("select waitimer from " . DB_PLAYERS . " where username = '" . $plyrname . "' ");
$tr = mysql_fetch_array($tq);
$waitimer = $tr['waitimer'];
if ($waitimer > $time) header('Location sitout.php');
?>
inc_sitout.php
<?
$time = time();
$tq = mysql_query("select waitimer from ".DB_PLAYERS." where username = '".$plyrname."' ");
$tr = mysql_fetch_array($tq);
$waitimer = $tr['waitimer'];
if(($waitimer-1) <= $time){
header('Location: lobby.php');
die();
}
$start = $waitimer-$time;
?>
I'm having a problem with a PHP script. I get this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, support@one.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
I don't have a .htaccess file, but I know that this is what often causes an error like this.
My hope is that one of you maybe can see what causes this error, because I have tried for a long time now - with no luck :s
Thanks,
walkie
Below you can see the page on which the error occures and the pages included:
Sitout.php:
<?
require('includes/gen_inc.php');
require('includes/inc_sitout.php');
?>
<html>
<head>
<title><? echo TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/poker.css" type="text/css">
<script language="JavaScript" type="text/JavaScript" >
function countdown(passcount){
if(passcount > 0){
document.getElementById('sitout').innerHTML = '<font color="black" size="4"><b>'+passcount+'</b></font>';
passcount = (passcount-1);
var e = passcount;
setTimeout(function(){countdown(passcount)},1000);
}else{
parent.document.location.href = "lobby.php";
}
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" onLoad="countdown('<? echo $start; ?>');">
<table width="772" border="0" cellspacing="0" cellpadding="2" align="center" bgcolor="#1B1B1B">
<tr>
<td valign="top" bgcolor="#333333">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td>
<? require('includes/scores.php'); ?>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td class="fieldsethead" align="center"><b>
<? echo SITOUT_TIMER; ?>
</b></td>
</tr>
<tr>
<td>
<div align="center">
<table width="60%" border="0" cellspacing="0" cellpadding="5" bgcolor="#FFFF99">
<tr>
<td align="center">
<div id="sitout"><font face="Verdana, Arial, Helvetica, sans-serif" size="6"></font></div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="650" class="fieldsethead" valign="top" height="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td bgcolor="#333333"><b><font size="3"><i><? echo SITOUT; ?></i></font></b></td>
</tr>
</table>
<b><font size="3"><br>
</font></b>
<b><font size="3"> </font></b><br>
</td>
</tr>
</table>
</body>
</html>
gen_inc.php:
<? require('configure.php');
$host = DB_SERVER;
$ln = DB_SERVER_USERNAME;
$pw = DB_SERVER_PASSWORD;
$db = DB_DATABASE;
mysql_connect("$host", "$ln", "$pw") or die("Unable to connect to database");
mysql_select_db("$db") or die("Unable to select database");
require('tables.php');
require('settings.php');
session_start();
$plyrname = addslashes($_SESSION['playername']);
$SGUID = addslashes($_SESSION['SGUID']);
$valid = false;
$ADMIN = false;
$gID = '';
if (($plyrname != '') && ($SGUID != '')) {
$idq = mysql_query("select GUID, banned, gID, vID from " . DB_PLAYERS . " where username = '" . $plyrname . "' and GUID = '" . $SGUID . "' ");
$idr = mysql_fetch_array($idq);
$gID = $idr['gID'];
$gameID = $idr['vID'];
if ((mysql_num_rows($idq) == 1) && ($idr['banned'] != 1)) $valid = true;
$siteadmin = ADMIN_USERS;
if ($plyrname != '') {
$time = time();
$admins = array();
$adminraw = explode(',', $siteadmin);
$i = 0;
while ($adminraw[$i] != '') {
$admins[$i] = $adminraw[$i];
$i++;
}
if (in_array($plyrname, $admins)) $ADMIN = true;
}
}
require('p_inc.php');
require('language.php');
if (($_SESSION[SESSNAME] != '') && (MEMMOD == 1) && ($plyrname == '')) {
$time = time();
$sessname = addslashes($_SESSION[SESSNAME]);
$usrq = mysql_query("select username from " . DB_PLAYERS . " where sessname = '" . $sessname . "' ");
if (mysql_num_rows($usrq) == 1) {
$usrr = mysql_fetch_array($usrq);
$usr = $usrr['username'];
$GUID = randomcode(32);
$_SESSION['playername'] = $usr;
$_SESSION['SGUID'] = $GUID;
$ip = $_SERVER['REMOTE_ADDR'];
$result = mysql_query("update " . DB_PLAYERS . " set ipaddress = '" . $ip . "', lastlogin = '" . $time . "' , GUID = '" . $GUID . "' where username = '" . $usr . "' ");
$valid = true;
}
}
$time = time();
$tq = mysql_query("select waitimer from " . DB_PLAYERS . " where username = '" . $plyrname . "' ");
$tr = mysql_fetch_array($tq);
$waitimer = $tr['waitimer'];
if ($waitimer > $time) header('Location sitout.php');
?>
inc_sitout.php
<?
$time = time();
$tq = mysql_query("select waitimer from ".DB_PLAYERS." where username = '".$plyrname."' ");
$tr = mysql_fetch_array($tq);
$waitimer = $tr['waitimer'];
if(($waitimer-1) <= $time){
header('Location: lobby.php');
die();
}
$start = $waitimer-$time;
?>