Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Setup database information
- $db_location = "localhost";
- $db_name = "";
- $db_username = "";
- $db_password = "";
- $table_name = "tblhosting";
- mysql_connect($db_location,$db_username,$db_password);
- @mysql_select_db($db_name);
- //set vars
- $data['last7'] = 0;
- $data['total'] = 0;
- $data['yesterday'] = 0;
- $data['active'] = 0;
- $result = mysql_query("SELECT * FROM ".$table_name."");
- while($row = mysql_fetch_array($result))
- {
- ++$data['total']; //gets all accounts registered
- if($row['domainstatus']=="Active")
- ++$data['active']; //gets all active accounts
- if($row['regdate']==date("Y-m-d", time()-(60*60*24)))
- ++$data['yesterday']; //gets accounts created yesterday
- if(
- $row['regdate']==date("Y-m-d", time()-(60*60*24)) || //yesterday
- $row['regdate']==date("Y-m-d", time()-(2*60*60*24)) || //2 days ago...
- $row['regdate']==date("Y-m-d", time()-(3*60*60*24)) ||
- $row['regdate']==date('Y-m-d', time()-(4*60*60*24)) ||
- $row['regdate']==date('Y-m-d', time()-(5*60*60*24)) ||
- $row['regdate']==date('Y-m-d', time()-(6*60*60*24)) ||
- $row['regdate']==date('Y-m-d', time()-(7*60*60*24))
- )
- ++$data['last7'];
- }
- /*
- foreach($data as $key=>$val)
- {
- if($key=="total")
- echo "Total Accounts";
- if($key=="active")
- echo "Active Accounts";
- if($key=="yesterday")
- echo "Accounts Made Yesterday";
- if($key=="last7")
- echo "Accounts Made Within Last 7 Days";
- echo ": ".$val."<br />"
- }
- */
- $ran[] = $data['total']." webmasters use Web-Hosting-Service.org to host their websites!";
- $ran[] = $data['active']." new clients have signed up at Web-Hosting-Service this year.";
- $ran[] = $data['last7']." new clients signed up at Web-Hosting-Service this past week. ";
- $ran[] = "Yesterday a total of ".$data['yesterday']." accounts were opened at Web-Hosting-Service!";
- $max = count($ran)-1;
- $min = 0;
- $bla = rand($min,$max);
- echo $ran[$bla];
- echo mysql_error();
- // close DB after the website loads
- mysql_close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement