Posted on Wednesday 11th June 2008 at 02:29 AM
Well im trying to add a ban system to my site, and just isnt working..
banadmin.php
banned.php
Hope somone can help me.
banadmin.php
PHP Code
<? session_start(); include("config.php"); if($logged[username] && $logged[userlevel] == 6) { if($_GET[user]) { if (!$_POST[update]) // if the submit button is pressed { echo(" <form method="POST"> <select size="1" name="type"> <option selected value="1">1 Hour</option> <option value="2">2 Hour</option> <option value="3">3 Hour</option> <option value="4">4 Hour</option> <option value="5">5 Hour</option> <option value="6">6 Hour</option> <option value="7">7 Hour</option> <option value="8">8 Hour</option> <option value="9">9 Hour</option> <option value="10">10 Hour</option> <option value="11">11 Hour</option> <option value="12">12 Hour</option> <option value="13">13 Hour</option> <option value="14">14 Hour</option> <option value="15">15 Hour</option> <option value="16">16 Hour</option> <option value="17">17 Hour</option> <option value="18">18 Hour</option> <option value="19">19 Hour</option> <option value="20">20 Hour</option> <option value="21">21 Hour</option> <option value="22">22 Hour</option> <option value="23">23 Hour</option> <option value="24">24 Hour</option> <option value="36">36 Hour</option> <option value="48">2 Day Ban</option> <option value="168">7 day ban</option> </select></p> <p> Reason/violation:</p> <p><textarea rows="4" name="reason" cols="22"></textarea></p> <input type="submit" name="update" value="Update"></td> </form> ");// ends the echo } else { $type = htmlspecialchars($_POST[type]); // posts the type of ban $reason = htmlspecialchars($_POST[reason]); //posts the reason echo ("$_GET[user] has been banned. This ban will be lifted automaticly."); // display's message $update = mysql_query("Update users set bannedhours = '$type', reason = '$reason', banned = 'yes' where username = '$_GET[user]'"); // updates the database } } else { $getusers = mysql_query("Select * from users order by username asc"); // gets the users while($users = mysql_fetch_array($getusers)) { echo("<a href="banadmin.php?user=$users[username]">$users[username]</a>"); // display's all users } } } else // if your not admin { echo("Sorry, but your not allowed to view this page. piss of now."); // display's message if your not admin or not logged in } ?>
banned.php
PHP Code
<? session_start(); include("config.php"); if($logged[username] && $logged[banned] ==yes) // lets the banned preview :) { setcookie("id", 2132421,time()+(60*60*24*5), "/", ""); setcookie("pass", loggedout,time()+(60*60*24*5), "/", ""); // logs em out echo ("A moderator has banned you for $logged[reason]. Your ban will be lifted in $logged[bannedhours] Hours. If this is not correct please contact us. "); // tells em about their bann } else { echo("You are not banned you froob"); //tells em to get lost } ?>
Hope somone can help me.