Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function write_file($filename, $content) {
- $file = $filename;
- $file_contents = $content;
- $open_file = fopen($file, "wb");
- fwrite($open_file, $file_contents);
- fclose($open_file);
- }
- // MYSQL
- // Usual DB connection stuff, some minor error detection.
- $server = "10.0.0.172";
- $user = "maya";
- $pass = "=";
- $link = mysql_connect($server, $user, $pass);
- if (!$link) {
- die('Could not connect: ' . mysql_error());
- }
- $db = mysql_select_db("maya", $link);
- if (!$db) {
- die('Could not select db: '. mysql_error());
- }
- $json_file = "latest_orders.json";
- /*if (file_exists($json_file)) {
- $json = fopen($json_file, "r");
- $json_json = fread($json,filesize('./'.$json_file)+1);
- fclose($json);
- $last_order = find_last_order($json_json);
- $latest_orders_json = get_orders_and_total($last_order);
- write_file("latest_orders.json", $latest_orders_json);
- } else {*/
- $latest_orders_json = get_orders_and_total();
- write_file("latest_orders.json", $latest_orders_json);
- //}
- $leaderboard_json = build_leaderboard();
- write_file("leaderboard.json", $leaderboard_json);
- mysql_close($link);
Add Comment
Please, Sign In to add comment