logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 07-02-2011, 10:35 AM   #1
drunkmafia
drunkmafia's Avatar
 
Join Date: Jun 2011
Posts: 17
Default whats wrong with this php code?

PHP Code:
<?
include("adminprocess.php");
?>
<?
include("include/session.php");

/**
 * displayUsers - Displays the users database table in
 * a nicely formatted html table.
 */
function displayUsers(){
   global 
$database;
   
$q "SELECT username,userlevel,email,timestamp "
       
."FROM ".TBL_USERS." ORDER BY userlevel DESC,username";
   
$result $database->query($q);
   
/* Error occurred, return given name by default */
   
$num_rows mysql_numrows($result);
   if(!
$result || ($num_rows 0)){
      echo 
"Error displaying info";
      return;
   }
   if(
$num_rows == 0){
      echo 
"Database table empty";
      return;
   }
   
/* Display table contents */
   
echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
   echo 
"<tr><td><b>Username</b></td><td><b>Level</b></td><td><b>Email</b></td><td><b>Last Active</b></td></tr>\n";
   for(
$i=0$i<$num_rows$i++){
      
$uname  mysql_result($result,$i,"username");
      
$ulevel mysql_result($result,$i,"userlevel");
      
$email  mysql_result($result,$i,"email");
      
$time   mysql_result($result,$i,"timestamp");

      echo 
"<tr><td>$uname</td><td>$ulevel</td><td>$email</td><td>$time</td></tr>\n";
   }
   echo 
"</table><br>\n";
}

/**
 * displayBannedUsers - Displays the banned users
 * database table in a nicely formatted html table.
 */
function displayBannedUsers(){
   global 
$database;
   
$q "SELECT username,timestamp "
       
."FROM ".TBL_BANNED_USERS." ORDER BY username";
   
$result $database->query($q);
   
/* Error occurred, return given name by default */
   
$num_rows mysql_numrows($result);
   if(!
$result || ($num_rows 0)){
      echo 
"Error displaying info";
      return;
   }
   if(
$num_rows == 0){
      echo 
"Database table empty";
      return;
   }
   
/* Display table contents */
   
echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
   echo 
"<tr><td><b>Username</b></td><td><b>Time Banned</b></td></tr>\n";
   for(
$i=0$i<$num_rows$i++){
      
$uname mysql_result($result,$i,"username");
      
$time  mysql_result($result,$i,"timestamp");

      echo 
"<tr><td>$uname</td><td>$time</td></tr>\n";
   }
   echo 
"</table><br>\n";
}
   
/**
 * User not an administrator, redirect to main page
 * automatically.
 */
if(!$session->isAdmin()){
   
header("Location: ../main.php");
}
else{
/**
 * Administrator is viewing page, so display all
 * forms.
 */
?>
<div id="apDiv1"><font size="5" color="#ff0000">
<b>::::::::::::::::::::::::::::::::::::::::::::</b></font>
<font size="4">Logged in as <b><? echo $session->username?></b></font><br><br>
Back to [<a href="file:///C|/Users/Sean/SnIpzZXCREW/main.php">Main Page</a>]<br><br>
<?
if($form->num_errors 0){
   echo 
"<font size=\"4\" color=\"#ff0000\">"
       
."!*** Error with request, please fix</font><br><br>";
}
?>
<table align="left" border="0" cellspacing="5" cellpadding="5">
<tr><td>
<?
/**
 * Display Users Table
 */
?>
<h3>Users Table Contents:</h3>
<?
displayUsers
();
?>
</td></tr>
<tr>
<td>
<br>
<?
/**
 * Update User Level
 */
?>
<h3>Update User Level</h3>
<? echo $form->error("upduser"); ?>
<table>
<form action="../adminprocess.php" method="POST">
<tr><td>
Username:<br>
<input type="text" name="upduser" maxlength="30" value="<? echo $form->value("upduser"); ?>">
</td>
<td>
Level:<br>
<select name="updlevel">
<option value="1">1
<option value="9">9
</select>
</td>
<td>
<br>
<input type="hidden" name="subupdlevel" value="1">
<input type="submit" value="Update Level">
</td></tr>
</form>
</table>
</td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td>
<?
/**
 * Delete User
 */
?>
<h3>Delete User</h3>
<? echo $form->error("deluser"); ?>
<form action="../adminprocess.php" method="POST">
Username:<br>
<input type="text" name="deluser" maxlength="30" value="<? echo $form->value("deluser"); ?>">
<input type="hidden" name="subdeluser" value="1">
<input type="submit" value="Delete User">
</form>
</td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td>
<?
/**
 * Delete Inactive Users
 */
?>
<h3>Delete Inactive Users</h3>
This will delete all users (not administrators), who have not logged in to the site<br>
within a certain time period. You specify the days spent inactive.<br><br>
<table>
<form action="../adminprocess.php" method="POST">
<tr><td>
Days:<br>
<select name="inactdays">
<option value="3">3
<option value="7">7
<option value="14">14
<option value="30">30
<option value="100">100
<option value="365">365
</select>
</td>
<td>
<br>
<input type="hidden" name="subdelinact" value="1">
<input type="submit" value="Delete All Inactive">
</td>
</form>
</table>
</td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td>
<?
/**
 * Ban User
 */
?>
<h3>Ban User</h3>
<? echo $form->error("banuser"); ?>
<form action="../adminprocess.php" method="POST">
Username:<br>
<input type="text" name="banuser" maxlength="30" value="<? echo $form->value("banuser"); ?>">
<input type="hidden" name="subbanuser" value="1">
<input type="submit" value="Ban User">
</form>
</td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr><td>
<?
/**
 * Display Banned Users Table
 */
?>
<h3>Banned Users Table Contents:</h3>
<?
displayBannedUsers
();
?>
</td></tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td>
<?
/**
 * Delete Banned User
 */
?>
<h3>Delete Banned User</h3>
<? echo $form->error("delbanuser"); ?>
<form action="../adminprocess.php" method="POST">
Username:<br>
<input type="text" name="delbanuser" maxlength="30" value="<? echo $form->value("delbanuser"); ?>"> //error here
<input type="hidden" name="subdelbanned" value="1">
<input type="submit" value="Delete Banned User">
</form>
</td>
</tr>
</table>
Syntax error on line 253
error line:
PHP Code:
<input type="text" name="delbanuser" maxlength="30" value="<? echo $form->value("delbanuser"); ?>">

Last edited by drunkmafia; 07-02-2011 at 10:40 AM..
drunkmafia is offline   Reply With Quote
Old 07-04-2011, 02:02 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

<? echo $form->value("delbanuser"); ?>">

try <?php echo $form->value("delbanuser"); ?>">
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:45 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com