Strange Strtotime() Behavior
I'm trying to use the strtotime() function to manage sessions. But I
get the following
<?php
print(time() . " - " . strtotime("+1 hour"));
?>
outputs:
1097380666 - 1097308800
Strange strtotime("+1 hour") produced a time stamp less than the
current time. It also never changes. In other words strtotime("+1
hour") always results in the time stamp 1097308800.
I have also tried strtotime("+1 hour", time()) with the same result
Is this correct, have I misunderstood the strtotime() function?
I'm running Gentoo with kernal 2.6.8.1, php 5.0.1, apache2
View Complete Forum Thread with Replies
Related Forum Messages:
$PHP_SELF A Strange Behavior!?
As we know $PHP_SELF is a PHP predifined variable. It handles the current file name and extension. I have a file contains commonly used functions. it's named func.php. Inside some of these functions, I use $PHP_SELF. I perform include for this file in another file called index.php.The strange behavior is, in some code area $PHP_SELF does not return any value, in other word, it does not return index.php. However, in other areas it works properly! So What's the cause of this problem? Is it bug in my PHP? I use PHP Ver 4.2.3 on Apache, and windows ME. All this from phpdev423 package.
View Replies !
Strange Behavior With PHP Over HTTPS, On IE
I have a login.php and register.php inside our httpsdocs directory, that is the root of https:// path. login.php and register.php both require_once a global.php file located inside httpdocs, the root of http://. In Firefox and IE, viewing the page certificate of https://pathtosite/login.php will show our Equifax provider. But, only on Firefox does it show the 256 bit-encryption lock icon in the status bar of the browser. For some reason this isn't showing in IE. I created a blank index.php inside of httpsdocs, and accessed it at https://pathtosite/index.php, and in IE it shows the lock icon in the status bar. Very strange. Is it because the files are referencing to global.php, which is located outside of https? I wouldn't think so... or is this just an IE issue?
View Replies !
Classes: Strange Behavior
I have a problem with code like this (PHP 5.1.4): fila A.php: ======= include(B.php); class document extends obj { ......... } file B.php: ======= $GLOBALS['x']->new we(); function __autoload($class_name) { ...here is the code to load classes... } file C.php ======= class we extends obj { private $document; function __construct() { $this->document = new document(); } } The problem is that after loading A.php into browser, PHP cannot find document class which is defined in the A.php file! The problem is even more strange - if document class doesnt extends obj class than everything is ok. (The problem exact is that __autoload special function is called when in file C.php constructor of class we try to make the document object (all other classes like obj has been already loaded). Do you have any idea what is wrong with that?
View Replies !
Strange Class OOP Behavior
Anyone ever experienced this problem. When i pass a mysql result to the constructor of a class and use that resultset inside that class the original resultset outside the class gets affected too. That is not right i think because my result inside my class is private. Is this a bug? Can someone look at my code below please: <?php require_once('includes/connect.php'); class test { private $_result; private $_record; public function __construct($result) { $this->_result = $result; } public function show() { while($this->_record = mysql_fetch_array($this->_result)) { echo $this->_record['name'].'<br />' } } } # usage # sql statement dat artikels ophaald uit cartal database $SQL = "SELECT * FROM test_table"; # uitvoeren van dit statement $RESULT = mysql_query($SQL,$conn); $t = new test($RESULT); $t->show(); // mysql_data_seek($RESULT,0);..
View Replies !
Strange Mysql_query Behavior
I have the following query: $query = "select * from $tablename where lname like '$lname' order by lname" ; Then I have: $result = mysql_query($query); The $lname is formed properly. I have an lname that is "Marshall". If the $lname is "Mar%" the select works. If the $lname is "Marsha%" it doesn't.
View Replies !
Strange PHP_SELF Behavior
I am migrating a self-made CMS app from one linux server to another and i am getting very strange PHP_SELF behavior on the new server. This app uses SEF URLs like http://domain.com/index.php/title/4/ (4 being the id) When i use PHP_SELF in all the server but the new one i get as an answer "/index.php/title/4/". When i use it on the new server, i get "/title/4/"!!!!!!! I am at a loss here. What could be triggering such a change? What parameter should i change in the new server's config? For info purposes, i'll attach the PHPInfo for both servers: the working one and the new, not working one: NOT working server: http://new.microcar.es/phpinfo.php (PHP v4.3.11, Apache 1.3) working server: http://www.microcar.es/phpinfo.php (PHP v4.3.10, Apache 2.0) Hint: You could try http://new.microcar.es/phpinfo.php/title/4/ and see the result for yourself. last info: i tried under another 1.3 server and it works well.
View Replies !
Strange Date() Behavior
we are using date() in several contexts in our development. Now we get a quie strange looking error message. Can someone tell me, where it comes from? Code:
View Replies !
$_SERVER['HTTP_REFERER'] Strange Behavior.
I'm having trouble with referring a page across my site. My php uses a switch statement to see which action to use (if any): if(!empty($action_get)) { switch ($action_get) { case 'student_unassign': header('Location: ' . ERROR_FILE . '?error_id=2'); exit; break; default: header('Location: ' . ERROR_FILE . '?error_id=2'); exit; break; } } These two cases produce different results on the error.php page (defined as a constant for ERROR_FILE) I split out the referer array: $ref = $_SERVER['HTTP_REFERER']; $ref_arr = explode("/", $ref); $ref_count = count($ref_arr); $ref_url = $ref_arr[$ref_count-1]; and use $ref_url to display the referring page. case 'student_unassign': correctly displays where it's from (students.php) default: all the values are blank. Any idea what is causing this / how to fix it? Effectively I'm trying to positively validate the $action_get variable, and if it's not 'student_unassign', then redirect to the error.php page, creating a link for the user to return to the correct ("students.php") page.
View Replies !
Strange File Upload Behavior
I was having permission problems, so I'm using a test file to make sure uploading works. upload.php successfully uploads a file to the images/bookcovers dir: <html> <form method="post" enctype="multipart/form-data" action="upload.php"> <input type="file" name="userfile"> <input type="submit" value="submit"> <input type="text" name="eh" value='meh<'> </form> <?php $source = $_FILES['userfile']['tmp_name']; $dest = 'images/bookcovers/' . $_FILES['userfile']['name']; if ( ($source != 'none') && ($source != '' )) { move_uploaded_file( $source, $dest ); } ?> </html> Now, I use the same code in another php file. The file is in the same dir as the file above, and has the same permissions. The pertinent code is: $source = $_FILES['small_image']['tmp_name']; if ( ($source != 'none') && ($source != '' )) { $dest = explode(".", $_FILES['small_image']['name']); $dest = './images/bookcovers/' . $isbn . "_small." . $dest[1]; move_uploaded_file( $source, $dest ); $smallimg = 1; chmod($dest,0644); } When I try to upload a file using the second php script, I get permission errors: Warning: move_uploaded_file(./images/bookcovers/0679728759_small.jpg): failed to open stream: No such file or directory in /home/chucknet/public_html/bookclub/addBook.php on line 120 Warning: move_uploaded_file(): Unable to move '/tmp/phpw93I5U' to './images/bookcovers/0679728759_small.jpg' in /home/chucknet/public_html/bookclub/addBook.php on line 120 I'm really at a loss as to what could be causing this. Both scripts have the same permissions and the same owner.
View Replies !
OOP Mysql Result Strange Behavior
When i pass a mysql result to the constructor of a class and use that resultset inside that class the original resultset outside the class gets affected too. That is not right i think because my result inside my class is private. Code:
View Replies !
Strange Behavior With Phpmyadmin And Innodb Tables
I recently converted all my existing MyISAM tables to InnoDB tables through phpmyadmin. I noticed some strange behavior whenever I would refresh the screen, as phpmyadmin would report different numbers for the cardinality of the primary key (i.e. one minute it would say cardinality 388, then 244 on refresh, then something else), and it would report different values for the number of rows when mousing over the table names on the left menubar. This behavior only seems to exist on tables with a "larger" number of rows, and by larger I only mean ~100 or more rows (tables with fewer rows always report the correct number of rows). Whenever I do a SELECT *, I get the correct number of rows returned, so I know they are actually there.
View Replies !
Strange Behavior When Loading MySQLi Extension On Win32
I have come to love the ease of updating PHP, since getting used to using it these past few years. Recently, however, when I upgraded from PHP 5.1 to PHP 5.2.0 and again when moving to 5.2.1, I noticed strange behavior when trying to load php_mysqli.dll. I am using Apache 2.2.3 on Windows XP Pro (32-bit). I use the php5apache2_2.dll to load PHP as an Apache module. The PHPIniDir directive in httpd.conf points to the correct directory. I also have the older php_mysql.dll extension loaded simultaneously, which works fine. However, in phpinfo(), MySQLi is nowhere to be found, and trying to use any mysqli functions or its class will yield an error saying that they're undefined. In php.ini, the extension_dir directive points to "C:php5ext". As for the environment, I have my PHP install dir in the _System_ PATH (it's been there for a long time): C:php5. When I install, I just move new release into the php5 directory, so necessary DLLs for extensions do not need to be moved, and older versions can be overwritten for newer releases. In fact, mb_string, mcrypt, GD2, cURL, php_mysql, and many other extensions load just fine. However, the only way I can get MySQLi to load correctly is by moving libmysql.dll into my C:WINDOWSsystem or C:WINDOWSsystem32 folders. I simply can't understand why the problem lies only with MySQLi. Also, when I restart Apache, there are no errors. The MySQLi extension directive in php.ini is also uncommented, by the way. :-) This has only started to happen since my past couple upgrades, so I'm not sure exactly what to make of that.
View Replies !
Strange Behavior Of Class: Lose Data On Throw Exception.
I use a class vith a vaiables. When a function throws an exception it seems to loose data: .... $c=new myclass(); try{ $a->var1=1; $a->function_throw_exception(); <--- this throws an exception ... } catche(exception $e) { $a->var1; <--- is empty ?!?! } The code is more complex but the idea is this. it is possible? what do you think?
View Replies !
Strange Session Behavior, Are Session Cookies Server Dependant
I'm having a strange problem with session variables. I am trying to access one of my site from two different systems. Sessions work fine on my system and I'm able to login but I cannot login from the other system because sessions are not working on it. On printing session ID i found out that my system keeps 1 session ID but the other systems doesn't, everytime I refresh it fetches a new session id. I have tried all browser settings but all goes in vain. Now heres the strange bit. We do have another server and we've got some sites running on it using the same session code for login. Sessions work fine for that server on both systems. Code:
View Replies !
Odd Mt_srand Behavior
Apparently seeding mt_srand with different integers can produce identical series of mt_rand results. Specifically, every pair of consecutive even and odd numbers produces the same series - see below. This is a nuisance for me. Am I doing something wrong? I'm using PHP 4.3.4 on a windows box. mt_srand(0); echo " 0 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(1); echo " 1 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(2); echo " 2 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(3); echo " 3 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(4); echo " 4 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(100000); echo " 100000 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(100001); echo " 100001 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(100002); echo " 100002 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(100003); echo " 100003 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; mt_srand(100004); echo " 100004 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd =" . mt_rand() . "<BR>"; produces 0 new rnd =1898087491 rnd =2091264893 rnd =1090025303 1 new rnd =1898087491 rnd =2091264893 rnd =1090025303 2 new rnd =1309289693 rnd =1266233749 rnd =2011030501 3 new rnd =1309289693 rnd =1266233749 rnd =2011030501 4 new rnd =265425943 rnd =110448983 rnd =1971643347 100000 new rnd =863778341 rnd =827028059 rnd =1038256368 100001 new rnd =863778341 rnd =827028059 rnd =1038256368 100002 new rnd =1020061831 rnd =477025457 rnd =1071505930 100003 new rnd =1020061831 rnd =477025457 rnd =1071505930 100004 new rnd =2050501876 rnd =406342065 rnd =79708900
View Replies !
Odd Fsockopen Behavior
Any IP address I try to open with fsockopen on a particular server seems to use another IP address instead. eg. I open a socket connection to 192.168.1.1 but the remote_addr that the other server sees is 192.168.1.255. It's as if, like I said, the IP address I supply to fsockopen is being replaced with another one. Anyway, this is breaking a script of mine. I don't think I can really do a lot in PHP to fix this but is there perhaps some way that I can detect it? Is there some command line parameter that I can pass to passthru or something that'll tell me whether or not such a thing is happening? Also, how is this even being done? Could a firewall do this? If so, I'm still not even sure how it'd be done...
View Replies !
Countinue Behavior
Is that a normal behavior of countinue? Shouldn't it skip the echo? ------------------------------------- <? for ($i=0; $i < 10; $i++) { countinue; echo "bla"; } ?> -------------------------------------
View Replies !
Odd Cookie Behavior
I'm processing a form, and on the target posting page, I'm setting cookies for the name/value pairs like this: while (list($name, $value) = each($HTTP_POST_VARS)) { if ( $value <> NULL ) { setcookie($name,$value,time()+3600*24*30*12*10); $mystring = "<input type="hidden" value="$value" name="$name"> $mystring"; } } Now after posting when I go back to my original form with the same URL path, www.mydomain.com/mypath, I can see that the cookies are there because the values appear in the fields like we'd expect. However if I put the very same form in a different directory, eg: www.mydomain.com/secondpath then the cookied values no longer appear. I knew that cookies could be domain specific, but is there a setting that makes them somehow directory specific??
View Replies !
Array Behavior
I am trying to create a dropdown menu with options pulled from a MySQL database. I count the number of entries in the database, assign that to a variable, and then insert each entry into an array. I then try to echo the HTML for each option using this loop(where $numdisplayed is the number of times the loop has run, and $quotees is the array that the options for the dropdown menu are stored in.): while($numdisplayed < $numquotees){ echo '<option value="' echo"$quotees[$numdisplayed]"; echo'">' echo"$quotees[$numdisplayed]"; echo"</option>"; $numdisplayed++; } It seems as though you can't use a variable to refer to an array key. Any alternatives?
View Replies !
Using Strtotime()
Lets say I have a variable $time = 'Apr 30 2007 7:00AM'. Is there a function that I can use or a way of using the strtotime function to see if that variable $time is between the hours of 7am and 7pm?
View Replies !
Strtotime
I am trying to compare 2 dates, so that if a post is older that 90 days the user is not allowed to edit it. i am storing the post date in mysql in datetime field (2007-04-21 10:53:07). My question is how to user strtotime function to compare the NOW() date&time with the stored one, so if greater that 90 days return true.
View Replies !
A Bug With Strtotime
Something seems to be wrong with the strtotime function in PHP5. I've created a staff resourcing database, which is used to assign staff to projects on a weekly basis. The database stores assignments against a week ending date, which is derived using: PHP Code: $week = date('Y-m-d',strtotime('Sunday')) This works fine, $week is set to the current week ending date (Sunday) using this. However, I also create $nextweek and $lastweek using: PHP Code: $nextweek = date('Y-m-d',strtotime('next sunday',strtotime($week))); $lastweek = date('Y-m-d',strtotime('last sunday',strtotime($week))); This has also been working fine, until we got to week ending Sunday 30th October. For some reason, when $week = 2005-10-30, $nextweek becomes 2005-10-05, which is a Saturday. I've tried replacing the 'next Sunday' with '+7 days', but this returns the same date. Is this a bug? Am I missing something?
View Replies !
Strtotime &
I've got a question and was hoping someone could offer some assistance. I've got this simple line in a test file. PHP Code: echo date("Y-m-d", strtotime("next Monday")); Here's my results using different versions of PHP:PHP 4.4.7: 2007-11-04PHP 5.1.2: 2007-11-05PHP 5.2.3: 2007-11-05 Todays date is November 03, 2007 (2007-11-03).
View Replies !
Strtotime()
<?php $current = date ("F", strtotime("now")); $next = date("F", strtotime("next month")); //or try "+1 month" echo $current.'...'.$next; ?>
View Replies !
Lack Of Suexec Behavior
suexec on old perl cgi processes was useful: A cgi process (run by the apache process) could create files that belonged to me. Php usually runs as an '.so' library, owned by the apache process, which is more efficient. But it means all files (even in my filesystem space) created by php/apache end up owned by apache. This is an enormous pain the butt, particularly when complicated by 'safe_mode' restrictions. Why can't the php kernel be hacked to fork a full-fledged, separate process, that uses setuid owner for certain key file system chores: perhaps only for certain newly created functions, like "mkUserOwnedDir() or openUserOwnedFile()"
View Replies !
What Is Php's Behavior When Connect To A Db?
What is php's behavior when connect to a db? I've been told that php was once a dominant web programing language. I've read a few chapters of a php book. I was wonder what's php's performance. Perl was once for a while a popular programming language for cgi. But start very process per one web visit cause serioius problem to system performance. And then FASTCGI born. I was impressed by its performance. But recently i learn to do some php program which connect a mysql db. It seems that the program run's very slow. So, I have 2 questions: 1. does the os need to fork a php interpreter for every single web request? 2. does the php connects to mysql all the time? that is does it need to connect mysql 100 times when a user request the url 100 times? If the answer if yes, i think that php's performance is unacceptable.
View Replies !
Funny Session Behavior
I am writing a foto upload site. A PHP page displays the uploades fotos an the customer can choose several things. The data of the fotos are kept in an array called bilder. I keep the data in a session. When the customer send the data the following code will be run: if (isset($sendorder_x)) { session_start(); $nachricht = $bemerkungen; session_register(nachricht); // echo "1.: "; // print_r($bilder); // The array still exists in the session file // echo "<br> 2.: "; for ($i = 1; $i <= $bildanzahl; $i++) { $formatname = "formate" . substr("00" . $i, -2); $copyname = "copy" . substr("00" . $i, -2); $bilder[$i]->format = $$formatname; $bilder[$i]->anzahl = $$copyname; } // print_r($bilder); // bilder[] exists with the changed data in the session file // echo "<br> 3.: "; $briefporto = $porto; session_register(briefporto); // session_register(bilder); // print_r($bilder); // exit(); // bilder[] exists with the changed data in the session file // echo "<br> "; header("Location: datenupdate.php"); } The page datenupdate.php starts with the fololwing code: <?php session_start(); // print_r($bilder); // exit(); // all data is in the session file, but the array bilder[] is empty now! include ("database.php"); $dbid = connect(); ..... You can read in the comments, what happens. The lines, which start with commenst, are for debugging. Has anyone an idea, what the reason for tis behavior is? BTW, I use PHP 5.1.4, Apache Server 2 on WinXP prof. SP2 And: This is no Easter Egg :-).
View Replies !
Php Equivalent To Perl's || Behavior?
one feature of perl I'm desparately missing in php is using || to assign the first non-empty value in a list to a variable. For example, # perl example 1 $a = 1; $b = 2; $c = $a || $b; print $c; # displays 1 # perl example 2 $a = 1; $b = 2; $c = $d || $b; print $c; # displays 2, since $d is empty # perl example 3 $a = 'apple' $b = 'banana' $c = 'cherry' $d = $a || $b || $c; print $d; # displays 'apple' # perl example 4 $a = '' $b = '' $c = 'cherry' $d = $a || $b || $c; print $d; # displays 'cherry' This is such a handy language construct. Is there any such php equivalent that accomplishes this? I've already written a function to do it. (Like this: $d = value($a, $b, $c). But making value() visible everywhere is something I'd rather avoid if there's something built-in to php.)
View Replies !
How To Tell If Escape Behavior Is Turned On
Is there a programmatic way in PHP (using PHP 4) to tell if the escaping apostraphes behavior is turned on when a request is submitted? What I would like to do is insert a value into my db table, but only apply escaping if PHP hasn't applied it for me ... $v = $_REQUEST['val']; if (escaping_disabled()) { $v = escape($v); } insertIntoDB($v);
View Replies !
How To Save User's Behavior
I would like to record in a session (or in any other way) some array with user's behavior. But I need to save it on my machine in the moment the user is leaving, for I don't want to do it every time page is loaded. Is there any way to realize it?
View Replies !
Confusing POST Behavior -- Doing It Twice?
I am confused about what goes on with method POST. Here is an overview of a my code, sketching it out: <?php if (isset($_POST['Submit']) && $_POST['Submit']=="Submit") { ---Do a bunch of stuff--- if (isset($_SESSION['Error'])) unset($_SESSION['Error']); if (strcmp($A, "any") { // Verify that a Zip code is numeric and is five digits If (!is_numeric($_POST($zip)) strlen($_POST($zip)) != 5) then { $_SESSION['Error'] = "an error description"; header("Location: thisSite.php:); } } } header("Location: anotherSite.php:); ?> ...... in the form description I have an <?php if (isset(($_SESSION['Error'])) echo $_SESSION['Error']; ?> (Note: The form is type POST). So here is the problem: 1 - When I start, there is no error message. 2 - I deliberately put in a bad zip code and have a value other than "any" in the A control and click to submit it. 3 - Instead of going back to thisSite.php and displaying the error message, it goes to anotherSite.php. 4 - If I then hit the back arrow on the browser, it displays with the error message on thisSite.php It seems that 1 - on the submit it goes through the logic and sets the error. 2 - It then must be going through a second time, but this time taking on the default setting of "any" for control A and so bypass the logic on the zip code and so goes to anotherSite.php.
View Replies !
Text File Behavior
I have a question about the behavior of a text file thats being written and read to. Say Im using an XML file as the database for my little application. Users come to my site and the file is read and parsed and coverted to some display in html. On another page users can add information that updates this XML file. Is there any risk in this approach? While the XML file is being written to, what is its readabililty? And vise-versa. Assuming Im using the standard read write functions for files in PHP, will the read wait for a write to finish, etc.
View Replies !
Odd Behavior Installing Extension
I've set up PHP 5.0.5.5 on an Windows 2003 system running IIS (yes yes, have I considered Apache? Unable, other factors at play). I wrote a simple test PHP that does nothing but phpinfo(), and it works great. The moment I activate mysql support, trying to execute the script results in a perpetual wait until timeout. I have read http://www.php.net/manual/en/instal....extensions.php My libmysql.dll is accessible to paths (copied to Windows as experiment to make sure. My extensions_dir is pointed at my ext dir, and if I insert gibberish into it, launching PHP gives an error, so I know PHP has found and parsed the file. The crux is that things go to heck when I uncomment extension=php_mysql.dll. Trying to run the test.php halts and goes no further. If I comment that out again, everything works fine (except, of course, for mysql).
View Replies !
Stumped By This Php Database Behavior
Consider: while ($j < $num2) { $parent_id=mysql_result($result2,$j,"parent_id"); $fam_first_name=mysql_result($result2,$j,"fam_first_name"); $fam_age=mysql_result($result2,$j,"fam_age"); echo "it is $parent_id"; echo "<tr id=$parent_id>"; echo "<td></td>"; echo "<td >$fam_first_name</td>"; echo "<td>$fam_age</td>"; echo "</tr>"; ++$j; } The line that says "it is $parent_id" will print the variable. The next parent id will skip one if it has two of the same values. I know this may not make sense, but: it is 1 it is 3 it is 3 it is 6 but the second three from above will never be in the tr id= tag. i hope this makes sens. It just doesn't print in the tag if it has two rows.
View Replies !
Wierd Login Behavior
I have a registration script that allows someon to register to my site. After the register they are taken to a login script which consists of a username and password field. Simple enough. Here's the weird thing. They can login just fine. But only once!?! The next time they try and login in it fails to execute the query. Does this sound familiar to anyone?
View Replies !
Weird Variable Behavior
I'm having an issue with some weird variable behavior. I could be overlooking something simple, but I figured I'd throw it out there since I can't seem to figure it out. I have a page that takes a variable in from GET called $pageview, it basically decides whether or not you want your results, or everyones. You load the page in view 1, your results, and if I echo $pageview at the top of the page, it displays "pageview: 1", ok all good. Code:
View Replies !
Inconsistant Cookie Behavior
The idea is that the cookie should write the referrer information on whatever page the user lands on. The include for writing the cookie is included on every page of the site and has a conditional wrapper that essentially says don't write the cookie if the cookie exists. Thus should preserve the value of the first page the user lands on so that I can retrieve the information later. Unfortunately, sometimes the page written is not the first page of landing .. but rather the last page prior to the page that requests the cookie.
View Replies !
Different Behavior Between Desktop And BlackBerry
I can't seem to figure this one out. On my site, I have a real estate listing form. One of the fields is for the user to be able to upload a picture. Now, when I access this page on my PC at home, I have no problems. The error handling and security checks work fine. Regardless of whether I input info for this picture field, the form processor works. Code:
View Replies !
Normal Behavior W/ Slashes
Before anything is inserted into my site's DB, I run addslashes() on it. When the function is used, data in the DB looks exactly like it did when it was submitted. For example, if a user enters O'Reilly in a form, it will appear as O'Reilly in the database (when viewed in phpmyadmin, at least.) This seems to negate the need for stripslashes() when displaying text from the database, as there are no slashes in the string.
View Replies !
Problem With Strtotime
I am stucked with strtotime to convert date earlier than 1970 into time. Is there any other way to convert older dates between 1900-1970 into time?
View Replies !
StrToTime () Issue
I'm using strtotime to get the timestamp for midnight. I have a statistics script for my pagecounter that displays hits since midnight. I also display the number of hours and minutes passed since midnight. $start = strtotime ('today 00:00'); $timepassed = date ('H:i', time () - $start); The weird part is at 11.30 AM it says 12 hrs and 30 minutes have passed. I tried adding GMT+1 like so: $start = strtotime ('today 00:00 GMT+1'); because I suspect the fact I'm in Holland is the reason for the miscalculation. But this format is refused by strtotime. (-1) Does anyone know a) whether this is indeed the problem, and b) how to fix it. Preferrably not alone for me here, but in suc a way anyone around the globe would have a correctly working script if they'd use mine. The php page for strtotime pointed me to a link at gnu.org where the syntax for it apparantly is listed, but I get a no such page error.
View Replies !
Strtotime And Cron
I've got a db of events which have dates attached to them which have been created using strtotime(). They don't have any time.. just the date. I've got a script which gets today's date using strtotime("today"). I use this as a comparison to find events which happen today. This works fine when I call the script from a URL, however when I called the php file from a cron job... the strtotime("today") creates values which are different each time. Are there any thoughts on what could be causing this? Firstly, I was wondering if the cron job was somehow using a different timezone to me (I'm On GMT). How do I explicitly tell php to use GMT.. .but then again.. this should matter too much, because I jsut want to date not the time! It also wouldn't account for the changing values of strtotime("today"). Just out of interest, does php4 and php5 handle strtotime("today") differently? I'm just wondering if cron is using the correct version of php?
View Replies !
Strtotime Question?
I have a string that looks like (a series of them) 1 Sep 2007 21:06:11 2 Sep 2007 13:45:31 2 Sep 2007 13:45:31 3 Sep 2007 01:40:42 and I want to go strto time on it any ideas its return -1 right now so I know somethings wrong.
View Replies !
Date Strtotime
i am trying to right a date into the mysql database but when i get the date from the html form and do strtotime on it it goes to an invalid date (by this i mean it is not the date i entered in the html form so for example 22-06-2007 changes to 28-11-2027).
View Replies !
Remove 0 From Strtotime?
Like every other blog in the world, I have mine displaying the date and time of each entry. Right now this is what I'm using: echo date('h:ia', strtotime($r[date])); My latest entry's time is displayed as 07:56pm. How do I remove the 0 when the hour is a single digit?
View Replies !
Strtotime(date('m/d/Y'))
does the following code give the correct time:?strtotime(date('m/d/Y')) or do I need to use : strtotime(date('d/m/Y'))? I tried to find out which way the month and day work, but can't seem to find anything that will tell me.
View Replies !
Strtotime() Pre-1970
if I code $birth = strtotime(Ƈ April 1950'); then $birth = -1, I guess that this is because time "began" on 1st Jan, 1970. (although I seem to remember a few good times before that). So, what's the easiest way to find out how many days old I am (exactly, please, not just taking 1 April 1970 and adding 20 *365, which does not account for leap years?
View Replies !
Strtotime Failure
I don't know how I should input date + time into a strtotime function (i'm a total noob) so I tested this: <? $d=01; $M=01; $y=1970; $h=01; $m=01; $s=01; echo "$d $M $y $h:$m:$s"; echo strtotime("$d $M $y $h:$m:$s"); ?> I get as echo strtotime '-1', wich means the strtotime has a failure. Can anybody explain me why? Or can anybody tell me how I can make a strtotime function that puts a timestamp in the database depending on the date and time inserted in a textbox? (one textbox or one textbox to insert the day, another to insert the year,...) I should be able to change a format like (for example) this : 01-02-1990 00:00:00 (midnight) into a timestamp. so dd-mm-yyyy hh:mm:ss (or something else just to make it work)I'm clueless.
View Replies !
|