Re: [PHP] pop-up windows
on 29/06/02 2:53 AM, Kevin Stone ([EMAIL PROTECTED]) wrote: John I hate to critisize you since you are one of the most active members on this list. But are these types of comments really useful? -Kevin No, I'm with John on this one. I'd say I type no, JavaScript is client-side, and PHP is server side around 20 times a week to this list, and that's only when I can be bothered. Searching for pop-up in the archives would have solved the writers problem in about 2 minutes. For this group to maintain it's worth, we need to encourage users to do a LITTLE research before asking obvious questions, and we need to discourage people wasting our time with repetitive questions, or those who clearly subscribe to the but it's so easy to just send an email and wait to be flamed mentality. Regards, Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping Secrets in PHP Files
on 29/06/02 3:20 AM, Tamas Arpad ([EMAIL PROTECTED]) wrote: I was thinking if you use 90 character long filenames, assuming you only use the letters of the alphabet and the digits then you would have 62^90 different filenames, which is roughly 2E161 (2 followed by 161 zeros), which is quite a bit. Hopefully the numbers involved would make it infeasible for an attacker to loop through all the permutations. But what if the attacker just knows one file's name, for example index.php or something that's in the url in the browser. Then he/she can stole that file, read it, and gets other filenames because of includes/requires. With some work he/she can get all the files without any bruteforce filename guessing. Well if a php file is parsed to the server, then they can't determine what the orginal included fiels were at all, unless you're dumb enuff to do this: !-- include /inc/secret/passwords.inc -- ? include('/inc/secret/passwords.inc'); ? :) If you adopt some of the practices (I think) included earlier in this thread by me, you could restrict browser access to your inc files by the use of smart file naming, dedicated directories and .htaccess files, then this should cover the basics of people grabbing your included files (with passwords etc) via http (browser). It doesn't cover people within the server (others on a shared server, etc) though. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] supersession
I think there is also a directive in php.ini to ALWAYS include a certain file at the top of each script, transparently. Perhaps you could dynamically write to this file as needed, or dynamically write to a MySQL table which is called/queried by this script. This may or may not help, depending on your needs :) Justin French on 29/06/02 6:38 AM, Michael Sweeney ([EMAIL PROTECTED]) wrote: Depending on what data you need to have in these variables, you might be able to set them as environment variables through apache (that is, _if_ you're running apache, _if_ you have access to the configuration file, _if_ mod_env is installed, etc). I'm guessing that wouldn't be a flexible enough alternative for you, but it might be worth considering. ..michael.. On Fri, 2002-06-28 at 13:19, Jay Blanchard wrote: [snip] Perhaps something of this nature is already available and I don't know about it, but in the scope of the current project I am working on it would be beneficial to take the concept of superglobals and apply it to sessions. That is, to be able to register a session-style variable in which all instances of the script and/or server to access. I know it is possible to use a database or write a file to keep track of such an item, but it would be nice to have this feature built in to php. [/snip] I know what you mean. I have written a file that was included on every page instance that had the session start function with all of the registered session variables and included the database connections as well. Not as neat as a supersession function you speak of, but workable. Jay -- 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
Re: [PHP] Yet another session problem, with a twist.
PHPLib has session functions, and was essentially what people used before PHP4. It will of course require a fair bit of work to port your scripts across. Personally I'd change to another host :) Justin French on 29/06/02 2:17 PM, Cysec ([EMAIL PROTECTED]) wrote: I have already scripted a site using PHP 4 and was at the point of uploading it to my client's chosen server (decided to go third party) when I discover, their server is running PHP3, launch is in five days, and I have 40+ pages using PHP4's session handling (session_start() etc.). This would be a total pain to change throughout the site, so I was wondering if anyone knew of a script of functions that emulate PHP4's session handling. I would love to be able to just update the server, and would have if it were one I was administrating, however I can't. Any help would be vastly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Session] SID automatically add on all pages?
Hi people, Just a question, I'm building components for a customer who wants some interactivity within his site, but still wants to build the site himself. One thing that would be interesting would be Session management. Now, if I just tell him to make all his own pages with .php ext instead of .html, would did be enough if --enable-trans-sid is used (and php.ini is correctly configured)? It seems to work here, but I want to know if I forgot something important... -- Kind regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Two cases going to same case?
I have a switch in a script I'm working on. I need to have case 1 and 2 both to to case 3, but without case 1 going through case 2. Is this possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Blank emails
Hi all. I know its Sunday morning and that Im NOT getting many responses right now ;-) I connected to the net, opened my browser, pointed it towards an e-mail script Ive installed this afternoon in my site (SquirrelMail) qnd got into the INBOX once there, I opened my MS Outlook and received 21 messages regarding PHP mailing list stuff, but all these had no FROM, SUBJECT, TO or CC I mean, they had body content but no headers to show ¿¿¿??? mailto:[EMAIL PROTECTED] Cesar Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621
[PHP] ZIP combinaton in PHP?
I realise its a longshot but is it possible to use PHP (or any other web-based languages) to combine multiple ZIP files into a single ZIP file? and any scripts i can download to do it. Any help with this is most appreciated. ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Two cases going to same case?
At 5:18 AM -0400 6/30/02, Leif K-Brooks wrote: I have a switch in a script I'm working on. I need to have case 1 and 2 both to to case 3, but without case 1 going through case 2. Is this possible? No, but you can do it this way: switch ($foo) { case 1: ... do_something(); break; case 2: ... do_something(); break; case 3: do_something(); break; } function do_something() { # this is the stuff that you want to do that is common to your # cases 1, 2 and 3 } This accomplishes the same thing. -steve -- ++ | Steve Edberg [EMAIL PROTECTED] | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | ++ | The end to politics as usual: | | The Monster Raving Loony Party (http://www.omrlp.com/) | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Blank emails
Can you post the code on here? There must be some headers somewhere because the mail has been sent to you - to header. Have you clicked on the email in Outlook and looked at the headers / message source? César aracena [EMAIL PROTECTED] wrote in message 002a01c22019$21a0c210$dfc405c8@gateway">news:002a01c22019$21a0c210$dfc405c8@gateway... Hi all. I know it's Sunday morning and that I'm NOT getting many responses right now ;-) I connected to the net, opened my browser, pointed it towards an e-mail script I've installed this afternoon in my site (SquirrelMail) qnd got into the INBOX. once there, I opened my MS Outlook and received 21 messages regarding PHP mailing list stuff, but all these had no FROM, SUBJECT, TO or CC... I mean, they had body content but no headers to show. ¿¿¿??? mailto:[EMAIL PROTECTED] Cesar Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Session] SID automatically add on all pages?
enable-trans-sid appends a session id to URLs, but it works in conjunction with php's session functions. Simply compiling with --enable-trans-sid or appending it to the URL yourself will not maintain session. using functions like session_start() and the registering of session variables ($_SESSION['something'] = foo;) will establish/maintain a session. enable-trans-sid will only append a session ID to the URL for you if needed... it's main use is for maintaining session across multiple pages whilst not relying on cookies. simply converting your files to .php and compiling with enable-trans-sid will not give you sessions. Justin French on 30/06/02 5:47 AM, Tim Stoop ([EMAIL PROTECTED]) wrote: Hi people, Just a question, I'm building components for a customer who wants some interactivity within his site, but still wants to build the site himself. One thing that would be interesting would be Session management. Now, if I just tell him to make all his own pages with .php ext instead of .html, would did be enough if --enable-trans-sid is used (and php.ini is correctly configured)? It seems to work here, but I want to know if I forgot something important... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Session] SID automatically add on all pages?
Hi Justin, Thx for the reply Justin French wrote: using functions like session_start() and the registering of session variables ($_SESSION['something'] = foo;) will establish/maintain a session. Yes, I understand. Sessions need to be started. But once they have started, do I need to re-affirm the session on every page, or will it hold for a few pages, until the session-variables will be used again ... simply converting your files to .php and compiling with enable-trans-sid will not give you sessions. ... when I do this? -- Kind regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bug in sessions
Hello, i discovered bug in sessions: when using unset($_SESSION[...]) insted session_unregister(...) and before calling read _$SESSION[...] variable WILL NOT unset. please try these examples and see result. here is method how to produce this bug (you must have cookies enabled): 1. run script 2. reload page (you should see 2 $_SESSION arrays with the same value) 3. click on unset link 4. now you should see first array filled with test value and second should be empty - that's OK - but variable test should be deleted from session 5. reload page 6. here is BUG: i unset session variable test so i shouldn't exists, but exists. --- 7. comment line marked #fatal and go to repeat process from begining on step 6. both arrays will be empty cut here-- ?php session_start(); echo 'pre'; print_r($_SESSION); if (isset($_GET['submit'])) { $test = $_SESSION['test']; # fatal unset($_SESSION['test']); } else { $_SESSION['test'] = 'this is test'; } echo 'a href='.$_SERVER['PHP_SELF'].'?submit=yesunset/abr'; print_r($_SESSION); echo '/pre'; ? cut here-- replaceunset($_SESSION['test']); with session_unregister('test'); and repeat process - here will be everything OK. http://www.php.net/manual/en/ref.session.php (see Example 3.) Tested on PHP 4.2.1 (win, Debian). Epilogue: using unset at $_SESSION array is NOT safe. Regards, Michal Dvoracek [EMAIL PROTECTED] Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include files or fopen
Hi, I am trying to write a program that is very modular in nature one of the features I need the user to be able to do is install/uninstall or enable/disable the module though the interface. I have though of 2 ways this could be done, either when the module is installed it adds additional lines to an include file, which means the next time the page is loaded the new module will also be included. Alternatively I though of writing my own config files and using fopen etc to read in the values and store them as appopriate. If I was writing this as a compiled program in C / Java, I would definately use the fopen method as the operation only needs to be done either a program start or when a new module is added. However with PHP the operation would need to be done on each page request. As far as I can tell both methods ultimately come down to opening a file and reading it in, but I would think that the built in include directive would be less of a performance risk that writing my own handler. The problem is by using include files I run the risk of if my script/server crashes half-way though a write or the user makes an error when editing the page directly it would possibly bring down the whole app, where as if I read the values in via my own file methods I can ensure that the values and syntax are valid before acting upon what is read in. Therefore if my assumptions are correct I am caught between either possibily having a faster program but is possibly not a resiliant to error, or a slower program that is more resiliant and can exit nicely on error. Any thoughs that people have on this would be appriciated. Regards Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Two cases going to same case?
Hi One way to achieve the same effect: fallthru = 0; switch($whatever){ case 1: do something1; $fallthru = 1; case 2: if(!$fallthrough){ do something2; } case 3 do something3; break; } Tom At 05:18 AM 30/06/2002 -0400, Leif K-Brooks wrote: I have a switch in a script I'm working on. I need to have case 1 and 2 both to to case 3, but without case 1 going through case 2. Is this possible? -- 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
Re: [PHP] [Session] SID automatically add on all pages?
on 30/06/02 9:04 PM, Tim Stoop ([EMAIL PROTECTED]) wrote: Yes, I understand. Sessions need to be started. But once they have started, do I need to re-affirm the session on every page, or will it hold for a few pages, until the session-variables will be used again ... Well, you really need to check out a decent article/tutorial on sessions, because it's a lot more in depth than can possible be explained here. But as a bare minimum, each page would need to call session_start() BEFORE the HTML tag or any other content is sent to the browser. You'd also need to register variables to the session (otherwise what's the point?) What is the session to be used for? simply converting your files to .php and compiling with enable-trans-sid will not give you sessions. ... when I do this? do what? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populate Popup Menu from Database
On Sunday 30 June 2002 03:03, Mike Tuller wrote: To let everyone know, I did apologize to Mr. Wong. I misunderstood what he was trying to ask me. I took it as he was saying It's easy, what is your problem rather than What is your problem . Thanks. But no need to call me Mr though :) -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Yevtushenko has... an ego that can crack crystal at a distance of twenty feet. -- John Cheever */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ZIP combinaton in PHP?
On Sunday 30 June 2002 15:32, Tony Harrison wrote: I realise its a longshot but is it possible to use PHP (or any other web-based languages) to combine multiple ZIP files into a single ZIP file? and any scripts i can download to do it. Any help with this is most appreciated. ;-) If you have a command-line zip program on your system then just use exec() (or friends) to run it. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* ... I see TOILET SEATS ... */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Session] SID automatically add on all pages?
On Sunday 30 June 2002 19:04, Tim Stoop wrote: Hi Justin, Thx for the reply Justin French wrote: using functions like session_start() and the registering of session variables ($_SESSION['something'] = foo;) will establish/maintain a session. Yes, I understand. Sessions need to be started. But once they have started, do I need to re-affirm the session on every page, or will it hold for a few pages, until the session-variables will be used again ... There is a setting in php.ini, session.auto_start, which enables php to automatically register a session. But as Justin suggests, you should refer to a decent article/book or manual for details. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* If you flaunt it, expect to have it trashed. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Session] SID automatically add on all pages?
Hi Justin, Thx again for the answer. Justin French wrote: Well, you really need to check out a decent article/tutorial on sessions, Nah, I think I explain my question a little wierd and that's why you don't understand me... I've worked with sessions lots of times (although mostly in Java Servlets). Or something must be really crooked with my knowledge of standard sessions... because it's a lot more in depth than can possible be explained here. But as a bare minimum, each page would need to call session_start() BEFORE the HTML tag or any other content is sent to the browser. Ah yes, I forgot about that... I need to resume the session, of course. Would session.auto_start set to 1 work without these session_start()'s? The thing is, I need as less as possible of a hassle to have the sessions work... Read on for an explanation. You'd also need to register variables to the session (otherwise what's the point?) What is the session to be used for? Well... For a shopping-cart actually :) But not the standard kind. I'm building a set of components that a webdesigner can use easily, without actually understanding how the code works. The webdesigner (my customer) wants to build a site where his customers can browse to some products and put them in their shopping-cart with simple code. Something like: HTML HEAD bla bla.. /HEAD BODY H1Buy this product!/H1 Pbla bla/P ?php include(functions.php); makeBuyButton(black shoes, size 34); ? /BODY /HTML I do the work with the variables and all, he only needs to make sure everything looks fine. I used to do this with Cookies, but they're evil :) Besides, a session-solution a much prettier :) I want to know if the session is maintained if he makes use of the components and has all his files extend on .php, when I have --enable-trans-sid on and (as noted in this mail) session.auto_start. I think this would work? I made a test-site locally, but I need to know the exact options that make this work, so I can inform the provider what to change (very helpful chaps over there, just don't know sh*t about PHP). -- Kind regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] change variable in file
On Sunday 30 June 2002 03:09, Nookie wrote: Hi, I want to write function which change variable in ie. config.php file ... Here is code: ? include config.php; $file = fopen(config.php, w+); $content = fread($file, filesize(config.php)); $content = str_replace(\$option['test'] = \ . $option['test'] . \;, \$option['test'] = \po tescie\;, $content); fwrite($file, $content); ? and config.php: ? $option['test'] = test; ? and it's doesn't work :( ... when I run script, it clear config.php and nothing else ... where is my fault? What does $content contain? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* I'm still waiting for the advent of the computer science groupie. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imageellipse not working with gdlib2.0
Maybe I am just doing it incorrectly but I am unable to get anything displayed with imageellipse in gdlib2.0. Can anyone give me a simple php script to test it with? I am using php with Sablotron. Thank you. -- Bill Amsterdam, NL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 30 Jun 2002 13:48:29 -0000 Issue 1436
php-general Digest 30 Jun 2002 13:48:29 - Issue 1436 Topics (messages 104544 through 104572): Re: Usiing FOREACH to loop through Array 104544 by: Brad Melendy 104548 by: Steve Edberg 104550 by: Brad Melendy mcrypt 104545 by: charlesk Re: Getting IP from behind proxies 104546 by: JJ Harrison 104547 by: Rasmus Lerdorf Re: Limiting number of decimal places reported 104549 by: Beverly Steiner Re: pop-up windows 104551 by: Justin French Re: Keeping Secrets in PHP Files 104552 by: Justin French Re: supersession 104553 by: Justin French Re: Yet another session problem, with a twist. 104554 by: Justin French [Session] SID automatically add on all pages? 104555 by: Tim Stoop 104561 by: Justin French 104562 by: Tim Stoop 104566 by: Justin French 104569 by: Jason Wong 104570 by: Tim Stoop Two cases going to same case? 104556 by: Leif K-Brooks 104559 by: Steve Edberg 104565 by: Tom Rogers Blank emails 104557 by: César Aracena 104560 by: Peter ZIP combinaton in PHP? 104558 by: Tony Harrison 104568 by: Jason Wong bug in sessions 104563 by: Michal Dvoracek include files or fopen 104564 by: Lee Re: Populate Popup Menu from Database 104567 by: Jason Wong Re: change variable in file 104571 by: Jason Wong imageellipse not working with gdlib2.0 104572 by: William S. 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--- Steve, Thanks very much. This make total sense to me. Now, I was pretty sure that I was getting an array back from mysql_fetch_array because when I do a 'print $myCourses' without specifying any value, I just get 'array' which I believe I am supposed to, IF it is truly an array. Anyway, I'm going to revisit the mysql_fetch_array function right now. Thanks for your help, it is greatly appreciated. ...Brad Steve Edberg [EMAIL PROTECTED] wrote in message news:p05100300b943f2a7feef@[168.150.239.37]... At 3:27 PM -0700 6/29/02, Brad Melendy wrote: Hi All, I've stumped myself here. In a nutshell, I have a function that returns my array based on a SQL query and here's the code: -begin code--- function getCourses($UID) { global $link; $result = mysql_query( SELECT C.CourseName FROM tblcourses C, tblusers U, tblEnrollment E WHERE C.ID = E.CourseID AND E.UserID = U.ID AND U.ID = $UID, $link ); if ( ! $result ) die ( getRow fatal error: .mysql_error() ); return mysql_fetch_array( $result ); } end code I call this from a PHP page with the following code: begin code-- $myCourses = getCourses($session[id]); foreach ($myCourses as $value) { print br$value; } end code--- Now, when I test the SQL from my function directly on the database, it returns just want I want it to return but it isn't working that way on my PHP page. For results where there is a single entry, I am getting the same entry TWICE and for records with more than a single entry I am getting ONLY the FIRST entry TWICE. Now I know my SQL code is correct (I am testing it against a MySQL database using MySQL-Front) so I suspect I'm doing something stupid in my foreach loop. I think your problem lies in a misunderstanding of the mysql_fetch_array() function. It doesn't return the entire result set in an array - just one record at a time. You can fix this in one of two ways: (1) Loop though the entire result set in your function: function getCourses($UID) { global $link; $ResultSet = array(); $result = mysql_query( SELECT C.CourseName FROM tblcourses C, tblusers U, tblEnrollment E WHERE C.ID = E.CourseID AND E.UserID = U.ID AND U.ID = $UID, $link ); if ( ! $result ) die ( getRow fatal error: .mysql_error() ); while ($Row = mysql_fetch_array( $result )) { $ResultSet[] = $Row['C.CourseName']; } return $ResultSet; } ... $myCourses = getCourses($session[id]); foreach ($myCourses as $value) { print br$value; } or (2) set a flag in getCourses() so that the query is only executed once, otherwise returning a result line - something like: function getCourses($UID) global $link; static $result = false; if (!$result) { $result = mysql_query( SELECT C.CourseName FROM tblcourses C, tblusers U, tblEnrollment E WHERE C.ID = E.CourseID AND E.UserID = U.ID AND U.ID = $UID, $link ); if ( ! $result )
RE: [PHP] bug in sessions
Same for me (PHP4.2.1 on Win). Unset removes the variable from the session for the duration of the script, but doesn't actually remove it from the session. Using session_unregister() does remove the variable from the session. You should post it as a bug, Michal, or tell them to change the documentation. ---John Holmes... -Original Message- From: Michal Dvoracek [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 7:37 AM To: [EMAIL PROTECTED] Subject: [PHP] bug in sessions Hello, i discovered bug in sessions: when using unset($_SESSION[...]) insted session_unregister(...) and before calling read _$SESSION[...] variable WILL NOT unset. please try these examples and see result. here is method how to produce this bug (you must have cookies enabled): 1. run script 2. reload page (you should see 2 $_SESSION arrays with the same value) 3. click on unset link 4. now you should see first array filled with test value and second should be empty - that's OK - but variable test should be deleted from session 5. reload page 6. here is BUG: i unset session variable test so i shouldn't exists, but exists. --- 7. comment line marked #fatal and go to repeat process from begining on step 6. both arrays will be empty cut here-- ?php session_start(); echo 'pre'; print_r($_SESSION); if (isset($_GET['submit'])) { $test = $_SESSION['test']; # fatal unset($_SESSION['test']); } else { $_SESSION['test'] = 'this is test'; } echo 'a href='.$_SERVER['PHP_SELF'].'?submit=yesunset/abr'; print_r($_SESSION); echo '/pre'; ? cut here-- replaceunset($_SESSION['test']); with session_unregister('test'); and repeat process - here will be everything OK. http://www.php.net/manual/en/ref.session.php (see Example 3.) Tested on PHP 4.2.1 (win, Debian). Epilogue: using unset at $_SESSION array is NOT safe. Regards, Michal Dvoracek [EMAIL PROTECTED] Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112 -- 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
RE: [PHP] Getting IP from behind proxies
Why not create a cookie for that poll. When the vote check for the cookie. Unless a user clears the cookie himself, you basically limit votes to one per computer or one per computer per user. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 29, 2002 10:34 PM To: JJ Harrison Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Getting IP from behind proxies Importance: Low You need to assign each person a unique identifier of some sort. ie. assign them a login and password and verify that information by sending a message to their email address. Then only people with multiple email addresses can spam your system with votes. Beyond that it comes down to verifying each voter manually. Get a phone number and call each one up. Even that is not quite foolproof. Personal certificates might be an option here, but that is rather cumbersome for everyone involved. Basically there is no good solution for this problem. Until everyone in the world has a unique and non-spoofable, easily verifiable id number, what you are trying to do is impossible. Basically live with the fact that your voting system will be inaccurate and spoofable. -Rasmus On Sun, 30 Jun 2002, JJ Harrison wrote: what esle could i use? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can only get it if the proxy provides you with this data. Most don't, so this is not a reliable approach. -Rasmus On Sat, 29 Jun 2002, JJ Harrison wrote: I want to check to see if people have voted yet for a poll. How can I get the ip of a user from both behind a proxy and the proxies ip? is this simple? will i have trouble with firewalls etc? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- 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 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
Re: [PHP] Two cases going to same case?
Leif K-Brooks wrote: I have a switch in a script I'm working on. I need to have case 1 and 2 both to to case 3, but without case 1 going through case 2. Is this possible? Does case 3 have to be in the switch? If not, just leave it to execute just after the end of the switch. Otherwise, consider making your program modular. For case 3, include a file that has the code you're wanting to execute. Then all you have to do is include the same file at the bottom of both cases 1 and 2. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Register Globals = off
Hi Going through some literature, it seems like the use of registered globals can cause security issues. Now, the dilemma, all my previous PHP installations ( for the last year or so ) have come with register globals = on in the php.ini file by default, and users on my system has happily coded their websites using this function. Now , with all the new versions of PHP, the registered globals are turned off in the ini and will basically cause all those previous sites not to function. Which means that I'm between a rock and a hard place, turn the register globals back on and carry on with the security risks, or keep it off and have all those people re-code their sites... Is there a more gentle solution out there? Am I just misunderstanding the issue? Any light on the matter will be appreciated. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting IP from behind proxies
It is rather trivial to turn off cookies. It's not a matter of clearing cookies, the user simply turns it off. Heck, many users browse with cookies turned off by default. -R On Sun, 30 Jun 2002, Bruce Karstedt wrote: Why not create a cookie for that poll. When the vote check for the cookie. Unless a user clears the cookie himself, you basically limit votes to one per computer or one per computer per user. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 29, 2002 10:34 PM To: JJ Harrison Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Getting IP from behind proxies Importance: Low You need to assign each person a unique identifier of some sort. ie. assign them a login and password and verify that information by sending a message to their email address. Then only people with multiple email addresses can spam your system with votes. Beyond that it comes down to verifying each voter manually. Get a phone number and call each one up. Even that is not quite foolproof. Personal certificates might be an option here, but that is rather cumbersome for everyone involved. Basically there is no good solution for this problem. Until everyone in the world has a unique and non-spoofable, easily verifiable id number, what you are trying to do is impossible. Basically live with the fact that your voting system will be inaccurate and spoofable. -Rasmus On Sun, 30 Jun 2002, JJ Harrison wrote: what esle could i use? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can only get it if the proxy provides you with this data. Most don't, so this is not a reliable approach. -Rasmus On Sat, 29 Jun 2002, JJ Harrison wrote: I want to check to see if people have voted yet for a poll. How can I get the ip of a user from both behind a proxy and the proxies ip? is this simple? will i have trouble with firewalls etc? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- 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 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
RE: [PHP] pop-up windows
Here ! Here ! Everyone's time is valuable, and therefore the more we all respect each other's time and opinions, the more valuable a resource this will become. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 2:45 AM To: Kevin Stone; [EMAIL PROTECTED] Subject: Re: [PHP] pop-up windows Importance: Low on 29/06/02 2:53 AM, Kevin Stone ([EMAIL PROTECTED]) wrote: John I hate to critisize you since you are one of the most active members on this list. But are these types of comments really useful? -Kevin No, I'm with John on this one. I'd say I type no, JavaScript is client-side, and PHP is server side around 20 times a week to this list, and that's only when I can be bothered. Searching for pop-up in the archives would have solved the writers problem in about 2 minutes. For this group to maintain it's worth, we need to encourage users to do a LITTLE research before asking obvious questions, and we need to discourage people wasting our time with repetitive questions, or those who clearly subscribe to the but it's so easy to just send an email and wait to be flamed mentality. Regards, Justin French -- 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] PEAR website down
The pear.php.net site seems to have a problem with no MySQL server running. I need to download PEAR in a hurry. Can someone get the site back up or tell me if I can get PEAR from somewhere else?? Thanks Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register Globals = off
On Sunday 30 June 2002 23:12, PHPCoder wrote: Hi Going through some literature, it seems like the use of registered globals can cause security issues. Now, the dilemma, all my previous PHP installations ( for the last year or so ) have come with register globals = on in the php.ini file by default, and users on my system has happily coded their websites using this function. Now , with all the new versions of PHP, the registered globals are turned off in the ini and will basically cause all those previous sites not to function. Which means that I'm between a rock and a hard place, turn the register globals back on and carry on with the security risks, or keep it off and have all those people re-code their sites... Is there a more gentle solution out there? Am I just misunderstanding the issue? Any light on the matter will be appreciated. I don't there are any gentle approaches to this. People will have to bite the bullet sooner or later. What may help slightly is the fact that you can have different settings for register_globals for each virtual host. Thus the global setting for register_globals, ie php.ini, can be off. Then for each of your users who have not yet recoded, enable register_globals in their virtual host setting. Thus the people who have bothered to recode will be able to benefit from a more secure application without being affected by the people who have not yet recoded. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Depart in pieces, i.e., split. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Problem
Hello, I am having some problems parsing XML with PHP. Here is an example of my problem: Example 1: PAGE TAG1 SOME TEXT /TAG1 /PAGE When I try to use the expat XML functions I cannot parse TAG1 in the above example. I simply get nothing. However with the following example: Example 2: PAGE TAG1SOME TEXT/TAG1 /PAGE I have absolutely no problems. I get the text in between TAG1 without any problems. However I have some very long documents that I would like to translate to XML and I cannot put the whole document on one line, as it would be impossible to read. I have, however seen other XML files like example 1 that were parsed fine, AND they were parsed with the expat functions. I cannot figure how though. Any help would be appreciated. Thanks in Advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Session] SID automatically add on all pages?
on 30/06/02 11:33 PM, Tim Stoop ([EMAIL PROTECTED]) wrote: Ah yes, I forgot about that... I need to resume the session, of course. Would session.auto_start set to 1 work without these session_start()'s? I believe so... and Jason Wong has sent an email suggesting this. The thing is, I need as less as possible of a hassle to have the sessions work... Read on for an explanation. [snip] I'd say everything will work out, depending of course on the code you're writing to manage everything :) It's worth pointing out that you may not really have to worry about the session_start() call at the top of script. In reality, you may replace this with a single include() statement which contains a library of functions, maintains the session, etc etc as the first line of the file. Much simpler than imposing yet another requirement on the host (portability is always an issue), and much simpler than multiple includes and stuff scattered every where. ? include('inc/header.inc'); ? // includes sessions, functions, etc HTML HEAD bla bla.. /HEAD BODY H1Buy this product!/H1 Pbla bla/P ?=makeBuyButton(black shoes, size 34)? /BODY /HTML Good luck. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register Globals = off
You could leave the setting to ON in your php.ini, and impose OFF on a per-directory (account, domain, etc) basis with a .htaccess file (or vice-versa), assuming you have Apache. This will mean all new clients will have the setting to OFF, and will do things the right way from day 1. It will also allow existing clients to modify their setting to OFF (as I do on a shared server) to keep things a little more secure. You could also advise all existing clients of a planned changeover in 12 months, offer code advise (including a simple function at the top of each script can push all $_GET['var'], POST, SESSION, etc vars into standard $vars), and document the many security holes and benefits of upgrading over time. In 12 months, you can changeover to OFF in the php.ini file. At which time coding practices, books, websites, applications and all the rest will be much more inline than they are now. Justin French on 01/07/02 1:12 AM, PHPCoder ([EMAIL PROTECTED]) wrote: Hi Going through some literature, it seems like the use of registered globals can cause security issues. Now, the dilemma, all my previous PHP installations ( for the last year or so ) have come with register globals = on in the php.ini file by default, and users on my system has happily coded their websites using this function. Now , with all the new versions of PHP, the registered globals are turned off in the ini and will basically cause all those previous sites not to function. Which means that I'm between a rock and a hard place, turn the register globals back on and carry on with the security risks, or keep it off and have all those people re-code their sites... Is there a more gentle solution out there? Am I just misunderstanding the issue? Any light on the matter will be appreciated. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [Session] SID automatically add on all pages?
Tim, You might want to look into a good templating solution, too. You can make it so the customer can maintain all of the HTML and you maintain the PHP, and it's all kept separate. It's would be similar to what it looks like you are doing now. Instead of telling the client to put ?=makeBuyButton(black shoes, size 34)?, you could do something like BuyButton type=shoes size=34, which may be easier for someone with an HTML background to understand. It's up to you. ---John Holmes... -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 12:15 PM To: Tim Stoop; [EMAIL PROTECTED] Subject: Re: [PHP] [Session] SID automatically add on all pages? on 30/06/02 11:33 PM, Tim Stoop ([EMAIL PROTECTED]) wrote: Ah yes, I forgot about that... I need to resume the session, of course. Would session.auto_start set to 1 work without these session_start()'s? I believe so... and Jason Wong has sent an email suggesting this. The thing is, I need as less as possible of a hassle to have the sessions work... Read on for an explanation. [snip] I'd say everything will work out, depending of course on the code you're writing to manage everything :) It's worth pointing out that you may not really have to worry about the session_start() call at the top of script. In reality, you may replace this with a single include() statement which contains a library of functions, maintains the session, etc etc as the first line of the file. Much simpler than imposing yet another requirement on the host (portability is always an issue), and much simpler than multiple includes and stuff scattered every where. ? include('inc/header.inc'); ? // includes sessions, functions, etc HTML HEAD bla bla.. /HEAD BODY H1Buy this product!/H1 Pbla bla/P ?=makeBuyButton(black shoes, size 34)? /BODY /HTML Good luck. Justin French -- 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] fopen(); deciding if going for the IP or domain.
Hello, Is there anyway I can do fopen to try to open a connection to a domain name, if it cant try opening it to the IP? For some weird reason today a domain name wont resolve and Iam getting this error: Warning: php_network_getaddresses: getaddrinfo failed: Name or service not known Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Two cases going to same case?
Can't you write it this way? switch( $bar) { case 2: ... case 1: ... case 3: ... } On Sun, 30 Jun 2002, Leif K-Brooks wrote: I have a switch in a script I'm working on. I need to have case 1 and 2 both to to case 3, but without case 1 going through case 2. Is this possible? -- +91 471 329302 (Office) +91 9473 22280 (Cell) Linuxense Information Systems Pvt. Ltd., Trivandrum, India http://www.linuxense.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [Session] SID automatically add on all pages?
Thanks for the help guys. The one-line include is definitly a very good idea, which I'll use. Templating is very interesting, although, only if it works exactly as you say, with HTML-like tags. I looked at Smart, patTemplate en some others, but they all use {} or [] style tags. In that case, I prefer de php. If anyone knows of a template-engine that can recognise the difference between a custom-tag with and a HTML-tag, I'd appreciate the URL :) For now, I'm going to make this work. -- Kind regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen(); deciding if going for the IP or domain.
The manual shows fopen(http://www.php.net/,r;) works. If you are saying it is only today that it is not working then I wonder if the server (or dns server for it) is down. If on unix, does dig domain.com give an ANSWER section with ip address? If on NT, does nslookup domain.com give an ip address? (with domain.com changed to be whatever server the url you are looking for is on). I don't know anything about the particular error you are getting but maybe the above are some pointers (assuming you didn't just do a typo). HTH Chris [EMAIL PROTECTED] wrote: Hello, Is there anyway I can do fopen to try to open a connection to a domain name, if it cant try opening it to the IP? For some weird reason today a domain name wont resolve and Iam getting this error: Warning: php_network_getaddresses: getaddrinfo failed: Name or service not known Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gradients in PHP GD
Well, I'm deeply moved by your concern - I don't think I was either hostile or impatient however - I was just stating the obvious and implying a question (why isn't it straightforward). That was my problem with your post--why imply the question, and leave it open to interpretation? Why not just ask? Who would mistake a direct request for more info as hostile or impatient? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Problem
On Sun, Jun 30, 2002 at 05:58:59PM +0200, Sebastian A. wrote: I am having some problems parsing XML with PHP. Here is an example of my problem: The answer hasn't changed since the last time we had this same discussion back in early May. Search groups.google.com for message id [EMAIL PROTECTED] --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with online cedit card processing
names of companies that charge a reasonable rate, that you can use you own shopping cart and work well with PHP My company's site uses Innuity as a gateway with PHP pages. You can do whatever you want to get the totals, then POST the charge to their secure server which can return all values back to a script on your site to finish. Pretty well documented too. We use it for web site hosting and domain name registration orders. http://www.teamITS.com/internet/credit_cards.html - Steve Yates - A Penny saved is a congressional oversight. / Taglines by Taglinator - www.srtware.com / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] securing an 'includes' dir
Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 1. Name all included files .inc If you name them *.php then put anything in them inside a function, then when the user browses to that file he/she won't see anything at all. - Steve Yates - A fool and his money... Hey! Where's my wallet? / Taglines by Taglinator - www.srtware.com / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] pop-up windows
Perhaps we could agree on a standard response when someone asks about doing javascript in php. Then when someone asks that question, the first one to send out that canned response wins 1 php credit. John and Jason would be php millionaires by the year out I think. -Original Message- From: Bruce Karstedt [mailto:[EMAIL PROTECTED]] Sent: June 30, 2002 11:27 AM To: 'Justin French'; 'Kevin Stone'; [EMAIL PROTECTED] Subject: RE: [PHP] pop-up windows Here ! Here ! Everyone's time is valuable, and therefore the more we all respect each other's time and opinions, the more valuable a resource this will become. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 2:45 AM To: Kevin Stone; [EMAIL PROTECTED] Subject: Re: [PHP] pop-up windows Importance: Low on 29/06/02 2:53 AM, Kevin Stone ([EMAIL PROTECTED]) wrote: John I hate to critisize you since you are one of the most active members on this list. But are these types of comments really useful? -Kevin No, I'm with John on this one. I'd say I type no, JavaScript is client-side, and PHP is server side around 20 times a week to this list, and that's only when I can be bothered. Searching for pop-up in the archives would have solved the writers problem in about 2 minutes. For this group to maintain it's worth, we need to encourage users to do a LITTLE research before asking obvious questions, and we need to discourage people wasting our time with repetitive questions, or those who clearly subscribe to the but it's so easy to just send an email and wait to be flamed mentality. Regards, Justin French -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] securing an 'includes' dir
Steve Yates wrote: Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 1. Name all included files .inc If you name them *.php then put anything in them inside a function, then when the user browses to that file he/she won't see anything at all. I think this is a very poor tactic, because it covers up the problem rather than doing anything about it. You still allow people to access your modules directly, and worse, you allow them to execute these modules out of context. By restricting your modules to only allow function declarations, you also make things more difficult on yourself without any real benefit. It's much better to properly name your included files *.inc as suggested by Mr. French and either: 1. don't put them under document root (my preference) or: 2. configure your Web server to not allow access to .inc files Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Blank emails
This is one of the mails headers: /dev/cdrom595M 596M 0 100% /mnt/cdrom bash-2.05$ rpm -q redhat-release redhat-release-7.2-1 X-UIDL: =aK!16!7o9!jCB!! ** And this is it's content: System: Linux angel 2.4.7-10 #1 Thu Sep 6 17:21:28 EDT 2001 i586 unknown Architecture: i586 Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc GCC: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 2731 (Red Hat Linux 7.1 2.96-98) Compilation info: CC='gcc' CFLAGS='-O6 -fno-omit-frame-pointer -mpentium' CXX='gcc' CXXFLAGS='-O6 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mpentium' LDFLAGS='' LIBC: lrwxrwxrwx1 root root 13 Dec 16 2001 /lib/libc.so.6 - libc-2.2.4.so -rwxr-xr-x1 root root 5716491 Sep 4 2001 /lib/libc-2.2.4.so -rw-r--r--1 root root 27304836 Sep 4 2001 /usr/lib/libc.a -rw-r--r--1 root root 178 Sep 4 2001 /usr/lib/libc.so Configure command: ./configure --disable-shared --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --without-berkeley-db --with-innodb --enable-assembler --with-mysqld-user=mysql --with-unix-socket-path=/var/lib/mysql/mysql.sock --prefix=/ --with-extra-charsets=complex --exec-prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var/lib/mysql --infodir=/usr/info --includedir=/usr/include --mandir=/usr/man --with-embedded-server --enable-thread-safe-client '--with-comment=Official MySQL RPM' - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php From [EMAIL PROTECTED] Sun Jun 30 06:31:59 2002 Return-Path: [EMAIL PROTECTED] -Original Message- From: Peter [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 6:52 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Blank emails Can you post the code on here? There must be some headers somewhere because the mail has been sent to you - to header. Have you clicked on the email in Outlook and looked at the headers / message source? César aracena [EMAIL PROTECTED] wrote in message 002a01c22019$21a0c210$dfc405c8@gateway">news:002a01c22019$21a0c210$dfc405c8@gateway... Hi all. I know it's Sunday morning and that I'm NOT getting many responses right now ;-) I connected to the net, opened my browser, pointed it towards an e-mail script I've installed this afternoon in my site (SquirrelMail) qnd got into the INBOX. once there, I opened my MS Outlook and received 21 messages regarding PHP mailing list stuff, but all these had no FROM, SUBJECT, TO or CC... I mean, they had body content but no headers to show. ¿¿¿??? mailto:[EMAIL PROTECTED] Cesar Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621 -- 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
RE: [PHP] XML Problem
You were right, I found the following: # Declare the function that runs each time # character data is encountered. function CharacterHandler($Parser, $Line) { global $CData; # Place lines into an array because elements # can contain more than one line of data. $CData[] = $Line; This should, obviously solve the problem, but I am not sure how I should go about using it? Later on, you make the $Cdata a string, $temp, and then the next time you use it: $Temp = $Data['TRADE-DATETIME'] You re-assign it again without using the data. Did I miss something? -Original Message- From: Analysis Solutions [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 8:27 PM To: PHP List Subject: Re: [PHP] XML Problem On Sun, Jun 30, 2002 at 05:58:59PM +0200, Sebastian A. wrote: I am having some problems parsing XML with PHP. Here is an example of my problem: The answer hasn't changed since the last time we had this same discussion back in early May. Search groups.google.com for message id [EMAIL PROTECTED] --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- 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
RE: [PHP] [Session] SID automatically add on all pages?
Well Tim, I don't have much time working with PHP, but I did study the template format made by Ying Zhang. I found it when searching for a shopping cart - PHP made - script. If you want to look at it, search hotscripts for mymarket. To give you an idea, I make just one page with session_start() for all my sites... in the header.inc which is obviously inserted at the top of every page... This page also inserts the login and logout functions, so I can make all the other pages without having to worry about session management. I don't know if this is going to help you, but it sure makes my life easier when working with sessions. C. -Original Message- From: Tim Stoop [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 3:05 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] [Session] SID automatically add on all pages? Thanks for the help guys. The one-line include is definitly a very good idea, which I'll use. Templating is very interesting, although, only if it works exactly as you say, with HTML-like tags. I looked at Smart, patTemplate en some others, but they all use {} or [] style tags. In that case, I prefer de php. If anyone knows of a template-engine that can recognise the difference between a custom-tag with and a HTML-tag, I'd appreciate the URL :) For now, I'm going to make this work. -- Kind regards, Tim -- 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
Re: [PHP] Getting IP from behind proxies
why not assign your user a unique id when they first visit you site and this is registered in a database. The unique id is then passed from page to page in the URL (i.e. get method) when they submit their vote, the PHP page: 1: check to see if that Unique ID is stored in the database (checks it hasn't just been made up) 2: checks to see if the Voted field is set to false if either of the above return as FALSE reject the vote because either the user has already voted or they modified the unique id to try and cheat the system. Now, the only way for them to make multiple votes is to keep getting to the voting page by going back to your homepage and following the links to your vote page or to make up a unique id and hope it's already been created by someone else. Every time you change the poll, you should empty the database as there could be a few unique ids that were created but the visitor didn't vote. It's a bit overkill for a web poll though!!! Bruce Karstedt [EMAIL PROTECTED] wrote in message 000401c22047$925f4840$768c3841@c3">news:000401c22047$925f4840$768c3841@c3... Why not create a cookie for that poll. When the vote check for the cookie. Unless a user clears the cookie himself, you basically limit votes to one per computer or one per computer per user. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 29, 2002 10:34 PM To: JJ Harrison Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Getting IP from behind proxies Importance: Low You need to assign each person a unique identifier of some sort. ie. assign them a login and password and verify that information by sending a message to their email address. Then only people with multiple email addresses can spam your system with votes. Beyond that it comes down to verifying each voter manually. Get a phone number and call each one up. Even that is not quite foolproof. Personal certificates might be an option here, but that is rather cumbersome for everyone involved. Basically there is no good solution for this problem. Until everyone in the world has a unique and non-spoofable, easily verifiable id number, what you are trying to do is impossible. Basically live with the fact that your voting system will be inaccurate and spoofable. -Rasmus On Sun, 30 Jun 2002, JJ Harrison wrote: what esle could i use? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can only get it if the proxy provides you with this data. Most don't, so this is not a reliable approach. -Rasmus On Sat, 29 Jun 2002, JJ Harrison wrote: I want to check to see if people have voted yet for a poll. How can I get the ip of a user from both behind a proxy and the proxies ip? is this simple? will i have trouble with firewalls etc? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- 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 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] Finding all instances
Hi, I have a little problem I am trying to solve but right now I have no idea where to begin. I am preying that someone out there might be able to help me. In my MySQL database I have a group of figures, one for each record. Through PHP I have concluded at a 'magical' number which I will need to compare against. What I need to do is try to find all instances or combinations of figures from the database which fit inside this magical figure, but how I do this I am not sure. I'm thinking I need to somehow read the figures into an array somehow but I have not had enough experience with php to know how to even do this effectively. I have read up on the issue but it all seems double dutch, and I don't know what I need to do from this point anyway. For example: Magic Number: 7 Numbers in database: 12, 6, 2, 8, 5, 3, 1 Combinations returned: 1, 3, 5, 2, 6, 52, 32, 321, 51, 61, 21, 31 Can anyone please help? Thanks, Michael.
[PHP] [more info] Finding all instances
Hi, I have a little problem I am trying to solve but right now I have no idea where to begin. I am preying that someone out there might be able to help me. In my MySQL database I have a group of figures, one for each record. Through PHP I have concluded at a 'magical' number which I will need to compare against. What I need to do is try to find all instances or combinations of figures from the database which fit inside this magical figure, but how I do this I am not sure. I'm thinking I need to somehow read the figures into an array somehow but I have not had enough experience with php to know how to even do this effectively. I have read up on the issue but it all seems double dutch, and I don't know what I need to do from this point anyway. For example: Magic Number: 7 Numbers in database: 12, 6, 2, 8, 5, 3, 1 Combinations returned: 1, 3, 5, 2, 6, 52, 32, 321, 51, 61, 21, 31 Can anyone please help? [MORE INFO: Each record in the database has a unique identifier, numberid, which would be used to identify which records are used in the combinations. We can assume for now that the numberid is equal to the number in the database for simplicity sake. Sorry for not making this clear the first time] Thanks, Michael. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include files or fopen
I am trying to write a program that is very modular in nature one of the features I need the user to be able to do is install/uninstall or enable/disable the module though the interface. I have, in the past, stored such information in a database. In projects that have need of such functionality I create a modules table and use that to store what information I need - normally that's a path to the module, the name of the config file for that module and any other relevant bits that the project as a whole needs to know about. Then when a page loads it can check for any appropriate modules in the process and deal with them accordingly. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Globals bug??
We are seeing a rare bug that seems to imply that there is a bug in PHP's global variables across httpd processes. To make a long story short, it appears that on rare occassions our script gets the value of a HTTP_GET_VARS variable from another user's process. Is this possible? BTW, it seems to occur when using HTTP_GET_VARS and the new 'super globals'. FWIW, we're using PHP 4.1.2 on (Red Hat) Linux 2.4.9 with Apache 1.3.12. Thanks! (please reply via email in addition to posting here if possible) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Globals bug??
I don't see how. But if what you are saying is actually happening, then it is a Linux kernel-level bug if memory is leaking from one process to another. No matter how badly we screwed up in PHP, the kernel prevents such a screwup from infecting a separate process. I'd suggest having a close look at your code. -Rasmus On 30 Jun 2002 [EMAIL PROTECTED] wrote: We are seeing a rare bug that seems to imply that there is a bug in PHP's global variables across httpd processes. To make a long story short, it appears that on rare occassions our script gets the value of a HTTP_GET_VARS variable from another user's process. Is this possible? BTW, it seems to occur when using HTTP_GET_VARS and the new 'super globals'. FWIW, we're using PHP 4.1.2 on (Red Hat) Linux 2.4.9 with Apache 1.3.12. Thanks! (please reply via email in addition to posting here if possible) -- 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
Re: [PHP] [more info] Finding all instances
Well I'm not good enough at SQL to do this, but how about you get PHP to figure out all the combinations, ie 1, 3, 5, 2, 6, 52, 32, 321, 51, 61, 21, 31 Then do a set of SELECT * FROM table WHERE number=1 SELECT * FROM table WHERE number=3 SELECT * FROM table WHERE number=3 OR number=1 Then you can read all these values into a array of some kind and do what you want... I think I may mis-understood the problem a little, but I hope this helps Andrew - Original Message - From: mikeyb [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 30, 2002 10:26 PM Subject: [PHP] [more info] Finding all instances Hi, I have a little problem I am trying to solve but right now I have no idea where to begin. I am preying that someone out there might be able to help me. In my MySQL database I have a group of figures, one for each record. Through PHP I have concluded at a 'magical' number which I will need to compare against. What I need to do is try to find all instances or combinations of figures from the database which fit inside this magical figure, but how I do this I am not sure. I'm thinking I need to somehow read the figures into an array somehow but I have not had enough experience with php to know how to even do this effectively. I have read up on the issue but it all seems double dutch, and I don't know what I need to do from this point anyway. For example: Magic Number: 7 Numbers in database: 12, 6, 2, 8, 5, 3, 1 Combinations returned: 1, 3, 5, 2, 6, 52, 32, 321, 51, 61, 21, 31 Can anyone please help? [MORE INFO: Each record in the database has a unique identifier, numberid, which would be used to identify which records are used in the combinations. We can assume for now that the numberid is equal to the number in the database for simplicity sake. Sorry for not making this clear the first time] Thanks, Michael. -- 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
Re: [PHP] Gradients in PHP GD
The only question I could possibly have asked to leave it open enough to all the possibilities was basically the one I asked. That's because possible reasons for not writing his own function may have been: - he wanted a very basic gradient, but he was such a newbie in PHP that he didn't know how - I would've been happy to help in this case; - he needed some strange gradient/shape/mask - in which case someone who needed the same kind of thing at a previous date would've been able to answer; - he was pressed for time; - he was lazy. Please tell me what would be a question which would leave all these answer opportunities open while also being brief and obviously not being hostile? Bogdan Joshua Alexander wrote: Well, I'm deeply moved by your concern - I don't think I was either hostile or impatient however - I was just stating the obvious and implying a question (why isn't it straightforward). That was my problem with your post--why imply the question, and leave it open to interpretation? Why not just ask? Who would mistake a direct request for more info as hostile or impatient? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More on removing item from cart
Hi Vicki: I'm not going to cover everything in the email. BUT, the essence of the solution is right here. I made a little test script based on the values you said were in the cart array at the top of the page and the variables contained in the form... #! /usr/local/bin/php -q ?php # Simulate the $cart session variable: $cart[1] = 1; $cart[3] = 1; # Simulate the $checkbox array from the form: # $checkbox[1] = 'yes'; $checkbox[3] = 'yes'; # Run through each item in the cart: foreach($cart as $artID = $value) { if ( !isset($checkbox[$artID]) ) { unset($cart[$artID]); echo br /removed $artID from cart\n; } else { echo br /kept $artID in cart\n; } } ? This behaves exactly as expected. Now, let's put my foreach loop from above (leave out all the rest of the stuff) in the place of your foreach loop (which is in the if($save) statement). Run it and things _should_ work right. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gradients in PHP GD
By this point, I am trying to speak generally. Not trying to pick on Bogdan specifically, since communication can always be improved. Please tell me what would be a question which would leave all these answer opportunities open while also being brief and obviously not being hostile? Hmm... not sure... how about, I don't have enough info from your post to help... please tell us more about what exactly you are having problems with? How does that sound? That's fairly general, based on a post I saw here recently. Of course it could be augmented with questions like Are you new to PHP? and, in the specific case we've been discussing, Are you trying to create a basic gradient or something unusual?, etc. -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Gradients in PHP GD
You guys are over-complicating this. If you want to help someone and don't understand their question, just say so. People asking for help are usually more than happy to provide additional information or rephrase their question. Be careful when using the question, Are you new to PHP?. It has an implied, That was an awfully silly question... are you new to PHP?. Some may take that as an insult. Of course, it could be funny as well. Imagine responding to Rasmus, Are you new to PHP? ;) hehe -Original Message- it could be augmented with questions like Are you new to PHP? and, in the specific case we've been discussing, Are you trying to create a basic gradient or something unusual?, etc. This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to put these 2 IF statements into 1, with regex?
Hi People, I was wondering if there is anyway to combine these two IF statements into one: if (preg_match(siteUserList.cgi?group=site177, $QUERY_STRING)) and: if (preg_match(siteUserList.cgi?group=site177, $QUERY_STRING)) In other words I need it to match if the query string HAS or DOESNT HAVE a at the end. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to put these 2 IF statements into 1, with regex?
try this if (preg_match(@siteUserList.cgi?group=site177?@, $QUERY_STRING)) (I added a ? after get ) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 11:29 AM To: [EMAIL PROTECTED] Subject: [PHP] How to put these 2 IF statements into 1, with regex? Hi People, I was wondering if there is anyway to combine these two IF statements into one: if (preg_match(@siteUserList.cgi?group=site177@, $QUERY_STRING)) and: if (preg_match(@siteUserList.cgi?group=site177@, $QUERY_STRING)) In other words I need it to match if the query string HAS or DOESNT HAVE a at the end. Thanks. -- 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] Re: How to put these 2 IF statements into 1, with regex?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: I was wondering if there is anyway to combine these two IF statements into one: if (preg_match(@siteUserList.cgi?group=site177@, $QUERY_STRING)) and: if (preg_match(@siteUserList.cgi?group=site177@, $QUERY_STRING)) Remember that preg_* functions aren't equivalent to str_*; you're matching against a regex pattern now, not just a simple text string. So you must first escape any regex special characters within your text string if you want reliable results. Otherwise, you're going to eventually end up with unintended matches like siteUserList9cggroup=site177. Regarding the rest of your question: the ? character is what you seek. if (preg_match(/siteUserList\.cgi\?group=site177?/, $QUERY_STRING)) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 1 Jul 2002 02:16:39 -0000 Issue 1437
php-general Digest 1 Jul 2002 02:16:39 - Issue 1437 Topics (messages 104573 through 104611): Re: bug in sessions 104573 by: John Holmes Re: Getting IP from behind proxies 104574 by: Bruce Karstedt 104577 by: Rasmus Lerdorf 104598 by: Peter Re: Two cases going to same case? 104575 by: Chris Shiflett 104586 by: Anil Kumar K. Register Globals = off 104576 by: PHPCoder 104580 by: Jason Wong 104583 by: Justin French Re: pop-up windows 104578 by: Bruce Karstedt 104593 by: SP PEAR website down 104579 by: Paul Reilly XML Problem 104581 by: Sebastian A. 104590 by: Analysis Solutions 104596 by: Sebastian A. Re: [Session] SID automatically add on all pages? 104582 by: Justin French 104584 by: John Holmes 104587 by: Tim Stoop 104597 by: César Aracena fopen(); deciding if going for the IP or domain. 104585 by: php.net.co.cr 104588 by: Chris Hewitt Re: Gradients in PHP GD 104589 by: Joshua Alexander 104605 by: Bogdan Stancescu 104607 by: Joshua Alexander 104608 by: Lazor, Ed Re: PHP with online cedit card processing 104591 by: Steve Yates Re: securing an 'includes' dir 104592 by: Steve Yates 104594 by: Chris Shiflett Re: Blank emails 104595 by: César Aracena Finding all instances 104599 by: mikeyb [more info] Finding all instances 104600 by: mikeyb 104604 by: Andrew Brampton Re: include files or fopen 104601 by: David Freeman Globals bug?? 104602 by: troy.recipezaar.com 104603 by: Rasmus Lerdorf Re: More on removing item from cart 104606 by: Analysis Solutions How to put these 2 IF statements into 1, with regex? 104609 by: php.net.co.cr 104610 by: Martin Towell 104611 by: CC Zona 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--- Same for me (PHP4.2.1 on Win). Unset removes the variable from the session for the duration of the script, but doesn't actually remove it from the session. Using session_unregister() does remove the variable from the session. You should post it as a bug, Michal, or tell them to change the documentation. ---John Holmes... -Original Message- From: Michal Dvoracek [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 7:37 AM To: [EMAIL PROTECTED] Subject: [PHP] bug in sessions Hello, i discovered bug in sessions: when using unset($_SESSION[...]) insted session_unregister(...) and before calling read _$SESSION[...] variable WILL NOT unset. please try these examples and see result. here is method how to produce this bug (you must have cookies enabled): 1. run script 2. reload page (you should see 2 $_SESSION arrays with the same value) 3. click on unset link 4. now you should see first array filled with test value and second should be empty - that's OK - but variable test should be deleted from session 5. reload page 6. here is BUG: i unset session variable test so i shouldn't exists, but exists. --- 7. comment line marked #fatal and go to repeat process from begining on step 6. both arrays will be empty cut here-- ?php session_start(); echo 'pre'; print_r($_SESSION); if (isset($_GET['submit'])) { $test = $_SESSION['test']; # fatal unset($_SESSION['test']); } else { $_SESSION['test'] = 'this is test'; } echo 'a href='.$_SERVER['PHP_SELF'].'?submit=yesunset/abr'; print_r($_SESSION); echo '/pre'; ? cut here-- replaceunset($_SESSION['test']); with session_unregister('test'); and repeat process - here will be everything OK. http://www.php.net/manual/en/ref.session.php (see Example 3.) Tested on PHP 4.2.1 (win, Debian). Epilogue: using unset at $_SESSION array is NOT safe. Regards, Michal Dvoracek [EMAIL PROTECTED] Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Why not create a cookie for that poll. When the vote check for the cookie. Unless a user clears the cookie himself, you basically limit votes to one per computer or one per computer per user. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL
[PHP] checking date is not greater than today
I am trying to compare a given date string (i.e. June 30, 2002 is 20020630). I want to make sure that the input string that is given is not greater than today (i.e. if today is June 30, and you ask for 20020701, I want to be able to throw an error). I'm a newbie, so I'm not sure the best way to do this. My thought was that if I take the year () and add on the day-of-year (i.e. Feb 10 = 041) then I would be able to compare them as you would any other numbers. The problem I have then run into is that strftime and date seem to have different opinions as to what day of the year it is. date z - day of the year; i.e. 0 to 365 strftime %j - day of the year as a decimal number (range 001 to 366) I have these variables defined $SEARCHYEAR = i.e 2002 $SEARCHMONTH = MM i.e. 06 $SEARCHDAY = DD i.e. 30 $TODAYCMP=date (Yz); $SEARCHCMP=strftime(%Y%j,mktime(0,0,0,$SEARCHMONTH,$SEARCHDAY,$SEARCHYEAR)); and then I tried it for today and got echo !-- TODAY is $TODAYCMP SEARCHCMP is $SEARCHCMP -- ; as a result I get !-- TODAY is 2002180 SEARCHCMP is 2002181 -- So I'm trying to figure out: A) Why strftime and date don't handle leap years the same way and (more importantly) B) The best way to make sure a given date MMDD is not greater than today I did some googling php.net searching without luck. Thanks TjL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] emulating enable_trans_sid
Hi, As discussed a few months back, I'm interested attempting to recreate PHP's enable_trans_sid feature, for users without cookies. ONLY if cookies are UNavailable, I want to open the output buffer, build the page, then run a reg exp or something over the output to append SIDs to all URLs (GET), then print it. I've got a pretty good picture in my head of how I'll test for cookies, and how I'll do the output buffering, but regexp's are NOT my thing :) I'm interested in hearing some opinions on the most efficient way to append the SID to all internal URLs on the page... this would include: - header(Location: something.php) - A href=something.php - FORM action=something.php My thoughts are that it would only be done for relative links (dir/something.php), NOT for fully qualified URLs (http://otherdomain.com, ftp://, mailto:, https://, ?), as per enable_trans_sid documentation. It would also have to accommodate URLs which already have a query string... if there's an existing query string, just append SID, otherwise append ?SID. This seems to me like a rather in-depth regexp already, and I'm sure i'm forgetting something. Perhaps there's a simpler way that I'm missing? The only simpler way I can think of would be to search for '.php' and '.php?' and act accordingly, but this has obvious problems when 'something.php' is type, but not in context of a link or header redirection. Where would I look to see the source of enable_trans_sid -- maybe this will give me some hints?? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] emulating enable_trans_sid
Hi enable_trans_sid does exactly what you are trying to re create, if no cookies are available it modifies all the urls automatically. and transparently Tom At 12:48 PM 1/07/2002 +1000, Justin French wrote: Hi, As discussed a few months back, I'm interested attempting to recreate PHP's enable_trans_sid feature, for users without cookies. ONLY if cookies are UNavailable, I want to open the output buffer, build the page, then run a reg exp or something over the output to append SIDs to all URLs (GET), then print it. I've got a pretty good picture in my head of how I'll test for cookies, and how I'll do the output buffering, but regexp's are NOT my thing :) I'm interested in hearing some opinions on the most efficient way to append the SID to all internal URLs on the page... this would include: - header(Location: something.php) - A href=something.php - FORM action=something.php My thoughts are that it would only be done for relative links (dir/something.php), NOT for fully qualified URLs (http://otherdomain.com, ftp://, mailto:, https://, ?), as per enable_trans_sid documentation. It would also have to accommodate URLs which already have a query string... if there's an existing query string, just append SID, otherwise append ?SID. This seems to me like a rather in-depth regexp already, and I'm sure i'm forgetting something. Perhaps there's a simpler way that I'm missing? The only simpler way I can think of would be to search for '.php' and '.php?' and act accordingly, but this has obvious problems when 'something.php' is type, but not in context of a link or header redirection. Where would I look to see the source of enable_trans_sid -- maybe this will give me some hints?? Justin French -- 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] Printing
Is there a way to bypass the print popup window within linux? I wish to run a print job of 200 or so invoices and don't want the promp for every page I print.. Is any one able to point me in the right direction.. Thanks in advance.. --- Chris Kay Technical Support - Techex Communications Website: www.techex.com.au Email: [EMAIL PROTECTED] Telephone: 1300 88 111 2 - Fax: (02) 9970 5788 Address: Suite 13, 5 Vuko Place, Warriewood, NSW 2102 Platinum Channel Partner of the Year - Request DSL - Broadband for Business --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fast code to partially flatten an array based on several keys?
Martin, I said I'd let you know how I got on. It's all working, but only realistically for no more than 500 or so records. When I feed it 1+ records, the machine chokes. So I'm back to textbooks just looking for clues on really fast sorting and searching algorithms. I've written a mostly working quicksort routine, which seems to have cut the time down significantly on searches, so I'll keep plugging away at this. Of course, now that it *appears* to be working, I'm getting a lot more work dumped on me, so finishing it off is going to take a bit longer. =) Morgan Grubb. Martin Towell [EMAIL PROTECTED] wrote in message 6416776FCC55D511BC4E0090274EFEF508A550@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A550@EXCHANGE... This is what I came up with before I saw this email, and eek, we think the same (sorta) This is going to be a bit iffy, but here goes (BTW: this hasn't been tested, so expect heaps of errors :) ) $i = 0; while ($row = mysql_fetch_assoc($result)) { for ($j = 0, $found = false; $j $i !$found; $j++) { if ($vehicles[$j]['dealer_id'] == $row['dealer_id'] $vehicles[$j]['vehicle_id'] == $row['vehicle_id']) { $found = true; $idx = $j } } if (!$found) { $idx = $i; $i++; } $vehicles[$idx]['dealer_id'] = $row['dealer_id']; $vehicles[$idx]['vehicle_id'] = $row['vehicle_id']; $vehicles[$idx][$row['company_id']] = $row['page_views']; } The other thing I just thought of is: can $row['dealer_id'] and $row['vehicle_id'] be indexes to the array $vehicles[$row['dealer_id']][$row['vehicle_id']][$row['company_id']] = $row['page_views']; so you'd get something like (manually created result...): ( [645] = Array ( [35073] = Array ( [1] = 10 [0] = 6 ) ) ) -Original Message- From: Morgan Grubb [mailto:[EMAIL PROTECTED]] Sent: Friday, June 28, 2002 11:35 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Fast code to partially flatten an array based on several keys? Martin, Here's an example of what I implemented (simplified down again). As you can see, it's hideously simple and not optimized in the least. It works well on small datasets, but you can see by looking at it that large datasets get exponentially slower. while ($row = mysql_fetch_assoc($result)) { $found = false; $count = count($vehicles); for ($j = 0; $j $count; $j++) { if ( $vehicles[$j]['dealer_id'] == $row['dealer_id'] $vehicles[$j]['vehicle_id'] == $row['vehicle_id'] ) { $vehicles[$j][$row['company_id']] = $row['page_views']; $found = true; } } if (!$found) { $vehicles[$i]['dealer_id'] = $row['dealer_id']; $vehicles[$i]['vehicle_id'] = $row['vehicle_id']; $vehicles[$i][$row['company_id']] = $row['page_views']; } $i++; } Morgan Grubb. Martin Towell [EMAIL PROTECTED] wrote in message 6416776FCC55D511BC4E0090274EFEF508A54E@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A54E@EXCHANGE... this sort of merging would be easier to do when you create the array (unless you need the other format for something else?) -Original Message- From: Morgan Grubb [mailto:[EMAIL PROTECTED]] Sent: Friday, June 28, 2002 11:09 AM To: [EMAIL PROTECTED] Subject: [PHP] Fast code to partially flatten an array based on several keys? I have a large dataset which can contain many different fields, and I'm trying to flatten them in such a way that I can display it happily in a table. To simplify: I'm populating the array such (many many more fields, but these will do): $i = 0; while ($row = mysql_fetch_assoc($result)) { $vehicles[$i]['dealer_id'] = $row['dealer_id']; $vehicles[$i]['vehicle_id'] = $row['vehicle_id']; $vehicles[$i][$row['company_id']] = $row['page_views']; $i++; } Now, if that vehicle_id and dealer_id combination exist, instead of adding it as another record completely, just add $vehicles[$existing_id][$row['company_id']] = $row['page_views']; The end result of this would be (if given two 'company_id' records for the given dealer): ( [0] = Array ( [dealer_id] = 645 [vehicle_id] = 35073 [1] = 10 ) [1] = Array ( [dealer_id] = 645 [vehicle_id] = 35073 [0] = 6 ) ) Turns into: ( [0] = Array ( [dealer_id] = 645 [vehicle_id] = 35073 [1] = 10 [0] = 6 ) ) Can anyone think of a fast way to do this
Re: [PHP] Printing
On Monday 01 July 2002 11:16, Chris Kay wrote: Is there a way to bypass the print popup window within linux? That's a function of whatever browser you're using! -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Such a foolish notion, that war is called devotion, when the greatest warriors are the ones who stand for peace. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Fast code to partially flatten an array based on several keys?
Sorting - are you sorting the array keys or the values ? If you're sorting the keys, maybe it would be better to have another array that holds a list of keys, sort that, and then use that as a pointer to the actual array. If you're sorting the values, then php has a good sort function (uses the quick sort algorithm if I remember rightly) -Original Message- From: Morgan Grubb [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Fast code to partially flatten an array based on several keys? Martin, I said I'd let you know how I got on. It's all working, but only realistically for no more than 500 or so records. When I feed it 1+ records, the machine chokes. So I'm back to textbooks just looking for clues on really fast sorting and searching algorithms. I've written a mostly working quicksort routine, which seems to have cut the time down significantly on searches, so I'll keep plugging away at this. Of course, now that it *appears* to be working, I'm getting a lot more work dumped on me, so finishing it off is going to take a bit longer. =) Morgan Grubb. [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] checking date is not greater than today
$today = date(Ymd); if($input_date $today) { echo Date must be before today!; } It looks like you're dealing with MySQL dates. There are a ton of useful functions you can use in your queries that make any time manipulation in PHP unnecessary. Chapter 6, Date and Time Functions of the MySQL manual. ---John Holmes... -Original Message- From: Timothy J. Luoma [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 10:31 PM To: PHP Mailing List Subject: [PHP] checking date is not greater than today I am trying to compare a given date string (i.e. June 30, 2002 is 20020630). I want to make sure that the input string that is given is not greater than today (i.e. if today is June 30, and you ask for 20020701, I want to be able to throw an error). I'm a newbie, so I'm not sure the best way to do this. My thought was that if I take the year () and add on the day-of-year (i.e. Feb 10 = 041) then I would be able to compare them as you would any other numbers. The problem I have then run into is that strftime and date seem to have different opinions as to what day of the year it is. date z - day of the year; i.e. 0 to 365 strftime %j - day of the year as a decimal number (range 001 to 366) I have these variables defined $SEARCHYEAR = i.e 2002 $SEARCHMONTH = MM i.e. 06 $SEARCHDAY = DD i.e. 30 $TODAYCMP=date (Yz); $SEARCHCMP=strftime(%Y%j,mktime(0,0,0,$SEARCHMONTH,$SEARCHDAY,$SEARCHY EA R)); and then I tried it for today and got echo !-- TODAY is $TODAYCMP SEARCHCMP is $SEARCHCMP -- ; as a result I get !-- TODAY is 2002180 SEARCHCMP is 2002181 -- So I'm trying to figure out: A) Why strftime and date don't handle leap years the same way and (more importantly) B) The best way to make sure a given date MMDD is not greater than today I did some googling php.net searching without luck. Thanks TjL -- 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
Re: [PHP] emulating enable_trans_sid
I'm aware of this. What I'm trying to do is emulate this process on servers which have not compiled with --enable_trans_sid. I thought that was pretty clear, but perhaps not. In the ideal world, enable_trans_sid would have been compiled, but I'm yet to find many shared hosts where this has been done. And since shared servers seem to be what my current client set are using, I'm looking at emulating enable_trans_sid. Regards, Justin French on 01/07/02 1:07 PM, Tom Rogers ([EMAIL PROTECTED]) wrote: Hi enable_trans_sid does exactly what you are trying to re create, if no cookies are available it modifies all the urls automatically. and transparently Tom At 12:48 PM 1/07/2002 +1000, Justin French wrote: Hi, As discussed a few months back, I'm interested attempting to recreate PHP's enable_trans_sid feature, for users without cookies. ONLY if cookies are UNavailable, I want to open the output buffer, build the page, then run a reg exp or something over the output to append SIDs to all URLs (GET), then print it. I've got a pretty good picture in my head of how I'll test for cookies, and how I'll do the output buffering, but regexp's are NOT my thing :) I'm interested in hearing some opinions on the most efficient way to append the SID to all internal URLs on the page... this would include: - header(Location: something.php) - A href=something.php - FORM action=something.php My thoughts are that it would only be done for relative links (dir/something.php), NOT for fully qualified URLs (http://otherdomain.com, ftp://, mailto:, https://, ?), as per enable_trans_sid documentation. It would also have to accommodate URLs which already have a query string... if there's an existing query string, just append SID, otherwise append ?SID. This seems to me like a rather in-depth regexp already, and I'm sure i'm forgetting something. Perhaps there's a simpler way that I'm missing? The only simpler way I can think of would be to search for '.php' and '.php?' and act accordingly, but this has obvious problems when 'something.php' is type, but not in context of a link or header redirection. Where would I look to see the source of enable_trans_sid -- maybe this will give me some hints?? Justin French -- 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
Re: [PHP] checking date is not greater than today
On Sun, 30 Jun 2002, John Holmes wrote: $today = date(Ymd); if($input_date $today) { echo Date must be before today!; } *thwaps self* DUH! Thanks... been staring at this for too long. It looks like you're dealing with MySQL dates. There are a ton of useful functions you can use in your queries that make any time manipulation in PHP unnecessary. Chapter 6, Date and Time Functions of the MySQL manual. I'm not dealing with MySQL dates yet, just simple query strings, but I'll check that out before I get into MySQL. Thanks TjL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Problem
Sire: On Sun, Jun 30, 2002 at 10:21:40PM +0200, Sebastian A. wrote: Later on, you make the $Cdata a string, $temp, and then the next time you use it: $Temp = $Data['TRADE-DATETIME'] You re-assign it again without using the data. Did I miss something? Yes. Further down was the default case, with the line: $Data[$Elem] = $Temp; But, that's not there any more. I reworked that file a bit to clarify that and add in more error checking. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP with CSS
Quick question? Is their anything in Apache or PHP that would keep styles from working. Both external (CSS) and inline styles are ignored. Environment : Win XP Pro Apache 2.0.39 PHP 4.2.1 Writing Debugging on Homesite 4.0.1 Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP with CSS
if in-line styles aren't working (and you can see them when you do a view source) then it's nothing to do with apache. (unless there's a header() command I don't know about that stops them from working...) Martin -Original Message- From: Bruce Karstedt [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 2:32 PM To: PHP - General List (E-mail) Subject: [PHP] PHP with CSS Quick question? Is their anything in Apache or PHP that would keep styles from working. Both external (CSS) and inline styles are ignored. Environment : Win XP Pro Apache 2.0.39 PHP 4.2.1 Writing Debugging on Homesite 4.0.1 Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -- 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
RE: [PHP] PHP with CSS
Bruce... there is nothing stopping it from working unless they are turned off in the browser's settings... just be mindful that CSS works slightly differently in netscape to ie.. -Original Message- From: Bruce Karstedt [mailto:[EMAIL PROTECTED]] Sent: Monday, 1 July 2002 2:32 PM To: PHP - General List (E-mail) Subject: [PHP] PHP with CSS Quick question? Is their anything in Apache or PHP that would keep styles from working. Both external (CSS) and inline styles are ignored. Environment : Win XP Pro Apache 2.0.39 PHP 4.2.1 Writing Debugging on Homesite 4.0.1 Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] securing an 'includes' dir
Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Steve Yates wrote: If you name them *.php then put anything in them inside a function, then when the user browses to that file he/she won't see anything at all. I think this is a very poor tactic, because it covers up the problem rather than doing anything about it. (...) It's much better to properly name your included files *.inc as suggested by Mr. French and either: 1. don't put them under document root (my preference) or: 2. configure your Web server to not allow access to .inc files I guess I wasn't trying to say that my suggestion was a complete solution, but one thing to consider. For instance, what happens if the .htaccess file is accidentally deleted? Then there's no protection. Or say the host upgrades PHP or Apache and for whatever reason PHP files aren't being parsed? Then my suggestion doesn't solve things (but moving them outside the htdocs structure will, if available as an option). Is there an advantage to not putting code in included files inside functions? I wasn't sure if you were critiquing that part of my suggestion also. - Steve Yates - Edit. Assemble. Link. Run. Curse. Boot. / Taglines by Taglinator - www.srtware.com / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checking date is not greater than today
On 30 Jun 2002 at 22:31, Timothy J. Luoma wrote: I am trying to compare a given date string (i.e. June 30, 2002 is 20020630). I want to make sure that the input string that is given is not greater than today (i.e. if today is June 30, and you ask for 20020701, I want to be able to throw an error). I'm a newbie, so I'm not sure the best way to do this. My thought was that if I take the year () and add on the day-of-year (i.e. Feb 10 = 041) then I would be able to compare them as you would any other numbers. [...] snipped I ignored the rest as it was beyond me. I'm also a newbie to PHP but I looked into dates in Perl. I quickly began using a module from CPAN as I realized this was more complicated than meets the eye and you seem to indcate that when you mention leap years. I would question why you accept input as a particular format. It's certainly easier to work with timestamps than arbitrary representations of dates. I would not be so quick to assume you have to accept input as is. Or at least have it fixed to a format ... but the Perl modules I've worked with are liberal with what they receive :) Anyhow, I'd just find a PHP module ot handle this. I found this: http://www.phpbuilder.com/columns/akent2610.php3 but I'd just want a class (guess you call it that in PHP). And then this looks real interesting: Date/Time Processing with PHP By The Disenchanted Developer March 19, 2002 http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/DateTime/page1.html In Perl I happen to use this moduel for date manipulation: http://search.cpan.org/doc/STBEY/Date-Calc-5.0/Calc.pod There must be something similar in PHP but since I too am a newbie (and lazy to boot) I don't know what it is. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: checking date is not greater than today
On Mon, 1 Jul 2002, Peter J. Schoenster wrote: On 30 Jun 2002 at 22:31, Timothy J. Luoma wrote: I am trying to compare a given date string (i.e. June 30, 2002 is 20020630). I want to make sure that the input string that is given is not greater than today (i.e. if today is June 30, and you ask for 20020701, I want to be able to throw an error). I would question why you accept input as a particular format. It's certainly easier to work with timestamps than arbitrary representations of dates. I would not be so quick to assume you have to accept input as is. Or at least have it fixed to a format ... but the Perl modules I've worked with are liberal with what they receive :) Anyhow, I'd just find a PHP module ot handle this. In general, the user shouldn't ever have to format the date... it's all automatically generated. However, wise users will look at http://www.tntluoma.com/ethan/daily/index.php?20020701 and realize that they could possibly look ahead by manually editing the URL and going to http://www.tntluoma.com/ethan/daily/index.php?20020702 That's all I wanted to avoid. I'm using that particular date string because it works easily with what I am trying to accomplish. I am surprised, however, that two PHP functions would deal differently with the way that day#-of-the-year is handled (365 vs 366). Thanks to all who made suggestions on/off list, I believe I now have it working. TjL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP with CSS
Checking view source was the first thing I thought of. The inline code appears OK, style sheets, I only see the link of course. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 11:31 PM To: '[EMAIL PROTECTED]'; PHP - General List (E-mail) Subject: RE: [PHP] PHP with CSS Importance: Low if in-line styles aren't working (and you can see them when you do a view source) then it's nothing to do with apache. (unless there's a header() command I don't know about that stops them from working...) Martin -Original Message- From: Bruce Karstedt [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 2:32 PM To: PHP - General List (E-mail) Subject: [PHP] PHP with CSS Quick question? Is their anything in Apache or PHP that would keep styles from working. Both external (CSS) and inline styles are ignored. Environment : Win XP Pro Apache 2.0.39 PHP 4.2.1 Writing Debugging on Homesite 4.0.1 Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] emulating enable_trans_sid
Hi Ok probably the easiest is just to add ?if(!empty(SID) echo 'sid='.SID? to the end of each url, if cookies are supported SID will be an empty string. Tom At 01:59 PM 1/07/2002 +1000, you wrote: I'm aware of this. What I'm trying to do is emulate this process on servers which have not compiled with --enable_trans_sid. I thought that was pretty clear, but perhaps not. In the ideal world, enable_trans_sid would have been compiled, but I'm yet to find many shared hosts where this has been done. And since shared servers seem to be what my current client set are using, I'm looking at emulating enable_trans_sid. Regards, Justin French on 01/07/02 1:07 PM, Tom Rogers ([EMAIL PROTECTED]) wrote: Hi enable_trans_sid does exactly what you are trying to re create, if no cookies are available it modifies all the urls automatically. and transparently Tom At 12:48 PM 1/07/2002 +1000, Justin French wrote: Hi, As discussed a few months back, I'm interested attempting to recreate PHP's enable_trans_sid feature, for users without cookies. ONLY if cookies are UNavailable, I want to open the output buffer, build the page, then run a reg exp or something over the output to append SIDs to all URLs (GET), then print it. I've got a pretty good picture in my head of how I'll test for cookies, and how I'll do the output buffering, but regexp's are NOT my thing :) I'm interested in hearing some opinions on the most efficient way to append the SID to all internal URLs on the page... this would include: - header(Location: something.php) - A href=something.php - FORM action=something.php My thoughts are that it would only be done for relative links (dir/something.php), NOT for fully qualified URLs (http://otherdomain.com, ftp://, mailto:, https://, ?), as per enable_trans_sid documentation. It would also have to accommodate URLs which already have a query string... if there's an existing query string, just append SID, otherwise append ?SID. This seems to me like a rather in-depth regexp already, and I'm sure i'm forgetting something. Perhaps there's a simpler way that I'm missing? The only simpler way I can think of would be to search for '.php' and '.php?' and act accordingly, but this has obvious problems when 'something.php' is type, but not in context of a link or header redirection. Where would I look to see the source of enable_trans_sid -- maybe this will give me some hints?? Justin French -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP with CSS
1. when you say the link, you're talking about the link tag right? if so, are you sure your syntax is correct - this tag is something I keep stuffing up (using src instead of href, forgetting rel=stylesheet [is this required?], setting type=text/stylesheet instead of type=text/css) 2. is the style sheet file accessable from the web can't think of anything else that could be wrong -Original Message- From: Bruce Karstedt [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 3:17 PM To: 'Martin Towell'; 'PHP - General List (E-mail)' Subject: RE: [PHP] PHP with CSS Checking view source was the first thing I thought of. The inline code appears OK, style sheets, I only see the link of course. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 11:31 PM To: '[EMAIL PROTECTED]'; PHP - General List (E-mail) Subject: RE: [PHP] PHP with CSS Importance: Low if in-line styles aren't working (and you can see them when you do a view source) then it's nothing to do with apache. (unless there's a header() command I don't know about that stops them from working...) Martin -Original Message- From: Bruce Karstedt [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 2:32 PM To: PHP - General List (E-mail) Subject: [PHP] PHP with CSS Quick question? Is their anything in Apache or PHP that would keep styles from working. Both external (CSS) and inline styles are ignored. Environment : Win XP Pro Apache 2.0.39 PHP 4.2.1 Writing Debugging on Homesite 4.0.1 Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP with CSS
In article 001101c220b8$5338fc30$768c3841@c3, [EMAIL PROTECTED] (Bruce Karstedt) wrote: Quick question? Is their anything in Apache or PHP that would keep styles from working. Both external (CSS) and inline styles are ignored. If it was the only the external stylesheet that wasn't working, the first thing to do would be to check that Apache is configured to the right content type (text/css) for it and that the PHP code isn't doing anything silly like sending the dynamically-generating the *.css page with a header() declaring a different content type; but with the inline styles also not working, that scenario would either be unlikely or only part of the story. Have the HTML and CSS both been validated yet? If the output of your PHP includes syntactically-flawed HTML, that could lead to problems with the CSS rendering as well. And of course, invalid CSS will not render as expected. This final thought may already be obvious to you, but is there any chance that the styles you're using are either not supported by your browser, or that your page's doctype has accidentally triggered the browser's less-forgiving standards mode? (If any of this sounds unfamiliar, you can follow-up with a newsgroup or list where CSS is on-topic, such as news:comp.infosystems.www.authoring.stylesheets.) Good luck! -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] emulating enable_trans_sid
on 01/07/02 3:36 PM, Tom Rogers ([EMAIL PROTECTED]) wrote: Ok probably the easiest is just to add ?if(!empty(SID) echo 'sid='.SID? to the end of each url, if cookies are supported SID will be an empty string. I want to avoid this, because it adds a level of complexity to the construction of pages that I'm not comfortable with. With multiple writers, designers and programmers passing stuff around, it'll be way too easy to loose the session. I'm not really looking for easiest, I'm looking for the solution, regardless of how long it take to perfect, because this will be a write-once solution that I'll use over and over. It's quite possible that the end solution will require a decent HTML parser or state engine. Fun fun :) Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] emulating enable_trans_sid
Justin It's quite possible that the end solution will require a decent HTML parser or state engine. Fun fun :) Do you have any JS that will have to be altered because of what you're trying to do. 'Cause if you have to write an HTML parser, you'd prob have to write a JS parser too :) More fun for ya! Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php