[PHP] date() is hours behind
Hi all, I currently use: date("l jS F Y, g:i A"); To format the current date/time to my personal preference. However, at 12:19 AM on my machine, date("l jS F Y, g:i A"); shows 4:19PM... 8 hours slow :( Any ideas on how to correct this? Am I right in saying that there is a timezone problem? Any ideas appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() is hours behind
"Jon Kriek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Well I meant just > > putenv('TZ=US/Eastern'); > > But you get the idea. > > -- > Jon Kriek > http://phpfreaks.com > > "Jon Kriek" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > See the putenv() function. For example to get the correct Eastern Standard > > Time > > > > http://www.php.net/putenv > > > > > putenv('TZ=US/Eastern'); > > echo 'Last modified: ' . date('d/m/y H:i', getlastmod()); > > ?> > > > > -- > > Jon Kriek > > http://phpfreaks.com > > > > "Php Webmaster" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Hi all, > > > > > > I currently use: > > > > > > date("l jS F Y, g:i A"); > > > > > > To format the current date/time to my personal preference. > > > > > > However, at 12:19 AM on my machine, date("l jS F Y, g:i A"); shows > > 4:19PM... > > > 8 hours slow :( > > > > > > Any ideas on how to correct this? Am I right in saying that there is a > > > timezone problem? > > > > > > Any ideas appreciated. I'm in London and and my timezone is GMT, so what should I use? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() is hours behind
"Jon Kriek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > putenv('TZ=Europe/London'); > > OR > > putenv('TZ=GMT'); > > -- > Jon Kriek > http://phpfreaks.com > > "Php Webmaster" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I'm in London and and my timezone is GMT, so what should I use? OK, using the putenv code you posted, I now have: Which displays: Wednesday 1st October 2003, 1:19 AM, BST The time and date is correct (thankgod!) but how comes the time zone is BST (?) and not GMT? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: method to prevent multiple logons of same account
"Chris W. Parker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi. Ok I've got the logging in of customer accounts settled but what I need to work into the system is that of preventing more than one instance of the same account. If I logon right now as testuser1 on ComputerA and then go to ComputerB and login as testuser1 it'll work just fine. What I want to do is one of the following: (a) prevent the second instance of testuser1 from succeeding, (b) logoff the first instance of testuser1 when the second instance authenticates. I know I'll have to keep a database and store the following: username (or user id), session id, time of login, and/or time of last action. Option A is very easy. I can easily look in the database and see if that person is already logged in. If they are found in the db I just refuse the second login attempt. Option B on the other hand seems a little more difficult. As far as I've thought it out so far I'll have to check the db on each page request to see if the user is still valid. That is to say, if the second attempt is allowed to login I would have to change the users session id from the first instance to the second instance. Then when the first instance goes to a new page the application would say "Hey wait a minute buddy! Your session id is different than the one in the database. You've either timed out or someone else has logged in with the same username." Am I thinking this through correctly? Comments? Chris. I created a Members script a while ago and to prevent multiple logins with the same username/password combination, I had a column called logged_in inside the members table which would be marked '1' when the user was logged in and '0' when the user logged out. When any user attempts to login, it checks that the logged_in column is first marked as '0'. I personally don't see anything wrong with the above method. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] method to prevent multiple logons of same account
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This has been discused several times befor and the conclusion is that > these obstructions are wrong. What if the user loses its credentials and > he is still considered loged in. He cannot log in again. If you bind the > session to a IP address then you create problems for users behind proxy > farms. Your option (b) is virtualy the same as doing nothing about it at > all. > > Chris W. Parker wrote: > > Hi. > > > > Ok I've got the logging in of customer accounts settled but what I need > > to work into the system is that of preventing more than one instance of > > the same account. > > > > If I logon right now as testuser1 on ComputerA and then go to ComputerB > > and login as testuser1 it'll work just fine. What I want to do is one of > > the following: (a) prevent the second instance of testuser1 from > > succeeding, (b) logoff the first instance of testuser1 when the second > > instance authenticates. > > > > I know I'll have to keep a database and store the following: username > > (or user id), session id, time of login, and/or time of last action. > > > > Option A is very easy. I can easily look in the database and see if that > > person is already logged in. If they are found in the db I just refuse > > the second login attempt. Option B on the other hand seems a little more > > difficult. As far as I've thought it out so far I'll have to check the > > db on each page request to see if the user is still valid. That is to > > say, if the second attempt is allowed to login I would have to change > > the users session id from the first instance to the second instance. > > Then when the first instance goes to a new page the application would > > say "Hey wait a minute buddy! Your session id is different than the one > > in the database. You've either timed out or someone else has logged in > > with the same username." > > > > > > Am I thinking this through correctly? Comments? > > > > > > > > Chris. > > This problem could be easily fixed by using a "Forgotten password" script with the membership system which logs the user out once the username/password has been sent to an e-mail address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wrapping code inside [code]xxx[/code] tags.
Hi all, I have on my site a part where users' can submit articles and no doubt their articles will contain code. Code is wrapped inside of [code] tags, i.e. [code][/code] However, there is other text in the same article, so I need to format the code inside of the [code] and [/code] tags using htmlspecialchars, nl2br and highlight_file and the rest of the code needs to be formatted with nl2br, strip_tags and possibly stripslashes/wordwrap. A typical example: --- Count number of rows inside of MySQL table [code] [/code] Save the above code into a file called count.php --- The code inside of the [code] and [/code] tags needs htmlspecialchars, nl2br, highlight_file and the outside text needs nl2br, strip_tags, stripslashes/wordwrap. Sorry for being repetitive, but just need to make sure I make sense! Any ideas appreciated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] .htaccess - Still asking for login information although already sent through address bar
Hi all, Iv'e got a .htaccess file protecting a site using HTTPS. I have tried using a form to send the login details to the site through the address bar (http://user:[EMAIL PROTECTED]) but the .htaccess password protection box still appears asking for the username and password! The only thing I can think of is me sending invalid information, but I know I'm not! Any ideas appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: .htaccess - Still asking for login information although already sent through address bar
"Php Webmaster" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > Iv'e got a .htaccess file protecting a site using HTTPS. I have tried using > a form to send the login details to the site through the address bar > (http://user:[EMAIL PROTECTED]) but the .htaccess password protection box > still appears asking for the username and password! > > The only thing I can think of is me sending invalid information, but I know > I'm not! > > Any ideas appreciated. Just a quick update. To ensure that invalid login info was not being sent, I copied the text that was in the address bar after submitting the login form, closed down IE, pasted in the text and it went straight in without any login boxes appearing ?!!? It seems to be only happening after I use a form! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess - Still asking for login information although already sent through address bar
"Mika Tuupola" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 6 Oct 2003, PHP Webmaster wrote: > > > Iv'e got a .htaccess file protecting a site using HTTPS. I have tried using > > a form to send the login details to the site through the address bar > > (http://user:[EMAIL PROTECTED]) but the .htaccess password protection box > > That does not look like https. Try changing to > > https://user:[EMAIL PROTECTED]/ > > -- > Mika Tuupola http://www.appelsiini.net/~tuupola/ Oops, sorry. I meant HTTPS. I did also check again! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess - Still asking for login information although already sent through address bar
"Nathan Taylor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Does it continuously ask or just twice? I've found a weird issue with .htaccess where if the domain name is a mask for a subdomain host and you try to access an .htaccess protected page it will prompt you for the password, redirect you to the subdomain and then prompt you again. Nathan - Original Message - From: Mika Tuupola To: PHP Webmaster Cc: [EMAIL PROTECTED] Sent: Monday, October 06, 2003 7:12 AM Subject: Re: [PHP] .htaccess - Still asking for login information although already sent through address bar On Mon, 6 Oct 2003, PHP Webmaster wrote: > Iv'e got a .htaccess file protecting a site using HTTPS. I have tried using > a form to send the login details to the site through the address bar > (http://user:[EMAIL PROTECTED]) but the .htaccess password protection box That does not look like https. Try changing to https://user:[EMAIL PROTECTED]/ -- Mika Tuupola http://www.appelsiini.net/~tuupola/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If I use my login form, the login box pops up only once. If I copy the text from the address bar (generated by the form) and paste it into the address bar (after restarting the browser) the logon box does not appear. Weird eh? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess - Still asking for login information although already sent through address bar
"Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tuesday 07 October 2003 00:32, PHP Webmaster wrote: > > > If I use my login form, the login box pops up only once. If I copy the text > > from the address bar (generated by the form) and paste it into the address > > bar (after restarting the browser) the logon box does not appear. > > Perhaps you could show some code? > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > A reverend wanted to telephone another reverend. He told the operator, > "This is a parson to parson call." > */ Sure, This is the code for the login form: (login_form.html) Control Panel Login Domain Name: Username: Password: This is the code for the login processor file: (login_process.php) Error:One or more form fields have been left blank."; echo "Please use your browsers' back button and fill in all form fields."; exit; } else { $redirect_url = "https://"; . $username . ":" . $password . "@" . $domain . ":2083/frontend/x/index.html"; header("Location: $redirect_url"); exit; } } else { header("Location: login_form.html"); exit; } ?> I know that there is no username/password validation code inside the login_process.php file, but this is not my priority at the moment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Detecting devices i.e. PDA, Mobile
"Shaun" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I have created an online system, and have created a WAP version, and am > currently crreating a PDA version. What I wuold like to to do is give out > the same URL instead of domain.com for normal use, domain.com/wap/ or > domain.com/pda/. Is there a way of detecting what device is loading the site > and redirect them accordingly? > > Thanks for your help As far as I am aware, PHP or infact even JavaScript isn't capable of doing this. Your best bet is to default redirect to a default version of the site (not the WAP or PDA version) and provide a link to the WAP and PDA versions of the site. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Search for an exact string inside of another string
Hi all, I have a little problem that I hope you can help me with. I have the following strings: $str1 = "Bob"; $str2 = "My Name Is Bob"; How can I get PHP to look for $str1 inside of $str2? Also, what about if "Bob" inside of $str2 is in different places? I would like something like: if ($str1 IS INSIDE OF $str2) { echo "str1 is inside of str2"; } else { echo "could not find str1 inside of str2"; } Any ideas appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Search for an exact string inside of another string
"Manuel VáZquez Acosta" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Try: > > if (strpos($str2, $str1) !== false) > echo "$str1 is inside $str2"; > else > echo "could not find $str1 inside $str2"; > > "Php Webmaster" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi all, > > > > I have a little problem that I hope you can help me with. > > > > I have the following strings: > > > > $str1 = "Bob"; > > $str2 = "My Name Is Bob"; > > > > How can I get PHP to look for $str1 inside of $str2? > > > > Also, what about if "Bob" inside of $str2 is in different places? > > > > I would like something like: > > > > if ($str1 IS INSIDE OF $str2) { > > echo "str1 is inside of str2"; > > } > > else { > > echo "could not find str1 inside of str2"; > > } > > > > Any ideas appreciated. Thanks! Just what I needed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session not getting destroyed !
"Binay" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yes its showing 0 only.. > > Its a weird kind of problem for me .. > > - Original Message - > From: "David Otton" <[EMAIL PROTECTED]> > To: "Binay" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Friday, October 17, 2003 4:16 PM > Subject: Re: [PHP] Session not getting destroyed ! > > > > On Fri, 17 Oct 2003 15:58:36 +0530, you wrote: > > > > >My session is not getting destroyed once i close the browser. Problem is > only in IE 5 as IE 6+ its getting destroyed. I don't know what is the > problem. I looked at the session settings parameters in php.ini file but > couldn't figure it out. > > > > > >I am using php 4.2.3 > > >and session.cookie_lifetime is set to 0 also. > > > > Are you certain cookie_lifetime is set to 0? > > > > print_r (session_get_cookie_params ()); Do you have a logout page? Something that uses session_destroy() ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using ImageGIF
"Louie Miranda" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > And here's the error > > > [Fri Oct 17 10:52:20 2003] [error] PHP Fatal error: Call to undefined > function: imagegif() in /Volumes/WWW_Root/louie/test.php on line 6 > > > > -- - > Louie Miranda > http://www.axishift.com > > > - Original Message - > From: "Louie Miranda" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, October 17, 2003 10:46 AM > Subject: [PHP] using ImageGIF > > > > Im trying to show gif images on a browser, since on my work. Not all are > > using Internet explorer on windows. One of my test shows on a Mac OS X > 10.1 > > IE 5.5 the jpeg and png files are not supported and only gif images. > > > > I tried this syntax to generate gif files.. > > > > --php code-- > > $im = ImageCreate(200, 200); > > $white = ImageColorAllocate($im, 0xFF, 0xFF, 0xFF); > > $black = ImageColorAllocate($im, 0x00, 0x00, 0x00); > > ImageFilledRectangle($im, 50, 50, 150, 150, $black); > > header("Content-Type: image/gif"); > > ImageGIF($im); > > --php code-- > > > > but the browser returns an error on the image.. > > > > ("The image http://url cannot be displayed, because it contains errors.") > > > > And how would you know that gif is supported? PNG and JPEG is shown on > > phpinfo(); > > > > > > -- - > > Louie Miranda > > http://www.axishift.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > [Fri Oct 17 10:52:20 2003] [error] PHP Fatal error: Call to undefined > function: imagegif() in /Volumes/WWW_Root/louie/test.php on line 6 That message confirms that imagegif() is not compiled into PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read a file, extract and echo some information
Hi all, I have a little dilemma on my hands that I can't seem to solve. Iv'e looked through the PHP Manual at the fread(), fgets(), fopen(), file() etc functions which I beleive are capabile of what I want to do, but I just can't seem to peice it all together. Anyway, the following code is inside of home.php: Welcome to the home page of our website. Blah, blah and more blah! And the following code is inside of index.php: As you can see, the above code will not work as the $title variable has not been set yet. So, I need a way of opening up the home.php file, extracting the line containing the $title variable and putting that information inbetween the tags. Any ideas greatly appreciated, Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read a file, extract and echo some information
"Chris W. Parker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] PHP Webmaster <mailto:[EMAIL PROTECTED]> on Monday, October 20, 2003 4:36 PM said: > As you can see, the above code will not work as the $title variable > has not been set yet. So, I need a way of opening up the home.php > file, extracting the line containing the $title variable and putting > that information inbetween the tags. In that case do it backwards: index.php: Welcome to the home page of our website.\n" ."Blah, blah and more blah!\n"; include "footer.php"; ?> header.php: footer.php: Hope this helps!! Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ The above would work OK, but in the index.php file, where I have: The required file will be changing all the time, that's why I want to set the title in the individual pages and get the main page to read that information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: the function of the "@" symbol?
"Joffrey L Leevy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all: > > I have been searching through several books to find out what the "@" > character represents. > > An example used in code: > > if (@$first == "no"). > > Could anyone please explain the function of "@" in the code? > > Thanks The @ sign prevents errors from being displayed for that particular peice of code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] verify my ISP
"John Taylor-Johnston" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How can I verify if my ISP really does have PHP on a server I am using. They say if I want PHP, I must pay an extra $15 per month. Is there somehting I can put in my .htaccess to verify and maybe do this? > > > AddType application/x-httpd-php .php .php4 .php3 .phtml .htm .html > AddType application/x-httpd-php-source .phps > For an extra $15 p/m, I would look elsewhere. A lot of cheaper places on the net. And that's not just for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php