PHP - Format Timestamp To Timezone
I have an idea, which I'm trying to realise, im using the time() function to store the timestamp within my db...and within the db I have a timezone column (which contains the timezone selected by that user).
So I'd like to display $row['timestamp'] (the stored timestamp generated by time()) to the specified timezone, how would that work? <?php //$timestamp = timestamp generated by the time() function //$timezone = the timezone to convert $timestamp too function convert_time($timestamp, $timezone) { //$new_timestamp = do something to adapt $timestamp to $timezone //return the formatted/readable date... return date('D M Y H:i', $new_timestamp); } ?> Similar TutorialsHi, I am writing a script for invoicing various contractor jobs. I have fields for date assigned and date completed. Both are timestamp with timezone columns in a postgresql table My goal is to have a cron job which selects the records from the table on the dates the invoices are due and includes the proper jobs-- i.e. the ones that are completed prior to the due date and time(5PM on the first and 15th of each month) That is where I am running into confusion as to how to store the time/tz and then select it in the future so everything is correct This is what I have right now: Code: [Select] $assignmenttype, "miles" => $miles, "notes" => $notes, "dateassigned" => "{$assignmenty1}-{$assignmentm1}-{$assignmentd1} $time1:00 America/Chicago", "datecompleted" => "{$completedassignmenty1}-{$completedassignmentm1}-{$completedd1} $time2:00 America/Chicago"); $res = pg_insert($conn, 'assignments', $invoicearray); Hello,
I am trying to convert the Date,Month,Year, Hour:Minutes:Seconds to Timestamp and Timestamp to Date,Month,Year, Hour:Minutes:Seconds .
I ve setted the Timezone as Asia/Calcutta in the code .
The Code works well when I run in my localhost , But when I run the code in my server located in Dallas,TX,USA the data changes largely .
For example :
The Timestamp generated for 24-May-2014 00:00:00 is 1400889600 in my localhost (Chennai, India).
The Timestamp generated for 24-May-2014 00:00:00 is 1400914800 in my server (Dallas, TX, USA).
why this changes occurs even though I ve setted the timezone ?
Code:
<?php $date = new DateTime(null, new DateTimeZone('Asia/Calcutta')); $ist = ($date->getTimestamp() + $date->getOffset()); echo "<h1>Current Timestamp and Date and Time for India</h1> <b>".$ist.'</b>';echo " ";echo '<b>'.date('D, d M Y H:i:s ',$ist).'+0530</b>'; echo "<br />"; ?> <h1>Timestamp to Date and Time Converter</h1> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="number" name="timestamp_to_dt_timestamp" id="timestamp_to_dt_timestamp" /> <input type="submit" id="submit" name="submit" value="Submit" /> </form> <?php if (isset($_POST['timestamp_to_dt_timestamp'])) { $timestamp_to_dt_timestamp = $_POST['timestamp_to_dt_timestamp']; echo 'Date and Time for the Timestamp :'.$timestamp_to_dt_timestamp.' is : '.date('D, d M Y H:i:s ',$timestamp_to_dt_timestamp); } ?> <h1>Date and Time to TimeStamp Converter</h1> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> Date (no preceeding zeros): <input type="text" name="dt_to_timestamp__date" id="dt_to_timestamp__date" value="<?php echo date('j',$ist) ?>" /><br /> Month (number): <input type="text" name="dt_to_timestamp__month" id="dt_to_timestamp__month" value="<?php echo date('n',$ist) ?>" /><br /> Year : <input type="text" name="dt_to_timestamp__year" id="dt_to_timestamp__year" value="<?php echo date('Y',$ist) ?>" /><br /> Hours : <input type="text" name="dt_to_timestamp__hours" id="dt_to_timestamp__hours" value="00" /><br /> Minutes : <input type="text" name="dt_to_timestamp__mins" id="dt_to_timestamp__mins" value="00" /><br /> Seconds : <input type="text" name="dt_to_timestamp__sec" id="dt_to_timestamp__sec" value="00" /><br /> <input type="submit" id="submit" name="submit" value="Submit" /> <p>Leave the time field(s) if you don't know the exact time.</p> </form> <?php if (isset($_POST['dt_to_timestamp__date'])) { $dt_to_timestamp__date = $_POST['dt_to_timestamp__date']; } if (isset($_POST['dt_to_timestamp__month'])) { $dt_to_timestamp__month = $_POST['dt_to_timestamp__month']; } if (isset($_POST['dt_to_timestamp__year'])) { $dt_to_timestamp__year = $_POST['dt_to_timestamp__year']; } if (isset($_POST['dt_to_timestamp__hours'])) { $dt_to_timestamp__hours = $_POST['dt_to_timestamp__hours']; } if (isset($_POST['dt_to_timestamp__mins'])) { $dt_to_timestamp__mins = $_POST['dt_to_timestamp__mins']; } if (isset($_POST['dt_to_timestamp__sec'])) { $dt_to_timestamp__sec = $_POST['dt_to_timestamp__sec']; } if (isset($_POST['dt_to_timestamp__date'])) { if (isset($_POST['dt_to_timestamp__month'])) { if (isset($_POST['dt_to_timestamp__year'])) { if (isset($_POST['dt_to_timestamp__hours'])) { if (isset($_POST['dt_to_timestamp__mins'])) { if (isset($_POST['dt_to_timestamp__sec'])) { echo date(mktime($dt_to_timestamp__hours, $dt_to_timestamp__mins, $dt_to_timestamp__sec, $dt_to_timestamp__month, $dt_to_timestamp__date, $dt_to_timestamp__year)); } } } } } } ?>What I am missing ? -Thanks Can anyone please tell me how I convert DD-MM-YYY (text) to TIME (unix) thought I'd say that I have this line at the top of all my pages, just in case it means a different code. Code: [Select] date_default_timezone_set('Europe/London'); //### Set the default timezone I have a simple mysql database holding information about an image upload including its 'name' and 'date uploaded' [current_timestamp()] to a folder 'image' I then display it into a table using the php ‘foreach’ facility. I want the date to be displayed in the ‘dd/mm/yyyy’ format. not the default yyyy/mm/dd. Here is the relevant code <?php $conn = mysqli_connect("localhost", "root", "", "dbname"); $results = mysqli_query($conn, "SELECT * FROM tablename"); $image = mysqli_fetch_all($results, MYSQLI_ASSOC); ?> <?php foreach ($image as $user): ?> <td><p>NAME</p><?php echo $user['name']; ?></td> <td><p>COMMENT</p><?php echo $user['comment']; ?></td> <td><p>DATE</p><?php echo $user['date']; ?></td> What do I need to do? THANKS- Warren Code: [Select] function time_ago($timestamp) { //$months = array("Jan" => 31, "Feb" => 28, "Mar" => 31, "Apr" => 30, "May" => 31, "Jun" => 30, "Jul" => 31, "Aug" => 31, "Sept" => 30, "Oct" => 31, "Nov" => 30, "Dec" => 31); $curr_time = time(); $time_ago = $curr_time - $timestamp; if($time_ago < 60) // seconds { $ext = $time_ago . " seconds ago.."; } else { if($time_ago >= 60) // minutes { $time = floor($time_ago / 60); $seconds_remainder = $time_ago % 60; $ext = $time . " minutes " . $seconds_remainder . " seconds ago.."; if($time >= 60) // hours { $hours = floor($time / 60); $minutes = $time % 60; $ext = $hours . " hours " . $minutes . " minutes ago.."; if($hours >= 24) // days { $days = floor($hours / 24); $day_hours = $hours % 24; $ext = $days . " days " . $day_hours . " hours ago .."; } } } } return $ext; } Is there a cleaner approach to this? Code: [Select] function time_ago($timestamp) { //$months = array("Jan" => 31, "Feb" => 28, "Mar" => 31, "Apr" => 30, "May" => 31, "Jun" => 30, "Jul" => 31, "Aug" => 31, "Sept" => 30, "Oct" => 31, "Nov" => 30, "Dec" => 31); $curr_time = time(); $time_ago = $curr_time - $timestamp; if($time_ago < 60) // seconds { $ext = $time_ago . " seconds ago.."; } else { if($time_ago >= 60) // minutes { $time = floor($time_ago / 60); $seconds_remainder = $time_ago % 60; $ext = $time . " minutes " . $seconds_remainder . " seconds ago.."; if($time >= 60) // hours { $hours = floor($time / 60); $minutes = $time % 60; $ext = $hours . " hours " . $minutes . " minutes ago.."; if($hours >= 24) // days { $days = floor($hours / 24); $day_hours = $hours % 24; $ext = $days . " days " . $day_hours . " hours ago .."; } } } } return $ext; } It seems to work fine (was going to tackle Months but haven't done it yet), but anyway is there a better way to do this? I'm guessing there is as I wrote this up rather fast and I'm not that great with date math. Any suggestions are appreciated (besides maybe using ternaries which I'm working on atm).
Hello All, function convertTimeFormat($time12Hour) { // Initialized required variable to an empty string. $time24Hour = ""; // Used explode() function to break the string into an array and stored its value in $Split variable. $Split = explode(":",$time12Hour); // print_r(explode (":", $time12Hour)); => Array ( [0] => 09 [1] => 50 [2] => 08AM ) // Retrieved only "hour" from the array and stored in $Hour variable. $Hour = $Split[0]; $Split[2] = substr($Split[2],0,2); // Used stripos() function to find the position of the first occurrence of a string inside another string. if($Hour == '12' && strpos($time12Hour,"AM")!== FALSE) { // Code here } elseif(strpos($time12Hour,"PM")!== FALSE && $Hour != "12") { // code here } return $time24Hour; } $time12Hour = "09:50:08AM"; $result = convertTimeFormat($time12Hour); print_r($result); /* Input : "09:50:08AM"; Output : "21:50:08PM"; */
Hi all, I am currently making a website that has e-custom functions and a back end for the client. I want them to be able to upload images - but they need to be transparent. I do not want to leave this in the hands of the client, so I am looking at ways of using the GD library to make the change I got no issue with the png/gif type for upload/resize function since this type already transparent background but my major problems is how to deal with jpeg/jpg image type which is their background was not a transparent...so is it possible I can change/ convert to png/gif type upon successful of uploading image...so the new final image will be png/gif type with transparent background...is it doable...I am not even sure it is possible...? Thanks for any help.. Quote Strict Standards: DateTime::__construct() [datetime.--construct]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/elliottw/public_html/login/inc/conn.inc.php on line 45 And the code I am using is: $timezone = new DateTimeZone("Europe/London"); $date = new DateTime(); $date->setTimezone($timezone); $dateTime = $date->format('H:i:s d/m/Y'); $sqlDateTime = $date->format('Y-m-d H:i:s'); I've come to the end of my tether. I can't see anything wrong with this, searched Google and I'm starting to go crazy (partly due to the Caffeine and staring at code for 4 hours). Any help would be greatly appreciated! Cheers. I just upgraded from 5.2.x to 5.3.3 this morning, and am now confronted with the "infamous" Code: [Select] It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\Inetpub\wwwroot\ATSTest\sys\class\class.calendar.inc.php on line 98 Previously I just let php pull the system time to keep everything accurate with DST. Now that I'm having to use the date.timezone setting in php.ini, how can I tell it to factor in DST, or do I now have to manually perform a calculation in my methods/functions to check and adjust? Or does it automagically recognize the DST by setting it to Code: [Select] date.timezone = America/New_York (yeah, right...what are the odds of *that*? I am in need of a script that can detect a visitors timezone with out using geoip and with out the user providing the information. Any help on this or references would be greatly appreciated. hey im writing a page that does the timezones for 5:00 around the world and i found this template the only thing is it didnt include the timezone.php file the js is loading this new Ajax('timezone.php?tz='+String(timezone),{onComplete:tzCLB, method: 'get'}).request(); what it does is retrieves a list of countries from that file i think. How and what would i need to do to make a timezone.php that would get the countries. Thanks How would I change the current timezone used within a php script? The method I usually use, date_default_timezone_set() is undefined on my webhost, so I am trying to find another way. instead of js alert displaying the timezone offset, i would like the content of get_time_zone_offset() to be used as a php variable.
<script type="text/javascript"> function get_time_zone_offset( ) { var current_date = new Date(); return -current_date.getTimezoneOffset() / 60; } alert("The local time zone is: GMT " + get_time_zone_offset()); </script> Hi, I am trying to get the date and time that a particular table was last updated, which the code below does, but it doesn't seem to be putting it in the correct timezone, it is 5 hours behind, anyone know why this is? or how i can fix it? Thanks Code: [Select] <?php date_default_timezone_set('Europe/London'); $query = "SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'tffdb' AND TABLE_NAME = 'test_team_points'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); echo $row['UPDATE_TIME']; ?> Developing apps is great until I have to start dealing with blasted timezones. For some reason this aspect of it always does my head in. At the moment I'm storing all dates in the DB as GMT with the format Y-m-d H:i:s. I figure it's good to be consistent and store dates in GMT then convert to the users desired timezone. So I allow users to choose there timezone, based off the defined PHP timezones that can be used with the DateTimeZone class. My problem, however, arises with the whole syncing of times. Let's say I post something right now. The date gets stored in in the database as: 2012-04-14 02:35:49 Now I'm in GMT +10 (possibly the greatest of timezones ), so I've set my timezone in my settings as Australia/Melbourne and when displaying date/times locally I do something like this: Code: [Select] public static function local($user, $date, $format = 'F j, Y, h:ia') { $date = new DateTime($date); return $date->setTimezone(new DateTimeZone($user->timezone))->format($format); } So running the stored date above through my method gives me a date like this: April 14, 2012, 12:35pm Awesome. My question is: I noticed that on say, Twitter, when you change your timezone your tweet dates don't change. They remain as the date/time of my actual timezone, regardless of what I set it too. With my implementation however, if I change my timezone to GMT +12 (Fiji) my post is now posted at: April 14, 2012, 02:35pm So is what I'm doing right? My head has about had it. Thanks. I have a Xampp Timezone Error Error Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\Users\cory j\Desktop\xampp\htdocs\NoXIp\Toplist\inc\vote.php on line 56 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' NOW())' at line 1 Line 56 $diffrence = time() - strtotime($getDate['lastVoteDate']); The Date Function in Php.ini [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = "America/New_York" date.timezone = "America/New_York" ; http://php.net/date.default-latitude ;date.default_latitude = 31.7667 ; http://php.net/date.default-longitude ;date.default_longitude = 35.2333 ; http://php.net/date.sunrise-zenith ;date.sunrise_zenith = 90.583333 ; http://php.net/date.sunset-zenith ;date.sunset_zenith = 90.583333 Hi all I've got an issue with time zones for displaying information. I'm hoping someone might know of a guide that would cover the following. I'm struggling to find one! Basically I have many online events to list in many different timezones. Users may wish to use their time zone to display information in. What I would like to do is store a timestamp and timezone for each event, then will need (I think!) to convert all to a single timezone in order to list them chronologically. From that I would then convert them into the user's desired timezone and display to the page. The idea to is avoid changes in time throughout the year, so it does it all automatically. Any links, tips, words of advice very gratefully received! Hi,
Please help to resolve this script.
Default time zone is not working properly it shows time only in AM (PM is not working) and in the INDIAN time 7:00pm to 7:00am table never fetch any content.
<div class="cart"> <table width="100%" height="100%" cellspacing="0" cellpadding="10"> <tbody> <tr style="margin: 5px; padding-bottom: 5px; background-color:#ececec; line-height:30px"> <td style="width: 10%;"> <span> Sr. No. </span> </td> <td style="width: 15%;"> <span> Order Id </span> </td> <td style="width: 35%;"> <span> Order Date / Time </span> </td> <td style="width: 10%;"> <span> Amount </span> </td> <td style="width: 35%;"> <span> Coupon Name </span> </td> <td style="width: 10%;"> <span> Action </span> </td> </tr> <tr> <td colspan="5" height="10"></td> </tr> <?php date_default_timezone_set("Asia/Dili"); $session_user_id = $_SESSION['userId']; $ordercount=1; $current_date = date('Y-m-d'); $order_id = $_SESSION['new_order_id']; $query = "select * from cs_order where order_id = '$order_id'"; if(!($result = mysql_query($query))) { echo $query.mysql_error(); exit; } $order_items = mysql_fetch_array($result); $order_transaction_id = $order_items['order_transaction_id']; $order_transaction_date = $order_items['order_transaction_date']; $order_currency_id = explode(", ", $order_items['order_currency_id']); $order_amount = $order_items['order_amount']; $order_coupon_id = explode(", ", $order_items['order_coupon_id']); $new_order_currency_id = $order_currency_id[0]; if(strtotime(date('Y-m-d', strtotime($order_transaction_date)))==strtotime($current_date)) { ?> <tr> <td style="width: 10%;"> <span> <?=$ordercount; ?> </span> </td> <td style="width: 10%;"> <span> <?=$order_transaction_id; ?> </span> </td> <td style="width: 25%;"> <span> <?=date('d M Y / h:i a', strtotime($order_transaction_date)); ?> </span> </td> <td style="width: 10%;"> <span> <?=$new_order_currency_id; ?> <?=$order_amount; ?> </span> </td> <td style="width: 25%;"> <span> <?php $user_id = $_SESSION['userId']; $current_date = date('Y-m-d'); $order_id = $_SESSION['new_order_id']; $query = "select * from cs_order as ord left join cs_countries as country on ord.order_country = country.country_id left join cs_states as state on ord.order_state = state. state_id left join cs_cities as city on ord.order_city = city. city_id where ord.order_id = '$order_id' and ord.order_user_id = '$user_id' and ord.order_transaction_date like '$current_date %:%:%'"; if(!($result = mysql_query($query))) { echo $query.mysql_error(); exit; } $total_invoice_amount = 0; while($invoice = mysql_fetch_assoc($result)) { $invoice_record[] = $invoice; } ?> <?php echo $invoice_record[0]['order_coupon_name']; ?> </span> </td> <td style="width: 15%;" align="center"> <span> <form action="" method="post" name="formGetcode"> <?php foreach($order_coupon_id as $coup_id) { $checkout_couponid = $coup_id['order_coupon_id']; $checkoutquery = "select * from cs_coupons as coup left join cs_company as comp on coup.coupons_store = comp.retailer_id where coup.coupons_id = '$checkout_couponid'"; if(!($checkoutresult = mysql_query($checkoutquery))) { echo $checkoutquery.mysql_error(); exit; } $coupon = mysql_fetch_array($checkoutresult); $checkout_couponurl = $coupon['coupons_website']; $coup_type = $coupon['coupons_type']; ?> <?php if($coup_type=='R') { ?> <button class="submit button" type="button" onclick="getCodePopup(<?=$checkout_couponid; ?>, '<?=$checkout_couponurl; ?>');" style="font-size:11px;width:86px;">Get Code</button> <?php } else { ?> <button class="submit button" type="button" onclick="getPrintPopup(<?=$checkout_couponid; ?>);" style="font-size:11px;width:86px;">Print Coupon</button> <?php } } ?> </form> </span> </td> </tr> <?php $ordercount++; } ?> <tr> <td colspan="5" height="20"></td> </tr> </tbody> </table> </div> </div><!--cart container close here--> And <script type="text/javascript"> function getCodePopup(str1, str2) { var cid = str1; var curl = str2; window.open('getcouponcode.php?id=' +cid, 'open_window', ' width=540, height=480, left=0, top=0'); window.open(curl,'_blank'); } function getPrintPopup(str1) { var cid = str1; window.open('printCoupon.php?id=' +cid, 'open_window1', ' width=640, height=320, left=0, top=0'); } </script>Pop Up code not fetching Coupon ID after number 9. Please help me to solve this. Thanks. Paresh Edited by mac_gyver, 13 June 2014 - 03:09 AM. code tags please Ok well i have a virtual world, my friendcoded the emulator. In PHP but he's on holiday for 2 weeks. I keep getting Quote PHP Warning: PHP Startup: It is not safe to rely on the system's timezone setti ngs. You are *required* to use the date.timezone setting or the date_default_tim ezone_set() function. In case you used any of those methods and you are still ge tting this warning, you most likely misspelled the timezone identifier. We selec ted 'Europe/London' for '0.0/no DST' instead in Unknown on line 0 PHP Warning: eval(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone _set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ' Europe/London' for '0.0/no DST' instead in C:\inetpub\wwwroot\main\server\chapat iz.php(2) : eval()'d code on line 4 But there are only 4 lines in chapatiz.php and it has nothing to do with it i think Quote <?php eval(file_get_contents('serv_original.ini')); ?> Here's chapatiz.php (Its attached since its big) Quote //config $socketurl = "munizonline.co.uk; $httpurl = "munizonine.co.uk; $rootPath = "c:/inetpub/wwwroot/"; // SQL SETTINGS $host = 'localhost'; $user = 'root'; $dbname = 'chapatiz'; $password = '---'; $sqli = new mysqli("p:". $host, $user, $password, $dbname); // create a persistant sql connexion (keepAlive) $banned_ips = array(); ///// ADD BAN BY IP FROM HTACCESS $filename = $rootPath.".htaccess"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); $contents = utf8_decode($contents); $ex = explode("\n", $contents); $exf = array(); foreach ($ex AS $k => $str) { if(preg_match('`deny from (.*?) \#`', $str, $sortie)) { $return = $sortie[1]; array_push($exf, $return); } } foreach ($exf AS $k => $str) { array_push($banned_ips, $str); } // LOG ALL ACTIONS function dolog($text) { $myFile = "c:/inetpub/wwwroot/main/log/chat.txt"; $fh = fopen($myFile, 'a'); fwrite($fh, $text. "\n"); fclose($fh); } function serve($r) { return file_get_contents('C:/inetpub/wwwroot/main/server/serve/'. $r. '.php'); } function getitems($name) { return file_get_contents('http://munizonline.co.uk/main/items.php?u='. $name); } function haveitem($name, $item) { $c = file_get_contents('http://munizonline.co.uk/main/items.php?u='. $name); $pattern = '/"'. $item .'"/'; $pattern2 = '/"0'. $item .'"/'; if ((preg_match($pattern, $c)) OR (preg_match($pattern2, $c))) { return true; } else { return false; } } function dotag($tag) { $tag = explode('##', $tag); $tags = array(); foreach ($tag AS $k => $v) { list($name, $value) = explode('=', $v); $tags[$name] = $value; } return $tags; } function updatetag($tags, $tochange, $value) { $tags[$tochange] = $value; $new = "##"; foreach ($tags AS $k => $v) { $new .= $k. "=". $v. '##'; } return $new; } ini_set('display_errors', '1'); error_reporting(0); $quete8 = $sqli->query('UPDATE phpbb_users SET online = 0'); function cmd() { return false; } $modee = false; session_start(); $_SESSION['start'] = "yess"; $mainsock = socket_create(AF_INET, SOCK_STREAM, 0); //modifiez la prochaine ligne si besoin $pport = rand(81, 8000); while (!socket_bind($mainsock, $socketurl, $pport)) { $pport = rand(81, 8000); echo "\n port modified to ". $pport. "\n"; } $myFile = $rootPath."main/server/socket.php"; $fh = fopen($myFile, 'w+') or die("can't open file"); fwrite($fh, $socketurl. ":". $pport); fclose($fh); socket_set_nonblock($mainsock); socket_listen($mainsock); $clients=Array(); $compteur=0; $write = NULL; $except = NULL; $lol = NULL; $race = "0"; $flag = "0"; date_default_timezone_set('Europe/London'); $ok_marry = "0"; $ok_pv = "0"; function random($car) { $string = ""; return $string; } function random3($car3) { $string3 = ""; return $string3; } function random2($car2) { $string2 = ""; return $string2; } function random1($car1) { $string1 = ""; return $string1; } echo("Waiting for players!\n"); $file = file_get_contents($rootPath.'main/server/server_while.php'); $lasteval = time(); while(true){ if ($lasteval <= strtotime('-1 minute')) { if (file_exists($rootPath."main/server/server_while.php")) { $file = file_get_contents($rootPath.'main/server/server_while.php'); } $lasteval = time(); echo "\neval again\n\n"; } eval($file); } I have no clue whats wrong it use to work. |