[PHP] quickie survey
I am doing a site where some of the pages will show various hours of some businesses. To make life easier for searching for open businesses PER DAY, I have pretty much decided to make an arbitrary dat-to-day boundary, instead of the usual midnight boundary. Some businesses that this applies to are bars, restaurants, dances, and even the hours of regular blue collar jobs for factories that have 24/7 operation. My survey is, what hour would you pick if you were to do that? Examples might be any time after midnight (none before). I could make each listing have it's own variable day-to-day boundary, but I'd prefer to have one site wide boundary. 1AM through 6AM for examples. Even hours. Send me your vote, and I will summarize it and post it to the list. This might be useful information for design work by others on this site. I've heard a lot of other php coders working on similar projects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quickie - manipulating strings
Hi, I need to manipulate a string to insert a space 3 characters from the right end. eg: turn 'ng23fgh' into 'ng23 fgh', or 'hfdgskfjgh23kj' into 'hfdgskfjgh2 3kj'. Any help gratefully received. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Quickie array question
> > foreach($newlines as $newline) { > > #how do I get the index of the array each time $newline is printed out? > > echo ??; > } foreach($newlines as $id=>$newline){ echo $id.''.$newline; } read the documentation http://us3.php.net/manual/en/control-structures.foreach.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quickie array question
foreach($newlines as $newline) { #how do I get the index of the array each time $newline is printed out? echo ??; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)
Justin French propably said: > In order to set and then check a cookie, you need to go through a > page... so you'd have to set something in the URL like ?cookieset=1 > anyway, in order to knwo you had set it, in order to check it. > > In other words, you'll need some guff in the URL, in order for it to > all work, so why not let it be the session key, and let trans_sid do > the work? > > Without trying to sound rude, "get over it" or "deal with it" :) Guess i'll have to ;) - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)
In order to set and then check a cookie, you need to go through a page... so you'd have to set something in the URL like ?cookieset=1 anyway, in order to knwo you had set it, in order to check it. In other words, you'll need some guff in the URL, in order for it to all work, so why not let it be the session key, and let trans_sid do the work? Without trying to sound rude, "get over it" or "deal with it" :) Justin on 01/10/02 8:53 PM, Daniel Alsén ([EMAIL PROTECTED]) wrote: > Aha...i got a bit confused first when i read your answer since i _know_ i > have cookies enabled. But isn´t there any other way to work around this? Can > i check if the cookie is set myself and if it is disable trans_sid with > 'ini_set('session.use_trans_sid',false);'? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)
Justin French propably said: > You'd loose session for those without cookies. The work around for > this would be to hard-code the session ID to all URLs across your > site for all pages you wish to carry a session through -- a real pain. Indeed. > It HAS TO use a session ID from the first page to the second, to be > sure that the session is being carried... on the second page, it > assesses if the cookie was set, and if so, doesn't bother rewriting > any of the URLs, else, it continues. Aha...i got a bit confused first when i read your answer since i _know_ i have cookies enabled. But isn´t there any other way to work around this? Can i check if the cookie is set myself and if it is disable trans_sid with 'ini_set('session.use_trans_sid',false);'? > Most people beg to HAVE trans_sid enabled on their server, not to > have it removed. It ensures the widest array of people can access > your site without breaking sessions, and without the need for you to > include (pass around) a session ID throughout your site via URLs. Thanks. - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)
On Tue, 1 Oct 2002 12:06:04 +0200, Daniel Alsn wrote: >To reply to myself .) > >I disabled trans_sid on the actual site by using: > >ini_set('session.use_trans_sid',false); >session_start(); > >But i still want to know what trans_sid does for me. What am i missing out >on when not using it? > >- D, loves google > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > Testing - please ignore. Sorry for any inconcenience. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trans_sid? (was: SV: [PHP] Quickie)
on 01/10/02 7:45 PM, Daniel Alsén ([EMAIL PROTECTED]) wrote: > John W. Holmes propably said: > >> Do you have a session_start() on the page? It looks like you have a >> trans_sid enabled. PHP will add that to all of your URLs >> automatically. Can you disable it in php.ini? > > Yes trans_sid is enabled and i have a session_start on the page. What is > trans_sid doing exactly? I tried looking it up in the documentation but > don't really get it IF you're using sessions, and IF the client (browser) doesn't have cookies available, PHP's trans sid re-writes the URLs on your pages to include a session ID. > What would i loose if i disabled trans_sid (or actually - tried to persuade > my webhotel to disable it). You'd loose session for those without cookies. The work around for this would be to hard-code the session ID to all URLs across your site for all pages you wish to carry a session through -- a real pain. > The strange thing is also that it only adds the session id to url:s when the > page is first loaded. After the first click it goes away. It HAS TO use a session ID from the first page to the second, to be sure that the session is being carried... on the second page, it assesses if the cookie was set, and if so, doesn't bother rewriting any of the URLs, else, it continues. Most people beg to HAVE trans_sid enabled on their server, not to have it removed. It ensures the widest array of people can access your site without breaking sessions, and without the need for you to include (pass around) a session ID throughout your site via URLs. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)
To reply to myself .) I disabled trans_sid on the actual site by using: ini_set('session.use_trans_sid',false); session_start(); But i still want to know what trans_sid does for me. What am i missing out on when not using it? - D, loves google -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trans_sid? (was: SV: [PHP] Quickie)
John W. Holmes propably said: > Do you have a session_start() on the page? It looks like you have a > trans_sid enabled. PHP will add that to all of your URLs > automatically. Can you disable it in php.ini? Yes trans_sid is enabled and i have a session_start on the page. What is trans_sid doing exactly? I tried looking it up in the documentation but don't really get it. What would i loose if i disabled trans_sid (or actually - tried to persuade my webhotel to disable it). The strange thing is also that it only adds the session id to url:s when the page is first loaded. After the first click it goes away. - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: SV: [PHP] Quickie
> Another thing - the first time the page is loaded every link on the page > gets a '?PHPSESSID=...etc...' attached to itself. But only the first time. > It dissapears after the first click i make. Do you have a session_start() on the page? It looks like you have a trans_sid enabled. PHP will add that to all of your URLs automatically. Can you disable it in php.ini? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: SV: [PHP] Quickie
Thanks guys! That did the trick. Time to study these sessions a bit more thourough it seems :) Another thing - the first time the page is loaded every link on the page gets a '?PHPSESSID=...etc...' attached to itself. But only the first time. It dissapears after the first click i make. I've never seen that before. Can i get rid of it? - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] Quickie
Your session variable overwrites the get variable, use $newlang session_start(); session_register("lang"); if(isset($newlang) $lang=$newlang; // check here for valid values if (!isset($lang)) { $lang = 'se'; } Daniel Alsén wrote: >John W. Holmes propably said: > > > >>Is register globals on or off? >> >> > >On. > >Now - without doing anything - i managed to change the value of $lang to >'en' with a link (pagesname.php?lang=en). But i can't change it back with >?lang=se. Should i get someting to eat to get my brain working? > >- D > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Quickie
> John W. Holmes propably said: > > > Is register globals on or off? > > On. > > Now - without doing anything - i managed to change the value of $lang to > 'en' with a link (pagesname.php?lang=en). But i can't change it back with > ?lang=se. Should i get someting to eat to get my brain working? Here's the problem with register globals. If you pass $lang in the url, it's a get variable. But when you call session_start, $lang is being overwritten with the $lang from the session. So you're not changing it. Try passing a $change_to_lang=en, and then If(isset($change_to_lang)) { $lang = $change_to_lang; } Hope that helps. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] Quickie
John W. Holmes propably said: > Is register globals on or off? On. Now - without doing anything - i managed to change the value of $lang to 'en' with a link (pagesname.php?lang=en). But i can't change it back with ?lang=se. Should i get someting to eat to get my brain working? - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Quickie
Is register globals on or off? ---John Holmes... > -Original Message- > From: Daniel Alsén [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 30, 2002 12:19 PM > To: php general > Subject: [PHP] Quickie > > Guys, > > i've been away for a while - enjoying a much needed vacation in lovely > Hungary and expanding my company. Now im back to bother you with easy > questions ;) > > I am doing a small site multilingual and will display different content > depending on what language the user choses. When the user comes to the > site > i want the default language to be swedish and is setting it in a session: > > session_start(); > session_register("lang"); > if (!isset($lang)) { $lang = 'se'; } > > However - i can´t change the value for $lang after that. It gets set to > 'se' > every time the page loads. Shouldn't row 3 only be executed if $lang isn't > already assigned a value? > > Regards > - D > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quickie
Guys, i've been away for a while - enjoying a much needed vacation in lovely Hungary and expanding my company. Now im back to bother you with easy questions ;) I am doing a small site multilingual and will display different content depending on what language the user choses. When the user comes to the site i want the default language to be swedish and is setting it in a session: session_start(); session_register("lang"); if (!isset($lang)) { $lang = 'se'; } However - i can´t change the value for $lang after that. It gets set to 'se' every time the page loads. Shouldn't row 3 only be executed if $lang isn't already assigned a value? Regards - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Quickie
Read chapter: LXXVIII. Session handling functions Niklas -Original Message- From: Peter [mailto:[EMAIL PROTECTED]] Sent: 22. syyskuuta 2001 8:19 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Quickie Hi, I am trying to redirect the user to another page after user authentication and using sessions. I was wondering how do you redirect to another page and then at the same use pass the session ID over to that other page. Thanks. Peter On Fri, 21 Sep 2001, [iso-8859-1] Stig-Ørjan Smelror wrote: > > If nothing is beeing sent to output on the page then use header() else > > you need to use javascript. > > > > > > Niklas > > > > > if headers are sent. > > Use header( "Location: file.php" ), as noted earlier, if no headers are sent. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Quickie
Hi, I am trying to redirect the user to another page after user authentication and using sessions. I was wondering how do you redirect to another page and then at the same use pass the session ID over to that other page. Thanks. Peter On Fri, 21 Sep 2001, [iso-8859-1] Stig-Ørjan Smelror wrote: > > If nothing is beeing sent to output on the page then use header() else > > you need to use javascript. > > > > > > Niklas > > > > > if headers are sent. > > Use header( "Location: file.php" ), as noted earlier, if no headers are sent. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Quickie
> If nothing is beeing sent to output on the page then use header() else > you need to use javascript. > > > Niklas > if headers are sent. Use header( "Location: file.php" ), as noted earlier, if no headers are sent. -- Stig-Ørjan Smelror Systemutvikler Linux Communications AS Sandakerveien 48b Box 1801 - Vika N-0123 Oslo, Norway tel. +47 22 09 28 80 fax. +47 22 09 28 81 http://www.lincom.no/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Quickie
If nothing is beeing sent to output on the page then use header() else you need to use javascript. Niklas -Original Message- From: Daniel Alsén [mailto:[EMAIL PROTECTED]] Sent: 21. syyskuuta 2001 15:51 To: php Subject: [PHP] Quickie How do i send the user on to another page at the end of the execution of a script? # Daniel Alsén| www.mindbash.com # # [EMAIL PROTECTED] | +46 704 86 14 92 # # ICQ: 63006462 | # -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Quickie
How do i send the user on to another page at the end of the execution of a script? # Daniel Alsén| www.mindbash.com # # [EMAIL PROTECTED] | +46 704 86 14 92 # # ICQ: 63006462 | # -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]