[PHP] redirect http to https

2007-04-09 Thread Ben Liu
What's the prescribed method for redirecting a user forcibly to from the non-SSL secured version of a page to the SSL-secured version? Is this handled at the web server level or at the script level. I found this by googling: ?php if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS']

Re: [PHP] redirect http to https

2007-04-09 Thread Ben Liu
On 4/9/07, Martin Marques martin@bugs.unl.edu.ar wrote: This should be done with the rewrite instruction of apache, or what ever instructionyour web server has. Um...guess I will have to check with our hosting company about this. Thanks. - Ben -- PHP General Mailing List

Re: [PHP] redirect http to https

2007-04-09 Thread Ben Liu
On 4/9/07, Peter Lauri [EMAIL PROTECTED] wrote: You might be able to do this by putting an .htaccess file in your webroot of non-ssl: -- RewriteEngine On RewriteRule ^/(.*)$ https://www.yourdomain.com/$1 [L] -- This appears to work: RewriteEngine On RewriteCond %{SERVER_PORT}

[PHP] open source zip code geographical drill down

2006-11-03 Thread Ben Liu
I'm trying to build some functionality commonly seen on the web where a user enters a zip code and they are provided with a listing of business or entity locations sorted by geographical distance. I've got a client with a distributor network and I need to create something like this for them. They

Re: [PHP] creating a threaded message system--sorting messages

2006-06-30 Thread Ben Liu
On Jun 30, 2006, at 12:05 AM, Larry Garfield wrote: I've written such a system before more than once. You do the sorting in SQL, and then traverse the data recursively in PHP to build the tree. It's a single SQL query. Check the archives for this list for about 3-4 weeks ago, I

Re: [PHP] creating a threaded message system--sorting messages

2006-06-30 Thread Ben Liu
Hi Larry, Thanks for the help. I was just coming to a similar conclusion last night after reading the warnings on this thread about querying the database recursively. I guess my test data with 7 posts is not a rigorous simulation. :-) I've looked through the posts on the PHP general list

Re: Re: [PHP] Re: creating a threaded message system--sorting messages

2006-06-30 Thread Ben Liu
Thanks to everybody who posted on this thread. I wanted to post back the solution I came up with after removing the DB query from the recursion. In case anyone else is trying to accomplish the same thing, this is how I solved it (criticisms welcome, and note that I have not tested it extensively

Re: Re: [PHP] Re: creating a threaded message system--sorting messages

2006-06-30 Thread Ben Liu
On 6/30/06, Adam Zey [EMAIL PROTECTED] wrote: I think that will work, but there is one huge improvement you can make. You are making millions of copies of your work array! Not only do you pass the entire array by value recursively, but foreach makes copies of the arrays it loops through! So who

Re: [PHP] Re: creating a threaded message system--sorting messages

2006-06-30 Thread Ben Liu
On Jun 30, 2006, at 5:04 PM, Adam Zey wrote: I mean, do this: foreach ( array_keys($workArr) as $key ) { echo $workArr[$key]['foo']; } instead of this: foreach ( $workArr as $key = $value ) { echo $value['foo']; } Okay, I think I get the idea. So using my code example...

[PHP] creating a threaded message system--sorting messages

2006-06-29 Thread Ben Liu
This question might deviate from PHP into the domain of MySQL but I thought best to post here first. I'm building a message board system with PHP/MySQL. I'm trying to present the messages to the users in threaded order rather than flat. I'm having a lot of trouble figuring out how to sort the

[PHP] Re: Re: creating a threaded message system--sorting messages

2006-06-29 Thread Ben Liu
On 6/29/06, Adam Zey [EMAIL PROTECTED] wrote: Just throwing an idea out there, but you can do the sorting entirely in the SQL query. The trick is to figure out the best way. The first idea that came to mind (and it sucks, but it works), is a text field with padded numbers separated by dots,

[PHP] Re: Re: creating a threaded message system--sorting messages

2006-06-29 Thread Ben Liu
SOLVED, almost. I read the article suggested by K.Bear and found the recommended solution to be a bit more complicated than I wanted to implement. I then found another way to do this using the existing Adjacency List Model through a recursive function. So basically, you query the database for the

[PHP] shutting down a web app for maintenance

2006-06-20 Thread Ben Liu
Hello All, I'm not sure this is strictly a PHP related question or perhaps a server admin question as well. What do you do when you are trying to shutdown a web application for maintenance (like a membership or registration-required system)? I understand that you can temporarily upload or

Re: [PHP] shutting down a web app for maintenance

2006-06-20 Thread Ben Liu
maintenance.php could contain something like: htmlheadtitleDown for Maintenance/title/headbodySite down for maintenance!/body/html ?php exit(0); ? (Or, to be sure, you could do both.) jon Ben Liu wrote: Hello All, I'm not sure this is strictly a PHP related question or perhaps a server admin question

[PHP] Re: shutting down a web app for maintenance

2006-06-20 Thread Ben Liu
/20/06, Adam Zey [EMAIL PROTECTED] wrote: Ben Liu wrote: Hello All, I'm not sure this is strictly a PHP related question or perhaps a server admin question as well. What do you do when you are trying to shutdown a web application for maintenance (like a membership or registration-required

[PHP] Re: shutting down a web app for maintenance

2006-06-20 Thread Ben Liu
the ramifications of having open sessions alive through the maintenance period and afterward might be so I thought it best to just kill them. It doesn't sound like anything horrible can happen except some inconvenience maybe. Regards, Adam Ben Liu wrote: Thanks Adam, What you say makes good sense to me

Re: [PHP] Re: order of elements in $_POST super global

2006-06-10 Thread Ben Liu
, June 8, 2006 10:20 am, Ben Liu wrote: I probably should add some more details to my question: The names of the form checkboxes could be changed from ie: bool_careers, bool_speaking, bool_internship, etc. to a single array bool_questions[], for instance. The problem with that is that I am using

Re: [PHP] Re: order of elements in $_POST super global

2006-06-09 Thread Ben Liu
Hi Mike, Thanks for pointing that out. I hadn't thought of it but you are right. But I still don't think this addresses the issue of ordering. The basic problem is that the way a $_POST variable gets processed is in the order it is in on the original form. If you want to present the fields in

[PHP] Re: order of elements in $_POST super global

2006-06-09 Thread Ben Liu
version 5.12.there was a bug, if you want that PHP makes an associative array of form elements. http://bugs.php.net/bug.php?id=37276 Enjoy Mindaugas On 6/9/06, Ben Liu [EMAIL PROTECTED] wrote: Hi Mike, Thanks for pointing that out. I hadn't thought of it but you are right. But I still don't think

[PHP] order of elements in $_POST super global

2006-06-08 Thread Ben Liu
Hello All, I'm using a form (method=POST) to collect 30 boolean values from the end user using a series of checkboxes in the form. The form is arranged in a table so that the 30 check boxes are not a long list but rather three columns (with related items columnized). The problem is when I

Re: [PHP] order of elements in $_POST super global

2006-06-08 Thread Ben Liu
also, so having the loop allows for some future-proofing. - Ben On 6/8/06, Dave Goodchild [EMAIL PROTECTED] wrote: On 08/06/06, Ben Liu [EMAIL PROTECTED] wrote: You can access the values in the $_POST array in any order, so if you know the checkbox names why not output them in the order you

[PHP] Re: order of elements in $_POST super global

2006-06-08 Thread Ben Liu
I probably should add some more details to my question: The names of the form checkboxes could be changed from ie: bool_careers, bool_speaking, bool_internship, etc. to a single array bool_questions[], for instance. The problem with that is that I am using the form checkbox names later to

[PHP] Re: order of elements in $_POST super global

2006-06-08 Thread Ben Liu
Also, I need to re-order the elements in a custom manner, not simply alphabetical or reverse alphabetical or some logical way like that, more like how the original form is presented, by related fields. More specifically, the form is for a membership system, the system collects typical demographic

Re: [PHP] order of elements in $_POST super global

2006-06-08 Thread Ben Liu
Der...of course. Thanks Ron! I knew the answer was simple. :-) -Ben On 6/8/06, Ron Clark [EMAIL PROTECTED] wrote: why not create an array with the keys in the order you want ( $array= array(value1,value2,). Then loop through the array and use the values as keys to the $_POST variable and

Re: [PHP] Re: order of elements in $_POST super global

2006-06-08 Thread Ben Liu
Hello João, You are right that the $_POST variable does not receive anything for unchecked boxes. I didn't realize that. But I still need the foreach loop for other reasons: So it looks like this: foreach ($_POST as $key = $data) { $query.=$key, ; } Instead of

Re: [PHP] Re: order of elements in $_POST super global

2006-06-08 Thread Ben Liu
ccc $query.=$key, ; break; } } In switch you can order by ordening the cases. Hope help. - Original Message - From: Ben Liu [EMAIL PROTECTED] To: João Cândido de Souza Neto [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Thursday, June 08, 2006 1:14 PM

Re: [PHP] reset a resource?

2006-06-08 Thread Ben Liu
sorry, mysql_data_seek() On 6/8/06, sam [EMAIL PROTECTED] wrote: After I've looped through a resource do I have to run the query again to load up 'mysql_fetch_assoc' or is there some kind of reset function I can't find? $q = SELECT * FROM table; $s = mysql_query($q, $pe) or

[PHP] better way to create custom text file from query results?

2006-06-07 Thread Ben Liu
Hello All, I've written a clunky script that presents a form to a user with 30 checkboxes on it to match 30 fields in a table. The user checks off each field they want to appear in a text file produced by the script. The script I wrote captures each checkbox response to a separate

Re: [PHP] better way to create custom text file from query results?

2006-06-07 Thread Ben Liu
I guess I was just talking the problem out. :-) Writing that post helped me think of iterating through $_POST. Now I've come to this problem: Before I did this and it works: while ([EMAIL PROTECTED]($result)) { if ($fieldname1) $output.=$row[fieldname1]\t; if ($fieldname2)

Re: [PHP] better way to create custom text file from query results?

2006-06-07 Thread Ben Liu
Nevermind, got it to work with this: while ([EMAIL PROTECTED]($result)) { foreach ($_POST as $key = $data) { if ($data) $output.=$row[$key]\t; } // foreach $_POST }// while $row Had a poorly positioned statement throwing

Re: [PHP] Session contamination?

2006-04-21 Thread Ben Liu
it may make them more difficult to find, but it does not guarantee security as Chuck points out. This is discussed at [http://php.net/manual/en/ ref.session.php] as pointed out by Jochem. - Ben On Apr 20, 2006, at 7:22 PM, Richard Lynch wrote: On Thu, April 20, 2006 1:46 pm, Ben Liu wrote

Re: [PHP] Session contamination?

2006-04-21 Thread Ben Liu
Ach, correction: Chuck is correct here. = *Richard* is correct here. No morning coffee yet, sorry. - Ben On Apr 20, 2006, at 7:22 PM, Richard Lynch wrote: On Thu, April 20, 2006 1:46 pm, Ben Liu wrote: After a bit more research, I think I understand why Jochem recommends use

Re: [PHP] Re: Session contamination?

2006-04-21 Thread Ben Liu
assume it should be outside the web space). Should I make up some random folder name (one time) and story my session data within that directory, within my own home directory? Ben Liu wrote: Hello All, I'm using a single development server to host multiple client projects, many of which require

[PHP] Session contamination?

2006-04-20 Thread Ben Liu
Hello All, I'm using a single development server to host multiple client projects, many of which require session management. I've noticed that sometimes when I test these various web apps (which are simply in separate sub directories) I get session leakage where logging in and establishing a

Re: [PHP] Session contamination?

2006-04-20 Thread Ben Liu
Thanks for the response Robin, I'm reading up on session.cookie_path now. It seems that this would require creating separate php.ini files for each application. On 4/20/06, Robin Vickery [EMAIL PROTECTED] wrote: On 20/04/06, Ben Liu [EMAIL PROTECTED] wrote: Hello All, I'm using a single

Re: [PHP] Session contamination?

2006-04-20 Thread Ben Liu
/20/06, Dave Goodchild [EMAIL PROTECTED] wrote: You can use ini_set to alter this value locally (until the script exits) in the script itself, which saves having to use a separate ini file if that is the only value you want to change. On 20/04/06, Ben Liu [EMAIL PROTECTED] wrote: Thanks

Re: [PHP] Session contamination?

2006-04-20 Thread Ben Liu
Thanks Jochem, this should give me all I need to solve this problem. -Ben On 4/20/06, Jochem Maas [EMAIL PROTECTED] wrote: Ben Liu wrote: Hi Dave, Thanks, I think the method recommended by Robin using the function ini_set() would work, but somehow I think this could be done in simpler

Re: [PHP] Session contamination?

2006-04-20 Thread Ben Liu
you get on. I have encountered the session leakage issue before also and it scared the willies out of me. On 20/04/06, Ben Liu [EMAIL PROTECTED] wrote: Hi Dave, Thanks, I think the method recommended by Robin using the function ini_set() would work, but somehow I think this could

Re: [PHP] AJAX PHP

2005-07-21 Thread Ben Liu
I've been tinkering with AJAX for a few weeks now. I've used it in a simple user registration system form. Instead of submitting a desired username and waiting for a round trip to the server to verify that the username is not already in use, I used AJAX to perform the DB query in the