News:

Click here for Toll-Free Service for your business starting at $2.00 per month

Main Menu

Hi

Started by Ries, January 25, 2006, 07:45:01 PM

Previous topic - Next topic

Ries

I made a script for owner accounts on my game to edit players accounts but it doesn't seem to be getting the data from the forms here is the code
<title>eluxian - Staff Options</title>
<?PHP
include("game_header.php");
$title = "Staff Options";
if ($playerinfo[status] != "MEM") {
echo "<font face=Verdana,arial size=1></br>Welcome to the Staff Centre</p>";
}
if ($playerinfo[status] == "OWN"){
echo "[<a href=admin.php?step=edit>Edit Account</a>]</br>";
}
if ($step == "edit"){
if ($playerinfo[status] != "OWN"){
echo "You are not authorised to view this page, it has been recorded that you have tried to view the page</br>";
}else{
echo "Who would you like to edit?</br>";
echo "ID: <form action=admin.php?step=edit2 method=post><input type=text name=id><input type=submit value=Edit>";
}
if ($step == "edit2"){
if ($playerinfo[status] != "OWN"){
echo "You are not authorised to view this page, it has been recorded that you have tried to view the page</br>";
}
}else{
$_POST[id] = $editid;
$getid = mysql_query("SELECT * FROM userdb WHERE id='$editid'")or die(mysql_error());
while ($edit_info = mysql_fetch_array( $getid )){
echo "<table border=0><tr><td>Name</td><td>ID</td><td>Email</td><td>Password</td></tr>";
echo "<tr><td>$edit_info[name]</td><td>$edit_info[id] </td><td> $edit_info[email]</td><td>$edit_info[pass]</td></tr>";
   }
}
}
if ($playerinfo[staus] == "MEM") {
echo "</br>Your not Staff!";
}


echo "</br></br></br>";
echo "<marquee width=700><a href=elite.php><font color=red>Do you want 1 years free Elite Days? Then Click Me</a></marquee>";
?></table>
<?PHP include("game_footer.php"); ?>

any help?

webzone (archived)

I don't think that it is the problem, but $playerinfo[status] and $_POST[id] are invalid. You must use " or ' around strings like : $playerinfo["status"]

sixthcrusifix

Quote from: webzone on January 25, 2006, 08:27:11 PM
I don't think that it is the problem, but $playerinfo[status] and $_POST[id] are invalid. You must use " or ' around strings like : $playerinfo["status"]

Possibley these are really intengers and he meant to use $_POST[$id] and $playerinfo[$status]? You shouldn't need quotes around variables (if that's what was intended, variable)
Visite me website at http://www.sixthcrusifix.com

Ries

that isnt true i use $_POST[id] or whatever all of the time and it works

webzone (archived)

Quotethat isnt true i use $_POST[id] or whatever all of the time and it works

Quote from: PHP DocumentationIf you use an undefined constant, PHP assumes that you mean the name of the constant itself, just as if you called it as a string (CONSTANT vs "CONSTANT"). An error of level E_NOTICE will be issued when this happens. See also the manual entry on why $foo[bar] is wrong (unless you first define() bar as a constant).

$_POST[id] may work, but it is invalid and triggers an error.

brainiac744

I think you may have had an extra brace in there. I've removed it, but haven't checked the code, so try this :)


<title>eluxian - Staff Options</title>
<?PHP
include("game_header.php");
$title = "Staff Options";
if ($playerinfo[status] != "MEM") {
echo "<font face=Verdana,arial size=1></br>Welcome to the Staff Centre</p>";
}
if ($playerinfo[status] == "OWN"){
echo "[<a href=admin.php?step=edit>Edit Account</a>]</br>";
}
if ($step == "edit"){
if ($playerinfo[status] != "OWN"){
echo "You are not authorised to view this page, it has been recorded that you have tried to view the page</br>";
}else{
echo "Who would you like to edit?</br>";
echo "ID: <form action=admin.php?step=edit2 method=post><input type=text name=id><input type=submit value=Edit>";
}
if ($step == "edit2"){
if ($playerinfo[status] != "OWN"){
echo "You are not authorised to view this page, it has been recorded that you have tried to view the page</br>";
}
else{
$_POST[id] = $editid;
$getid = mysql_query("SELECT * FROM userdb WHERE id='$editid'")or die(mysql_error());
while ($edit_info = mysql_fetch_array( $getid )){
echo "<table border=0><tr><td>Name</td><td>ID</td><td>Email</td><td>Password</td></tr>";
echo "<tr><td>$edit_info[name]</td><td>$edit_info[id] </td><td> $edit_info[email]</td><td>$edit_info[pass]</td></tr>";
   }
}
}
if ($playerinfo[staus] == "MEM") {
echo "</br>Your not Staff!";
}


echo "</br></br></br>";
echo "<marquee width=700><a href=elite.php><font color=red>Do you want 1 years free Elite Days? Then Click Me</a></marquee>";
?></table>
<?PHP include("game_footer.php"); ?>