Jump to content

[SOLVED] php error


moogle1979

Recommended Posts

I have been searching and searching and cannot find a single error, I know it has to be something small I missed.

 

Here is the code

 

<?php
// Declare variables
session_start();
include('../includes/connect.php');

// Define Site Root URL
$SITE_ROOT = "http://www.rigganmore.com/";

// Check if User is Logged In
if($_SESSION['login'] != "yessir")
{
// If not, redirect to login page
header("Location: ".$SITE_ROOT."signin.php");
exit();
}
// Check if the User has Admin access
if($_SESSION['access'] < "65")
{
// If not, display "Access Denied" message
header("Location: ".$SITE_ROOT."includes/msg.php?code=9");
exit();
}
if(isset($_GET['id'])){
$user_id = $_GET['id'];
$query = mysql_query("SELECT * FROM members WHERE userid= '" . $user_id . "' LIMIT 1") or die(mysql_error());
$result = mysql_fetch_array($query);
}
else {
$uname = $_POST['uname'];
$suspend = $_POST['suspend'];
$date = date('m/d/y');
$time = date('H:i');
echo "The account with the username " . $uname . " will be suspended for the following reason: " . $suspend; 
$query = mysql_query("SELECT * FROM members WHERE user= '" . $uname . "' LIMIT 1") or die(mysql_error());
$result = mysql_fetch_array($query);

switch ($result['account_notes']){
	case 'first warning':
		$account_notes = "second warning"; 
		$access = 20;
		break;
	case 'second warning':
		$account_notes = "third warning"; 
		$access = 15;
		break;
	case 'third warning':
		$account_notes = "fourth warning"; 
		$access = 10;
		break;
	case 'fourth warning':
		$account_notes = "frozen"; 
		$access = 5;
		break;
	default:
		$account_notes = "first warning"; 
		$access = 25;
		break;		
}

$update = mysql_query("UPDATE members SET name = '{$result['name']}', status = 'suspended', access = '{$access}', account_notes = '{$account_notes}' WHERE user = '{$uname}'") or die(mysql_error());
$query = mysql_query("SELECT * FROM members WHERE user='{$uname}' LIMIT 1") or die(mysql_error());
$result = mysql_fetch_array($query);

$log = mysql_query("INSERT INTO log (username, status, date, time, account_affected, updated_user, new_status, new_accountnotes) VALUES ('{$_SESSION['user']}', '{$_SESSION['access']}', '{$date}', '{$time}', '{$result['user']}', '{$result['name']}', '{$result['status']}', '{$suspend}');
mysql_query($log) or die(mysql_error(). '<br />'. $log);
}
?>
<html>
<head>
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.style2 {font-size: 12px; color: #FF0000; }
.style3 {color: #FF0000}
</style>
<title>Edit - <?php echo $result['user']; ?>, Suspend Page</title>
</head>
<body>
<h1 align="center"><?php echo $result['user']; ?>'s Account Information</h1>
<table name="userinfo" align="center" width="100%">
<tr>
	<td width="90%">
		<table width="100%" border="0">
    				<tr>
      					<td width="50%" valign="top">
      						<fieldset>
      							<!-- Edit account Info -->
      							<legend>Account Info</legend>
      							<dl>
      								<dt><label for="id">
      									<strong>Account ID:</strong></label> <?php echo $result['userid']; ?> 
      								</dt>
      								<dt><label for="status">
      									<strong>Account Status:</strong></label> <?php echo $user_status; ?></dt>
      								<dt>
      									<label for="username"><strong>Username:</strong></label> <?php echo $result['user']; ?>
      								</dt>
      								<dt>
      									<label for="email"><strong>E-Mail:</strong></label> <?php echo $result['email']; ?>
      								</dt>
      								<dt>
      									<label for="regip"><strong>Registered IP:</strong></label> <?php echo $result['regip']; ?> 
      								</dt>
      								<dt>
      									<label for="lastlogin"><strong>Last Login:</strong></label> <?php echo $result['lastlogin']; ?> 
      								</dt>
      							</dl>
      						</fieldset>      
      					</td>
      					<td width="50%" valign="top">
      						<fieldset>
      							<!-- Edit Player Info -->
      							<legend>Player Info</legend>
      							<dl>
      								<dt>
      									<label for="lvl"><strong>Level:</strong></label> <?php echo $result['lvl']; ?>
      								</dt>
      								<dt>
      									<label for="hp"><strong>HP:</strong></label> <?php echo $result['hp']; ?>
      								</dt>
      								<dt>
      									<label for="hpmax"><strong>HP Max:</strong></label> <?php echo $result['hpmax']; ?>
      								</dt>
      								<dt>
      									<label for="exp"><strong>Experience:</strong></label> <?php echo $result['exp']; ?>								
      								</dt>      			
      								<dt>
      									<label for="money"><strong>Money:</strong></label> <?php echo $result['money']; ?>
      								</dt>
      								<dt>
      									<label for="bank"><strong>Bank:</strong></label> <?php echo $result['bank']; ?>
      								</dt>
      							</dl>
      						</fieldset>      
      					</td>
    				</tr>
    				<form action="suspend.php" method="post">
    				<tr>
      					<td style="text-align:center">
      						<fieldset>
      							<!-- Account Notes -->
      							<legend>Account Notes</legend>
      							<dl>
      								<dt>
      									<?php
      										if ($result['account_notes'] == "")
      											echo "No notes to display";
      										else
      											echo $result['account_notes'];
      									?>
      								</dt>		
      							</dl>
      						</fieldset>     
      					</td>
      				</tr>
      				<tr>
      					<td colspan="3" style="text-align:center">
      						<fieldset style="text-align:center">
    							<!-- Actions available in Suspend mode -->
    							<legend>Actions</legend>
    							<?php 
    								if (isset($uname)){
    							?>
    							<dl>
    								<dt style="text-align:center">
    									<div>
    										You have now suspended an account, <a href="index.php">Click here</a> to return and Administer someone else. <br />
    										If you have noone else to administer then <a href="<?php $SITE_ROOT ?>admin.php">Click here</a> to return to the Admin Panel.
    									</div>
    								</dt>
    							</dl>
    							<?php
    								}
    								else {
    							?>
    							<dl>    								
    								<dt style="text-align:center">
        								<textarea cols="100" rows="10" name="suspend" class="style2"></textarea>
        								<div style="color:red">Type a short reason</div>
      								</dt>
      								<dt style="text-align:center">
      									<label for="username"><strong>Retype Username:</strong></label> <input type="text" name="uname" value="" id="uname" />
      								</dt>
    								<dt>
    									<label for="suspend">
    										<input type="submit" name="submit" value="" style="background:url(../images/suspend.png); background-repeat:no-repeat; border:none; width:80px; height:18px;" onclick="javascript:return confirm('Are you sure you want to suspend <?php echo $result['user']; ?> ?')" />	
    									</label>
    								</dt>
    							</dl>
    							<dl>
    								<dt>
    									<label for="cancel">
    										<a href="members.php?id=<?php echo $result['userid']; ?>"><img src="<?php echo $SITE_ROOT; ?>images/cancel.png" alt="Cancel" border="0" /></a>
    									</label>
    								</dt>
   	 						</dl>
   	 						<?php
   	 							}
   	 						?>   	 		
    						</fieldset>
    					</td>
    				</tr>
    				</form>
    				<tr>
      					<td colspan="2" valign="top">
      						<fieldset>
      							<!-- Last Actions Taken -->
      							<legend>Last Actions Taken</legend>
      							<dl>
      								<dt>
        								<div align="center" class="style2">
        									<?php
        									$date = date('m/d/y');
        									$newdate = strtotime ("-3 months");
        									$query = mysql_query("SELECT * FROM log WHERE account_affected = '" . $result['user'] . "' AND date BETWEEN '$date' AND '$newdate' ORDER BY date") or die(mysql_error());
        									while($log = mysql_fetch_array($query)){
        									echo $log['username'] . " edited this account at " . $log['date'] . " for the following reason: " . $log['new_accountnotes'] . "<br />";
        									}
        									?>
        								</div>
      								</dt>
      							</dl>
      						</fieldset>     
      					</td>
      				</tr>
  			</table>
  		</td>	
  	</tr>   	
</table>
<div align="center" style="color:#0000FF;"><a href="members.php?id=<?php echo $result['userid']; ?>" class="style3">Back</a></div>

 

Can someone help me?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.