Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. <?php
  2. // Setup database information
  3. $db_location = "localhost";
  4. $db_name = "";
  5. $db_username = "";
  6. $db_password = "";
  7. $table_name = "tblhosting";
  8.  
  9. mysql_connect($db_location,$db_username,$db_password);
  10. @mysql_select_db($db_name);
  11. //set vars
  12. $data['last7'] = 0;
  13. $data['total'] = 0;
  14. $data['yesterday'] = 0;
  15. $data['active'] = 0;
  16.  
  17.  
  18. $result = mysql_query("SELECT * FROM ".$table_name."");
  19. while($row = mysql_fetch_array($result))
  20. {
  21. ++$data['total']; //gets all accounts registered
  22.  
  23. if($row['domainstatus']=="Active")
  24. ++$data['active']; //gets all active accounts
  25.  
  26. if($row['regdate']==date("Y-m-d", time()-(60*60*24)))
  27. ++$data['yesterday']; //gets accounts created yesterday
  28.  
  29. if(
  30. $row['regdate']==date("Y-m-d", time()-(60*60*24)) || //yesterday
  31. $row['regdate']==date("Y-m-d", time()-(2*60*60*24)) || //2 days ago...
  32. $row['regdate']==date("Y-m-d", time()-(3*60*60*24)) ||
  33. $row['regdate']==date('Y-m-d', time()-(4*60*60*24)) ||
  34. $row['regdate']==date('Y-m-d', time()-(5*60*60*24)) ||
  35. $row['regdate']==date('Y-m-d', time()-(6*60*60*24)) ||
  36. $row['regdate']==date('Y-m-d', time()-(7*60*60*24))
  37. )
  38. ++$data['last7'];
  39. }
  40. /*
  41. foreach($data as $key=>$val)
  42. {
  43. if($key=="total")
  44. echo "Total Accounts";
  45.  
  46. if($key=="active")
  47. echo "Active Accounts";
  48.  
  49. if($key=="yesterday")
  50. echo "Accounts Made Yesterday";
  51.  
  52. if($key=="last7")
  53. echo "Accounts Made Within Last 7 Days";
  54.  
  55. echo ": ".$val."<br />"
  56. }
  57. */
  58.  
  59. $ran[] = $data['total']." webmasters use Web-Hosting-Service.org to host their websites!";
  60. $ran[] = $data['active']." new clients have signed up at Web-Hosting-Service this year.";
  61. $ran[] = $data['last7']." new clients signed up at Web-Hosting-Service this past week. ";
  62. $ran[] = "Yesterday a total of ".$data['yesterday']." accounts were opened at Web-Hosting-Service!";
  63.  
  64. $max = count($ran)-1;
  65. $min = 0;
  66. $bla = rand($min,$max);
  67. echo $ran[$bla];
  68.  
  69. echo mysql_error();
  70. // close DB after the website loads
  71. mysql_close();
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement