Php Review

Pinkyy

New Member
Messages
20
Reaction score
0
Points
0
<? $title = "Warn"; include("header.php");
if ($stat[rank] == Member) {
print"You are not a mod/admin";
exit;
}

print"
<center>
<b>Ban/Warn users dont put users warn % above 100% unless needed, If set to 100% use reason.</b><br>
<form method=post action=?action=warn>
User ID:<input type=text name=id>
Warn %:<input type=text name=ban>
Reason:<input type=text name=reas>
<input type=submit value=Submit></center>
</form>";
if ($action == warn) {
$hi = mysql_fetch_array(mysql_query("select * from users where id='$id'"));
$checke = mysql_num_rows(mysql_query("select * from users where id='$hi[id]'"));
if ($checke <= 0) {
print "No such player.";
include("footer.php");
exit;
}
if ($ban > 100) {
print"You cannot go over 100%";
exit;
include("footer.php");
}
if ($hi[rank] == Admin) {
print"You cannot ban a admin";
exit;
}
if ($stat[rank] == Moderator) {
if ($hi[rank] == Moderator) {
print"You cannot ban a moderator";
exit;
}
}
mysql_query("insert into mail (sender, senderid, owner, subject, body) values('DK','0','$hi[id]','Warning','You have been warned your warning level is now $ban%')") or die("Could submit.");
mysql_query("update users set ban='$ban' where id='$hi[id]'");
print"You've set $hi[name] warning % at $ban%";
exit;
}

For some reason thats not working, can someone find me error code there , i would appreciate it . Thanks
 

noerrorsfound

New Member
Messages
1,736
Reaction score
1
Points
0
I see you don't have a space between the word "print" and the quoatation marks in some places. Does that matter in PHP? Also, more information than "it's not working" would be useful, although since it's not much code I guess someone who codes PHP could still find it.
 

kbjradmin

New Member
Messages
512
Reaction score
2
Points
0
i don't know a lot about php, but i do know some.
i think your problem could be that you never declared your code as php.

your code starts out '<?' but i think it needs to be '<?php' instead.

i'm not sure, but that might be it.
 

bonbon

New Member
Messages
67
Reaction score
0
Points
0
...i c ...Php can't perform operation without quotations like ";"..
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
As kbjr stated, unless specifically set in your php.ini, the short form for the opening tag (<?) won't work. Try changing it to "<?php" first. If that doesn't fix your problem, then you need to give more details. Saying "it's not working" doesn't tell us much, it just sounds like a Microsoft error.

Also, you should use quotes around your strings, including array keys. Otherwise php will first check if you are referencing a constant. If you set error_reporting() to E_ALL, you'd see a lot of Notice messages. They aren't errors, but they basically mean that the statement can be written more correctly/efficiently for the interpreter.
 
Top