The Error
My code i have is:
Code:
[B]Parse error[/B]: parse error, unexpected T_CASE in [B]C:\Program Files\VertrigoServ\www\admin.php[/B] on line [B]144
[/B]
My code i have is:
PHP:
<?php
ob_start();
include("config.php");
//space
//space
switch($_GET[action])
{
case '':
//dunno
break;
case '':
//dunno
break;
case '':
//dunno
break;
case '':
//dunno
break;
case 'editdj':
if($logged[username] && $logged[level] ==5)
{
//checks to see if the user is logged in, and if their user level
//is 5 (this is administrator)
if($_GET[user])
{
//checks to see if there is a ?user=username variable in the url.
if (!$_POST[update])
{
// the form hasn't been submitted. We continue...
$user = mysql_query("SELECT * from users where username = '$_GET[user]'");
$user = mysql_fetch_array($user);
//these lines get the user's information and put it in an array.
//we will display the information in the html form
echo("
<div align=\"center\"><form method=\"POST\">
<table width=\"100%\">
<tr>
<td align=\"right\" width=\"25%\">
User Level
</td>
<td align=\"left\">
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"level\"
value=\"$user[level]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Location
</td>
<td align=\"left\">
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"locate\"
value=\"$user[location]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
MSN Messenger
</td>
<td align=\"left\">
<input size=\"25\" name=\"msn\" value=\"$user[msn]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
AOL Messenger</td>
<td align=\"left\">
<input size=\"25\" name=\"aim\" value=\"$user[aim]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Email Address</td>
<td align=\"left\">
<input size=\"25\" name=\"email\" value=\"$user[email]\"></td>
</tr>
<tr>
<td align=\"center\">
</td>
<td align=\"left\">
<input type=\"submit\" name=\"update\" value=\"Update\"></td>
</tr>
</table>
</form>
</div>");
//displays the html form
}
else
{
$email = htmlspecialchars($_POST[email]);
$aim = htmlspecialchars($_POST[aim]);
$msn = htmlspecialchars($_POST[msn]);
$locate = htmlspecialchars($_POST[locate]);
$level = htmlspecialchars($_POST[level]);
// the above lines get rid of all html.
echo ("$_GET[user]'s profile has been updated.");
$update = mysql_query("Update users set email = '$email',
msn = '$msn', aim = '$aim',
location = '$locate', level = '$level' where username = '$_GET[user]'");
// updates the information in the database.
}
}
else
{
$getusers = mysql_query("Select * from users order by username asc");
while($users = mysql_fetch_array($getusers))
{
//makes a list of all the users
echo("<a href=\"admin.php?user=$users[username]\">$users[username]</a><br />");
//displays the user's names
}
}
}
else
{
//the user's level is not 5! They cannot view this page
echo("Sorry, but you are not allowed to view this page!");
}
break;
case 'djsays':
if($logged[username] && $logged[level]== 3 || 5){
if(!$_POST[djupdate]){
echo "
<center>
<form action=\"?action=djsays&updatedjsays=1\" method=\"POST\">
<b>DJ Message</b>: <textarea name=\"message\" cols=\"35\"></textarea><br />
<input type=\"submit\" name=\"djupdate\" value=\"Set Dj Says\">
";
if($_GET[updatedjsays] == 1){
if($_POST[djupdate]){
$username = $logged[username];
$message = stripslashes(addslashes($_POST[message]));
echo "<b>DJ</b>: $username <b>Said</b>: $message";
mysql_query("UPDATE djsays SET username = '$username', message = '$message' WHERE id = '1'");
}elseif($logged[username] && $logged[level] == 1){
echo "Your Not A Dj Or An Admin";
}else{
echo "Your Not Logged In";
}
break;
case 'adminsays':
if($logged[username] && $logged[level] == 5)
{
echo "<form action='admin.php?action=staffnotes&updatestaffnotes=1' method='post'>
<textarea name='notes' id='notes' style='background-color:#F9FFA2;border:1px solid #CCC;width:95%;font-family:verdana;font-size:10px' rows='8' cols='25'>";include("staffnotes.php"); $sn = $notes; echo "$sn";echo "</textarea>
<br>
<div align='center'><input type='submit' name='Submit' value='Save Admin Notes'></div></form>";
if ($_GET['updatestaffnotes'] == 1)
{
if($_POST['Submit']) {
if (!is_file("staffnotes.php"))
{
die ("Error: The File <b>staffnotes.php</b> Doesn't Exist");
}
if (!is_writeable("staffnotes.php"))
{
die ("Error: The File <b>staffnotes.php</b> is NOT Writable....Please CHMOD to 777");
}
$sn1 = $_POST['notes'];
$body = '<?php $notes = "'.$sn1.'"; ?>';
$fp = fopen("staffnotes.php", "w");
fputs($fp, $body);
fclose($fp);
echo "<br><center>The Staff Notes Have Been Updated</center><br>";
}
else {
echo "Error: Please Do Not Visit This Link Directly";
}
}
}else{
echo "You Are Not An Admin";
}
break;
}//End Switch Get
?>
Last edited: