16) { echo "

Error: Ban ID cannot be longer than 16 characters


"; $error=true; } if (strlen($banid) < 16) { echo "

Error: Ban ID cannot be shorter than 16 characters


"; $error=true; } if (preg_match("#[^][A-Za-z0-9]#", $banid)) { echo "

Error: Ban ID contains invalid characters


"; $error=true; } if (strlen($banreason) > 100) { echo "

Error: Ban reason cannot be longer than 100 characters


"; $error=true; } if (strlen($whyunban) > 2000) { echo "

Error: Why do you think you should be unbanned cannot be longer than 2000 characters


"; $error=true; } if (!$error) { //ini_set('display_errors',1); //error_reporting(E_ALL | E_STRICT); // webbanappeal has read-only access to bans table, nothing else. It can only be accessed in localhost. Publishing password to git is fine. $con = pg_connect("host=localhost port=5432 dbname=limework user=webbanappeal password=UpUOZhRf5WLAy920wbDqyAKLySHl677juGgL"); if (!$con) { echo "

Failed to connect to database."; echo "

"; $error=true; } $query = "SELECT banid FROM bans WHERE banid = $1"; $stmt = pg_prepare($con, "bancheck", $query); $result = pg_execute($con, "bancheck", array($banid)); $banidfound=false; if (!$result) { echo "

An database error occurred, report this to staff."; echo "

"; $error=true; } else { while ($row = pg_fetch_assoc($result)) { $banidfound=true; } } if (!$banidfound) { echo "

There is no ban with the specified ban ID."; echo "

"; $error=true; } pg_free_result($result); } //must not be else if, as error variable may be set above if ($error) { echo "
"; } else { echo "

Opening your ban appeal...

"; $newcontent = file_get_contents("/var/www/html/template/index.html"); $newcontent=str_replace("Replace this line", "

Ban Appeal

Ban ID
$banid

Ban Reason
$banreason

Why do you think you should be unbanned?
$whyunban


Staff Reply

None yet.

", $newcontent); if (!file_exists("/var/www/html/appeal/view/$banid.html")) { $handle = fopen("/var/www/html/appeal/view/$banid.html","w+"); fwrite($handle,$newcontent); fclose($handle); } echo ""; } ?>