php-general Digest 8 Jul 2008 12:55:48 -0000 Issue 5557
php-general Digest 8 Jul 2008 12:55:48 - Issue 5557 Topics (messages 276421 through 276430): Re: PHP's mail(): proper way to send a 'From' header 276421 by: Chris Re: Looking for a reasonable explanation as to why $_REQUEST exists 276422 by: mike 276424 by: Daniel Brown 276426 by: Jochem Maas Re: Question before I end up writing alot of extra code... 276423 by: Chris Re: Multiple words str_shuffle 276425 by: Jochem Maas 276427 by: Jochem Maas php my admin 276428 by: Karl James Re: Session variables disappear (some of them only) 276429 by: karma Re: How to enable php-mysqli on linux 276430 by: Kapil Kapil Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- ?php $to = [EMAIL PROTECTED]; $from = [EMAIL PROTECTED]; $subject = This is a test!; $body = \tThis is a test email.\n; $body .= That is all.; $headers = From: .$from.\r\n; $headers .= Reply-To: .$from.\r\n; $headers .= X-Mailer: .basename(__FILE__).-PHP/.phpversion().\r\n; $headers .= Return-Path: .$from.\r\n; mail($to,$subject,$body,$headers,'-f'.$from); ? Note the fifth parameter passed to mail(): http://php.net/mail And also note that the 5th parameter is an email address only.. Don't do something like: ?php $from = Me [EMAIL PROTECTED]; and try to use that as the 5th parameter, it won't work. -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- On 7/7/08, Eric Butera [EMAIL PROTECTED] wrote: You asked for an explanation. I was just stating that is how I've seen some people write apps. I've also stated that isn't how I write them either. I use something along these lines: This is true. I really wanted to ask the internals folks first, to see how it came up. I mean, if there wasn't the option available, people would figure out a way to do it (probably one of the two ways I was showing before) The problem is, the cat's out of the bag now and a lot of people are just being lazy (in my mind) especially those who are used to ASP's Request.Value() which unfortunately is a lot of our developers at work. They don't have a real good background as to the difference between POST vs GET and even how the web works it seems. That's why in the library I've created for us to use, I unset() it before it's usable. Most third party software works okay too - off the top of my head we've got Pligg, WordPress, MediaWiki all using hooks into my library - a couple I did have to do a $_REQUEST = array_merge($_POST, $_GET) on, unfortunately. ---End Message--- ---BeginMessage--- On Mon, Jul 7, 2008 at 8:08 PM, mike [EMAIL PROTECTED] wrote: The problem is, the cat's out of the bag now and a lot of people are just being lazy (in my mind) especially those who are used to ASP's Request.Value() which unfortunately is a lot of our developers at work. They don't have a real good background as to the difference between POST vs GET and even how the web works it seems. Then the question isn't really why $_REQUEST exists, but rather, why do these folks have jobs? :-\ -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. ---End Message--- ---BeginMessage--- Daniel Brown schreef: On Mon, Jul 7, 2008 at 2:47 PM, mike [EMAIL PROTECTED] wrote: I don't see why if you -know- you need $_COOKIE['username'] someone would be lazy and use $_REQUEST['username'] That's the point --- it's intended as a fallback where you *don't* know the method that will be used, or if you want to be lackadaisical with your code (which, as we all know, is HIGHLY unrecommended). So if you are an application service provider (ASP) who, perhaps, runs a simple word shuffling script, with no database, email, or other externally-processed services, you may have a script like so: ?php $word = $_REQUEST['word']; echo str_shuffle($word).br /\n; ? Because, in this case, it really doesn't matter if $word is obtained via GET or POST, so you can allow external users to use your service via an HTTP POST form or a plain URL. Conversely, it can also be used as a login mechanism or other secure system, if you know what you're doing with regard to EGPCS the C allow DoS attacks on clients via XXS/etc if $_REQUEST is used. imagine setting a cookie id=CANT_USE_THIS_SITE_ANYMORE for a webshop that has urls like article.php?id=123 where article.php uses something like: $id = (int)$_REQUEST[id]; $_REQUEST is borked and should not contain ECS (of EGPCS) ... at least one should be able to exclude certain superglobals without actually making not set at
[PHP] Re: Session variables disappear (some of them only)
You're absolutely right, but the problem is not about how the SID is passed between the scripts, it is more about why some variables are written in the session file while others are not, even when these variables are created within the same script at the same time. If the SID was not correctly passed, it wouldn't find any other variables. I also wonder why this randomly happens ... I agree about the HTML/1.1 specs, I'm just a bit lazy ;) K. Shawn McKenzie a écrit : http://us.php.net/manual/en/function.header.php Note: Session ID is not passed with Location header even if session.use_trans_sid is enabled. It must by passed manually using SID constant. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: How to enable php-mysqli on linux
Hi How can we enable php-mysqli support on linux machine using yum etc., without reinstalling php again? Also how to check it - Is php-mysqli package is present or not? Thanks Kapil
Re: [PHP] Fwd: How to enable php-mysqli on linux
Kapil Kapil wrote: Hi How can we enable php-mysqli support on linux machine using yum etc., without reinstalling php again? Just install the appropriate package. Also how to check it - Is php-mysqli package is present or not? Check output from phpinfo(). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to create a slide show using PHP5
tedd wrote: At 4:37 PM -0400 7/2/08, philip wrote: Hi everyone, I want to create a slide show of photos for my web site. How is this done using php5? I am using Opensuse 10.3, Apache, PHP5. TIA for any assistance, Philip Philip: With a combination of php, html, and javascript, you can get this: http://webbytedd.com/c/fade-cycle/ The javascript is there. Cheers, tedd Oh! For a moment I thought tedd had let me down - it didn't quite work properly: the faded-out image flashed up again before being replaced by the new image. So I looked at the code and realised that the new image was a background image, which was being copied up to the foreground... and I had caching disabled (I was on my development system and hacking some annoying IE/JS problems) so the copying-up was forcing a reload from source... Not broken after all. Faith restored. All is well. -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Jul 7, 2008, at 12:46 PM, tedd wrote: At 2:51 PM +0100 7/7/08, Mayer, Jonathan wrote: Hiya all, I have coded a PHP site on an intranet which forms a MySQL query based on multiple inputs on a large form. The form results are POSTed back to itself, and query is formed, and the results are returned from the database and echoed. I am looking to set up a basic paging system (back/next, jump to page 3, etc) in order to limit results for efficiency. Jon: Here's my version of paging: http://webbytedd.com/bbb/paging/ And here's some different styles: http://webbytedd.com/ccc/pagination/ Here's an example of paging using ajax -- however, it's not as simple as the others: http://www.webbytedd.com/b1/photo-retouch/ tedd.. this is your best work so far! So maybe I'm a bit biased b/ c there's beautiful women on it. But hey, what can I say?! ~Phil Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Tue, Jul 8, 2008 at 9:29 AM, Philip Thompson [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 12:46 PM, tedd wrote: At 2:51 PM +0100 7/7/08, Mayer, Jonathan wrote: Hiya all, I have coded a PHP site on an intranet which forms a MySQL query based on multiple inputs on a large form. The form results are POSTed back to itself, and query is formed, and the results are returned from the database and echoed. I am looking to set up a basic paging system (back/next, jump to page 3, etc) in order to limit results for efficiency. Jon: Here's my version of paging: http://webbytedd.com/bbb/paging/ And here's some different styles: http://webbytedd.com/ccc/pagination/ Here's an example of paging using ajax -- however, it's not as simple as the others: http://www.webbytedd.com/b1/photo-retouch/ tedd.. this is your best work so far! So maybe I'm a bit biased b/c there's beautiful women on it. But hey, what can I say?! ~Phil Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php very nice images -- Bastien Cat, the other other white meat
Re: [PHP] Looking for a reasonable explanation as to why $_REQUEST exists
On Jul 7, 2008, at 2:19 PM, Eric Butera wrote: On Mon, Jul 7, 2008 at 2:47 PM, mike [EMAIL PROTECTED] wrote: On 7/7/08, Eric Butera [EMAIL PROTECTED] wrote: Laziness/convenience. I always get my data from the exact source I want. If someone chooses to use REQUEST it shouldn't break their application. You say it is a security risk, but not really. As long as everything is filtered/escaped properly it should be fine because you force the data to play by your rules. I'm not talking about escaping/filtering. I'm talking about variable overriding. In the past, it was $_GET['foo'] $foo register_globals fixed that. however, if your app is relying on $_SESSION['username'] or $_COOKIE['username'] or something like that, depending on the variables order, it can be overridden. I don't see why if you -know- you need $_COOKIE['username'] someone would be lazy and use $_REQUEST['username'] It winds up allowing the end user to override information themselves (again, depending on the variables order) which depending on that and how poor the code is (which to me if you're relying on $_REQUEST you've probably got some bugs and exploitable holes in there) creates a security risk. and session vars are in $_REQUEST, I tried it to sanity check myself before posting this :) Usually from what I've seen $_REQUEST is a lazy way to get an id from either a post or a get. Say you show a form and the url is page.php?id=x and then you post said page it might include a hidden form field called id so using request you don't have to worry about how to load your record back based on get or post. I'm not saying it is right, but that is how a lot of people use it. If your app is written correctly it doesn't matter what is thrown at it, it should always work. Even if a variable gets overridden it should still be forced to play with the rules of the app and work like a valid request does. I think that having a set of if statements that say something like the following is silly. if (isset($_POST['id'])) { } else if (isset($_GET['id'])) { } Try the shorter if/else... $id = isset ($_POST['id']) ? $_POST['id'] : $_GET['id']; Or, if you wish for _GET to have precedence... $id = isset ($_GET['id']) ? $_GET['id'] : $_POST['id']; Happy coding. ~Philip PS... Not a fan of _REQUEST because... well, it's longer to spell than _POST and _GET! =P The id should always be a get parameter since it is part of the request to build the state, not the state itself. So on my stuff if I need an id lookup, that is always going to be a GET. My post action will be save?id=x. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keeping POST values when paging
Yup, some good work there Tedd! In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Thanks all for your assistance, Jon. -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: 08 July 2008 15:08 To: Philip Thompson Cc: PHP-General List Subject: Re: [PHP] Keeping POST values when paging On Tue, Jul 8, 2008 at 9:29 AM, Philip Thompson [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 12:46 PM, tedd wrote: At 2:51 PM +0100 7/7/08, Mayer, Jonathan wrote: Hiya all, I have coded a PHP site on an intranet which forms a MySQL query based on multiple inputs on a large form. The form results are POSTed back to itself, and query is formed, and the results are returned from the database and echoed. I am looking to set up a basic paging system (back/next, jump to page 3, etc) in order to limit results for efficiency. Jon: Here's my version of paging: http://webbytedd.com/bbb/paging/ And here's some different styles: http://webbytedd.com/ccc/pagination/ Here's an example of paging using ajax -- however, it's not as simple as the others: http://www.webbytedd.com/b1/photo-retouch/ tedd.. this is your best work so far! So maybe I'm a bit biased b/c there's beautiful women on it. But hey, what can I say?! ~Phil Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php very nice images -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple words str_shuffle
On Mon, Jul 7, 2008 at 10:44 PM, Jochem Maas [EMAIL PROTECTED] wrote: grrr ... I rear my ugly head, briefly ... [snip!] questions on a postcard to Dan Brown, he just got married, he deserves it ;-) Welcome back, brother. Thanks for the well-wishes. I hope you and your son are doing well! -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keeping POST values when paging
On Tue, 2008-07-08 at 16:18 +0100, Mayer, Jonathan wrote: Yup, some good work there Tedd! In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Just a comment... the submit button/session technique sucks with respect to passing along links to people. I would suggest scrapping that approach and going with a GET approach (where the navigational information is present in the URL). I know my clients almost always want to be able to paste a URL into an email and have the recipient go directly to whatever they are viewing. Maybe that's not an issue for you though... yet ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2008-07-08 at 16:18 +0100, Mayer, Jonathan wrote: Yup, some good work there Tedd! In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Just a comment... the submit button/session technique sucks with respect to passing along links to people. I would suggest scrapping that approach and going with a GET approach (where the navigational information is present in the URL). I know my clients almost always want to be able to paste a URL into an email and have the recipient go directly to whatever they are viewing. Maybe that's not an issue for you though... yet ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php That isn't practical if your form has 50 fields though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote: On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings [EMAIL PROTECTED] wrote: Just a comment... the submit button/session technique sucks with respect to passing along links to people. I would suggest scrapping that approach and going with a GET approach (where the navigational information is present in the URL). I know my clients almost always want to be able to paste a URL into an email and have the recipient go directly to whatever they are viewing. Maybe that's not an issue for you though... yet ;) That isn't practical if your form has 50 fields though. I haven't been following the thread very closely... does he have 50 fields? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Tue, Jul 8, 2008 at 12:00 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote: On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings [EMAIL PROTECTED] wrote: Just a comment... the submit button/session technique sucks with respect to passing along links to people. I would suggest scrapping that approach and going with a GET approach (where the navigational information is present in the URL). I know my clients almost always want to be able to paste a URL into an email and have the recipient go directly to whatever they are viewing. Maybe that's not an issue for you though... yet ;) That isn't practical if your form has 50 fields though. I haven't been following the thread very closely... does he have 50 fields? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP I figured as much. :) He originally wrote: I have coded a PHP site on an intranet which forms a MySQL query based on multiple inputs on a large form. The form results are POSTed back to itself, and query is formed, and the results are returned from the database and echoed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keeping POST values when paging
-Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: 08 July 2008 17:01 To: Eric Butera Cc: Mayer, Jonathan; Bastien Koert; Philip Thompson; PHP-General List Subject: Re: [PHP] Keeping POST values when paging On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote: On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings [EMAIL PROTECTED] wrote: Just a comment... the submit button/session technique sucks with respect to passing along links to people. I would suggest scrapping that approach and going with a GET approach (where the navigational information is present in the URL). I know my clients almost always want to be able to paste a URL into an email and have the recipient go directly to whatever they are viewing. Maybe that's not an issue for you though... yet ;) That isn't practical if your form has 50 fields though. I haven't been following the thread very closely... does he have 50 fields? Cheers, Rob. I do have a large form - not quite 50 fields but it would create very long URLs! I take your point, however. In this situation the GET method isn't needed, as there will be a very limited number of users who will generally use the system independantly of each other, but I understand your reasoning. So, I've been lucky this time, but it's something I need to consider more carefully in the design stage of future projects. PHP programming is a small part of my job, with only hobby experience to work with, so it's only now that I'm moving on to slightly larger projects I'm beginning to see the real benefits in the design stage. With this project, I carefully worked out all the database design before coding, but didn't do enough on the use-case side of things, such as considering the need for paging to ensure system speed during a database query with lots of results. So I get to the situation where I have 1,000 lines of reasonably decent code, and I'm trying to hack in a solution for, say, paging, when it could have been easily handled if it was considered more carefully earlier. Live and learn I guess! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Tue, Jul 8, 2008 at 12:07 PM, Mayer, Jonathan [EMAIL PROTECTED] wrote: -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: 08 July 2008 17:01 To: Eric Butera Cc: Mayer, Jonathan; Bastien Koert; Philip Thompson; PHP-General List Subject: Re: [PHP] Keeping POST values when paging On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote: On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings [EMAIL PROTECTED] wrote: Just a comment... the submit button/session technique sucks with respect to passing along links to people. I would suggest scrapping that approach and going with a GET approach (where the navigational information is present in the URL). I know my clients almost always want to be able to paste a URL into an email and have the recipient go directly to whatever they are viewing. Maybe that's not an issue for you though... yet ;) That isn't practical if your form has 50 fields though. I haven't been following the thread very closely... does he have 50 fields? Cheers, Rob. I do have a large form - not quite 50 fields but it would create very long URLs! I take your point, however. In this situation the GET method isn't needed, as there will be a very limited number of users who will generally use the system independantly of each other, but I understand your reasoning. So, I've been lucky this time, but it's something I need to consider more carefully in the design stage of future projects. PHP programming is a small part of my job, with only hobby experience to work with, so it's only now that I'm moving on to slightly larger projects I'm beginning to see the real benefits in the design stage. With this project, I carefully worked out all the database design before coding, but didn't do enough on the use-case side of things, such as considering the need for paging to ensure system speed during a database query with lots of results. So I get to the situation where I have 1,000 lines of reasonably decent code, and I'm trying to hack in a solution for, say, paging, when it could have been easily handled if it was considered more carefully earlier. Live and learn I guess! I didn't think you had 50, but I got the impression it was quite a bit more than a simple input box. Rob is absolutely right though. I built a system that allowed a user to drill down across 5 levels of criteria. On each level I stored the parent's information in sessions so that I could skip all of the query string and loading of records each time. Well after all was said and done the clients soon realized that they couldn't copy and paste any url's in the system. It was easy for me in the beginning cutting down on a ton of code, but didn't work whatsoever for the client since they really needed to share that information. So I had to re-code quite a bit of stuff. Now whenever I build something I try to keep it as stateless as possible. I go out of my way to make sure that url's stay short too because when they become too long sometimes the copy and paste thing messes up with email clients text wrapping. In the end though just try and focus on what the needs are. If you're building a user data entry form for a very specific purpose they probably aren't going to need to share that with others. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Splitting up long URLs
At 12:05 PM -0400 7/8/08, Andrew Ballard wrote: However, there isn't a way to change what the user see's in the browser's url box, is there? For example, can you send a user to http://example.com/a.php, but they see http://example.com/b.php in their browser? Cheers, tedd Sounds pretty phishy to me, tedd. :-) Andrew Andrew: Yes, but there's nothing wrong with learning -- it's like talking to other women while you're married, it's what you do with the information that makes it right or wrong. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keeping POST values when paging
At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote: In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Jon: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. Cheers, tedd PS: Daniel, please don't offer hints to show how easy this is. I would like to see what others say. -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Splitting up long URLs
On Tue, 2008-07-08 at 12:42 -0400, tedd wrote: At 12:05 PM -0400 7/8/08, Andrew Ballard wrote: However, there isn't a way to change what the user see's in the browser's url box, is there? For example, can you send a user to http://example.com/a.php, but they see http://example.com/b.php in their browser? Cheers, tedd Sounds pretty phishy to me, tedd. :-) Andrew Andrew: Yes, but there's nothing wrong with learning -- it's like talking to other women while you're married, it's what you do with the information that makes it right or wrong. That reminds me of something I heard on TV a long time ago... Just because I've ordered doesn't mean I can't keep looking at the menu. :) Personally, me and the missus have more fun teasing each other when we find the other's eyes wandering. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Splitting up long URLs
At 2:07 PM -0400 7/8/08, Robert Cummings wrote: On Tue, 2008-07-08 at 12:42 -0400, tedd wrote: At 12:05 PM -0400 7/8/08, Andrew Ballard wrote: Sounds pretty phishy to me, tedd. :-) Andrew Andrew: Yes, but there's nothing wrong with learning -- it's like talking to other women while you're married, it's what you do with the information that makes it right or wrong. That reminds me of something I heard on TV a long time ago... Just because I've ordered doesn't mean I can't keep looking at the menu. :) I heard it: Just because I'm on a diet doesn't mean I can't look at the menu. I also like: I gave sex up for food and now I can't even get into my own pants. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating zip files
Hi, I am using the pclziplibrary to create a zip archive. Now i have the following error message: Error : PCLZIP_ERR_READ_OPEN_FAIL (-2) : Unable to open archive 'archive.zip' in wb mode If someone is using the same library please tell me what this error means exactly. I am using the same code in my PC, it is working but not in the real server. What i am able to do in my pc is writing the archive to the disc. Do you know if there is a way to create the archive just in memory and let the user download it without having to store it in the server? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating zip files
On Tue, Jul 8, 2008 at 3:17 PM, It flance [EMAIL PROTECTED] wrote: Hi, I am using the pclziplibrary to create a zip archive. Now i have the following error message: Error : PCLZIP_ERR_READ_OPEN_FAIL (-2) : Unable to open archive 'archive.zip' in wb mode If someone is using the same library please tell me what this error means exactly. I am using the same code in my PC, it is working but not in the real server. What i am able to do in my pc is writing the archive to the disc. Do you know if there is a way to create the archive just in memory and let the user download it without having to store it in the server? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Has it ever worked on the server? You might need to check permissions to see if your php script has access to write the zip archive to disc. If you're using php5 you can use the ZipArchive[1] extension that is built in now. It is quite fast and easy to use. [1] http://us2.php.net/manual/en/ref.zip.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Linking stuff
Hi all. I think I might be having a brain-fart afternoon, but I can't think of how to accomplish this. I want these centers to be linked to 1 another. If center A links to B and C, I want B to be linked to A and C, and C to A and B. So... it should look something like this: center link A B A C B A B C C A C B These results will be stored in a database and each of the records is unique. To slightly simplify things (hopefully!), I can just store each of the centers in an array, like so: array(A,B,C,D). I figure I'll have to loop through the array (several times?) and do comparisons with each other one. Basically, I don't want to over-complicate this for myself. Any guiding light would be appreciated on how to link all of these! Thanks ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating zip files
On Tue, Jul 8, 2008 at 3:17 PM, It flance [EMAIL PROTECTED] wrote: Hi, I am using the pclziplibrary to create a zip archive. Now i have the following error message: Error : PCLZIP_ERR_READ_OPEN_FAIL (-2) : Unable to open archive 'archive.zip' in wb mode Does the file `archive.zip` exist where the script is looking for it, and is it readable? This has nothing to do with PHP itself. Check with the support team for that project: http://www.phpconcept.net/pclzip/index.en.php -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Jul 8, 2008, at 12:32 PM, tedd wrote: At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote: In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Jon: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing it... ~Phil Cheers, tedd PS: Daniel, please don't offer hints to show how easy this is. I would like to see what others say. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jul 8, 2008, at 12:32 PM, tedd wrote: At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote: In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Jon: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing it... ~Phil Me neither. I'm guessing: either it's using a file to transfer vars (cookie or server-written file), or... I don't know :P Regards, Thiago Cheers, tedd PS: Daniel, please don't offer hints to show how easy this is. I would like to see what others say. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thiago Henrique Pojda
Re: [PHP] Linking stuff
On Tuesday 08 July 2008 21:22:34 Philip Thompson wrote: Hi all. I think I might be having a brain-fart afternoon, but I can't think of how to accomplish this. I want these centers to be linked to 1 another. If center A links to B and C, I want B to be linked to A and C, and C to A and B. So... it should look something like this: center link A B A C B A B C C A C B These results will be stored in a database and each of the records is unique. To slightly simplify things (hopefully!), I can just store each of the centers in an array, like so: array(A,B,C,D). I figure I'll have to loop through the array (several times?) and do comparisons with each other one. Basically, I don't want to over-complicate this for myself. Any guiding light would be appreciated on how to link all of these! Basicly you can use if to check similarities else link. Thanks ~Philip -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Jul 8, 2008, at 2:42 PM, Thiago H. Pojda wrote: On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jul 8, 2008, at 12:32 PM, tedd wrote: At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote: In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Jon: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing it... ~Phil Me neither. I'm guessing: either it's using a file to transfer vars (cookie or server-written file), or... I don't know :P Regards, Thiago Technically, SESSIONs and COOKIEs are just files as well, so I don't think it's a file. Oh oh oh! I know! He's using the Force! Did I get it right?! ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] push data directlly to the client(was Creating zip files)
Hi, Thank you for your answer. Now i figured out how to build the zip archive. I am using a class that returns the compressed data: $zipedresult = $zipfile-zipped_file(); This data, i can write it to a file. but i would like to make it downloadable without having to store it in the server. Is that possible? Thanks --- On Tue, 7/8/08, Eric Butera [EMAIL PROTECTED] wrote: From: Eric Butera [EMAIL PROTECTED] Subject: Re: [PHP] Creating zip files To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Date: Tuesday, July 8, 2008, 7:22 PM On Tue, Jul 8, 2008 at 3:17 PM, It flance [EMAIL PROTECTED] wrote: Hi, I am using the pclziplibrary to create a zip archive. Now i have the following error message: Error : PCLZIP_ERR_READ_OPEN_FAIL (-2) : Unable to open archive 'archive.zip' in wb mode If someone is using the same library please tell me what this error means exactly. I am using the same code in my PC, it is working but not in the real server. What i am able to do in my pc is writing the archive to the disc. Do you know if there is a way to create the archive just in memory and let the user download it without having to store it in the server? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Has it ever worked on the server? You might need to check permissions to see if your php script has access to write the zip archive to disc. If you're using php5 you can use the ZipArchive[1] extension that is built in now. It is quite fast and easy to use. [1] http://us2.php.net/manual/en/ref.zip.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linking stuff
At 2:22 PM -0500 7/8/08, Philip Thompson wrote: Hi all. I think I might be having a brain-fart afternoon, but I can't think of how to accomplish this. I want these centers to be linked to 1 another. If center A links to B and C, I want B to be linked to A and C, and C to A and B. So... it should look something like this: center link A B A C B A B C C A C B These results will be stored in a database and each of the records is unique. To slightly simplify things (hopefully!), I can just store each of the centers in an array, like so: array(A,B,C,D). I figure I'll have to loop through the array (several times?) and do comparisons with each other one. Basically, I don't want to over-complicate this for myself. Any guiding light would be appreciated on how to link all of these! Thanks ~Philip It looks like a permutation and sounds like a linked list. Maybe it would be better if you explained what you wanted to do wit it. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On 8 Jul 2008, at 21:09, Philip Thompson wrote: On Jul 8, 2008, at 2:42 PM, Thiago H. Pojda wrote: On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jul 8, 2008, at 12:32 PM, tedd wrote: At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote: In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Jon: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing it... ~Phil Me neither. I'm guessing: either it's using a file to transfer vars (cookie or server-written file), or... I don't know :P Regards, Thiago Technically, SESSIONs and COOKIEs are just files as well, so I don't think it's a file. Oh oh oh! I know! He's using the Force! Did I get it right?! I've only had a quick look but as far as I can see it's keeping the vars in a form, the form posts to index.php so I'm guessing index.php simply includes the script you specify on the form. Not what I would call pass[ing] variables between scripts but that's just semantics. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Linking stuff
Philip Thompson wrote: Hi all. I think I might be having a brain-fart afternoon, but I can't think of how to accomplish this. I want these centers to be linked to 1 another. If center A links to B and C, I want B to be linked to A and C, and C to A and B. So... it should look something like this: center link A B A C B A B C C A C B These results will be stored in a database and each of the records is unique. To slightly simplify things (hopefully!), I can just store each of the centers in an array, like so: array(A,B,C,D). I figure I'll have to loop through the array (several times?) and do comparisons with each other one. Basically, I don't want to over-complicate this for myself. Any guiding light would be appreciated on how to link all of these! Thanks ~Philip Well, it depends upon what you want to do with these. You'll have them in a db, so it's easy to get them out as an array. What's the problem? -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] push data directlly to the client(was Creating zip files)
It flance wrote: Hi, Thank you for your answer. Now i figured out how to build the zip archive. I am using a class that returns the compressed data: $zipedresult = $zipfile-zipped_file(); This data, i can write it to a file. but i would like to make it downloadable without having to store it in the server. Is that possible? Thanks Yes. Now that you have the zip file contents, send the correct headers to the browser for content-type and disposition, etc using header(), then echo $zipedresult. I can never remember the header to send I have to look it up most times. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
Stut wrote: On 8 Jul 2008, at 21:09, Philip Thompson wrote: On Jul 8, 2008, at 2:42 PM, Thiago H. Pojda wrote: On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jul 8, 2008, at 12:32 PM, tedd wrote: At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote: In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Jon: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing it... ~Phil Me neither. I'm guessing: either it's using a file to transfer vars (cookie or server-written file), or... I don't know :P Regards, Thiago Technically, SESSIONs and COOKIEs are just files as well, so I don't think it's a file. Oh oh oh! I know! He's using the Force! Did I get it right?! I've only had a quick look but as far as I can see it's keeping the vars in a form, the form posts to index.php so I'm guessing index.php simply includes the script you specify on the form. Not what I would call pass[ing] variables between scripts but that's just semantics. -Stut And how would you do that without accessing the $_POST var anyway? -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] push data directlly to the client(was Creating zip files)
Shawn McKenzie wrote: It flance wrote: Hi, Thank you for your answer. Now i figured out how to build the zip archive. I am using a class that returns the compressed data: $zipedresult = $zipfile-zipped_file(); This data, i can write it to a file. but i would like to make it downloadable without having to store it in the server. Is that possible? Thanks Yes. Now that you have the zip file contents, send the correct headers to the browser for content-type and disposition, etc using header(), then echo $zipedresult. I can never remember the header to send I have to look it up most times. -Shawn So I searched for it again but didn't test: $zipedresult = $zipfile-zipped_file(); header(Cache-Control: public); header(Content-Description: File Transfer); header(Content-Disposition: attachment; filename=SomeFileName.zip); header(Content-Type: application/zip); header(Content-Transfer-Encoding: binary); echo $zipedresult; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Linking stuff
On Jul 8, 2008, at 3:38 PM, Shawn McKenzie wrote: Philip Thompson wrote: Hi all. I think I might be having a brain-fart afternoon, but I can't think of how to accomplish this. I want these centers to be linked to 1 another. If center A links to B and C, I want B to be linked to A and C, and C to A and B. So... it should look something like this: center link A B A C B A B C C A C B These results will be stored in a database and each of the records is unique. To slightly simplify things (hopefully!), I can just store each of the centers in an array, like so: array(A,B,C,D). I figure I'll have to loop through the array (several times?) and do comparisons with each other one. Basically, I don't want to over-complicate this for myself. Any guiding light would be appreciated on how to link all of these! Thanks ~Philip Well, it depends upon what you want to do with these. You'll have them in a db, so it's easy to get them out as an array. What's the problem? -Shawn Ok, I figured out one solution. My brain finished farting. Here's what I came up with: ?php $center_ids = explode(,, $_POST[list]); $count = count ($center_ids); $list = array(); for ($i=0; $i$count; $i++) { for ($j=0; $j$count; $j++) { if ($j != $i !in_array($center_ids[$j], $list[$center_ids[$i]])) { $list[$center_ids[$i]][] = $center_ids[$j]; } } } foreach ($list as $cid1 = $array) { foreach ($array as $cid2) { $db-query(INSERT INTO `center_link` (`center_id`, `link_center_id`) VALUES ('$cid1', '$cid2')); } } ? The resulting array for $list (if centers 1, 2 and 3 are selected) is: Array ( [1] = Array ( [0] = 2 [1] = 3 ) [2] = Array ( [0] = 1 [1] = 3 ) [3] = Array ( [0] = 1 [1] = 2 ) ) If there's a cleaner/better way, feel free to set me straight. ;) Thanks for your input, guys. ~Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keeping POST values when paging
At 1:32 PM -0400 7/8/08, tedd wrote: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. So, this code in the HTML page, at the stage just before the data is sent to the script of my choice, isn't using POST to pass the variable? form method=post action=index.php [snip] input type='hidden' name='var2' value='hereWeGo' [snip] /form -Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keeping POST values when paging
At 1:32 PM -0400 7/8/08, tedd wrote: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. So, this code in the HTML page, at the stage just before the data is sent to the script of my choice, isn't using POST to pass the variable? form method=post action=index.php [snip] input type='hidden' name='var2' value='hereWeGo' [snip] /form -Jim Nope -- an explanation will be soon forthcoming. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
At 9:33 PM +0100 7/8/08, Stut wrote: I've only had a quick look but as far as I can see it's keeping the vars in a form, the form posts to index.php so I'm guessing index.php simply includes the script you specify on the form. Not what I would call pass[ing] variables between scripts but that's just semantics. -Stut As I figured, the smart ones would figure it out pretty easily. In the old days when memory was tight we used to do something we called overlays. The process worked like this: 1. Your program would compute what it could with what memory was available. 2. Then the program would halt and the variables used to that point would be frozen in memory. 3. Then another program was loaded on top of the in situ program with spaces in the memory for the values. 4. Then the program would take off again using the new program and those variables. 5. The process would repeat as many times as necessary. Now, in this case I am not swapping scripts because of memory restraints, but rather bringing in new scripts to continue with another part of the program -- but, I'm exiting the old script. It turns out to be a very simple process and it works like this. Run your first script, populate whatever variables you need (including post, get, and such) and then figure out where you want your program to go (i.e., next phase). Instead of populating a bunch of sessions, or filling up a database with values, simply -- ob_clean(); include('theNextScript.php'); exit(); -- and bingo! TheNextScript.php will have all the variables your original script had and your old script will be no more. -Stut is technically right, it's not really passing variables but rather overlaying a new script on top of the old one. In any event, I find it a neat way to continue a script without having to resort to using sessions, or other such storage mechanisms, to pass variables to the new script. Try it -- it works neat. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping POST values when paging
On Jul 8, 2008, at 4:19 PM, tedd wrote: At 9:33 PM +0100 7/8/08, Stut wrote: I've only had a quick look but as far as I can see it's keeping the vars in a form, the form posts to index.php so I'm guessing index.php simply includes the script you specify on the form. Not what I would call pass[ing] variables between scripts but that's just semantics. -Stut As I figured, the smart ones would figure it out pretty easily. In the old days when memory was tight we used to do something we called overlays. The process worked like this: 1. Your program would compute what it could with what memory was available. 2. Then the program would halt and the variables used to that point would be frozen in memory. 3. Then another program was loaded on top of the in situ program with spaces in the memory for the values. 4. Then the program would take off again using the new program and those variables. 5. The process would repeat as many times as necessary. Now, in this case I am not swapping scripts because of memory restraints, but rather bringing in new scripts to continue with another part of the program -- but, I'm exiting the old script. It turns out to be a very simple process and it works like this. Run your first script, populate whatever variables you need (including post, get, and such) and then figure out where you want your program to go (i.e., next phase). Instead of populating a bunch of sessions, or filling up a database with values, simply -- ob_clean(); include('theNextScript.php'); exit(); -- and bingo! TheNextScript.php will have all the variables your original script had and your old script will be no more. -Stut is technically right, it's not really passing variables but rather overlaying a new script on top of the old one. In any event, I find it a neat way to continue a script without having to resort to using sessions, or other such storage mechanisms, to pass variables to the new script. Try it -- it works neat. Cheers, tedd Clever, clever. I actually did something along these lines in the app I'm currently working on. I had a form, submitted it (to the same page), it did it's processing and continued on that page w/o forwarding. Mine did, however, use POST. For example, ?php if (isset ($_POST['confirm'])) { // Do stuff here // After doing stuff here, you could have a // header() redirect } // Now just continue onto the page ? form action=thispage.php.../form The downfall for doing it this way, w/o redirecting upon submit, is not being able to *refresh* w/o being prompted with submitting the form again. Now that I think about it... this has nothing to do with what you did! Ha! Ok, I'm going home - I'm tired. ~Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CURL de-bugging: So why am I not getting the results page on the target site?
My current theory on this is that the initial input page creates a per-session cookie. Is CURL able to send this when the page is submitted and if so how do I find out the name and value of the cookie as per my reading it is not stored on the computer, though I reckon it must be there somewhere. The initial page is in this format: https://www.targetsite.com/subdir/page.asp?serialno=GM201OtherCode=NextCode= So I have various GET parameters. The initial input page also has POST parameters which I can see the in page source, and so send via CURL. I cannot find any javascript doing a set_cookie, including in any included files of which there are none anyway. But there is some session going on as the serialno parameter is not in a hidden field or explicitly set cookie, so it must be a per-session cookie maybe with a different name, I reason. How do I find out about these? John ioannes wrote: My code is as below. It comes back with 'Bad session variable name - CompanySerialNo' from the site.but the COOKIEJAR does not show this variable name and it is not sent, it just shows: www.targetsite.comFALSE/FALSE0 ASPSESSIONIDQCSQDTABLKAONANAFJPNMFFECLFNCLBP There is a serialno but that is sent in the GET (URL below). Question is: What to test now? I am trying to get a results page from an input page. What code below is trying to do is access the page, get any cookies set then try the page again with the relevant inputs. ? $url=https://www.targetsite.com/subdir/page.asp?serialno=GM201OtherCode=NextCode=;; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_COOKIEJAR, cookies.txt); curl_setopt ($ch, CURLOPT_COOKIEFILE, cookies.txt); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_URL, $url); /* //GET list from submitting POST form as GET https://www.shortstay-london.com/checkavail.asp? 1 - clock=+09%3A54 2 - StartDay=6 3 - StartMonth=September+%3A+2008 4 - EndDay=13 5 - EndMonth=September+%3A+2008 13 - CheckThis=Check+This use this list to create POST data */ curl_setopt($ch, CURLOPT_POST, 1); $curlPost=array(); $curlPost[clock]= 09:54; $curlPost[StartDay]=6; $curlPost[StartMonth]=September : 2008; $curlPost[EndDay]=13; $curlPost[EndMonth]=September : 2008; //etc $curlPost[CheckThis]=Check This; curl_setopt($ch, CURLOPT_POSTFIELDS,$curlPost); curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $store = curl_exec ($ch); curl_close ($ch); print($store); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What font/size do you use for programming?
Hi gang: I'm running a Mac (so I know mine is a bit different size wise) but I'm currently using Veranda at 14 point for coding. Just out of curiosity, what font and size do you ppls use for your programming? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What font/size do you use for programming?
tedd wrote: Hi gang: I'm running a Mac (so I know mine is a bit different size wise) but I'm currently using Veranda at 14 point for coding. Just out of curiosity, what font and size do you ppls use for your programming? Cheers, tedd Courier New 10pt w/ClearType Enabled @ 1680x1050 with a 22in wide screen -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What font/size do you use for programming?
tedd wrote: Hi gang: I'm running a Mac (so I know mine is a bit different size wise) but I'm currently using Veranda at 14 point for coding. Just out of curiosity, what font and size do you ppls use for your programming? Cheers, tedd 12pt Adobe Sans MM (Zend Studio) on a 19 LCD @ 1280x1024 running Linux. I'm not doing PHP at my new job anymore (bummer), but the terminal I use to connect to the OpenVMS server uses auto font scaling to make it super huge (the programs only support 80 and 132 character screen widths). BTW, MUMPS is a very interesting language. By interesting I really mean crazy, but I suppose it is really old. F I=1:1:10 W VALUE: _I,! ; Writes VALUE: . I each on a new line Sorry for venturing off-topic, but I told you! -- Ray Hauge www.primateapplications.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CURL de-bugging: So why am I not getting the results page on the target site?
The way this page works is you access index.asp?SerialNo=abc123 from a link, that is re-directed to a frameset containing the main page, main.asp, just that. main.asp does not have any input fields showing the SerialNo, there is a comment with it but that is all. Fom this page, you input some dates and submit, and the form action is on a page like /checkthis.asp. What I can't see is how /checkthis.asp knows the SerialNo, which it needs. Is there some other way that asp pages transfer information between pages? I looked at the cache for IE after each page load and it does not have SerialNo as cookies or any cookies from this site other than google conversion tracking. On main.asp the button that submits the form does not refer to the SerialNo either. Nevertheless the results page creates the relevant data from the database. But it does produce error messages like, The Object has been Moved here, with my site plus ?lngSessionId=234984987SerialNo=abd123WinMode=AgentCode=CustCode=. If I add these parameters to the target URL in the CURL script it looks for displaymode (the message with my url in the display line at end of browser window: www.mysite.com/displaymode=). John ioannes wrote: My current theory on this is that the initial input page creates a per-session cookie. Is CURL able to send this when the page is submitted and if so how do I find out the name and value of the cookie as per my reading it is not stored on the computer, though I reckon it must be there somewhere. The initial page is in this format: https://www.targetsite.com/subdir/page.asp?serialno=GM201OtherCode=NextCode= So I have various GET parameters. The initial input page also has POST parameters which I can see the in page source, and so send via CURL. I cannot find any javascript doing a set_cookie, including in any included files of which there are none anyway. But there is some session going on as the serialno parameter is not in a hidden field or explicitly set cookie, so it must be a per-session cookie maybe with a different name, I reason. How do I find out about these? John ioannes wrote: My code is as below. It comes back with 'Bad session variable name - CompanySerialNo' from the site.but the COOKIEJAR does not show this variable name and it is not sent, it just shows: www.targetsite.comFALSE/FALSE0 ASPSESSIONIDQCSQDTABLKAONANAFJPNMFFECLFNCLBP There is a serialno but that is sent in the GET (URL below). Question is: What to test now? I am trying to get a results page from an input page. What code below is trying to do is access the page, get any cookies set then try the page again with the relevant inputs. ? $url=https://www.targetsite.com/subdir/page.asp?serialno=GM201OtherCode=NextCode=;; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_COOKIEJAR, cookies.txt); curl_setopt ($ch, CURLOPT_COOKIEFILE, cookies.txt); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_URL, $url); /* //GET list from submitting POST form as GET https://www.shortstay-london.com/checkavail.asp? 1 - clock=+09%3A54 2 - StartDay=6 3 - StartMonth=September+%3A+2008 4 - EndDay=13 5 - EndMonth=September+%3A+2008 13 - CheckThis=Check+This use this list to create POST data */ curl_setopt($ch, CURLOPT_POST, 1); $curlPost=array(); $curlPost[clock]= 09:54; $curlPost[StartDay]=6; $curlPost[StartMonth]=September : 2008; $curlPost[EndDay]=13; $curlPost[EndMonth]=September : 2008; //etc $curlPost[CheckThis]=Check This; curl_setopt($ch, CURLOPT_POSTFIELDS,$curlPost); curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $store = curl_exec ($ch); curl_close ($ch); print($store); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What font/size do you use for programming?
On Tue, 2008-07-08 at 16:28 -0700, Jim Lucas wrote: tedd wrote: Hi gang: I'm running a Mac (so I know mine is a bit different size wise) but I'm currently using Veranda at 14 point for coding. Just out of curiosity, what font and size do you ppls use for your programming? Cheers, tedd Courier New 10pt w/ClearType Enabled @ 1680x1050 with a 22in wide screen aterm - -adobe-courier-medium-r-normal-*-*-140-*-*-m-*-iso8859-1 gnome-terminal - Courier New 14 rxvt-unicode - xft:Luxi Mono:pixelsize=16 I work on a 1600x1200 21 LCD monitor (not widescreen crap :) I loved eterm and aterm, they're both righteously fast and very configurable.. unfortunately they don't support UTF8 so they're being phased out. Gnome-terminal sucks, as does almost every other terminal I've tried (and I've tried a lot of them). Either the colours aren't configurable, or they do some kind of freaky screen write caching so directory listings go by in chunked swathes of screen rendering. Additionally, with many of them the CPU for some odd reason jumps to 100% when doing a long listing-- yes I'm looking at you again gnome-terminal. Recently, I was fortunate enough to stumble across rxvt-unicode which is fast like aterm, supports UTF8 and apparently is where the aterm team moved their development focus. The great thing about using a terminal with my favourite editor (JOE) is that it's the same development atmosphere whether I'm connected remotely over SSH or locally. Additionally, I can use the same editor whether I'm writing code, editing config files, or whatever. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What font/size do you use for programming?
On Tue, 2008-07-08 at 21:35 -0400, Robert Cummings wrote: On Tue, 2008-07-08 at 16:28 -0700, Jim Lucas wrote: tedd wrote: Hi gang: I'm running a Mac (so I know mine is a bit different size wise) but I'm currently using Veranda at 14 point for coding. Just out of curiosity, what font and size do you ppls use for your programming? Cheers, tedd Courier New 10pt w/ClearType Enabled @ 1680x1050 with a 22in wide screen aterm - -adobe-courier-medium-r-normal-*-*-140-*-*-m-*-iso8859-1 gnome-terminal - Courier New 14 rxvt-unicode - xft:Luxi Mono:pixelsize=16 I should probably mention I usually have terminal background transparency enabled with shading set to 20 (80% black), and gray default text colour. Additionally, I do custom set my ls colours and syntax highlighting :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDOStatement - dump params to log after binding
Hi all, is there a way to access parameters in the PDOStatement object after they have been bound? it would be very useful for my debug logging. Thanks, Radek. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question before I end up writing alot of extra code...
Hey, Dude you could use it this way input type='checkbox' name='something' value='1' input type='checkbox' name='something' value='2' input type='checkbox' name='something' value='3' Once u submit it, do a small server side validation if(isset($_POST['something'] || $_POST['something']) != ){ insert... } This way you could avoid replacing the values with nulls. Thanks, Vam On Mon, Jul 7, 2008 at 12:25 PM, Jason Pruim [EMAIL PROTECTED] wrote: Hi everyone! So it's been a nice long weekend, I come in to work and try and mess with a project that I'm working on to get some new features added. All was going well until I realized that now my application is breaking... Here's the details... PHP 5.2 MySQL 5.2 I store the info in the database which is submitted from a HTML form.. Some of it text boxes, some check boxes, some radio buttons... I $_POST the info from the form into the processing script. The problem I'm running into though, is when a value has not changed it doesn't get $_POSTed back and my update script erases the info in the database... I'm trying to avoid using $_GET since it can be quite a few variables. Is there anyway I can do it without comparing the original field to what I am displaying? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question before I end up writing alot of extra code...
sorry it needs to be a array for checkbox for the example below. So you could use is_empty() instead. something like that. input type='checkbox' name='something[]' value='1' input type='checkbox' name='something[]' value='2' input type='checkbox' name='something[]' value='3' On Tue, Jul 8, 2008 at 7:37 PM, VamVan [EMAIL PROTECTED] wrote: Hey, Dude you could use it this way input type='checkbox' name='something' value='1' input type='checkbox' name='something' value='2' input type='checkbox' name='something' value='3' Once u submit it, do a small server side validation if(isset($_POST['something'] || $_POST['something']) != ){ insert... } This way you could avoid replacing the values with nulls. Thanks, Vam On Mon, Jul 7, 2008 at 12:25 PM, Jason Pruim [EMAIL PROTECTED] wrote: Hi everyone! So it's been a nice long weekend, I come in to work and try and mess with a project that I'm working on to get some new features added. All was going well until I realized that now my application is breaking... Here's the details... PHP 5.2 MySQL 5.2 I store the info in the database which is submitted from a HTML form.. Some of it text boxes, some check boxes, some radio buttons... I $_POST the info from the form into the processing script. The problem I'm running into though, is when a value has not changed it doesn't get $_POSTed back and my update script erases the info in the database... I'm trying to avoid using $_GET since it can be quite a few variables. Is there anyway I can do it without comparing the original field to what I am displaying? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What font/size do you use for programming?
tedd wrote: Hi gang: I'm running a Mac (so I know mine is a bit different size wise) but I'm currently using Veranda at 14 point for coding. Just out of curiosity, what font and size do you ppls use for your programming? Cheers, tedd Font: Agent Orange Size: 64pt 19 Westinghouse flatscreen. My wife bought it for me 2 Christmases ago, this weekend she got a widescreen Samsung :-( -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php