Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- //echo $IP;
- $cid = $_POST['cid'];
- $status = $_POST['status'];
- $username = $_POST['username'];
- $date = $_POST['date'];
- $votes = $_POST['votes'];
- $GhostsStatus = $_POST['GhostsStatus'];
- $GTAStatus = $_POST['GTAStatus'];
- $key = $_POST['leechers'];
- $CIDs = array();
- $IPs = array();
- $cidexists = false;
- $postingallowed = true;
- if (notBanned())
- {
- if (canUpload())
- {
- if (strlen($cid) == 32 && $status != '' && $username != '' && $date != '' && $votes != '' && $GhostsStatus != '' && $GTAStatus != '' && $postingallowed == true)
- {
- $i = 0;
- $dir = 'CIDs/';
- if ($handle = opendir($dir)) {
- while (($file = readdir($handle)) !== false){
- if (!in_array($file, array('.', '..')) && !is_dir($dir.$file))
- $i++;
- }
- }
- for ($i2 = 0; $i2 < $i; $i2++)
- {
- $tempfile='CIDs/CID' . $i2 . '.txt';
- $tempvar=fopen($tempfile,'r');
- $temptext=fgets($tempvar);
- $string = str_replace(array("\n", "\r"), '', $temptext);
- array_push($CIDs, $string);
- fclose($tempvar);
- }
- //$cid = str_replace(array("\n", "\r"), '', $cid);
- foreach ($CIDs as $value)
- {
- if ($value == $cid)
- {
- $cidexists = true;
- }
- }
- if (in_array($cid, $CIDs) == true)
- {
- echo "exists";
- }
- else
- {
- echo "CID doesnt exist";
- file_put_contents('CIDs/CID' . $i . '.txt', $cid . "\r\n" . $status . "\r\n" . $username . "\r\n" . $date . "\r\n" . $votes . "\r\n" . $GhostsStatus . "\r\n" . $GTAStatus);
- }
- }
- }
- }
- else
- {
- echo "You are not allowed to post anymore CIDs";
- }
- function canUpload()
- {
- $conn = mysql_connect("mysql.1freehosting.com", "u386696279_table", "TGSROCKS123") or die(mysql_error()); mysql_select_db("u386696279_ips") or die(mysql_error());
- $data = mysql_query("SELECT * FROM ips") or die(mysql_error());
- $IP = $_SERVER['REMOTE_ADDR'];
- $username2 = $_POST['username'];
- echo $username2;
- $foundip = false;
- $date_ = "";
- $attempts = "";
- while($info = mysql_fetch_array( $data ))
- {
- $ipfromtb = $info['IP'];
- if ($ipfromtb == $IP)
- {
- //echo "ip found" . $ipfromtb;
- $attempts = $info['Attempts'];
- $date_ = $info['LastLogin'];
- $foundip = true;
- }
- else
- {
- echo "not found";
- }
- }
- if ($foundip == true)
- {
- date_default_timezone_set('America/New_York');
- $today=date("d/m/y H:i:s");
- $result = mysql_query($SQL);
- if ($attempts < 4)
- {
- $val = $attempts + 1;
- $sql = "UPDATE ips SET LastUsername = '$username2', LastLogin = '$today', Attempts = '$val' WHERE IP ='$IP'";
- $result = mysql_query($sql, $conn);
- if($attempts == 3)
- {
- echo "start session";
- $_SESSION['timeout'] = time();
- return true;
- }
- return true;
- }
- else
- {
- if ($_SESSION['timeout'] + 10 * 10 < time())
- {
- echo "reset to 0";
- $val = 0;
- $sql = "UPDATE ips SET LastUsername = '$username', LastLogin = '$today', Attempts = '$val' WHERE IP ='$IP'";
- $result = mysql_query($sql, $conn);
- session_destroy();
- return true;
- }
- else
- {
- echo "no attempts left";
- return false;
- }
- }
- }
- else
- {
- date_default_timezone_set('America/New_York');
- $today=date("d/m/y H:i:s");
- $SQL = "INSERT INTO ips (IP, Attempts, LastLogin, LastUsername) VALUES ('$IP', 0, '$today', '$username2')";
- $result = mysql_query($SQL);
- return true;
- }
- }
- function notBanned()
- {
- $conn = mysql_connect("mysql.1freehosting.com", "u386696279_table", "TGSROCKS123") or die(mysql_error()); mysql_select_db("u386696279_ips") or die(mysql_error());
- $data = mysql_query("SELECT * FROM banned_ips") or die(mysql_error());
- $IP = $_SERVER['REMOTE_ADDR'];
- $found = false;
- while($info = mysql_fetch_array( $data ))
- {
- $ipfromtb = $info['IP'];
- if ($ipfromtb == $IP)
- {
- $found = true;
- }
- }
- if ($found == true)
- {
- return false;
- }
- else
- {
- return true;
- }
- } //end of function
- unset($CIDs);
- $cidexists = false;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment