Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <!DOCTYPE html>
- <html>
- <?php
- if(!isset($_SESSION['SteamID']))
- header('Location: index.php');
- require 'include/config.php';
- require 'include/common_db.php';
- require 'tmp/head.php';
- if($cur_admin['Admin'] == 0)
- header('Location: index.php');
- ?>
- <body>
- <div id="menu-corner">
- <?php require 'tmp/menu.php'; ?>
- </div>
- <div id="content">
- <?php
- if(empty($_GET)) {
- $req = $db->query('SELECT * FROM '.$db->prefix.'whitelist');
- if (!$db->num_rows($req)) {
- echo '<font color="red">Aucune demande pour le moment</font>';
- }
- while($data = $db->fetch_assoc($req)) {
- if($data['edit'] == 1)
- $edit = "<font color='green'>Demande en cours d'edition par le joueur</font>";
- else
- $edit = "";
- echo '<b>Motivation : </b>'.$data['Motivation'].'<br>';
- echo '<b>Age : </b>'.$data['Age'];
- echo '<br><a href="admin_whitelist.php?id='.$data['id'].'">Voir</a>';
- echo $edit;
- echo '<hr>';
- }
- } else {
- $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
- $req = $db->query('SELECT * FROM '.$db->prefix.'whitelist WHERE id = "'.$id.'"');
- $cur_whitelist = $db->fetch_assoc($req);
- echo '
- <h3>'.$cur_whitelist['UserName'].' - '.$cur_whitelist['SteamID'].'</h3>
- <b>Demande : </b> '.$cur_whitelist['Motivation'].'<br>
- <b> Age : </b> '.$cur_whitelist['Age'].'<br>
- <b> Profil URL : </b> '.$cur_whitelist['ProfilURL'].'<br><br>
- <b> Le '.date('d/m/Y', $cur_whitelist['time']).' à '.date('H:i:s', $cur_whitelist['time']).'</b>
- <hr>
- <h3 style="font-size:30px;"><b> Commentaire : </b></h3><br>
- ';
- $req = $db->query('SELECT * FROM '.$db->prefix.'commentaire WHERE whitelist = "'.$cur_whitelist['id'].'" ORDER BY id DESC');
- while($data = $db->fetch_assoc($req))
- echo '<h3>'.$data['Pseudo'].'</h3>'.$data['commentaire'].'';
- if(isset($_POST['sendcommen'])) {
- $db->query('INSERT INTO '.$db->prefix.'commentaire (`commentaire`, `Pseudo`, `time`, `whitelist`) VALUES(\''.$db->escape($_POST['commentaire']).'\', \''.$db->escape($_SESSION['UserName']).'\', \''.time().'\', \''.$cur_whitelist['id'].'\')');
- $db->query('INSERT INTO '.$db->prefix.'notification (`text`,`vue`,`SteamID`) VALUES(\'Vous avez reçus un nouveau commentaire\', \'0\', \''.$cur_whitelist['SteamID'].'\')');
- header('Location: admin_whitelist.php');
- }
- if(isset($_POST['sendcommen_edit'])) {
- $db->query('INSERT INTO '.$db->prefix.'commentaire (`commentaire`, `Pseudo`, `time`, `whitelist`) VALUES(\''.$db->escape($_POST['commentaire']).'\', \''.$db->escape($_SESSION['UserName']).'\', \''.time().'\', \''.$cur_whitelist['id'].'\')');
- $db->query('UPDATE '.$db->prefix.'whitelist SET edit=\'1\' WHERE id = "'.$cur_whitelist['id'].'"');
- $db->query('INSERT INTO '.$db->prefix.'notification (`text`,`vue`,`SteamID`) VALUES(\'Vous avez un nouveau commentaire dans votre demande de whitelist avec la possiblité de modifier vos motivations\', \'0\', \''.$cur_whitelist['SteamID'].'\')');
- header('Location: admin_whitelist.php');
- }
- if(isset($_POST['sendcommen_refu'])) {
- $db->query('DELETE FROM '.$db->prefix.'whitelist WHERE id='.$cur_whitelist['id']);
- $db->query('INSERT INTO '.$db->prefix.'notification (`text`,`vue`,`SteamID`) VALUES(\'Votre candidature a été rejeté, Merci de reposté ultérieurement\', \'0\', \''.$cur_whitelist['SteamID'].'\')');
- $db->query('UPDATE '.$db->prefix.'users SET whitelist=\'0\' WHERE SteamID = "'.$cur_whitelist['SteamID'].'"');
- header('Location: admin_whitelist.php');
- }
- if(isset($_POST['sendcommen_accept'])) {
- $SteamID = 'ulx adduserid .'$cur_whitelist['SteamID'].' wl';
- $db->query('DELETE FROM '.$db->prefix.'whitelist WHERE id='.$cur_whitelist['id']);
- $db->query('INSERT INTO '.$db->prefix.'notification (`text`,`vue`,`SteamID`) VALUES(\'Vous êtes acceptez, Maintenant vous pouvez vous connectez sur le serveur\', \'0\', \''.$cur_whitelist['SteamID'].'\')');
- $db->query('UPDATE '.$db->prefix.'users SET whitelist=\'1\' WHERE SteamID = "'.$cur_whitelist['SteamID'].'"');
- /**
- * Return a byte and split it out of the string
- * - unsigned char
- *
- * @param string $string String
- */
- function getByte(&$string)
- {
- $data = substr($string, 0, 1);
- $string = substr($string, 1);
- $data = unpack('Cvalue', $data);
- return $data['value'];
- }
- /**
- * Return an unsigned short and split it out of the string
- * - unsigned short (16 bit, big endian byte order)
- *
- * @param string $string String
- */
- function getShortUnsigned(&$string)
- {
- $data = substr($string, 0, 2);
- $string = substr($string, 2);
- $data = unpack('nvalue', $data);
- return $data['value'];
- }
- /**
- * Return a signed short and split it out of the string
- * - signed short (16 bit, machine byte order)
- *
- * @param string $string String
- */
- function getShortSigned(&$string)
- {
- $data = substr($string, 0, 2);
- $string = substr($string, 2);
- $data = unpack('svalue', $data);
- return $data['value'];
- }
- /**
- * Return a long and split it out of the string
- * - unsigned long (32 bit, little endian byte order)
- *
- * @param string $string String
- */
- function getLong(&$string)
- {
- $data = substr($string, 0, 4);
- $string = substr($string, 4);
- $data = unpack('Vvalue', $data);
- return $data['value'];
- }
- /**
- * Return a float and split it out of the string
- *
- * @param string $string String
- */
- function getFloat(&$string)
- {
- $data = substr($string, 0, 4);
- $string = substr($string, 4);
- $array = unpack("fvalue", $data);
- return $array['value'];
- }
- /**
- * Return a string and split it out of the string
- *
- * @param string $string String
- */
- function getString(&$string)
- {
- $data = "";
- $byte = substr($string, 0, 1);
- $string = substr($string, 1);
- while (ord($byte) != "0")
- {
- $data .= $byte;
- $byte = substr($string, 0, 1);
- $string = substr($string, 1);
- }
- return $data;
- }
- // Constant
- define('PACKET_SIZE', '1400');
- define('SERVERQUERY_INFO', "\xFF\xFF\xFF\xFFTSource Engine Query");
- define ('REPLY_INFO', "\x49");
- define('SERVERQUERY_GETCHALLENGE', "\xFF\xFF\xFF\xFF\x57");
- define ('REPLY_GETCHALLENGE', "\x41");
- define('SERVERDATA_AUTH', 3) ;
- define ('SERVERDATA_EXECCOMMAND', 2) ;
- // Ip address and port
- $_ip = '37.187.229.147'; // server ip
- $_port = '27015'; // server port
- $_password = 'XXXXXXXXXX'; // your rcon password
- $command = $SteamID;
- $s2 = '';
- $requestId = 1;
- // open connection with server
- $socket = fsockopen ('tcp://'.$_ip, $_port, $errno, $errstr, 30) ;
- // Send auth packet
- // Construct packet
- $data = pack("VV", $requestId, SERVERDATA_AUTH).$_password.chr(0).$s2.chr(0);
- // Prefix the packet by its size
- $data = pack("V",strlen($data)).$data;
- // Send packet
- fwrite ($socket, $data, strlen($data)) ;
- $requestId++ ;
- // Check if auth is successful
- $junk = fread ($socket, PACKET_SIZE) ;
- $string = fread ($socket, PACKET_SIZE) ;
- $size = getLong($string) ;
- $id = getLong ($string) ;
- if ($id == -1)
- {
- // Error
- die ('Auth failed: bad password !') ;
- }
- // Sending the command and getting the answer
- $data = pack ("VV", $requestId, SERVERDATA_EXECCOMMAND).$command.chr(0).$s2.chr(0) ;
- // Prefix the packet by its size
- $data = pack ("V", strlen ($data)).$data ;
- // Send packet
- fwrite ($socket, $data, strlen($data)) ;
- $requestId++ ;
- // Read response
- $i = 0 ;
- $text = '' ;
- while ($string = fread($socket, 4))
- {
- $info[$i]['size'] = getLong($string) ;
- $string = fread($socket, $info[$i]['size']) ;
- $info[$i]['id'] = getLong ($string) ;
- $info[$i]['type'] = getLong ($string) ;
- $info[$i]['s1'] = getString ($string) ;
- $info[$i]['s2'] = getString ($string) ;
- $text .= $info[$i]['s1'] ;
- $i++ ;
- }
- }
- ?>
- <center>
- <br>
- <form method="post" action="">
- <textarea name="commentaire" style="width:90%;height:200px;"></textarea>
- <input type="submit" name="sendcommen" value="Envoyer juste un commentaire">
- <input type="submit" name="sendcommen_edit" value="Envoyer un commentaire avec la chance de modifier la motivation">
- <input type="submit" name="sendcommen_refu" value="Refuser le joueur">
- <input type="submit" name="sendcommen_accept" value="Accepter le joueur">
- </form>
- </center>
- <?php
- }
- ?>
- </div>
- <?php require 'tmp/footer.php'; ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement