2022-09-07 09:29:20 +00:00
<! DOCTYPE html >
< html >
< link href = " /style.css " rel = " stylesheet " >
< head >
< link rel = " apple-touch-icon " sizes = " 180x180 " href = " /apple-touch-icon.png " >
< link rel = " icon " type = " image/png " sizes = " 32x32 " href = " /favicon-32x32.png " >
< link rel = " icon " type = " image/png " sizes = " 16x16 " href = " /favicon-16x16.png " >
< link rel = " manifest " href = " /site.webmanifest " >
< link rel = " mask-icon " href = " /safari-pinned-tab.svg " color = " #5bbad5 " >
< meta name = " msapplication-TileColor " content = " #da532c " >
< meta name = " theme-color " content = " #ffffff " >
< div class = " header " >
< a href = " / " >< img id = " logo " src = " /logo.png " ></ a >
</ div >
</ head >
< body >
< meta charset = " UTF-8 " >
< ul >
< li >< a href = " / " > Home </ a ></ li >
< li >< a href = " /chat " > Chat </ a ></ li >
< li >< a href = " /rules " > Rules </ a ></ li >
2022-10-27 17:34:35 +00:00
< li >< a href = " https://store.limework.net " style = " color:lightgreen; " >& #128722; Store</a></li>
2022-09-07 09:29:20 +00:00
< li >< div class = " dropdown " >
2023-04-01 09:55:52 +00:00
< button class = " dropbtn " > More </ button >
2022-09-07 09:29:20 +00:00
< div class = " dropdown-content " >
< a href = " https://git.limework.net " style = " color:lightgreen; " >& #127959; Gitea</a>
< a href = " https://video.govindas.net " style = " color:lightgreen; " >& #128250; PeerTube</a>
< a href = " https://creative.limework.net " style = " color:lightgreen; " >& #128506; Creative Map</a>
</ div >
</ div >
</ li >
</ ul >
< div class = 'content' >
< ? php
$banid = htmlspecialchars ( $_POST [ 'banid' ]);
$banreason = htmlspecialchars ( $_POST [ 'banreason' ]);
$whyunban = htmlspecialchars ( $_POST [ 'whyunban' ]);
$error = false ;
if ( strlen ( $banid ) > 16 ) {
echo " <p style='color:red;'>Error: Ban ID cannot be longer than 16 characters</p><br> " ;
$error = true ;
} if ( strlen ( $banid ) < 16 ) {
echo " <p style='color:red;'>Error: Ban ID cannot be shorter than 16 characters</p><br> " ;
$error = true ;
} if ( preg_match ( " #[^][A-Za-z0-9]# " , $banid )) {
echo " <p style='color:red;'>Error: Ban ID contains invalid characters</p><br> " ;
$error = true ;
} if ( strlen ( $banreason ) > 100 ) {
echo " <p style='color:red;'>Error: Ban reason cannot be longer than 100 characters</p><br> " ;
$error = true ;
} if ( strlen ( $whyunban ) > 2000 ) {
echo " <p style='color:red;'>Error: Why do you think you should be unbanned cannot be longer than 2000 characters</p><br> " ;
$error = true ;
} if ( ! $error ) {
2023-04-01 09:55:52 +00:00
//ini_set('display_errors',1);
//error_reporting(E_ALL | E_STRICT);
2022-09-07 09:29:20 +00:00
// webbanappeal has read-only access to bans table, nothing else. It can only be accessed in localhost. Publishing password to git is fine.
2023-04-01 09:55:52 +00:00
$con = pg_connect ( " host=localhost port=5432 dbname=limework user=webbanappeal password=UpUOZhRf5WLAy920wbDqyAKLySHl677juGgL " );
2022-09-07 09:29:20 +00:00
if ( ! $con ) {
2023-04-01 09:55:52 +00:00
echo " <p style='color:red;'>Failed to connect to database. " ;
2022-09-07 09:29:20 +00:00
echo " </p> " ;
2023-04-01 09:55:52 +00:00
$error = true ;
2022-09-07 09:29:20 +00:00
}
2023-04-01 09:55:52 +00:00
$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 " <p style='color:red;'>An database error occurred, report this to staff. " ;
echo " </p> " ;
$error = true ;
} else {
while ( $row = pg_fetch_assoc ( $result )) {
$banidfound = true ;
}
}
if ( ! $banidfound ) {
echo " <p style='color:red;'>There is no ban with the specified ban ID. " ;
echo " </p> " ;
$error = true ;
}
pg_free_result ( $result );
2022-09-07 09:29:20 +00:00
}
//must not be else if, as error variable may be set above
if ( $error ) {
echo " <form action='/appeal'><input type='submit' value='Go back' /></form> " ;
} else {
echo " <p><i>Opening your ban appeal...</i></p> " ;
$newcontent = file_get_contents ( " /var/www/html/template/index.html " );
$newcontent = str_replace ( " Replace this line " , " <h1>Ban Appeal</h1><p><b>Ban ID</b><br> $banid </p><p><b>Ban Reason</b><br> $banreason </p><p><b>Why do you think you should be unbanned?</b><br> $whyunban </p><br><h2>Staff Reply</h2><p><i>None yet.</i></p> " , $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 );
}
2022-11-13 08:38:24 +00:00
echo " <meta http-equiv='Refresh' content='0; url=https://limework.net/appeal/view/ $banid .html' /> " ;
2022-09-07 09:29:20 +00:00
}
?>
</ div >
< div class = " footer " >
< p > © Govindas Limework 2015 - present < a href = " /privacy-policy " >< span style = " float:right;color:lightgreen; " > Privacy Policy </ span ></ a ></ p >
</ div >
</ body >
</ html >