Jessica
Staff Alumni-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Jessica
-
Here's the age in many measurements. function birthdateToAge($birthdate){ $age = array(); $now = time(); $age['seconds'] = $now-$birthdate; $age['minutes'] = floor($age['seconds']/60); $age['hours'] = floor($age['minutes']/60); $age['days'] = floor($age['hours']/24); $age['years'] = floor($age['days']/365); return $age; } $age = birthdateToAge(strtotime("March 20, 1980")); print $age['years'];
-
Did you try any of the ones in the first page of results on Google? I searched for PHP Cache and there are plenty of tools.
-
Because if you used a variable, say: $check = true; And before they tried to include it, they happened to use a variable called $check, and set it true, then your script would include. They cannot change a constant, or redefine it. I posted a question about constants vs variables a few days ago, look back a few pages, it helps explain the benefits of Constants.
-
[SOLVED] Word filter [replace whole word instead of part]
Jessica replied to pocobueno1388's topic in PHP Coding Help
If you tried many different things and got the same result for every one, there might be another problem. I will write a function to do what I described, and post back momentarily. -
[SOLVED] Word filter [replace whole word instead of part]
Jessica replied to pocobueno1388's topic in PHP Coding Help
See this topic: http://www.phpfreaks.com/forums/index.php/topic,124570.0.html -
In the allowed files, define a constant. As the first lines of the include, check what the value of that constant is. If it's not the same, die. This won't work if people have access to the actual code of your include, as then they'd see what the deal was.
-
In order to do that, inside the function you must use global $foo; This is called variable scope: http://us2.php.net/manual/en/language.variables.scope.php
-
You select the first result, then try to access non existent rows in that result. You need to loop through the results using pg_fetch_array in a while loop - check the documentation page for pg_fetch_array, that will show you how to do this properly.
-
[SOLVED] echo "<td>if($row[name] == "","-",$row[name])</td>" error
Jessica replied to sayedsohail's topic in PHP Coding Help
Make an array of your fieldnames and loop. $foos = array('name', 'address', 'phone'); foreach($foos AS $bar){ if(!$row[$bar]){ $foo = '-'; }else{ $foo = $row[$bar]; } print "<td>$foo</td>"; } -
[SOLVED] echo "<td>if($row[name] == "","-",$row[name])</td>" error
Jessica replied to sayedsohail's topic in PHP Coding Help
if(!$row[name]){ $foo = '-'; }else{ $foo = $row[name]; } echo "<td>$foo</td>" -
Yeah this is seriously bad database design. Normalize your data!!
-
My husband is a security engineer for a fortune 500 company - we use McAffee on our home machines. We've never had any problems.
-
Yep, always good to check the manual before trying to write stuff like this. It's often already been done A good way to check is to search the manual for similar functions. In this case, you already knew about strtoupper - at the bottom it says "See also strtolower(), ucfirst(), ucwords() and mb_strtoupper()." It's an easy way to learn about new functions, I find great shortcuts that way all the time.
-
http://us3.php.net/ucwords
-
toggl, basecamp, there are tons already.
-
session_register is deprecated, you don't need those lines anyway. You have session_start() at the top of every page?
-
wow. You need to include the file which contains the Java class definition. There should be documentation for this program.
-
Check the stickied topic about header errors.
-
Help with using a .htaccess file, local php.ini, or other
Jessica replied to roseuz's topic in PHP Coding Help
the htaccess file goes in your root directory. You likely have a directory called html, it should go in there. -
number_format()
-
Slashes disappear after adding/getting something from mysql
Jessica replied to Nolongerused3921's topic in PHP Coding Help
The \ before a ' escapes the '. If you really want to insert the string exactly as \' you need to send \\\' into the database. One \ to escape the first \ and another \ to escape the '. Although the text in your strings shouldn't have those escaping slashes until it's about to go in the DB, not just as regular data. -
it's called Magic Quotes. You can turn it off in php.ini or use strip_slashes()
-
Don't store the Session's ID, store the values. So the user has an ID, store that in cookie and session. Rely on session all the time. Then when there is no session, check for the cookie, and check IT against the database. You shouldn't need to check the session against the database.
-
How to get my ads to show through my firewall
Jessica replied to veeraa2003's topic in PHP Coding Help
I concur. But honestly, you're not going to find a solution. As soon as people find a way to get around Adblock and other filters, they'll just update those. -
That's not what your comments in the code said. You're now saying it prints endless '1's. Did you see this note in the filesize function? Note: The results of this function are cached. See clearstatcache() for more details. Perhaps that will help.