PDA

View Full Version : can someone look at this script and tell me whats wrong


sytodave88
08-09-2005, 03:45 PM
when i click on sumit it does nothing


<head>
<style type="text/css">
<!--
body {
background-color: #eaeaea;
}
.style2 {color: #000000;
font-size: x-large;
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<?

//prevents caching
header("Expires: Sat, 01 Jan

2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter();

session_start();

//require the config file
require ("../config.php");

//see if the uesr is an administrator
if (ucfirst($_SESSION[authority]) != "Administrator")
{
echo "<Center><P><P class='style2'>You Have Been Cought Trying To Get In To the Admin Section Tut Tut!</P></P></center>";
echo '<center><img name="" src="/testphp/images/cought.jpg" width="500" height="500" alt="">';
exit;
}
?>
<html>
<head>
<script>
history.forward()
</script>

<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style type="text/css">
<!--
body {
background-color: #eaeaea;
}
-->
</style>
</head>

<body>
<div id="Layer2" style="position:absolute; width:200px; height:115px; z-index:2; left: 229px; top: 130px;">
<FORM method="post">
<table width="296" border="1">
<tr>
<td><font face="Tahoma"><b>Modify</b></font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><font face="Tahoma"><strong style="font-weight: 400">Username: </strong></font></td>
<td><font face="Tahoma">
<input type="text" name="username" size=25 maxlength=25>
</font></td>
</tr>
<tr>
<td><font face="Tahoma">Modify:</font></td>
<td><b><font face="Tahoma">
<select size="1" name="modify" style="font-family: Tahoma">
<option value="password">Password</option>
<option value="email">E-Mail</option>
<option value="redirect">Redirect</option>
<option value="authority">Authority</option>
</select>
</font></b></td>
</tr>
<tr>
<td><font face="Tahoma"><strong style="font-weight: 400">Change to:</strong> </font> </td>
<td><font face="Tahoma">
<input type="text" name="change" size=25 maxlength=100>
</font></td>
</tr>
<tr>
<td colspan="2"><font face="Tahoma">
<input type="submit" name="submit" value="Update" style="font-family: Tahoma">
</font></td>
</tr>
<tr>
<td colspan="2"><a href="logout.php"target="_top"><b><font face="Tahoma">Logout</font></b></a></td>
</tr>
</table>
</div>
<p>&nbsp;</p>
<div id="Layer1" style="position:absolute; width:133px; height:79px; z-index:1; left: 23px; top: 130px;">
<div align="left"></div>
<table width="131" border="1" align="left">
<tr>
<td width="121"><font face="Tahoma"><b><a href="adduser.html" target="mainFrame">Add a User</a></b></font></td>
</tr>
<tr>
<td><font face="Tahoma"><b><a href="deluser.html" target="mainFrame">Delete a User</a></b></font></td>
</tr>
<tr>
<td><font face="Tahoma"><b><a href="php/modkill.php" target="mainFrame">ModKill</a></b></font></td>
</tr>
<tr>
<td><font face="Tahoma"><b><a href="php/modkill.php" target="mainFrame">Ban IP</a></b></font></td>
</tr>
<tr>
<td><font face="Tahoma"><b><a href="php/addcont.php" target="mainFrame">Add Country</a></b></font></td>
</tr>
<tr>
<td><font face="Tahoma"><b><a href="php/admin_forum.php" target="mainFrame">Admin Forums</a></b></font></td>
</tr>
<tr>
<td><font face="Tahoma"><b><a href="php/editreords.php" target="mainFrame">Edit Records</a></b></font></td>
</tr>
</table>
</div>
</center>
</br>
</br>
</FORM>
</body>

</html>
<?

//require the config file
require ("../config.php");

//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());

//build and issue the query
$sql ="SELECT * FROM $table_name";
$result = @mysql_query($sql,$connection) or die(mysql_error());

//get the number of rows in the result set
$num = mysql_num_rows($result);

//prints a table of the information in the database
if ($num != 0) {
Echo '<div id="Layer3" style="position:absolute; width:200px; height:115px; z-index:3; left: 68px; top: 340px;">';
echo "<table border=\"1\" width=\"100%\" id=\"table1\" bordercolorlight=\"#FFFFFF\" bordercolordark=\"#C0C0C0\">";
echo "<tr>";
echo "<td width=\"10%\">Username:</td>";
echo "<td width=\"20%\">E-mail:</td>";
echo "<td width=\"20%\">Redirect to:</td>";
echo "<td width=\"20%\">Authority:</td>";
echo "</tr>";


$redir ="SELECT * FROM $table_name";
while ($redir = mysql_fetch_object($result))
{
$uname = $redir -> username;
$emailadd = $redir -> email;
$emailpass = $redir -> epass;
$ealert = $redir -> alert;
$last = $redir -> lastlogin;
$redirect = $redir -> redirect;
$auth = $redir -> authority;

echo "<tr>";
echo "<td>$uname</td>";
echo "<td>$emailadd</td>";
echo "<td>$redirect</td>";
echo "<td>$auth</td>";
echo "</tr>";


}
echo "</table>";
}


?>

Fou-Lu
08-09-2005, 04:03 PM
First off, this part will kill it (as in, you'll generate header errors with error_reporting and be unable to use sessions):


session_start();

You need to move that to the very top, prior to any output to the browser.
Next, by doing nothing do you mean that it doesn't process? Or do you mean that the processing completes nothing?