Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

redflag.php 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/php -q
  2. <?PHP
  3. chdir('/home/utd/control');
  4. require_once('lib/common.php');
  5. require_once('lib/database.php');
  6. chdir('/home/utd/scripts');
  7. function sendToHost($host,$method,$path,$data,$useragent=0)
  8. {
  9. // Supply a default method of GET if the one passed was empty
  10. if (empty($method))
  11. $method = 'GET';
  12. $method = strtoupper($method);
  13. $fp = fsockopen($host,80);
  14. if ($method == 'GET')
  15. $path .= '?' . $data;
  16. fputs($fp, "$method $path HTTP/1.1\r\n");
  17. fputs($fp, "Host: $host\r\n");
  18. fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
  19. if ($method == 'POST')
  20. fputs($fp, "Content-length: " . strlen($data) . "\r\n");
  21. if ($useragent)
  22. fputs($fp, "User-Agent: MSIE\r\n");
  23. fputs($fp, "Connection: close\r\n\r\n");
  24. if ($method == 'POST')
  25. fputs($fp, $data);
  26. while (!feof($fp))
  27. $buf .= fgets($fp,128);
  28. fclose($fp);
  29. return $buf;
  30. }
  31. $sql = 'SELECT signup_id, signup_data FROM signups WHERE signup_checked = 0';
  32. $res = mysql_query($sql) or print(mysql_error());
  33. while ($row = mysql_fetch_array($res)) {
  34. $data = unserialize($row['signup_data']);
  35. $query = 'appid=MD87scripts&query='.urlencode($data['data']['phone']);
  36. $query .= '&type=phrase&adult_ok=1&similar_ok=1&output=php';
  37. $re = sendToHost('api.search.yahoo.com', 'get', '/WebSearchService/V1/webSearch',$query);
  38. if (preg_match('/"totalResultsAvailable";i:([0-9]+);/',$re, $m)) {
  39. if ((int)$m[1] > 0) {
  40. logger::log('Red flagged account '.$data['data']['user'],logger::important);
  41. $sql = 'SELECT user_id FROM users WHERE user_name = \'';
  42. $sql .= mysql_real_escape_string($data['data']['user']).'\'';
  43. $re = mysql_query($sql);
  44. $ro = mysql_fetch_array($re);
  45. $sql = 'INSERT INTO actions (user_id, action_type) VALUES ('.$ro[0].', \'';
  46. $sql .= 'lock\')';
  47. mysql_query($sql);
  48. }
  49. }
  50. mysql_query('UPDATE signups SET signup_checked=1 WHERE signup_id = '.$row[0]);
  51. }
  52. ?>