heckenschutze
Members-
Posts
257 -
Joined
-
Last visited
Never
Everything posted by heckenschutze
-
If you want to search for the id: <?php $h = NULL; $cols = array(); $line = ""; if(($h = @fopen('file.txt', 'rb')) === FALSE) die('Failed to open some file'); while(($line = @fgets($h)) !== FALSE) { $cols = explode('\t', $h); /* $cols[0] is the fileid */ /* $cols[1] is the filename */ } fclose($h); ?> Search or do whatever.
-
how to prevent multiple login for single user account?
heckenschutze replied to zgkhoo's topic in PHP Coding Help
Don't do that, what if the user used a proxy server? Or several proxy servers? Some ISPs even use proxy servers, so your user would be pretty pissed off if you told them their account had been 'hacked' when they try to log in. Just chuck an extra field in your user table, 'lastAction' or something. Which stores a timestamp of their last action, if someone else tries to login in a time say greater than 'lastAction' + timeout then let them (and destroy the original session), else don't. -
Or phishy, get it phishy...
-
[SOLVED] How Would I Prevent PHP GD Cache?
heckenschutze replied to phpQuestioner's topic in PHP Coding Help
I don't see where you send the header of the content type... that it's jpeg header("Content-type: image/jpeg"); Or something -
Nothing really to fix it, $hours = diffHours(strtotime($row3['datetillcompletion']), time()); Does that work? you just need to pass 2 timestamps to diffHours. strtotime() converts a string to a timestamp. You should consider changing your database so dates/times are stored as unix timestamps, you can get the current time with time().
-
Calculating a fictional date, not working in PHP 4.4.4
heckenschutze replied to Gibbs's topic in PHP Coding Help
I've written something exactly like that in C before, it's very easy - just it's harder in PHP, being scripted etc. But try and structure it well, use an array rather than a string. -
Calculating a fictional date, not working in PHP 4.4.4
heckenschutze replied to Gibbs's topic in PHP Coding Help
I'd suggest starting again for the date/time, you seem to be making it hard on yourself. A unix timestamp the the no. of seconds after 1970. $ourTime = time(); $gameTime = array( 'year' => date('Y', $ourTime) + 2404, 'month' => date('m', $ourTime), 'day' => date('d', $ourTime)); echo 'Game year is ' . $gameTime['year']; Set it out something like that, you can change $ourTime to the start time, and just factor in how far in days, seconds, years or whatever the game time is ahead. No need to keep going back and forth. -
Calculating a fictional date, not working in PHP 4.4.4
heckenschutze replied to Gibbs's topic in PHP Coding Help
Why make it so hard on yourself? $realTime_current = mktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y")); Is the same as $realTime_current = time(); -
Calculating a fictional date, not working in PHP 4.4.4
heckenschutze replied to Gibbs's topic in PHP Coding Help
Remember that a UNIX timestamp only has precision until 2038, http://en.wikipedia.org/wiki/Year_2038_problem But you're not using a timestamp to store the year, so most likely your clock is wrong. -
Have you checked your php.ini to ensure that you're loading the mysql module?
-
> You must use require() instead of include() as the former is faster in terms of execution than the latter. No it isn't.
-
Your script will stop if config.php can't be included if you use require(), for any reason. Ie it doesn't exist or PHP doesn't have privs to read the file. include() will issue a warning if config.php cannot be included, but will continue running the script. Use require() for vital files, and include() for other non-vital things.
-
sf.net: http://sourceforge.net/projects/restaur-reserve/ Python & PostgreSQL, but it's close
-
OT: How to maintain signature in every post
heckenschutze replied to anujgarg's topic in PHP Coding Help
That's not PHP related But anywho, Profile -> Forum Profile Information, scroll down to Signature. -
Upper case a letter after a quote
heckenschutze replied to The Little Guy's topic in PHP Coding Help
Use strpos, or a simpler regex, there won't always be a space after 'bout ie: "that's all it's 'about". You'll want to match, [space][single apostrophe][a-z] -
Use spaces instead of tabs, seriously. `wp_posts`.`post_date` should be `wp_posts.post_date` or something.
-
Learn how to indent, it's very hard to read.
-
d.shankar don't be such a loser. You obviously didn't read my post, I said if you charge for your script/service you could have a problem. I don't work here for money, in fact I don't even work with PHP.