RE: [PHP] [Fwd: Can you help me about the installation of apache/php/MySQl/ssl ?]
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 30 July 2002 4:17 PM To: [EMAIL PROTECTED] Subject: [PHP] [Fwd: Can you help me about the installation of apache/php/MySQl/ssl ?] Hello, Can you help me about this problem ? Thanks, Edward. think u'll find that php.ini should be in /usr/local/lib dir not apache conf dir make sure you have the following in httpd.conf AddModule mod_php4.c LoadModule libexec/libphp4.so and see if that helps ya -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Fwd: Can you help me about the installation of apache/php/MySQl/ssl ?]
On Tuesday 30 July 2002 14:17, [EMAIL PROTECTED] wrote: Can you help me about this problem ? Try google. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Before borrowing money from a friend, decide which you need more. -- Addison H. Hallock */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL password()
Hi all, I do this: dbconnect(); $query=SELECT * FROM users where username='$PHP_AUTH_USER'; $result=mysql_query($query); $list=mysql_fetch_array($result); if ($PHP_AUTH_PW !== $list[passwd] || == $PHP_AUTH_PW || all != $list[domain]){ Header(WWW-authenticate: basic realm=\EMM\); Header( HTTP/1.0 401 Unauthorized); unauthorized(); exit; } } Noe this bit: if ($PHP_AUTH_PW !== $list[passwd] My problem is that the password stored in MySQL was done with password(), so it comes out similar to this as plain text: 072g307j9236a82h3u How do I Un password() it? I have RTFM but to no avail. If you tell me to RTFM again, at least tell me what to search for ;-) Cheers, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Resetting ID
Save all the entries somewhere programmatically, then do DELETE * FROM tablename; re insert all the entries (of course do not enter the ID field, cause it will be auto assigned). gl, Thomas Edison Jr. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Glory! I have a table, with 4 columns. One of the column is ID, a Primary Key, which has Auto_Increment set on it. Now i have a lot of rows deleted and a lot of duplicate rows that will be deleted, and all sorts of stuff happening in the table.. the result is, that the IDs have become inconsistent. What you get is something like 5,6,9,10,25,32,33 .. and so on. With many IDs missing etc. What i want to do is delete the entire IDs and generate them again so that they are in one single order like 1,2,3,4,5... .like this. And so that any new entry in the table gets the ID accordingly. How can i do this? Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MYSQL natsort() ?
Well, you can do something like: SELECT * FROM tablename ORDER BY fieldname [ASC|DESC] = [ASC|DESC] optional, put either of theses without the brackets. //Elias. Joel Colombo [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... This is a mysql question, cause i can do it with a natsort in php. question is can u do it directly in the MYSQL SELECT ? I am wondering if the SELECT statement can have a natural order by. Table has 5 rows. field name number values : 10 2 15 30 150 a regular order by number: generates results 10,15,150,2,30 i need a natural sort 2,10,15,30,150 is there a way to sort FLOAT valuse like this using an order by with a combo of other functions or something ? Thanks Joel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Resetting ID
What i want to do is delete the entire IDs and generate them again so that they are in one single order like 1,2,3,4,5... .like this. I suspect that if your table, as you use it, needs this ordering then you've got something wrong. It really shouldn't matter much what the internal IDs are. When you extract the data you'll be ordering it by some means that may or may not include the ID ie. You might sort by date or some other field in the table, in which case, the ID's are irrelevant - particularly if you're doing a select that excludes some of the data anyway. If you seriously need all your id's to be sequential and have no gaps then I suspect that about the only way you'll achieve it is probably to drop the contents and enter the information all over again. Of course, then you'll need to do the same again if you delete any information from the table and so on and so on... There may well be other ways, I've not really looked as I tend to think a reliance of this sort is counter-productive so I've never needed to look. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL password()
Mmm.. think you misinterpreted my question... http://www.mysql.com/doc/M/i/Miscellaneous_functions.html PASSWORD(str) how do you unPASSWORD(str) in PHP? - Original Message - From: Negrea Mihai [EMAIL PROTECTED] To: Liam MacKenzie [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 4:31 PM Subject: Re: [PHP] MySQL password() Try doing on the first time this: $query=SELECT * FROM users where username='$PHP_AUTH_USER' and passwd =password($PHP_AUTH_PW); then with mysql_num_rows you find out if the query returned any row.. or with is_resource() if it returned then the authentication was successfull.. if not.. not :) On Tuesday 30 July 2002 09:28 am, Liam MacKenzie wrote: Hi all, I do this: dbconnect(); $query=SELECT * FROM users where username='$PHP_AUTH_USER'; $result=mysql_query($query); $list=mysql_fetch_array($result); if ($PHP_AUTH_PW !== $list[passwd] || == $PHP_AUTH_PW || all != $list[domain]){ Header(WWW-authenticate: basic realm=\EMM\); Header( HTTP/1.0 401 Unauthorized); unauthorized(); exit; } } Noe this bit: if ($PHP_AUTH_PW !== $list[passwd] My problem is that the password stored in MySQL was done with password(), so it comes out similar to this as plain text: 072g307j9236a82h3u How do I Un password() it? I have RTFM but to no avail. If you tell me to RTFM again, at least tell me what to search for ;-) Cheers, Liam -- Negrea Mihai web: http://www.negrea.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image out of LDAP
Good morning, I'm running a OpenLDAP database which includes JPEG photos for some entries. The purpose is to view these images on a web page. Unfortunately I do not have much experience with PHP so any help would be very appreciated. Thanks in advance, Manuel Vazquez -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php extension problem
We've successfully installed and run PHP 4.0.6. However when we add an extension for win9x printing we get the message PHP Warning: Unable to load dynamic library 'c:\php\extensions/php_printer.dll' a device attached to the system is not functioning. The php.ini file has extension_dir=c:\php\extensions and includes the statement extension=php_printer.dll Any ideas would be most welcome! Cheers Peter Williams Analyst Programmer Calvary Health Care Tasmania -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL password()
To my knowledge it isn't possible to decrypt the PASSWORD function in MySQL (you need to use MySQL ENCRYPT/DECRYPT for that). However, it's possible to use PASSWORD on the user-provided string too. You could try the following code: $query=SELECT * FROM users where username='$PHP_AUTH_USER' AND passwd=PASSWORD('$PHP_AUTH_PW'); $result = mysql_query($query) or die(Couldn't execute query!); if (mysql_num_rows($result) 0) { // user exists } else { // user don't exist } Kindly /lasso ([EMAIL PROTECTED]) Liam Mackenzie wrote: Hi all, I do this: dbconnect(); $query=SELECT * FROM users where username='$PHP_AUTH_USER'; $result=mysql_query($query); $list=mysql_fetch_array($result); if ($PHP_AUTH_PW !== $list[passwd] || == $PHP_AUTH_PW || all != $list[domain]){ Header(WWW-authenticate: basic realm=\EMM\); Header( HTTP/1.0 401 Unauthorized); unauthorized(); exit; } } Noe this bit: if ($PHP_AUTH_PW !== $list[passwd] My problem is that the password stored in MySQL was done with password(), so it comes out similar to this as plain text: 072g307j9236a82h3u How do I Un password() it? I have RTFM but to no avail. If you tell me to RTFM again, at least tell me what to search for ;-) Cheers, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fullname
Hey php-general, is there some other easyer way to do in one line than this?: $fullname = $session[f_name]; $fullname .= ; $fullname .= $session[l_name]; P.S the thing is to add line in the middle of the first and last names :) Thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fullname
Is this easier for you? $fullname = $session[f_name]. .$session[l_name]; - Original Message - From: Mantas Kriauciunas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 30 July, 2002 7:11 PM Subject: [PHP] fullname Hey php-general, is there some other easyer way to do in one line than this?: $fullname .= ; $fullname .= P.S the thing is to add line in the middle of the first and last names :) Thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- 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] MySQL password()
Mmm.. think you misinterpreted my question... http://www.mysql.com/doc/M/i/Miscellaneous_functions.html PASSWORD(str) how do you unPASSWORD(str) in PHP? Basically, you don't. Instead, what you do is use the password that was provided as user input. You create a suitable database query where one of the select criteria is PASSWORD(user_input_password) - then if you get a match they must have entered the right password. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fullname
is there some other easyer way to do in one line than this?: $fullname = $session[f_name]; $fullname .= ; $fullname .= $session[l_name]; $fullname = $session[f_name] . . $session[l_name]; CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image out of LDAP
Hi On Tue, Jul 30, 2002 at 09:00:09AM +0200, Manuel Vazquez wrote: Good morning, I'm running a OpenLDAP database which includes JPEG photos for some entries. The purpose is to view these images on a web page. Unfortunately I do not have much experience with PHP so any help would be very appreciated. The archives should be useful. See http://marc.theaimsgroup.com/?l=php-devm=102495056502016w=2 for the general idea. For the actual script, have a look at http://marc.theaimsgroup.com/?l=php-generalm=93635963618041w=2 Stig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Table formatting -- PARTIALY SOLVED
why would you expect a for loop to know whether there was an array returned from the mysql_fetch_array($result). you haven't told it to check this. This is why I suggested using the fetch_array() to control the loop and a counter to determine when to start and end rows - did you not get that? Tim Ward www.chessish.com -Original Message- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: 29 July 2002 16:39 To: 'Martin Towell'; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Table formatting -- PARTIALY SOLVED Thnx a lot Martin and all, this worked. Anyway, apart of this being a logical solution (I almost kill myself for not thinking it before), why is that the FOR looping (before using that division operator) worked in such a strange way? Isn't it supposed to stop looping if nothing else is fetched from the DB? Pardon my interest in learning, but this is how I am. Thanks a lot, C. -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 2:05 AM To: 'César Aracena'; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Table formatting try changing these two lines $num_rows = mysql_num_rows($result); $num_cols = 2; to this $num_cols = 2; $num_rows = mysql_num_rows($result) / $num_cols; this isn't the full solution, but will help you on your way... HTH Martin -Original Message- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 2:03 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Re: Table formatting I know no one in this list like to think we newbie's want the job done for us, so I'm trying to figure out the below question myself, but trust me when I say it's making me nuts... this is my best shot so far: $query = SELECT * FROM saav_arts ORDER BY artid; $result = mysql_query($query) or die(mysql_error()); $num_rows = mysql_num_rows($result); $num_cols = 2; for ($x = 0; $x $num_rows; $x++) { echo tr; for ($i = 0; $i $num_cols; $i++) { $row = mysql_fetch_array($result); echo td align=\center\; echo a href=\details.php?artid=.$row[artid].\img src=\.$CFG-artdir./.$row[artsmall].\ ALT=\.$row[artname].\ BORDER=\0\/a; echo /td; } echo /tr; } The thing is that it shows up two columns as I want, but not the 4 images that I have in DB... it shows 2 rows of 2 images each and antoher 2 rows of 2 *NOT DIPLAYED* images which I don't have... like it was looping again with nothing to fetch from the DB... What is this? Jason: as I wrote this, your tip came over and as you can see I did figure it out (almost melted my brain though)... now, do you know what is going on? Thanx, C. -Original Message- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 12:27 AM To: 'Chris Earle'; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Table formatting I like this method a lot. Now, considering I do like FOR looping as a fact, how can I make a loop inside another loop. I mean, if I tell the first loop that $i=0 and then do the comparison and then add 1 to $i, in the inner or second loop should I state that $i=$i or what? Also make it $i=0??? Thanks, C. -Original Message- From: Chris Earle [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 27, 2002 1:54 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Table formatting You can do what he said or just put a separate loop inside the original loop. Depending on how you get the info, you can use either way (his would create less overhead if you are just using the same TD info every row, otherwise they're really the same because his way you'll have to create an array to access later for multiple rows, or just do my way and have the loop access the NEXT *3* (or whatever) items ...). i.e., for (LOOP FOR TR) { for (LOOP FOR TD) {} } César aracena [EMAIL PROTECTED] wrote in message 001a01c234f0$a5e8ad80$28ed0dd1@gateway">news:001a01c234f0$a5e8ad80$28ed0dd1@gateway... Hi all. Last nite I've came across a problem I wasn't able to figure out by my self. It's not difficult to make a loop that will make new *TABLE ROWS* (tr) to show several DB objects in a nice way. what I need to do, is to display 2 or maybe even 3 of this objects stored in a DB per table row, separated in different *TABLE COLUMS* (td). how can I achieve this? What I usually do is: -- // DB QUERY $query = SELECT * FROM table_name; $result = mysql_query($query) or die(mysql_error()); $num_rows = mysql_num_rows($result); // NOW THE LOOP for ($i=0; $i$num_rows; $i++) { $row =
Re: [PHP] Good books on sessions
Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help? My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to generate my variables for me on the action page, and if I cannot use a form to send variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So, I couldn't just jump in and use sessions as I would not be sure that my app would work on any PHP4 system regardless of the options it was compiled with. ( Oh, I am writing my apps to work with register_globals=off now, so that shouldn't be a problem). So I started to look for a way to code with sessions that will not require cookies nor require any special compile features; the answer came in adding ?=SID? to all relative URL's in my app. Alas, that is where I'm at, and it's still not working as I would have expected. My problem is with the way my proposed app works/should work. I am trying to write an app that allows the user to log in, then add/remove projects to his list, then, when a project is selected, he should have access to all the relevan documents in that project, again allowing him to add/remove documents from the project here, and in the last step, when a document is selected, allows hime to add/remove/edit chapters to the document. My first attempt at using sessions with this failed miserably ( keeping in mind my approach of adding SID at end of urls). I have a back link on all the pages that takes the user to the previous step(s) and thus on the last page ( the chpaters edit/remove/add page), there is a link to go back one level, two and three levels. Yet, using these causes unexpected results. I think the problem comes in with overriding the value of the session variable. For instance, on the first page you have a login form, on the action page I session_register(username,password), and that works fine even when using the back buttons as the values are never changed. But, on the 2nd page I have the drop down select containing all the project names ( gets built with a while that reads all the project names from the project_table) and send over the project_id. On that actio page, I session_register(project_id); and it also works fine for all pages down stream, however, when I come back to that page to select a new project, it keeps the old variable... At first I did nothing special in the sence of assigning a value to the session variables, as I let the register_globals=on do it's trick, but later I explicitly said $project_id = $HTTP_POST_VARS[project_id]; But that also did not overwrite the value of the session var. In the end I was forced to again add all my variables to the end of the url, keeping the session solely for the username and password. I don't know if you would like me to post my code ( it is quite a bit already ) but I would really appreciate it if someone could look at it, and then point out where I'm missing the picture, as then I would have two pictures that I can compare and see where my reasoning failed. Thanks for your time. Rasmus Lerdorf wrote: What issues? Just ask. -Rasmus On Mon, 29 Jul 2002, Petre wrote: What are good books/websites about sessions. I'm looking for more advanced stuff, I have the Luke Welling/Laura Tompson book, and have read the manual, but I still have issues that are unresolved. 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
Re: [PHP] Good books on sessions
Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on that target page is bogus. By the way, trans-sid is compiled in by default in PHP so should always be available. And it will fallback to sid mangling only if cookies are disabled. You would probably be better off just letting php manage this for you. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help? My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to generate my variables for me on the action page, and if I cannot use a form to send variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So, I couldn't just jump in and use sessions as I would not be sure that my app would work on any PHP4 system regardless of the options it was compiled with. ( Oh, I am writing my apps to work with register_globals=off now, so that shouldn't be a problem). So I started to look for a way to code with sessions that will not require cookies nor require any special compile features; the answer came in adding ?=SID? to all relative URL's in my app. Alas, that is where I'm at, and it's still not working as I would have expected. My problem is with the way my proposed app works/should work. I am trying to write an app that allows the user to log in, then add/remove projects to his list, then, when a project is selected, he should have access to all the relevan documents in that project, again allowing him to add/remove documents from the project here, and in the last step, when a document is selected, allows hime to add/remove/edit chapters to the document. My first attempt at using sessions with this failed miserably ( keeping in mind my approach of adding SID at end of urls). I have a back link on all the pages that takes the user to the previous step(s) and thus on the last page ( the chpaters edit/remove/add page), there is a link to go back one level, two and three levels. Yet, using these causes unexpected results. I think the problem comes in with overriding the value of the session variable. For instance, on the first page you have a login form, on the action page I session_register(username,password), and that works fine even when using the back buttons as the values are never changed. But, on the 2nd page I have the drop down select containing all the project names ( gets built with a while that reads all the project names from the project_table) and send over the project_id. On that actio page, I session_register(project_id); and it also works fine for all pages down stream, however, when I come back to that page to select a new project, it keeps the old variable... At first I did nothing special in the sence of assigning a value to the session variables, as I let the register_globals=on do it's trick, but later I explicitly said $project_id = $HTTP_POST_VARS[project_id]; But that also did not overwrite the value of the session var. In the end I was forced to again add all my variables to the end of the url, keeping the session solely for the username and password. I don't know if you would like me to post my code ( it is quite a bit already ) but I would really appreciate it if someone could look at it, and then point out where I'm missing the picture, as then I would have two pictures that I can compare and see where my reasoning failed. Thanks for your time. Rasmus Lerdorf wrote: What issues? Just ask. -Rasmus On Mon, 29 Jul 2002, Petre wrote: What are good books/websites about sessions. I'm looking for more advanced stuff, I have the Luke Welling/Laura Tompson book, and have read the manual, but I still have issues that are unresolved. 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
Re: [PHP] Good books on sessions
Yes, it is a forward link to the page, but as mentioned, that page contains a form with the selection options, and on that form's action page is where I don't see the values change, so the question should probably be something like how do I change the value in the session_var with the newly selected value? And oh, I almost forgot: Due to that fact that this type of app doesn't really have a logical end page, I cannot issue a session_destroy() anywhere logically ( except using a logout button), but that's not going to ensure that people use it... I would ideally like to have this app run on an intranet, where people will most probably have this app open indefinately, and thus I also battle with my logic of keeping a session alive. Thanks . Rasmus Lerdorf wrote: Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on that target page is bogus. By the way, trans-sid is compiled in by default in PHP so should always be available. And it will fallback to sid mangling only if cookies are disabled. You would probably be better off just letting php manage this for you. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help? My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to generate my variables for me on the action page, and if I cannot use a form to send variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So, I couldn't just jump in and use sessions as I would not be sure that my app would work on any PHP4 system regardless of the options it was compiled with. ( Oh, I am writing my apps to work with register_globals=off now, so that shouldn't be a problem). So I started to look for a way to code with sessions that will not require cookies nor require any special compile features; the answer came in adding ?=SID? to all relative URL's in my app. Alas, that is where I'm at, and it's still not working as I would have expected. My problem is with the way my proposed app works/should work. I am trying to write an app that allows the user to log in, then add/remove projects to his list, then, when a project is selected, he should have access to all the relevan documents in that project, again allowing him to add/remove documents from the project here, and in the last step, when a document is selected, allows hime to add/remove/edit chapters to the document. My first attempt at using sessions with this failed miserably ( keeping in mind my approach of adding SID at end of urls). I have a back link on all the pages that takes the user to the previous step(s) and thus on the last page ( the chpaters edit/remove/add page), there is a link to go back one level, two and three levels. Yet, using these causes unexpected results. I think the problem comes in with overriding the value of the session variable. For instance, on the first page you have a login form, on the action page I session_register(username,password), and that works fine even when using the back buttons as the values are never changed. But, on the 2nd page I have the drop down select containing all the project names ( gets built with a while that reads all the project names from the project_table) and send over the project_id. On that actio page, I session_register(project_id); and it also works fine for all pages down stream, however, when I come back to that page to select a new project, it keeps the old variable... At first I did nothing special in the sence of assigning a value to the session variables, as I let the register_globals=on do it's trick, but later I explicitly said $project_id = $HTTP_POST_VARS[project_id]; But that also did not overwrite the value of the session var. In the end I was forced to again add all my variables to the end of the url, keeping the session solely for the username and password. I don't know if you would like me to post my code ( it is quite a bit already ) but I would really appreciate it if someone could look at it, and then point out where I'm missing the picture, as then I would have two pictures that I can compare and see where my reasoning failed. Thanks for your time. Rasmus Lerdorf wrote: What issues? Just ask. -Rasmus On Mon, 29 Jul 2002, Petre wrote: What are good books/websites about sessions. I'm looking for more advanced stuff, I have the Luke Welling/Laura Tompson book, and have read the manual, but I still have issues
[PHP] Credit Card Validation With Expiration Date
Hi the ML I'm looking for an algorithm or a free PHP Script which enable me to verify expiration date with a credit card number. Does anybody knows this ? Regards Laurent Drouet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Credit Card Validation With Expiration Date
I'm looking for an algorithm or a free PHP Script which enable me to verify expiration date with a credit card number. Does anybody knows this ? It doesn't existcredit card number alogrithms do not use the expiry date in their formulas (at least I'm not aware of any that are). Also there is no way to actually check if a credit card is valid without using a company that keeps an online database of active credit cards. The most you can do is verify that the number provided could potentially be a credit card...and even then the expiry date has no algorithm attached to it...as long as it is past the present date there's no way to consider it invalid without cross-referencing against a database of active cards. Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good books on sessions
The trick is to not name your form vars the same as your session vars. Keep them separate so you have full control of what ends up where. Also, note that if you are not relying on trans_sid or cookies then don't use SID. Call session_id() explicitly to get the session id. So, a quick little mockup to illustrate this. login.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('username'); $username = 'petre'; ? a href=page1.php??=$sid?Next Page/a page1.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); ? form action=page2.php??=$sid? method=POST input type=text name=form_foo value=?=$_SESSION['foo']? /form page2.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('foo'); $foo = $_POST['form_foo']; echo You entered $foobr /\n; ? a href=page1.php??=$sid?Back/a I am ini_setting on each page to force PHP to not do trans-sid/cookies. Would be easier to simply turn these off in the php.ini file. When you hit the back link, $_SESSION['foo'] will exist on page1.php and the form will get filled in with the previous value. You can then change it, hit enter again and the session value will take on the new submitted value because I have decoupled the form data from the session data and I set the session var in page2.php. There are other ways to do this, but this is probably the easiest method to understand. Play with this simple example until you understand how it works. But again, I'd suggest letting PHP do session id handling for you by letting it default to cookies and fall back to url mangling in the few cases where cookies are turned off. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Yes, it is a forward link to the page, but as mentioned, that page contains a form with the selection options, and on that form's action page is where I don't see the values change, so the question should probably be something like how do I change the value in the session_var with the newly selected value? And oh, I almost forgot: Due to that fact that this type of app doesn't really have a logical end page, I cannot issue a session_destroy() anywhere logically ( except using a logout button), but that's not going to ensure that people use it... I would ideally like to have this app run on an intranet, where people will most probably have this app open indefinately, and thus I also battle with my logic of keeping a session alive. Thanks . Rasmus Lerdorf wrote: Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on that target page is bogus. By the way, trans-sid is compiled in by default in PHP so should always be available. And it will fallback to sid mangling only if cookies are disabled. You would probably be better off just letting php manage this for you. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help? My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to generate my variables for me on the action page, and if I cannot use a form to send variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So, I couldn't just jump in and use sessions as I would not be sure that my app would work on any PHP4 system regardless of the options it was compiled with. ( Oh, I am writing my apps to work with register_globals=off now, so that shouldn't be a problem). So I started to look for a way to code with sessions that will not require cookies nor require any special compile features; the answer came in adding ?=SID? to all relative URL's in my app. Alas, that is where I'm at, and it's still not working as I would have expected. My problem is with the way my proposed app works/should work. I am trying to write an app that allows the user to log in, then add/remove projects to his list, then, when a project is selected, he should have access to all the relevan documents in that project, again allowing him to add/remove documents from the project here, and in the last step, when a document is selected, allows hime to add/remove/edit chapters to the document. My first attempt at using sessions with this failed
Re[2]: [PHP] Re: need help with uploading images
Hi, Tuesday, July 30, 2002, 1:53:50 PM, you wrote: D This looks good but I just have one question about it if you don't mind, D what if someone was uploading a gif or a PNG file? can it be made to only D detect jpgs? D Thanks in advance D Deadsam Try it this way, it will check if it is a jpeg and it has a horizontal and vertical size so you can be pretty sure it is an image file. (you do not need the gd package for getimagesize()) /** Check for the type of the image : only allow jpeg's */ $im = getimagesize($_FILES['uploadFile'); if(!($im[2] == 2 $im[0] 0 $im[1] 0)){ echo You can only upload jpg images.; exit(); } The $im[2] being set to 2 means it is a jpeg other image types have a different number, have a look at the getimagesize()function for details -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Installation Problem
I have a development web server php 4.0.6 apache and mysql and everything works OK. I installed the same software onto a new server that will be the production server but I hit problems when my scripts try and hit the db on the new server. Comparing the phpinfo details for both, the new server does not have a mysql section it. I copied the original php.ini onto the new server and restarted apache after the installation. Where have I missed this in the installation process and how should I resolve it? As an aside question, is there any glaring issues I may encounter if I upgrade php to 4.2.2 from 4.0.6? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Installation Problem
Well, how did you do the install? You really need to provide more details. Heck, any details. You don't mention your OS, whether you compiled from source, if so which configure flags, from packages, which packages, etc.. We are not mind readers. -Rasmus On Tue, 30 Jul 2002, Mark Colvin wrote: I have a development web server php 4.0.6 apache and mysql and everything works OK. I installed the same software onto a new server that will be the production server but I hit problems when my scripts try and hit the db on the new server. Comparing the phpinfo details for both, the new server does not have a mysql section it. I copied the original php.ini onto the new server and restarted apache after the installation. Where have I missed this in the installation process and how should I resolve it? As an aside question, is there any glaring issues I may encounter if I upgrade php to 4.2.2 from 4.0.6? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- 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 Installation Problem
I'm not sure exactly what you're saying, but it sounds to me like you didn't configure --with-mysql for the new server. You MUST do that. ./configure --with-apxs=/blah/blah --with-mysql If you don't have --with-mysql compiled into the php binary, mysql functions won't work. Tyler On Tue, 30 Jul 2002 09:34:04 +0100 Mark Colvin [EMAIL PROTECTED] wrote: I have a development web server php 4.0.6 apache and mysql and everything works OK. I installed the same software onto a new server that will be the production server but I hit problems when my scripts try and hit the db on the new server. Comparing the phpinfo details for both, the new server does not have a mysql section it. I copied the original php.ini onto the new server and restarted apache after the installation. Where have I missed this in the installation process and how should I resolve it? As an aside question, is there any glaring issues I may encounter if I upgrade php to 4.2.2 from 4.0.6? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- 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 Installation Problem
On Tuesday 30 July 2002 16:34, Mark Colvin wrote: I have a development web server php 4.0.6 apache and mysql and everything works OK. I installed the same software onto a new server that will be the production server but I hit problems when my scripts try and hit the db on the new server. Comparing the phpinfo details for both, the new server does not have a mysql section it. That's because the php on the new server was not compiled with mysql support. I copied the original php.ini onto the new server and restarted apache after the installation. That wouldn't help. Where have I missed this in the installation process and how should I resolve it? reconfigure php to include mysql support. As an aside question, is there any glaring issues I may encounter if I upgrade php to 4.2.2 from 4.0.6? Quite a few, read the release notes/chagelog/history, read the php.ini. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Americans are people who insist on living in the present, tense. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good books on sessions
Thanks, will work through this immediately. Just to be clear. If I DO stick with your suggestion of letting PHP do the url mangling, and taking your code below, I can simply remove the ini_set('session.use_trans_sid',false); and ?=$sid? from your code to make it work exactly as is? Thanks Rasmus Lerdorf wrote: The trick is to not name your form vars the same as your session vars. Keep them separate so you have full control of what ends up where. Also, note that if you are not relying on trans_sid or cookies then don't use SID. Call session_id() explicitly to get the session id. So, a quick little mockup to illustrate this. login.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('username'); $username = 'petre'; ? a href=page1.php??=$sid?Next Page/a page1.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); ? form action=page2.php??=$sid? method=POST input type=text name=form_foo value=?=$_SESSION['foo']? /form page2.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('foo'); $foo = $_POST['form_foo']; echo You entered $foobr /\n; ? a href=page1.php??=$sid?Back/a I am ini_setting on each page to force PHP to not do trans-sid/cookies. Would be easier to simply turn these off in the php.ini file. When you hit the back link, $_SESSION['foo'] will exist on page1.php and the form will get filled in with the previous value. You can then change it, hit enter again and the session value will take on the new submitted value because I have decoupled the form data from the session data and I set the session var in page2.php. There are other ways to do this, but this is probably the easiest method to understand. Play with this simple example until you understand how it works. But again, I'd suggest letting PHP do session id handling for you by letting it default to cookies and fall back to url mangling in the few cases where cookies are turned off. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Yes, it is a forward link to the page, but as mentioned, that page contains a form with the selection options, and on that form's action page is where I don't see the values change, so the question should probably be something like how do I change the value in the session_var with the newly selected value? And oh, I almost forgot: Due to that fact that this type of app doesn't really have a logical end page, I cannot issue a session_destroy() anywhere logically ( except using a logout button), but that's not going to ensure that people use it... I would ideally like to have this app run on an intranet, where people will most probably have this app open indefinately, and thus I also battle with my logic of keeping a session alive. Thanks . Rasmus Lerdorf wrote: Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on that target page is bogus. By the way, trans-sid is compiled in by default in PHP so should always be available. And it will fallback to sid mangling only if cookies are disabled. You would probably be better off just letting php manage this for you. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help? My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to generate my variables for me on the action page, and if I cannot use a form to send variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So, I couldn't just jump in and use sessions as I would not be sure that my app would work on any PHP4 system regardless of the options it was compiled with. ( Oh, I am writing my apps to work with register_globals=off now, so that shouldn't be a problem). So I started to look for a way to code with sessions that will not require cookies nor require any special compile features; the answer came in adding ?=SID? to all relative URL's in my app. Alas, that is where I'm at, and it's still not working as I would have expected. My problem is with the way my proposed app works/should work. I am trying to write an app that allows the user to log in, then add/remove projects to his list, then, when a project is selected, he should have access to all the
Re: [PHP] Good books on sessions
Yup, get rid of both ini_set() calls and take out the $sid=... and ?=$sid? stuff and it should simply work. On Tue, 30 Jul 2002, Petre wrote: Thanks, will work through this immediately. Just to be clear. If I DO stick with your suggestion of letting PHP do the url mangling, and taking your code below, I can simply remove the ini_set('session.use_trans_sid',false); and ?=$sid? from your code to make it work exactly as is? Thanks Rasmus Lerdorf wrote: The trick is to not name your form vars the same as your session vars. Keep them separate so you have full control of what ends up where. Also, note that if you are not relying on trans_sid or cookies then don't use SID. Call session_id() explicitly to get the session id. So, a quick little mockup to illustrate this. login.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('username'); $username = 'petre'; ? a href=page1.php??=$sid?Next Page/a page1.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); ? form action=page2.php??=$sid? method=POST input type=text name=form_foo value=?=$_SESSION['foo']? /form page2.php: ? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('foo'); $foo = $_POST['form_foo']; echo You entered $foobr /\n; ? a href=page1.php??=$sid?Back/a I am ini_setting on each page to force PHP to not do trans-sid/cookies. Would be easier to simply turn these off in the php.ini file. When you hit the back link, $_SESSION['foo'] will exist on page1.php and the form will get filled in with the previous value. You can then change it, hit enter again and the session value will take on the new submitted value because I have decoupled the form data from the session data and I set the session var in page2.php. There are other ways to do this, but this is probably the easiest method to understand. Play with this simple example until you understand how it works. But again, I'd suggest letting PHP do session id handling for you by letting it default to cookies and fall back to url mangling in the few cases where cookies are turned off. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Yes, it is a forward link to the page, but as mentioned, that page contains a form with the selection options, and on that form's action page is where I don't see the values change, so the question should probably be something like how do I change the value in the session_var with the newly selected value? And oh, I almost forgot: Due to that fact that this type of app doesn't really have a logical end page, I cannot issue a session_destroy() anywhere logically ( except using a logout button), but that's not going to ensure that people use it... I would ideally like to have this app run on an intranet, where people will most probably have this app open indefinately, and thus I also battle with my logic of keeping a session alive. Thanks . Rasmus Lerdorf wrote: Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on that target page is bogus. By the way, trans-sid is compiled in by default in PHP so should always be available. And it will fallback to sid mangling only if cookies are disabled. You would probably be better off just letting php manage this for you. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help? My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to generate my variables for me on the action page, and if I cannot use a form to send variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So, I couldn't just jump in and use sessions as I would not be sure that my app would work on any PHP4 system regardless of the options it was compiled with. ( Oh, I am writing my apps to work with register_globals=off now, so that shouldn't be a problem). So I started to look for a way to code with sessions that will not require cookies nor require any special compile features; the answer came in adding ?=SID? to all relative URL's in my app. Alas, that is where I'm at, and it's still not
Re: [PHP] PHP 4.2.2 vpopmail
Uz.ytkownik Jakub Zawierucha napisa?: I have little problem with vpopmail functions from PHP 4.2.2. When I use vpopmail_auth_user ( blah, foo.bar.pl, secret string ); I get no correct return value ( echo vpopmail_auth_user ( blah, foo.bar.pl, secret string ); - give me no result ). This values are 100% good. I have Apache with suEXEC (VirtualHost - User vpopmail, Group vchkpw). Here's details: My Apache: ./configure \ --enable-suexec \ --suexec-caller=www-data \ --suexec-docroot=/usr/local/apache \ --server-uid=www-data \ --server-gid=www-data \ --enable-module=log_referer \ --enable-module=usertrack \ --disable-module=imap \ --activate-module=src/modules/php4/libphp4.a \ --prefix=/usr/local/apache cd src # ADD line AddModule modules/php4/libphp4.a in Configure ./Configure make cd .. make install My PHP: ./configure \ --enable-tokenizer \ --enable-track-vars \ --enable-ftp \ --enable-safe-mode \ --with-vpopmail=/home/vpopmail \ --with-apache=${SRC_APACHE_DIR} \ --prefix=/usr/local make;make install infophp(); produce: vpopmail version 5.2.1 vpopmail uid/gid php uid/gid/euid/egid 89/89 33/33/33/33 vpopmail dir /home/vpopmail vpopmail vadddomain /home/vpopmail/bin/vadddomain vpopmail vdeldomain /home/vpopmail/bin/vdeldomain vpopmail vaddaliasdomain /home/vpopmail/bin/vaddaliasdomain vpopmail valias support Enabled UIDs and GIDs : # cat /etc/group | grep 'vchkpw' vchkpw:x:89: # cat /etc/passwd | grep 'vpopmail' vpopmail:x:89:89::/home/vpopmail:/bin/bash # cat /etc/passwd | grep 'www-data' www-data:x:33:33:www-data:/var/www:/non Is this problem of my configuration or broken code of php extensions ? I solve that problem. Apache was not runed as vpopmail.vchkpw. Suexec is useless until you turn php as cgi. The better way (than suexec) is run separate apache server as vpopmail.vchkpw user on other port. Now vpopmail functions are ok. -- ---= Jakub Zawierucha teku(at)teku.ptc.pl.nospam - remove .nospam =--- ps. Sorry for my english ;P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fullname
Even more, $fullname = {$session['f_name']} {$session['l_name']}; even $fullname = sprintf(%s %s, $session[f_name], $session['l_name']); etc Mantas Kriauciunas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hey php-general, is there some other easyer way to do in one line than this?: $fullname = $session[f_name]; $fullname .= ; $fullname .= {$session['l_name']}; P.S the thing is to add line in the middle of the first and last names :) Thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php 4.2.2 and 4.0.6
Hello, Does php 4.2.2 is better than 4.0.6 ? Thank for your telling ! Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache and php
Hello, Which version of apache and which version of php are good for work together ? Thank for your help... Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions - Informed Opinions
Hello All, So, I've been using my own implementation of session handling which is mainly storing the userinfo in a cookie (an array, serialised and signed) but I'm starting to come around to the idea of storing this info on the server and just passing a session key about - but I have a couple of reservations, which I'm hoping someone can confirm or resolve : Assuming that sessions are stored on the filesystem by default: 1 How secure is this? Could someone with system level access simple wander into the session store directory and start browsing though the session data? 2 Are expired sessions removed from the filesystem automatically? How often is this garbage collection performed? 3 How can I get a count of currently active (I.e non expired) sessions? 4 Are there any performance issues to worry about doing it this way? 5 Is it quicker to do it this way or store sessions in a db using session_set_save_handler? Like the subject says, I'm after informed opinions on this subject rather than rumours and hearsay. As for my setup - it's a BSD box - Apache2.0.39 + PHP4.2.2 (apache module) + PHP4.3.0dev-Zend2alpha2 (cgi) - both compiled with pretty much everything. Thanks a lot people, Danny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache and php
For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2 The developer systems, I'd go for (indeed have gone for) Apache 2.0.39 + PHP4.2.2 HTH Danny. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:01 AM Subject: [PHP] apache and php Hello, Which version of apache and which version of php are good for work together ? Thank for your help... Edward. -- 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] Sessions - Informed Opinions
So, I've been using my own implementation of session handling which is mainly storing the userinfo in a cookie (an array, serialised and signed) but I'm starting to come around to the idea of storing this info on the server and just passing a session key about - but I have a couple of reservations, which I'm hoping someone can confirm or resolve : Assuming that sessions are stored on the filesystem by default: 1 How secure is this? Could someone with system level access simple wander into the session store directory and start browsing though the session data? Well, at least as secure as passing this stuff out across the Internet to random clients where anybody can steal these cookies and present them back to you in a spoof attack. 2 Are expired sessions removed from the filesystem automatically? How often is this garbage collection performed? Sure. You configure it. See php.ini 3 How can I get a count of currently active (I.e non expired) sessions? Count the number of session files. 4 Are there any performance issues to worry about doing it this way? Not really 5 Is it quicker to do it this way or store sessions in a db using session_set_save_handler? Should be slightly quicker if your database is nice and fast and your schema is sane. As for my setup - it's a BSD box - Apache2.0.39 + PHP4.2.2 (apache module) + PHP4.3.0dev-Zend2alpha2 (cgi) - both compiled with pretty much everything. Why in the world are you running Apache2? You are not running it threaded anyway (since you are on FreeBSD) so you are not gaining any of the threaded scalability that is Apache2's only real selling point right now. You are running code that acts just like Apache 1.3.x except it is much less stable (at least with PHP). -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache and php
Danny Shepherd wrote: For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2 They are good for work under Linux RedHat ( 6.x / 7.x ) system ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions - Informed Opinions
Comments inline - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Danny Shepherd [EMAIL PROTECTED] Cc: PHP-General [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:24 AM Subject: Re: [PHP] Sessions - Informed Opinions Assuming that sessions are stored on the filesystem by default: 1 How secure is this? Could someone with system level access simple wander into the session store directory and start browsing though the session data? Well, at least as secure as passing this stuff out across the Internet to random clients where anybody can steal these cookies and present them back to you in a spoof attack. Fair enough 2 Are expired sessions removed from the filesystem automatically? How often is this garbage collection performed? Sure. You configure it. See php.ini 3 How can I get a count of currently active (I.e non expired) sessions? Count the number of session files. Can I be sure that the count will only include active sessions though? 4 Are there any performance issues to worry about doing it this way? Not really 5 Is it quicker to do it this way or store sessions in a db using session_set_save_handler? Should be slightly quicker if your database is nice and fast and your schema is sane. Great As for my setup - it's a BSD box - Apache2.0.39 + PHP4.2.2 (apache module) + PHP4.3.0dev-Zend2alpha2 (cgi) - both compiled with pretty much everything. Why in the world are you running Apache2? You are not running it threaded anyway (since you are on FreeBSD) so you are not gaining any of the threaded scalability that is Apache2's only real selling point right now. You are running code that acts just like Apache 1.3.x except it is much less stable (at least with PHP). Can't say I've really noticed any stability issues - even with PHP (there was that multiple cookie bug but even so). It's a dev box (the release boxes all use Apache1.3.x) and TBH, I was playin' about some of Apache2's other features, such as the dynamic vhosting, which might be useful to me later. Thanks for the reply though, Danny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache and php
- Original Message - From: [EMAIL PROTECTED] To: Danny Shepherd [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:30 AM Subject: Re: [PHP] apache and php Danny Shepherd wrote: For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2 They are good for work under Linux RedHat ( 6.x / 7.x ) system ? Yeah, should be Ok. Danny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: libphp4.so
Peter wrote: howdy, i've got it all configured correctly .. well it doesn't spit any errors out on make but when i got to view a web page it opens a down load box ..so i added this LoadModule php4_modulelibexec/libphp4.so to httpd.conf as per the manual and restarted apache but it didn't start saying it couldn't find libphp.so which leads me to my question .. that file is created automatically correct? i havent been able to find that file on my machine any where.. so i can't point it to another location ... any one got any ideas what i should do as i have not seen any info any where that will direct me in this situation... Do the make install again and pay attention to what scrolls by and see where it puts the libphp4.so file. Then, make sure that's where Apache expects it. the LoadModule directive acts in conjunction with the one above all the LoadModules that tells Apache where to start looking for Modules in the first place. Some folks set that in httpd.conf to include the libexec part, so then your libexec in the LoadModule line is ending up doubling the libexec in the path and that ain't gonna work. If there are any *working* LoadModule lines, you can try digging around to find them on your hard drive, and make sure libphp4.so is sitting next to them, and then do the LoadModule the same way as the working ones. http://apache.org will explain all the stuff I just said in formal language. :-) Ok i followed what you have suggested and Apache didn't spit out anything on libphp4.so so I am lead to beleave it wasn't created.. my apache config like was #./configure --enable-module=most --enable-shared=max #--activate-module=src/ modules/php4/libphp4.a cheers Peter Peter - if you are still battling with this, perhaps you might try an alternate approach, where you first compile apache with dso support, then compile php as a loadable module. For guidance, here are the configure files I use for each: Apache ./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max You'll possibly have apache in a different place so may need to change the value for prefix. PHP #! /bin/sh # # Created by configure ./configure \ --enable-debug=no \ --enable-gd-imgstrttf \ --enable-gd-nativett \ --enable-sysvsem=yes \ --enable-sysvshm=yes \ --enable-track-vars=yes \ --with-apxs=/usr/local/apache/bin/apxs \ --with-config-file-path \ --with-config-file-path=/usr/local/apache/conf \ --with-freetype-dir=/usr/X11R6 \ --with-gd=/usr/local/src/gd-2.0.1 \ --with-jpeg-dir=/usr \ --with-mysql=/usr/local/mysql \ --with-png-dir=/usr \ --with-xml \ --with-xpm-dir=/usr/X11R6 \ --with-zlib \ --with-zlib-dir=/usr \ $ #--with-mnogosearch \ The two things you need specifically here are --with-apxs which allows the loadable module to be built, and the two with-config-file entries. The latter of these points to the directory where you have installed apache configuration files, and allows the php install process to find the apache config file and add the necessary entries to get php up and running. So the order of play is Apache configure make make install optionally start to ensure its all working PHP configure make make install Apache restart to re-read the config file That should get you up and running. I just did the php part earlier today to upgrade my laptop to 4.2.2 and it only took a few minutes. Cheers -- David Robley NUMBER CRUNCHING: Jumping on a Computer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions - Informed Opinions
3 How can I get a count of currently active (I.e non expired) sessions? Count the number of session files. Can I be sure that the count will only include active sessions though? By definition, if the session file is there, it is an active session. There is no such thing as counting active users on the Web. You define a time window and count how many users accessed your site within that window. Once a session has been idle for a time than the configured session gc time, it will get deleted. I tend to do this out of band though. PHP has a mechanism for calling the session gc code, but I prefer to turn this off and run my own cron job that does this regularly. And yes, this is easier to manage if you have a database where you can do a simple count() query to get the number of active sessions. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions - Informed Opinions
- Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Danny Shepherd [EMAIL PROTECTED] Cc: PHP-General [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:52 AM Subject: Re: [PHP] Sessions - Informed Opinions 3 How can I get a count of currently active (I.e non expired) sessions? Count the number of session files. Can I be sure that the count will only include active sessions though? By definition, if the session file is there, it is an active session. There is no such thing as counting active users on the Web. You define a time window and count how many users accessed your site within that window. Once a session has been idle for a time than the configured session gc time, it will get deleted. I tend to do this out of band though. PHP has a mechanism for calling the session gc code, but I prefer to turn this off and run my own cron job that does this regularly. And yes, this is easier to manage if you have a database where you can do a simple count() query to get the number of active sessions. Right, db sessions seem to be the way for me, thanks Rasmus. (Oh, thanks for PHP too :) Danny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Not a Valid File-Handle Resource
Chris Carlson wrote: I am trying to create a php program and am getting an error in this area of my script: $dataFile = fopen(/home/blurredv/data/.$username.Contact.txt,w); fputs($dataFile, $line); fclose ($dataFile); These are the errors: Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 34 Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 35 Note: My script work perfectly with different path names under Windows NT. Do I have to do something special for Unix. Thanks in advance, At a guess, the value you are using as a filename is incorrect, but you are suppressing any error message from fopen - better that you test that result and be prepared to handle an error situation. For a further guess, the value $username doesn't have a trailing slash. -- David Robley NUMBER CRUNCHING: Jumping on a Computer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Resetting ID
I have a table, with 4 columns. One of the column is ID, a Primary Key, which has Auto_Increment set on it. Now i have a lot of rows deleted and a lot of duplicate rows that will be deleted, and all sorts of stuff happening in the table.. the result is, that the IDs have become inconsistent. What you get is something like 5,6,9,10,25,32,33 .. and so on. With many IDs missing etc. What i want to do is delete the entire IDs and generate them again so that they are in one single order like 1,2,3,4,5... .like this. And so that any new entry in the table gets the ID accordingly. How can i do this? Who cares if your IDs aren't sequential?? All these IDs are for is to provide a unique identifier for each row. That's it. If the holes are causing a problem in your scripts, then you are using this column incorrectly. My guess is that you'd want to read up on the COUNT() or LIMIT functions in MySQL... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Not a Valid File-Handle Resource
$dataFile = fopen(/home/blurredv/data/.$username.Contact.txt,w); fputs($dataFile, $line); fclose ($dataFile); These are the errors: Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 34 Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 35 Note: My script work perfectly with different path names under Windows NT. Do I have to do something special for Unix. Thanks in advance, At a guess, the value you are using as a filename is incorrect, but you are suppressing any error message from fopen - better that you test that result and be prepared to handle an error situation. For a further guess, the value $username doesn't have a trailing slash. or moving to Unix introduced case sensitivity which windows has a habit of ignoring (or correcting for you). Cheers, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP directives in httpd.conf problems
Hello, people. So the problem. I have apache running with php-module. Recently I've upgraded the 4.0.6 version up to 4.2.2. All my php configuration directives in httpd.conf (php_flag, php_admin_flag, php_value, php_admin_value) are not working now. When I change libphp4.so back to 4.0.6 the directives work, if I use 4.2.2 module - they don't. The configuration of apache and php.ini are not being changed. The php.ini in both cases is almost the same. The configure options of both php-versions seems to be the same. Where is the problem? Did I miss anything while configuring and installing 4.2.2 php module? I can not find any info in php docs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A somewhat unusual session question...
Hi all! The manual claims here (http://se2.php.net/manual/en/ref.session.php) that: /snip ...If session.save_path's path depth is more than 2, garbage collection will not be performed. /snip Anyone know why this is the case? And can you get around it? My scripts currently lives on a shered server and I wanted to get away from using /tmp (which is the default). I changed the session_save path in my .htaccess file to: /home/httpd/vhosts/mydomainname/httpdocs/sessions/ and created some sessions. The creation and destruction of sessions works fine as long as the user logs out correctly, but PHP fails to garbage collect sessions when the user just quits the browser. I've tried changing the session.gc_probability to 100 (and waited until session.gc_maxlifetime had passed), but it still doesn't work. Now I'm stuck with a bunch of deserted session files that don't seem to go away. Any ideas on how to solve this? /Lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] need help reg. User Accounts
I am using PHP-4.1.1 on Linux, I wanted to know the difference between nobody user and normal user of operating system. None. Nobody is an ordinary user. However, ordinary UNIX users can be set up in all sorts of ways. This question just came to mind when, neither nobody's directory nor any entry was not found in /home or elsewhere. That's deliberate. The nobody user is set up with very few resources or privileges and is then used to run things like the web server. If a hacker can exploit a weakness in the server to gain control and issue commands as the user running it, the potential damage is limited to what that user can do, which is not much. Simon Ritchie Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ORDER BY from 2 tables
I am not sure what exactly you mean. If you are talking about a regular query then: SELECT tblTable1.hits, tblTable2.hits FROM tblTable1, tblTable2 ORDER BY tblTable1.hits; If you are talking about combining the two tables so that all your 'hits' are in one column then there are a few ways to skin that cute little kitten (in order of difficulty): 1) Check to see if your databae supports UNION clauses. 2) If not, make a table with the data from the first table then append the data from the second table. Then query for your combined results and delete the table from the database. You may run into problems if more than one person tries to do this at a time, so be careful. 3) Or. create an array using data from the first set then loop through the second set adding the data from the second set. Then sort. Good luck and keep us posted. Paul Georgie Casey wrote: i assume this is a simple question... how can I SELECT * FROM 2 different tables in the same query, ORDER BYing the 'hits' column, which both tables have. eg, 2 tables i have are similiar and i want to merge them and then select everything ordering by hits -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fullname
on 30/07/02 5:12 PM, Wee Keat ([EMAIL PROTECTED]) wrote: Is this easier for you? $fullname = $session[f_name]. .$session[l_name]; or $fullname = {$session['f_name']} {$session['l_name']}; Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good books on sessions
*shakes head a bit* I'm not REALLY sure what the problem is here, but let's take a step back. A session ID is a unique, random number assigned to a user as they kick around your site. To maintain state (a session) across multiple pages, you pass the session id around. This can be done with the URL or cookies. Yes, trans_sid is in there as well, but all it does is re-write URLs. No surprises so far. You then assign variables to the session. If you're using PHP = 4.1, I'd use $_SESSION['varname'] = value; rather than session_register(), because it's a lot more logical, and clearer to think through. Furthermore, the manual tells us NOT to mix use of session_register('var') and $_SESSION['var'] = 'value'... so, pick a method, and stick to it... since the $_SESSION array is the new way, I'd be going with it. So, the first two session vars YOU assign after the user logs in is the username and password (I wouldn't register the password). $_SESSION['username'] = justin; $_SESSION['password'] = secret; Then a few pages later, they pick an option from a pull-down list, and you assign another variable to the session: $_SESSION['project_id'] = 45; The user clicks through a few more pages, and later wants to work on a different project, so you link them through (forward) to the options page. They select a new project from the pull down, so you need to overwrite the old project_id session var with a new one: $_SESSION['project_id'] = 74; Now, when they kick around through pages, they will be doing it under project_id 74. If you wanted to delete the project_id all together (no project), you could use unset(). Now, go back, and have a look at your code, check out the logic, and I'm sure you'll see the mistake(s). As far as the maintaining session forever thing, I'd highly recommend it... it's highly insecure (walk away from your computer, someone else has access to everything)... besides, sessions are a temporary thing by nature, with garbage cleanouts, etc etc. If you really wanted to maintain state 'forever', you would have to set a cookie with the username and password to that person's computer, hence your website would 'remember them' all the time. Of course there are plenty of reasons why your shouldn't do this. I guess the client should be informed of the options here: 1. log in every so-often as needed (if there is lots of activity, the session probably won't die all day anyway), and have heaps more security 2. log in once only, and have the whole system wide-open forever I'd pick 1 over 2 anytime. I'd also provide a logout button with either system, so that people CHOOSE TO DESTROY THEIR SESSION. Personally, I log-out when I leave my desk, just in case. Imagine if you left a session open which disclosed everyone's pay rates in an office... not good for your career at all :) Hope this all helps, Justin French on 30/07/02 6:04 PM, Petre ([EMAIL PROTECTED]) wrote: Yes, it is a forward link to the page, but as mentioned, that page contains a form with the selection options, and on that form's action page is where I don't see the values change, so the question should probably be something like how do I change the value in the session_var with the newly selected value? And oh, I almost forgot: Due to that fact that this type of app doesn't really have a logical end page, I cannot issue a session_destroy() anywhere logically ( except using a logout button), but that's not going to ensure that people use it... I would ideally like to have this app run on an intranet, where people will most probably have this app open indefinately, and thus I also battle with my logic of keeping a session alive. Thanks . Rasmus Lerdorf wrote: Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on that target page is bogus. By the way, trans-sid is compiled in by default in PHP so should always be available. And it will fallback to sid mangling only if cookies are disabled. You would probably be better off just letting php manage this for you. -Rasmus On Tue, 30 Jul 2002, Petre wrote: Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help? My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to generate my variables for me on the action page, and if I cannot use a form to send variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So,
[PHP] Re: fullname
Sveix. I guess if the space or any other character is needed between MORE than TWO strings, this is a good construction: $fullname = join( , array($session[f_name], $session[l_name],$session[middle_name], ...)); P.S. I sometimes use this construct for generating sql statements Mantas Kriauciunas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hey php-general, is there some other easyer way to do in one line than this?: $fullname = $session[f_name]; $fullname .= ; $fullname .= $session[l_name]; P.S the thing is to add line in the middle of the first and last names :) Thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem of characters with xml_parse
Hello, I have a question concerning characters : I use the function xml_parse on a standalone XML file with the encoding ISO-8859-1 and I want to parse it. It contains all types of characters (including control characters, so ASCII characters from x to x00FF) so as to send and receive images, is it possible? I noticed that special characters such as ' have to be replaced in regard of the W3C definition of XML, and that character such as chr(9) tabulation, chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse (replaced repectively by #9; #10; #13; but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I replace them by #x (x is the decimal ASCII code of the character). Have you got an idea about it? I tried to find out an answer in the expat scripts used by the function, without any results. Thank you for your answering. Best regards. Sébastien Molé. reply to: [EMAIL PROTECTED]
[PHP] Problem of characters with xml_parse
Hello, I have a question concerning characters : I use the function xml_parse on a standalone XML file with the encoding ISO-8859-1 and I want to parse it. It contains all types of characters (including control characters, so ASCII characters from x to x00FF) so as to send and receive images, is it possible? I noticed that special characters such as ' have to be replaced in regard of the W3C definition of XML, and that character such as chr(9) tabulation, chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse (replaced repectively by #9; #10; #13; but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I replace them by #x (x is the decimal ASCII code of the character). Have you got an idea about it? I tried to find out an answer in the expat scripts used by the function, without any results. Thank you for your answering. Best regards. Sébastien Molé. reply to: [EMAIL PROTECTED]
Re: [PHP] Problem of characters with xml_parse
On Tue, Jul 30, 2002 at 05:12:25PM +0200, Sebastien Mole wrote: but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error Line wrapping... What a concept. In my PHP XML parsing tutorial, http://www.analysisandsolutions.com/code/phpxml.htm, I use the following preg to clean out those nasty characters: # Remove all non-visible characters except SP, TAB, LF and CR. $Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', \n, $Contents); --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] searching an array for words starting with 'p'
Hi there, I am wondering how to search an array for words starting with a certain character. E.G: $word = array('alpha', 'beta', 'php'); I would like to check if there is a word in the array starting with p Is there alrready a function for this? Thanx, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Coding PHP with register_globals off
Seeing as a question concerning register_globals seems to be posted every day - I thought this link might be useful to some: http://www.zend.com/zend/art/art-sweat4.php Neil -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting Output
I have a db with the following fields: id | month | company | title | name | role | show_company | show_title | show_month sql query is: select * FROM db ORDER BY month DESC; Output gets formatted like: month - company - title name role name role - title name role - company - title name role name role name role The occurrence of the number of fields within each heading is not static. The oldest data sits at the beginning of the db so the order by month desc sorts the output from newest to oldest. Fine so far. Now, as new data gets added to the db sometimes some of it refers to past months. So although the order by month clause will move the new data to the correct month it will not move it into the correct heading (company) and sub_heading (title). I've tried using group by and using multiple fields in the order by but can not get the results I'm looking for, any suggestions? -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting Output
How are you displaying it? Show us some code... ---John Holmes... - Original Message - From: Brian V Bonini [EMAIL PROTECTED] To: PHP Lists [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:52 AM Subject: [PHP] Sorting Output I have a db with the following fields: id | month | company | title | name | role | show_company | show_title | show_month sql query is: select * FROM db ORDER BY month DESC; Output gets formatted like: month - company - title name role name role - title name role - company - title name role name role name role The occurrence of the number of fields within each heading is not static. The oldest data sits at the beginning of the db so the order by month desc sorts the output from newest to oldest. Fine so far. Now, as new data gets added to the db sometimes some of it refers to past months. So although the order by month clause will move the new data to the correct month it will not move it into the correct heading (company) and sub_heading (title). I've tried using group by and using multiple fields in the order by but can not get the results I'm looking for, any suggestions? -Brian -- 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] Problem of characters with xml_parse
Can't you just use CDATA blocks? Personally I'd either use an entity reference or base64 the stuff. -Rasmus On Tue, 30 Jul 2002, Sebastien Mole wrote: Hello, I have a question concerning characters : I use the function xml_parse on a standalone XML file with the encoding ISO-8859-1 and I want to parse it. It contains all types of characters (including control characters, so ASCII characters from x to x00FF) so as to send and receive images, is it possible? I noticed that special characters such as ' have to be replaced in regard of the W3C definition of XML, and that character such as chr(9) tabulation, chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse (replaced repectively by #9; #10; #13; but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I replace them by #x (x is the decimal ASCII code of the character). Have you got an idea about it? I tried to find out an answer in the expat scripts used by the function, without any results. Thank you for your answering. Best regards. Sébastien Molé. reply to: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hide the undefined offset error for the array?
I have one of the website on windows and I get the undefined offset error, I don't have that problem on UNIX / Linux. Anyone know what method would work?? Here's the script! In this case, the $raw_data array is empty, so window complain of the empty data by displaying hte error message, Undefined offset . --clip-- if ($raw_data[$num_count] != $match_array[$x]) { --clip-- Thanks! FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php 4.2.2 and 4.0.6
Actually, PHP 4.2.2 just have more features than PHP 4.0.6. Example of those are more security and more functions as well as many of the other things. One disadvantage to it is some programming script will break because some PHP features is decommissioned, like functions or someting. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Does php 4.2.2 is better than 4.0.6 ? Thank for your telling ! Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache and php
I wouldn't jump on Apache 2.0.39 for the production website and some PHP features does not work for that version. That apache is in beta testing stage, so it will be a while. Danny Shepherd [EMAIL PROTECTED] wrote in message 024501c237b5$f95d8860$0200a8c0@DANNYS">news:024501c237b5$f95d8860$0200a8c0@DANNYS... - Original Message - From: [EMAIL PROTECTED] To: Danny Shepherd [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:30 AM Subject: Re: [PHP] apache and php Danny Shepherd wrote: For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2 They are good for work under Linux RedHat ( 6.x / 7.x ) system ? Yeah, should be Ok. Danny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hide the undefined offset error for the array?
Your default error reporting level must be set different on your Windows box. If you turn off E_NOTICE warnings on your Windows box it will act the same as your Linux box. But, in general, to write E_ALL clean code you would check if each exists first, or swallow the errors if you know that these indices may not be present using something like this: if ($raw_data[$num_count] != $match_array[$x]) { -Rasmus On Tue, 30 Jul 2002, Scott Fletcher wrote: I have one of the website on windows and I get the undefined offset error, I don't have that problem on UNIX / Linux. Anyone know what method would work?? Here's the script! In this case, the $raw_data array is empty, so window complain of the empty data by displaying hte error message, Undefined offset . --clip-- if ($raw_data[$num_count] != $match_array[$x]) { --clip-- Thanks! FletchSOD -- 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: A somewhat unusual session question...
The session.save_path have nothing to do with it. I have that same problem with the default path, /tmp when the session became a garbage collection when the user quit the browser without logging off. When the user quit the browser then there's no way for the server to know that, so the session stuffs stay active in the session.save_path. You will have to either manually clean it up weekly or use crontab to do the clean up for you at night-time with the time-range the website is off-limit to the user. This is where people do the maintaince also. Lars Olsson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all! The manual claims here (http://se2.php.net/manual/en/ref.session.php) that: /snip ...If session.save_path's path depth is more than 2, garbage collection will not be performed. /snip Anyone know why this is the case? And can you get around it? My scripts currently lives on a shered server and I wanted to get away from using /tmp (which is the default). I changed the session_save path in my .htaccess file to: /home/httpd/vhosts/mydomainname/httpdocs/sessions/ and created some sessions. The creation and destruction of sessions works fine as long as the user logs out correctly, but PHP fails to garbage collect sessions when the user just quits the browser. I've tried changing the session.gc_probability to 100 (and waited until session.gc_maxlifetime had passed), but it still doesn't work. Now I'm stuck with a bunch of deserted session files that don't seem to go away. Any ideas on how to solve this? /Lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What is REGEX ?
Look for regular expressions in the manual. Regex is just a shortening of that. Mike Lord Loh. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello! I am new to REGEX. I tried to read several posts on REGEX. However none were descriptive. What is Regex ? Is it a part of the php? or an additional module? What can it be used for ? Please let me know Thank you. Lord Loh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php 4.2.2 and 4.0.6
So, do you know apache 1.3.22 and php 4.2.2 are good for work with IMP 3.x ( http://www.horde.org/imp ) under RH 6.2 system ? Scott Fletcher wrote: Actually, PHP 4.2.2 just have more features than PHP 4.0.6. Example of those are more security and more functions as well as many of the other things. One disadvantage to it is some programming script will break because some PHP features is decommissioned, like functions or someting. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Does php 4.2.2 is better than 4.0.6 ? Thank for your telling ! Edward. -- 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] apache and php
So, which version of apache and php are the best for working together under any OS system ? Scott Fletcher wrote: I wouldn't jump on Apache 2.0.39 for the production website and some PHP features does not work for that version. That apache is in beta testing stage, so it will be a while. Danny Shepherd [EMAIL PROTECTED] wrote in message 024501c237b5$f95d8860$0200a8c0@DANNYS">news:024501c237b5$f95d8860$0200a8c0@DANNYS... - Original Message - From: [EMAIL PROTECTED] To: Danny Shepherd [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:30 AM Subject: Re: [PHP] apache and php Danny Shepherd wrote: For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2 They are good for work under Linux RedHat ( 6.x / 7.x ) system ? Yeah, should be Ok. Danny. -- 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] apache and php
The latest stable versions of both. Apache 1.3.26 and PHP 4.2.2. On Wed, 31 Jul 2002 [EMAIL PROTECTED] wrote: So, which version of apache and php are the best for working together under any OS system ? Scott Fletcher wrote: I wouldn't jump on Apache 2.0.39 for the production website and some PHP features does not work for that version. That apache is in beta testing stage, so it will be a while. Danny Shepherd [EMAIL PROTECTED] wrote in message 024501c237b5$f95d8860$0200a8c0@DANNYS">news:024501c237b5$f95d8860$0200a8c0@DANNYS... - Original Message - From: [EMAIL PROTECTED] To: Danny Shepherd [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 11:30 AM Subject: Re: [PHP] apache and php Danny Shepherd wrote: For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2 They are good for work under Linux RedHat ( 6.x / 7.x ) system ? Yeah, should be Ok. Danny. -- 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] how to debug mail() problem?
Hi, I have a loop that sends out a numbers of emails using the mail() function. -- Code start - for ( $i=0, $j=count($responders); $i $j; $i++ ) { $r = $responders[$i]; $headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: $r-FirstName $r-LastName $r-Email\r\n; echo sending email to $r-FirstName $r-LastName ($r-Email)br; if ( !mail( $r-Email, Subject, $message, $headers ) ) echo Failed to send email to $r-FirstName $r-LastName ($r-Email)br; } -- Code end -- $responders is an array of Responder objects - a Responder object has Email, LastName, FirstName member variables. My problem is that although the email is sent on each iteration and reaches it's intended recipient, I get the Failed to send email message on every loop! Anyone know why? mail() is obviously returning false, but the manual says mail() returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. Yet it _must_ have been successfully accepted for delivery, because the emails always get delivered. Any help would be appreciated. thanks, - Kev ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sendmail return-path from my virtual webhost
I was hoping there was a way to fix it without having to modify my php scripts [e.g., phpBB2, postlister, etc.] Manuel Lemos wrote: Hello, On 07/29/2002 01:54 PM, Al wrote: Emails sent from my php scripts, using sendmail, all have a goofy return-path variable in the header. Is there a way I can correct this, or does it require a change to the sendmail config file that I can't get to? Yes, you can use mail() 5th argument or call sendmail directly with the popen using -f switch. Take a look at these classes to learn how to do it in case you have doubts: http://www.phpclasses.org/mimemessage -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to debug mail() problem?
On 07/30/2002 01:27 PM, Kevin Porter wrote: Hi, I have a loop that sends out a numbers of emails using the mail() function. -- Code start - for ( $i=0, $j=count($responders); $i $j; $i++ ) { $r = $responders[$i]; $headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: $r-FirstName $r-LastName $r-Email\r\n; echo sending email to $r-FirstName $r-LastName ($r-Email)br; if ( !mail( $r-Email, Subject, $message, $headers ) ) echo Failed to send email to $r-FirstName $r-LastName ($r-Email)br; } -- Code end -- $responders is an array of Responder objects - a Responder object has Email, LastName, FirstName member variables. My problem is that although the email is sent on each iteration and reaches it's intended recipient, I get the Failed to send email message on every loop! Anyone know why? mail() is obviously returning false, but the manual says mail() returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. Yet it _must_ have been successfully accepted for delivery, because the emails always get delivered. Any help would be appreciated. thanks, Mail() has a track record of being very buggy, especially under Windows. From that error message it seems that it is getting an unexpected response from your server on the QUIT SMTP command. Anyway, if all else fails, you may want to try to use this class: http://www.phpclasses.org/smtpclass maybe in conjunction with this http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache and php
I'd recommend: http://www.apache.org/dist/httpd/Announcement.html -- Apache 1.3.26 -and- http://www.php.net/release_4_2_2.php -- PHP 4.2.2 Both include the latest bug fixes and are the latest stable releases. I've been running these on a RedHat 7.1 box (64MB RAM, 225mHz Pentium), with MySQL as well for about 4 months without any problems that weren't my fault. HTH chris [EMAIL PROTECTED] On Tuesday, July 30, 2002, at 12:25 PM, [EMAIL PROTECTED] wrote: So, which version of apache and php are the best for working together under any OS system ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sendmail return-path from my virtual webhost
Hello, On 07/30/2002 01:30 PM, Al wrote: I was hoping there was a way to fix it without having to modify my php scripts [e.g., phpBB2, postlister, etc.] There is an explicit php.ini option for that but it only works under Windows. On Unix, you may also try defining the sendmail path added [EMAIL PROTECTED] . Regards, Manuel Lemos Manuel Lemos wrote: Hello, On 07/29/2002 01:54 PM, Al wrote: Emails sent from my php scripts, using sendmail, all have a goofy return-path variable in the header. Is there a way I can correct this, or does it require a change to the sendmail config file that I can't get to? Yes, you can use mail() 5th argument or call sendmail directly with the popen using -f switch. Take a look at these classes to learn how to do it in case you have doubts: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hide the undefined offset error for the array?
I have one of the website on windows and I get the undefined offset error, I don't have that problem on UNIX / Linux. Anyone know what method would work?? Here's the script! In this case, the $raw_data array is empty, so window complain of the empty data by displaying hte error message, Undefined offset . --clip-- if ($raw_data[$num_count] != $match_array[$x]) { --clip-- It's now a Windows/Unix thing...your installations of PHP have different error reporting levels set in PHP.ini. So, either change the error reporting in PHP.ini or with the error_reporting() function, hide the warning by using , or check and make sure the variable exists before you use it. if($raw_data[$num_count] != $match_array[$x]) or... if(isset($raw_data[$num_count]) $raw_data[$num_count] != $match_array[$x]) Hmm...what are you doing, btw? Are you use you couldn't make use of in_array()?? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php 4.2.2 and 4.0.6
You may will want to use hte later version of Apache, the latest stable release is 1.3.26 due to one of hte security hole that affect the previous version, this security hole would allow the vrius, like worm virus or something to go through the security hole. We wouldn't want that. By the way, from the look of the www.horde.org/imp website, if you're going to use IMP version 3.1 then the requirement on that website stated the minimum are PHP version 4.1.0. I'll tell you what's the easiest way, get all stable release with the latest version and you should not have a problem with it. It would be rare that anyone would have that problem. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So, do you know apache 1.3.22 and php 4.2.2 are good for work with IMP 3.x ( http://www.horde.org/imp ) under RH 6.2 system ? Scott Fletcher wrote: Actually, PHP 4.2.2 just have more features than PHP 4.0.6. Example of those are more security and more functions as well as many of the other things. One disadvantage to it is some programming script will break because some PHP features is decommissioned, like functions or someting. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Does php 4.2.2 is better than 4.0.6 ? Thank for your telling ! Edward. -- 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 debug mail() problem?
Manuel == Manuel Lemos [EMAIL PROTECTED] writes: [. . .] Manuel Anyway, if all else fails, you may want to try to use this Manuel class: Manuel http://www.phpclasses.org/smtpclass Manuel maybe in conjunction with this Manuel http://www.phpclasses.org/mimemessage Just by way of affirmation, here --as _though_ it were actually needed-- I've been using the smtpclass for a while now. It rocks. -lee -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A somewhat unusual session question...
I'm aware that the server cannot know whenever a user just quits without logging out, but I was under the impression that the flags session.gc_maxlifetime and session.gc_probability in php.ini would control when and how often leftover session files would be removed. If this isn't true, what are these flags actually used for? Pretty confusing if you ask me... /lasso Scott Fletcher wrote: The session.save_path have nothing to do with it. I have that same problem with the default path, /tmp when the session became a garbage collection when the user quit the browser without logging off. When the user quit the browser then there's no way for the server to know that, so the session stuffs stay active in the session.save_path. You will have to either manually clean it up weekly or use crontab to do the clean up for you at night-time with the time-range the website is off-limit to the user. This is where people do the maintaince also. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Internationalization
Can someone provide a good source of information on what PHP can and cannot do in regards to making a site multi-lingual. I've found a little information about using gettext but that's about it. Do you have to using a certain charset? Do all functions work with different languages? String functions for example? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good books on sessions
Yes , I agree,But that is exactly where my problem comes in, when I link the person forward, it DOES NOT take the new value for the project_id, as it is a form element and it only becomes variable on the action page. This is where I'm unsure about how to initialize the variable. As mentioned earlier in my posts, I simply do a session_register(project_id); on the action page, I DO NOT say anything like $_SESSION['project_id'] = 45; or any other form of assignment whatsoever, as I leave the work to register_globals=on and it's normal expected behaviour. And I think this is where the problem lies. It seems I MUST actually do that for things to work??? Unfortunately I cannot test this yet, as I'm busy with something else, and just trying to get the basic academics right. I understand the way you are explaining sessions 100%, but when I put that knowledge to practise, things doesn't seem to work... :( . I am still to test yours and Rasmus' sugestions and will come back shortly. Thanks for the help so far. Justin French wrote: *shakes head a bit* I'm not REALLY sure what the problem is here, but let's take a step back. A session ID is a unique, random number assigned to a user as they kick around your site. To maintain state (a session) across multiple pages, you pass the session id around. This can be done with the URL or cookies. Yes, trans_sid is in there as well, but all it does is re-write URLs. No surprises so far. You then assign variables to the session. If you're using PHP = 4.1, I'd use $_SESSION['varname'] = value; rather than session_register(), because it's a lot more logical, and clearer to think through. Furthermore, the manual tells us NOT to mix use of session_register('var') and $_SESSION['var'] = 'value'... so, pick a method, and stick to it... since the $_SESSION array is the new way, I'd be going with it. So, the first two session vars YOU assign after the user logs in is the username and password (I wouldn't register the password). $_SESSION['username'] = justin; $_SESSION['password'] = secret; Then a few pages later, they pick an option from a pull-down list, and you assign another variable to the session: $_SESSION['project_id'] = 45; The user clicks through a few more pages, and later wants to work on a different project, so you link them through (forward) to the options page. They select a new project from the pull down, so you need to overwrite the old project_id session var with a new one: $_SESSION['project_id'] = 74; Now, when they kick around through pages, they will be doing it under project_id 74. If you wanted to delete the project_id all together (no project), you could use unset(). Now, go back, and have a look at your code, check out the logic, and I'm sure you'll see the mistake(s). As far as the maintaining session forever thing, I'd highly recommend it... it's highly insecure (walk away from your computer, someone else has access to everything)... besides, sessions are a temporary thing by nature, with garbage cleanouts, etc etc. If you really wanted to maintain state 'forever', you would have to set a cookie with the username and password to that person's computer, hence your website would 'remember them' all the time. Of course there are plenty of reasons why your shouldn't do this. I guess the client should be informed of the options here: 1. log in every so-often as needed (if there is lots of activity, the session probably won't die all day anyway), and have heaps more security 2. log in once only, and have the whole system wide-open forever I'd pick 1 over 2 anytime. I'd also provide a logout button with either system, so that people CHOOSE TO DESTROY THEIR SESSION. Personally, I log-out when I leave my desk, just in case. Imagine if you left a session open which disclosed everyone's pay rates in an office... not good for your career at all :) Hope this all helps, Justin French on 30/07/02 6:04 PM, Petre ([EMAIL PROTECTED]) wrote: Yes, it is a forward link to the page, but as mentioned, that page contains a form with the selection options, and on that form's action page is where I don't see the values change, so the question should probably be something like how do I change the value in the session_var with the newly selected value? And oh, I almost forgot: Due to that fact that this type of app doesn't really have a logical end page, I cannot issue a session_destroy() anywhere logically ( except using a logout button), but that's not going to ensure that people use it... I would ideally like to have this app run on an intranet, where people will most probably have this app open indefinately, and thus I also battle with my logic of keeping a session alive. Thanks . Rasmus Lerdorf wrote: Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on
Re: [PHP] Credit Card Validation With Expiration Date
That is correct. As long as the expiration date is past present it's fine. I used to work for another hosting company who would just guess new expiration dates for monthly recurring customers who had not submitted a cancellation request but who's cards had expired. As long as the date was past present they would go through. P.S. Save the flames. It was not my idea to guess new expiration dates ;-) Jim Grill Support Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Craig Vincent [EMAIL PROTECTED] To: Laurent Drouet [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 3:41 AM Subject: RE: [PHP] Credit Card Validation With Expiration Date I'm looking for an algorithm or a free PHP Script which enable me to verify expiration date with a credit card number. Does anybody knows this ? It doesn't existcredit card number alogrithms do not use the expiry date in their formulas (at least I'm not aware of any that are). Also there is no way to actually check if a credit card is valid without using a company that keeps an online database of active credit cards. The most you can do is verify that the number provided could potentially be a credit card...and even then the expiry date has no algorithm attached to it...as long as it is past the present date there's no way to consider it invalid without cross-referencing against a database of active cards. Sincerely, Craig Vincent -- 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] Dynamic Web Pages
I would like to have the same page (test.php) have different text in it depending on a database entry. which is easy enough. but I want it to be on the fly. example list would be created on the fly depending on databse entries. which ever entry was picked (lets say STLT) it would open up my template test.php and it would but the STLT info on the page. Is there a way to do this without turning on Global_Variables which come standard off in php4.2.2 I'm using apache 2.0.39, PHP4.2.2, FreeBSD4.6, Mysql3.23.51 My database entries would be deparmentpageartical template stlt1body of page test.php aps 1body of page test.php srp 1body of page test2.php main 1body of page test.php the list would be created by a query that looks for all page 1 entries from there the main page would show up(default), but once you pick from the list it would show the database enteries for that department. |---|--- |main | |STLT | STLT was picked show STLT artical database entry |aps | this is are STLT page |srp | | | |---|--- |---|--- |main | |stlt | APS was picked show APS artical database entry |APS | this is are APS page |srp | | | |---|--- I assume that Gobal_Variables are off for a reason. Rolando
[PHP] enabling mysql support
Hi, I would like to recompile php with mysql support. I am a newbie. I really don't want to have to reinstall RedHat just to be able to use MySQL with php. I ran: rpm -qa | frgrep php and I see these: php-4.0.6-15 php-imap-4.0.6-15 asp2php-gtk-0.75.17.1 php-ldap-4.0.6-15 asp2php-0.75.17-1 php-pgsql-4.0.6-15 thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] enabling mysql support
Simply install the php-mysql rpm. On Mon, 29 Jul 2002, Joel Lopez wrote: Hi, I would like to recompile php with mysql support. I am a newbie. I really don't want to have to reinstall RedHat just to be able to use MySQL with php. I ran: rpm -qa | frgrep php and I see these: php-4.0.6-15 php-imap-4.0.6-15 asp2php-gtk-0.75.17.1 php-ldap-4.0.6-15 asp2php-0.75.17-1 php-pgsql-4.0.6-15 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: A somewhat unusual session question...
Hm...seems it works after all...Tried extremely short session.gc_maxlifetime and a 100% session.gc_probability...works like a charm! Sorry for not checking this thoroughly enough before whining... ;) /lasso ([EMAIL PROTECTED]) Lars Olsson wrote: Hi all! The manual claims here (http://se2.php.net/manual/en/ref.session.php) that: /snip ...If session.save_path's path depth is more than 2, garbage collection will not be performed. /snip Anyone know why this is the case? And can you get around it? My scripts currently lives on a shered server and I wanted to get away from using /tmp (which is the default). I changed the session_save path in my .htaccess file to: /home/httpd/vhosts/mydomainname/httpdocs/sessions/ and created some sessions. The creation and destruction of sessions works fine as long as the user logs out correctly, but PHP fails to garbage collect sessions when the user just quits the browser. I've tried changing the session.gc_probability to 100 (and waited until session.gc_maxlifetime had passed), but it still doesn't work. Now I'm stuck with a bunch of deserted session files that don't seem to go away. Any ideas on how to solve this? /Lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] searching an array for words starting with 'p'
try preg_grep() http://www.php.net/manual/en/function.preg-grep.php example: ? $word = array('alpha', 'beta', 'php'); // match anything beginning with upper or lower case p $matches_array = preg_grep('/^(p|P).*/', $word); print_r($matches_array); ? Jim Grill Support Web-1 Hosting http://www.web-1hosting.net - Original Message - From: andy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 10:36 AM Subject: [PHP] searching an array for words starting with 'p' Hi there, I am wondering how to search an array for words starting with a certain character. E.G: $word = array('alpha', 'beta', 'php'); I would like to check if there is a word in the array starting with p Is there alrready a function for this? Thanx, Andy -- 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] searching an array for words starting with 'p'
I don't think there's a builtin that does exactly what you are looking for, but this will do the trick: ?php $array = array ( pinaeapple, orange, passionfruit); $newar = array(); foreach ($array as $val) { if ($val{0} == p) { $newar[] = $val; } } ? -Joseph Rosenblum President, 25th Street Networks Easy, Reliable PHP Web Hosting at: http://www.25thstreet.net/ -Original Message- From: andy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 8:37 AM To: [EMAIL PROTECTED] Subject: [PHP] searching an array for words starting with 'p' Hi there, I am wondering how to search an array for words starting with a certain character. E.G: $word = array('alpha', 'beta', 'php'); I would like to check if there is a word in the array starting with p Is there alrready a function for this? Thanx, Andy -- 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] PHP4 and MS Excel?
I would like to give my users the ability to send (to my website) a Microsoft Excel file, and then have my server (PHP code) extract that data and turn it into a TAB Delimited Text file -- is this possible with PHP? Thanks. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A somewhat unusual session question...
That last statement was not entirely true. The server does not have to know when someone leaves to clean up. You are right about session.gc_maxlifetime and session.gc_probability. if the maxlifetime is set to 1200 (20 minutes) and the probability is set to 1 that means that one percent of the time there is session activity on the server it will perform the garbage clean up routine. If you set probability to 100 then every time someone refreshed or loaded a page that used sessions php will look through the session data and remove anything that's older than our 20 minute maxlifetime. As for your problem, I do not know what to tell you except that you might look for an alternative to file type sessions. It is true that php will not perform garbage clean up if the path is beyond two dirs up from root. MySQL is a popular alternate choice because it's fast and more secure than any file that is world readable. Jim Grill Support Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Lars Olsson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 12:09 PM Subject: [PHP] Re: A somewhat unusual session question... I'm aware that the server cannot know whenever a user just quits without logging out, but I was under the impression that the flags session.gc_maxlifetime and session.gc_probability in php.ini would control when and how often leftover session files would be removed. If this isn't true, what are these flags actually used for? Pretty confusing if you ask me... /lasso Scott Fletcher wrote: The session.save_path have nothing to do with it. I have that same problem with the default path, /tmp when the session became a garbage collection when the user quit the browser without logging off. When the user quit the browser then there's no way for the server to know that, so the session stuffs stay active in the session.save_path. You will have to either manually clean it up weekly or use crontab to do the clean up for you at night-time with the time-range the website is off-limit to the user. This is where people do the maintaince also. -- 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: PHP4 and MS Excel?
I would like to give my users the ability to send (to my website) a Microsoft Excel file, and then have my server (PHP code) extract that data and turn it into a TAB Delimited Text file -- is this possible with PHP? http://groups.google.com/groups?hl=svlr=ie=ISO-8859-1q=data+from+excel+ph p Google is your friend. -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF_function HELP again!!! :(
Here we go again; I posted the message pdflib, NEED HELP with function problem (newby) and thank you to all that helped. Even after that help, seems I cant understand scope to well. Im trying to make a function that creates another page when I have reached the bottom of a page. For some reason everytime I try to include a PDF_function call inside a function I get an out of scope error message. Like so: Fatal error: PDFlib error: function 'PDF_begin_page' must not be called in 'page' scope The function I created is below function next_page($throw) { global $p; if ($throw = open) { PDF_begin_page($p, 600, 800); return; } if ($throw = close) PDF_end_page($p); return; } } All I do is put in to var $throw open or close and its not working; $p is global, what am I doing wrong? Im really having a terrible time with scope and php, no calles from PDF seem to want to work inside a function. Thanks for any help you guys can give me. Im pulling my hair out. PHP is a great language but this scope stuff is givin me fits. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dynamic Web Pages
Hi! Database queries and global variables are not related to each other. It usually just boils down to the following steps 1. Collect data that that's needed for the database query (via $_GET or $_POST) 2. Run the query against the database and store the results in some nice variables (arrays/strings depending on data) 3. Display the results within the page by printing the variables at appropiate places inside your template file (test.php). Obviously the possibilities are endless, but if you want a starting point you could try the following link: http://www.php.net/manual/en/ref.mysql.php (check under Examples) Kindly /lasso ([EMAIL PROTECTED]) Rolando Morales wrote: I would like to have the same page (test.php) have different text in it depending on a database entry. which is easy enough. but I want it to be on the fly. example list would be created on the fly depending on databse entries. which ever entry was picked (lets say STLT) it would open up my template test.php and it would but the STLT info on the page. Is there a way to do this without turning on Global_Variables which come standard off in php4.2.2 I'm using apache 2.0.39, PHP4.2.2, FreeBSD4.6, Mysql3.23.51 My database entries would be deparmentpageartical template stlt1body of page test.php aps 1body of page test.php srp 1body of page test2.php main 1body of page test.php the list would be created by a query that looks for all page 1 entries from there the main page would show up(default), but once you pick from the list it would show the database enteries for that department. |---|--- |main | |STLT | STLT was picked show STLT artical database entry |aps | this is are STLT page |srp | | | |---|--- |---|--- |main | |stlt | APS was picked show APS artical database entry |APS | this is are APS page |srp | | | |---|--- I assume that Gobal_Variables are off for a reason. Rolando -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDF_function HELP again!!! :(
Diregard the missing { bracket its not the problem, I dont why its missing from my post. Jeff Jeffrey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Here we go again; I posted the message pdflib, NEED HELP with function problem (newby) and thank you to all that helped. Even after that help, seems I cant understand scope to well. Im trying to make a function that creates another page when I have reached the bottom of a page. For some reason everytime I try to include a PDF_function call inside a function I get an out of scope error message. Like so: Fatal error: PDFlib error: function 'PDF_begin_page' must not be called in 'page' scope The function I created is below function next_page($throw) { global $p; if ($throw = open) { PDF_begin_page($p, 600, 800); return; } if ($throw = close) PDF_end_page($p); return; } } All I do is put in to var $throw open or close and its not working; $p is global, what am I doing wrong? Im really having a terrible time with scope and php, no calles from PDF seem to want to work inside a function. Thanks for any help you guys can give me. Im pulling my hair out. PHP is a great language but this scope stuff is givin me fits. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $row and alias
I would like to show some fields based on a Interbase database, everthing is working when i type the fields name usinf $row- field something like this while ($row = ibase_fetch_object($sth)) { echo TRTD$row-RAZAO_SOCI/TD; echoTD$row-ENDERECO/TD/TR\n ; } But I would like to make a generic output without declaring the field name in code. I discover that the code bellow show-me the field names and alias for any feetched database while ($row = ibase_fetch_object($sth)) { for ($i=0; $i $coln; $i++) { $col_info = ibase_field_info($sth, $i); echo name: .$col_info['name']. ; echo alias: .$col_info['alias'].; } How can I output the data field content based on field alias ( .$col_info['alias'].; ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP4 and MS Excel?
So -- it looks like I can connect to Excel via COM -- buuutt... anyone have any examples or can anyone point me to any -- that show how to save-out an excel file as a TEXT (.csv) TAB Delimited file? I guess if there is a way to see each ROW in the Excel Spreadsheet -- then I can grab that data and easily save it out as a \t delimited file (I know how to do that) -- ***so, then*** I guess my real question is; how can I *see* the data using COM ??? I'm not too familiar with COM. Say I have an excel spreadsheet called Test.xls and it has three columns: Name:Salary:Expense: Jon Doe$63,000 $2,345 Jane Doe $65,234$3,256 and so on... Thanks Jason Jome [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I would like to give my users the ability to send (to my website) a Microsoft Excel file, and then have my server (PHP code) extract that data and turn it into a TAB Delimited Text file -- is this possible with PHP? http://groups.google.com/groups?hl=svlr=ie=ISO-8859-1q=data+from+excel+ph p Google is your friend. -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDF_function HELP again!!! :(
Sounds like you didn't call pdf_end_page() before calling your next_page() function. -Rasmus On Tue, 30 Jul 2002, Jeffrey wrote: Here we go again; I posted the message pdflib, NEED HELP with function problem (newby) and thank you to all that helped. Even after that help, seems I cant understand scope to well. Im trying to make a function that creates another page when I have reached the bottom of a page. For some reason everytime I try to include a PDF_function call inside a function I get an out of scope error message. Like so: Fatal error: PDFlib error: function 'PDF_begin_page' must not be called in 'page' scope The function I created is below function next_page($throw) { global $p; if ($throw = open) { PDF_begin_page($p, 600, 800); return; } if ($throw = close) PDF_end_page($p); return; } } All I do is put in to var $throw open or close and its not working; $p is global, what am I doing wrong? Im really having a terrible time with scope and php, no calles from PDF seem to want to work inside a function. Thanks for any help you guys can give me. Im pulling my hair out. PHP is a great language but this scope stuff is givin me fits. Jeff -- 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] Serialised Data DBs
Hi, Is it necessary to perform addslashes() on serialised data before inserting it into a database? Thanks, Danny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serialised Data DBs
Yes, you would need to. serialize() does not encode any of the variable data. -Rasmus On Tue, 30 Jul 2002, Danny Shepherd wrote: Hi, Is it necessary to perform addslashes() on serialised data before inserting it into a database? Thanks, Danny. -- 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] how to apply php patch file: 4.2.1 - 4.2.2
I couldn't find any adequate instructions on this anywhere on this list or on the php web site so here is for anyone who needs it. I had originally tried: patch patchfile but that doesn't work, even though file names don't require any stripping with -p option, it is still required: -p0 My php sources are in /usr/local/src cp patchfile /usr/local/src cd /usr/local/src cp php-4.2.1 php-4.2.1.copy patch -p0 patchfile mv php-4.2.1 php-4.2.2 mv php-4.2.1.copy php-4.2.1 Then you need to reconfigure, re-make php and install, restart apache. - Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail Form
Can somebody please tell me why I keep getting this error when using this script... Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php on line 54 ?php // Read POST request params into global vars $to = $_POST['to']; $from= $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; // Obtain file upload vars $fileatt = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; $headers = From: $from; if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x; // Add the headers for a file attachment $headers .= \nMIME-Version: 1.0\n . Content-Type: multipart/mixed;\n . boundary=\{$mime_boundary}\; // Add a multipart boundary above the plain message $message = This is a multi-part message in MIME format.\n\n . --{$mime_boundary}\n . Content-Type: text/plain; charset=\iso-8859-1\\n . Content-Transfer-Encoding: 7bit\n\n . $message . \n\n; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $message .= --{$mime_boundary}\n . Content-Type: {$fileatt_type};\n . name=\{$fileatt_name}\\n . //Content-Disposition: attachment;\n . // filename=\{$fileatt_name}\\n . Content-Transfer-Encoding: base64\n\n . $data . \n\n . --{$mime_boundary}--\n; } // Send the message $ok = mail($to, $subject, $message, $headers); if ($ok) { echo pMail sent! Yay PHP!/p; } else { echo pMail could not be sent. Sorry!/p; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php