RE: [PHP] Dynamic to Static
Hello Ed, We have used a combination of the following scripts on our site: /jim if ((filemtime(cache/$sidid) + 60) time()) { $cachefile = fopen(cache/$sidid,r); fpassthru($cachefile); exit(); } // start buffering the output ob_start(); // output format - either www or file $output = outputfile.php; $data = ob_get_contents(); $fp = fopen (inputfile.inc, w); fwrite($fp, $data); fclose($fp); ob_end_clean(); echo finished; -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: den 15 juli 2004 06:20 To: [EMAIL PROTECTED] Subject: [PHP] Dynamic to Static Is anyone taking a dynamic PHP / MySQL site and storing or cacheing it statically in order for pages to display more quickly when visitors access the site? If so, what solutions are you using to achieve this? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compile Php5: --with-mysql and --with-mysqli
Curt Zirzow wrote: * Thus wrote Jacob Friis Larsen: How do I install Php5 with both --with-mysql and --with-mysqli? 1. Follow instructions at http://php.net/mysqli. Is this correct: --with-mysqli=/usr/bin/mysql_config? (This works: ./configure --with-mysqli=/usr/bin/mysql_config --with-apxs2) 2. Follow instructions at http://php.net/mysql, using the path to your mysql4.1 library Is this correct: --with-mysql=/usr? If not, how can I find out? 3. Tweak your my.cnf so the mysqlclient look at the right places. What should I tweak? MySQL is the original RPM from MySQL. Version 4.1.3-beta. Sorry, I think I need more help. I've read this: If you would like to install the mysql extension along with the mysqli extension you have to use the same client library to avoid any conflicts., but I do not understand the meaning of it. There is only one MySQL installation on the server. This is my configure, which fails: ./configure --disable-all --with-mysqli=/usr/bin/mysql_config --with-mysql=/usr --with-apxs2 Thanks, Jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dynamic to Static
Ed Lazor wrote: Is anyone taking a dynamic PHP / MySQL site and storing or cacheing it statically in order for pages to display more quickly when visitors access the site? If so, what solutions are you using to achieve this? Thanks, Ed Hey Ed, there are a couple of ways that you can do it depending on your needs. Probably the easiest way to do it is to generate the entire page once and cache it for some period of time (1 hour?) and then serve that page until you determine it should expire. OR You could create a static part of a page and a dynamic part of a page. HTML works best for the static part (obviously :) and then you just get the php code you need for the dynamic. If this is your choice, then you'll probably want to cache MySQL query results and as much of the personalized user information as possible - dbm files can work well for this. OR If there isn't much personal information (but a lot of users... you DO have a lot of users right? ;) you can be really stingy and store some user data in a cookie. Usual rules for cookies apply here, but basically if you have very little personalized info needed for every page then this can be more efficient than db calls. OR Try using one of the software packages out there that cache php byte code (especially if you have a lot of includes). If you absolutely demand dynamic generation and want a performance boost, Zend can help you out a lot in this department. OR Some other solution someone more clever than I has come up with :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [Q] PHP 101 -- How to check for session existence?
Hey Michael, I think you really only need to check the $_SESSION array, not necessarily each index. if (!isset($_SESSION)) { // login header('Location: ' . MEMBER_LOGIN_PAGE); } else { // session exists } However, if you want to have non-empty values for your session variables you should use: if (empty($_SESSION['username'] || empty($_SESSION['session_id']) { // session indexes username and / or session_id are empty header('Location: ' . MEMBER_LOGIN_PAGE); } There is a fine difference between isset() and empty(). Check the online manual or this newsgroup for further discussion. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: New object model
Troy S wrote: Is there an ini-file setting so that objects are passed by value as in PHP 4? If so, how long is this likely to be supported? Thanks, Troy Although you can turn on zend engine 1 compatibility, if you intend to distribute your code you cannot expect this on most servers. Another way to pass by value is to use the __clone method. function test($orig, $clone) { $orig-x = 'I am the original.'; $clone-x = 'I am a clone.'; print_r($orig); // should be different since this is a copy, not a reference print_r($clone); } class foo {} $orig = new foo(); test($orig, $orig-__clone()); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [Q] PHP 101 -- How to check for session existence?
I think it would be better to use Apache facility of authentication through Mysq l Michael T. Peterson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To protect certain web pages on my site, I am using the following code inserted at the very beginning (top) of the page: ?php include_once( 'init.php'); if( isset( $HTTP_SESSION_VARS['session_id'] ) == FALSE || isset( $HTTP_SESSION_VARS['username'] ) == FALSE ){ header( 'Location: '.MEMBER_LOGIN_PAGE ); } ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html ... Dreamweaver template code here... /html Is this a recommended way of doing this? Next, to initialize the session, a login page posts the username - password information to a PHP script, check_login.php. The login info is checked against a database and, if all is kosher, a new session is created and the user is dispatched to the site's home page. Here's the relevant code: ?php include_once( 'init.php'); ... $username = trim($HTTP_POST_VARS['username']); $password = trim($HTTP_POST_VARS['password']); ... if username and password check out, initialize a session... $HTTP_SESSION_VARS['username'] = $username; $HTTP_SESSION_VARS['session_id'] = crypt( $password ); header( 'Location: '.SITE_HOME_PAGE ); ... ? Does this make sense? Am I missing something? Any review, advice, etc., would be much appreciated. Cheers, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload an image and store it in mysql
I have php code that takes text input from a webpage and and stores it in a mysql data base. I tried uploading small images (jpg) using basically the same syntax but they don't make it into the data base. Does anyone know of a simple tutorial that shows how to do this? although I'm against storing files in databases... $file = mysql_real_escape_string(file_get_contents($_FILES['yourfile']['tmp_name'])); $query = INSERT INTO yourtable (imgdata) VALUES ('$file'); Thanks, that seems to work. Although trying to retrieve them and show them in a browser shows characters / symbols instead. This kind of stuff: j?w4qHQI'[EMAIL PROTECTED] `*[#j q6]Q.b ?(Y:9-(K\' EbXW(e 9?pEXalm8={?xf Ly?e(5 PP3a o XD ~?J VF7 c[3bCE Another reason for not storing images in a database - you need to spit out the correct set of headers before you send the actual image data. -- Raditha Dissanayake. - http://www.raditha.com/megaupload/upload.php Sneak past the PHP file upload limits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic to Static
Ed Lazor wrote: Is anyone taking a dynamic PHP / MySQL site and storing or cacheing it statically in order for pages to display more quickly when visitors access the site? If so, what solutions are you using to achieve this? The best example of this that I have seen is in the mediawiki software - the software that powers the wikipedia. For smaller sites (i appologise if yours is a huge site) all that hard work is not required. Just install turck MMCache if you are really worried about speed. -- Raditha Dissanayake. - http://www.raditha.com/megaupload/upload.php Sneak past the PHP file upload limits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: php vs. cgi app
Bruce, you need to start new threads when you ask a new question... a lot of people don't bother to check out a thread that's already got responses, and it really makes more logical sense to start a new one anyway (original post is below my response)... When you say cgi vs. php, I'm going to assume you mean cgi versus apache module (correct me if I misunderstand). To be honest I don't know enough about the internals of the apache module to tell you why it's better for an apache server (would love it if someone could explain!). What I do know I've gathered from PHP's site... check these out: http://www.php.net/install.commandline http://us3.php.net/manual/en/security.cgi-bin.php Jason [original post] hi.. a really general/basic question... what is the difference between a cgi app and a php app.. does it really come down to where the app is being run from.. i mean within apache, if i specify that php/perl/etc... app resides at a given location, and that files with a certain extension are to be handled by the perl/php/etc app, then i can handle the processing of the file by the interpreter anywhere within my site that i grant access to. is there anything/any reason to have a cgi-bin portion of my app, other than good design practice... clarification would be useful!!! thanks.. -bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compile Php5: --with-mysql and --with-mysqli
Jacob Friis Larsen wrote: Curt Zirzow wrote: * Thus wrote Jacob Friis Larsen: How do I install Php5 with both --with-mysql and --with-mysqli? 1. Follow instructions at http://php.net/mysqli. Is this correct: --with-mysqli=/usr/bin/mysql_config? (This works: ./configure --with-mysqli=/usr/bin/mysql_config --with-apxs2) 2. Follow instructions at http://php.net/mysql, using the pathto your mysql4.1 library Is this correct: --with-mysql=/usr? If not, how can I find out? execute /usr/bin/mysql_config --include. It's the path without include/mysql. Also make sure you don't have multiple libraries installed, you should install MySQL-shared-compat*.rpm 3. Tweak your my.cnf so the mysqlclient look at the right places. What should I tweak? MySQL is the original RPM from MySQL. Version 4.1.3-beta. Sorry, I think I need more help. I've read this: If you would like to install the mysql extension along with the mysqli extension you have to use the same client library to avoid any conflicts., but I do not understand the meaning of it. There is only one MySQL installation on the server. This is my configure, which fails: ./configure --disable-all --with-mysqli=/usr/bin/mysql_config --with-mysql=/usr --with-apxs2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: New object model
Jason Barnett wrote: Although you can turn on zend engine 1 compatibility, if you intend to distribute your code you cannot expect this on most servers. Another way to pass by value is to use the __clone method. function test($orig, $clone) { $orig-x = 'I am the original.'; $clone-x = 'I am a clone.'; print_r($orig); // should be different since this is a copy, not a reference print_r($clone); } class foo {} $orig = new foo(); test($orig, $orig-__clone()); Fatal error: Cannot call __clone() method on objects - use 'clone $obj' instead... Should be: test($orig, clone($orig)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic to Static
Hi, Ed Lazor wrote: Is anyone taking a dynamic PHP / MySQL site and storing or cacheing it statically in order for pages to display more quickly when visitors access the site? If so, what solutions are you using to achieve this? Thanks, Ed I'm using two-way or two-step caching - I'll try to describe it ;) conditions: - wrote special class for cache handling, updating - using smarty - using turck mmcache 1. step - as the data I'm passing to smarty are only array, I've decided to store this pre-generated array in a file*. - data are refreshed not periodically but only when changed or if they are missing* - in the scrip, where I'm displaying those data, the file is only included *this is done by my caching class 2. step - as I'm using turck mmcache, data file is precompiled into bytecode and held in shared memory. I've got HUGE improvement in speed and from-time-to-time server loads disappeared. From 0.1s per script I've got to approx 0.005s per script, ofcourse it depends on some other conditions, but generally improvement was huge. -- Mirek Novak jabberID: [EMAIL PROTECTED] ICQ: 119499448 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: php vs. cgi app
-Original Message- When you say cgi vs. php, I'm going to assume you mean cgi versus apache module (correct me if I misunderstand). To be honest I don't know enough about the internals of the apache module to tell you why it's better for an apache server (would love it if someone could explain!). PHP loads as an Apache module at startup and remains in memory, ready to process files. Running PHP as a cgi means that Apache has to load and run PHP each time a PHP file is processed. Basically, there's a lot of extra work in running PHP as a cgi. There are some benefits to having the cgi available though. For example, if you're at a unix prompt and need to process a file. Or, more commonly, if you want to execute scripts in cronjobs. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: php vs. cgi app
On Thursday 15 July 2004 16:02, Ed Lazor wrote: There are some benefits to having the cgi available though. For example, if you're at a unix prompt and need to process a file. Or, more commonly, if you want to execute scripts in cronjobs. For these situations you would be better off using the CLI version of PHP. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Sometimes when you look into his eyes you get the feeling that someone else is driving. -- David Letterman */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MIME files decoding
Hello all, In order to use pear mimedecode.php I have a few questions that were not answered by the documentation. I have emails that have .zip, .pdf, .txt and .csv files. Some emails have more than one attachment. I would like to have a php script to fetch these emails and save only those with .zip , .txt and .csv deleting everything else. Can anyone point me how to use mimedecode so that I can keep the original filename of the attachment. How can I obtain the file name? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compile Php5: --with-mysql and --with-mysqli
execute /usr/bin/mysql_config --include. It's the path without include/mysql. In that case my configure is correct: ./configure --disable-all --with-mysqli=/usr/bin/mysql_config --with-mysql=/usr --with-apxs2 Also make sure you don't have multiple libraries installed, you should install MySQL-shared-compat*.rpm I have installed MySQL-shared-compat-4.1.3-0.i386.rpm, but I still get errors. thanks, Jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MIME files decoding
Hi Scheidecker, Try posting to [EMAIL PROTECTED], the author will be able to help you with your question. C.F. Scheidecker Antunes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, In order to use pear mimedecode.php I have a few questions that were not answered by the documentation. I have emails that have .zip, .pdf, .txt and .csv files. Some emails have more than one attachment. I would like to have a php script to fetch these emails and save only those with .zip , .txt and .csv deleting everything else. Can anyone point me how to use mimedecode so that I can keep the original filename of the attachment. How can I obtain the file name? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP5 Windows not built with Soap Enabled?
Did you adjust your php.ini file? -Original Message- From: Sean Malloy [mailto:[EMAIL PROTECTED] Sent: donderdag 15 juli 2004 3:50 To: [EMAIL PROTECTED] Subject: [PHP] PHP5 Windows not built with Soap Enabled? Am I the only one experiencing this: Fatal error: Class 'SoapClient' not found checking the output of phpinfo() for the 5.0.0 binary from www.php.net, it would seem there is no soap support built in at all. Or have I just not woken up today? -- 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] Regular Expressions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello together, I am havin trouble with php regular expressions. I would like to implement following pattern Last Name:\s*(.*)\n. - From following text, Name: James Last Name: Jason Street: abc I get just 'Jason'. But what I currently get is: Jason Street: abc Obviously the new-line is missed. Any thoughts on this? sample code: ereg(Last Name:\s*(.*)\n, $strInput, $regs) echo $regs[1]; Thanks for the help! Cheers, Arik -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (MingW32) iD8DBQFA9ns4//PXyz2NiW8RAuLDAJ0eBoCsJvT919/9xoVdk+BUkc8pegCeJ6O0 PxeXTxOwxr4WF639fZpDFYs= =3BQA -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
Arik Raffael Funke wrote: Hello together, I am havin trouble with php regular expressions. I would like to implement following pattern Last Name:\s*(.*)\n. - From following text, Name: James Last Name: Jason Street: abc I get just 'Jason'. But what I currently get is: Jason Street: abc Obviously the new-line is missed. Any thoughts on this? sample code: ereg(Last Name:\s*(.*)\n, $strInput, $regs) echo $regs[1]; Thanks for the help! Cheers, Arik Donno about regular expressions but with perl compatible you can use: preg_match('/Last Name:\s*(.*)\n/', $inputStr, $regs); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
Obviously the new-line is missed. Any thoughts on this? sample code: ereg(Last Name:\s*(.*)\n, $strInput, $regs) echo $regs[1]; try this: ereg(Last Name:\s*(.*[^\n]), $strInput, $regs); echo $regs[1]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 15 Jul 2004 08:02:13 -0500 Matt M. [EMAIL PROTECTED] wrote: Obviously the new-line is missed. Any thoughts on this? sample code: ereg(Last Name:\s*(.*)\n, $strInput, $regs) echo $regs[1]; try this: ereg(Last Name:\s*(.*[^\n]), $strInput, $regs); echo $regs[1]; Thanks for the quick help. Both ways, preg_match('/Last Name:\s*(.*)\n/', $inputStr, $regs); and ereg(Last Name:\s*(.*[^\n]), $strInput, $regs); work fine. However if I have, Last Name: Street: Teststreet (no entry after last name) Both search strings return me: - Street: Teststreet - Also why doesn't Last Name:\s*(.*)$ work, and neither ^Last Name:\s*(.*). Both strings are not found at all - that's why I thought the php implementation might treat new lines in a strange way. Can anybody explain these effects to me? Cheers, Arik -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (MingW32) iD8DBQFA9oN1//PXyz2NiW8RAmCQAJ9wRDxc8YDyfU+4EoNeRsqMKJDPBQCgsMvv 7cpFD6cYZuckqGdY+1Gtqi8= =Hi/P -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
In article [EMAIL PROTECTED], Arik Raffael Funke wrote: implement following pattern Last Name:\s*(.*)\n. I get just 'Jason'. But what I currently get is: Jason Street: abc This is behaviour because (.*) is greedy. As you noticed, it matched Jason \nStreet:abc /Last Name:\s+(.*?)\n/ -- Tim Van Wassenhove http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
On Thursday 15 July 2004 21:15, Arik Raffael Funke wrote: However if I have, Last Name: Street: Teststreet (no entry after last name) Both search strings return me: Street: Teststreet Also why doesn't Last Name:\s*(.*)$ work, and neither ^Last Name:\s*(.*). Both strings are not found at all - that's why I thought the php implementation might treat new lines in a strange way. preg_match('|^Last Name:(.*)$|m', $haystack, $matches); should work. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Someone is speaking well of you. How unusual! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Log all GET AND POST?
I was wondering if anyone knew of a way to log all GET and POST information being passed to a log file? Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Log all GET AND POST?
[snip] I was wondering if anyone knew of a way to log all GET and POST information being passed to a log file? [/snip] Yes. Create a log file. Pass all GET and POST information to it. Over and over. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 release HTTP Authentication not working on FreeBSD.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Guys, I've just upgraded from 5.0 rc3 to 5.0 release on freeBSD (using the ports) and now find that HTTP Authentication dosent work. Here is the test script that i am using: ?php ~ error_reporting(E_ALL); ~ ini_set('display_errors', true); ~ if (! (isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['PHP_AUTH_PW']) )) { ~ header('WWW-Authenticate: Basic realm=My Realm'); ~ header('HTTP/1.0 401 Unauthorized'); ~ echo 'Text to send if user hits Cancel button'; ~ exit; ~ } else { ~ echo pHello '{$_SERVER['PHP_AUTH_USER']}'./p; ~ echo pYou entered {$_SERVER['PHP_AUTH_PW']} as your password./p; ~ } ? And here is the output that i get: Notice: Undefined index: PHP_AUTH_USER in test.php on line 10 Hello ''. You entered pass as your password. As you can see PHP_AUTH_USER is on longer being set. Does anybody else have this issue or know of a fix? - -- Regards, William Bailey. Pro-Net Internet Services Ltd. http://www.pro-net.co.uk/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFA9o3ZzSfrYDJMXmERAmZqAKCunk+xl2w+RRIKOvbDTQEWjXbGCgCgxXsw DknafWhfiwLTYrusTzHl0gE= =IMNL -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Dynamic to Static
Is anyone taking a dynamic PHP / MySQL site and storing or cacheing it statically in order for pages to display more quickly when visitors access the site? If so, what solutions are you using to achieve this? I looked at doing it, wrote a single PHP-page that when I accessed would make static pages for me (numbering in the thousands), but it was all for nought as the pieces of code I included in the web pages made for not being able to get a PHP-session variable and hindering my cart process. Maybe I could change the code in some way to get the correct information where I need it, but at this time the functional way to do it was with leaving the pages dynamic. That being said, if all you want to do is spit out numerous pages (based off MySQL data) and put them on the web for people to look at, I would be happy to shoot you my PHP page to work it out. Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem including images in safe_mode
Hall all, i have sometimes problems to include images. the reason are substrings like ? in the image. in that case the php-parser tries to parse the string and returns the error: parse error, unexpected ',' in unforunatly there in no other way to include the image, cause the server runs in safe_mode and the image is located in the safe_mode_include_dir. therefore readfile and things like that wont work. Any suggestions how to protect an including file for getting parsed? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Log all GET AND POST?
On Thursday 15 July 2004 09:58 am, Robert Sossomon wrote: I was wondering if anyone knew of a way to log all GET and POST information being passed to a log file? Thanks, Robert $DEBUG_DATA = $_SERVER['PHP_SELF'].\n; while (list ($key, $val) = each ($_REQUEST)) { if (is_array($_REQUEST[$key])){ while (list ($ar_key, $ar_val) = each ($_REQUEST[$key])) { $DEBUG_DATA .= $key [ $ar_key ] = $ar_val\n; } } else { $DEBUG_DATA .= $key = $val\n; } } mysql_select_db(HISTORY); $query = insert into BIG_BROTHER values ( '.$_SESSION['user_ID'].', .time()., '$DEBUG_DATA'); mysql_query($query); reset($_REQUEST); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] including external C header files and libraries
I have a 3rd party SDK written in C. It includes a compiled .a file and a header file (.h). Is there any way that I can call the functions included in the SDK from within a php script? Regards, Jeremy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem including images in safe_mode
On Thursday 15 July 2004 19:52, Frank Holtschke wrote: i have sometimes problems to include images. the reason are substrings like ? in the image. in that case the php-parser tries to parse the string and returns the error: parse error, unexpected ',' in unforunatly there in no other way to include the image, cause the server runs in safe_mode and the image is located in the safe_mode_include_dir. therefore readfile and things like that wont work. Any suggestions how to protect an including file for getting parsed? Even if you could prevent an included file from being parsed, I can't see how it would help you as you can't assign the contents to a variable. But you say that you sometimes have problems which implies that sometimes it works. Could you explain how it works? And anyway why are your images in safe_mode_include_dir in the first place? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I love you, not only for what you are, but for what I am when I am with you. -- Roy Croft */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File locking in PHP???
Hi! I saw the php function flock(), since I never used it before so I thought I would ask you folks a couple of questions. 1) Is this function good or is there a better function somewhere that I'm not aware of? 2) If the flock() activated the file lock then is it possible that I manually unlock the file? Like chmod or something through the Linux console for example. 3) good example of script just in case.. Thanks, FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Log all GET AND POST?
Robert Sossomon wrote: I was wondering if anyone knew of a way to log all GET and POST information being passed to a log file? The GET stuff is already in your apache log file. The POST stuf you probably don't want to log because it can be rather huge if you are dealing with things like file uploads. Jame's suggestion seems pretty good especially because you cannot get the raw post data for 'known' content types with PHP. -- Raditha Dissanayake. - http://www.raditha.com/megaupload/upload.php Sneak past the PHP file upload limits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem including images in safe_mode
Jason Wong wrote: On Thursday 15 July 2004 19:52, Frank Holtschke wrote: i have sometimes problems to include images. the reason are substrings like ? in the image. in that case the php-parser tries to parse the string and returns the error: parse error, unexpected ',' in unforunatly there in no other way to include the image, cause the server runs in safe_mode and the image is located in the safe_mode_include_dir. therefore readfile and things like that wont work. Any suggestions how to protect an including file for getting parsed? Even if you could prevent an included file from being parsed, I can't see how it would help you as you can't assign the contents to a variable. But you say that you sometimes have problems which implies that sometimes it works. Could you explain how it works? We just flush it on the display. the php-script is an image src like img src=showImage.php The showImage.php does an include of the image which is located out of the DocumentRoot. The image is generated by a cron script. Mostly it works but sometimes we have the problem described above. And anyway why are your images in safe_mode_include_dir in the first place? Cause php-scripts (owned by different uids = therefore the safe_mode_include_dir ) of various virtual servers make use of the image. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File locking in PHP???
Hi! I saw the php function flock(), since I never used it before so I thought I would ask you folks a couple of questions. did you read all of the user comments on http://us2.php.net/flock There is a bunch of good info in there -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File locking in PHP???
Yea, read that, very good info there. Alright, I'll make one from scratch and do some testing to find what need to be add/change/remove to make it more a rock solid script. Boy, it remind me of Perl. Thanks, FletchSOD Matt M. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! I saw the php function flock(), since I never used it before so I thought I would ask you folks a couple of questions. did you read all of the user comments on http://us2.php.net/flock There is a bunch of good info in there -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File locking in PHP???
Nah! I'll settle for a simplier one... file_exists() by checking to see if the file exist then spit out the error message. Meaning the file is in use... FletchSOD Matt M. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! I saw the php function flock(), since I never used it before so I thought I would ask you folks a couple of questions. did you read all of the user comments on http://us2.php.net/flock There is a bunch of good info in there -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP upgrade... issues???
I've just got this mail from my host... = Dear customer, This email is sent to inform you that we'll upgrade the PHP version on your server to the latest stable version 4.3.8 within the next hour. = Are there any issues that I need to panic about...? I'm off to google now, but am just having a panic attack, and hope that I can sit back knowing that my PHP pages will still work... Cheers... Tris... * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP upgrade... issues???
[EMAIL PROTECTED] wrote: I've just got this mail from my host... = Dear customer, This email is sent to inform you that we'll upgrade the PHP version on your server to the latest stable version 4.3.8 within the next hour. = Are there any issues that I need to panic about...? I'm off to google now, but am just having a panic attack, and hope that I can sit back knowing that my PHP pages will still work... I wouldn't be too worried. PHP 4.3.8 Changelog: http://us2.php.net/ChangeLog-4.php -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP upgrade... issues???
[EMAIL PROTECTED] wrote: This email is sent to inform you that we'll upgrade the PHP version on your server to the latest stable version 4.3.8 within the next hour. = Are there any issues that I need to panic about...? Don't worry about, I'm sure you will have any problem as it only fixes some security bugs. Mine is upgrading today alto to 4.3.8 (From 4.3.7), and before where many, many upgrade versions. My only problem is that I cannot test pages on my preview server, during this time. My only worry is my pub being opened to have a beer with friend ;) Regards, Jordi Canals -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date difference
Hello, Is there a function to determine the difference between two dates? I am asking so I can do some date verification for COPA. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ereg question/prob...
hi... i have the following... $file = .txt; ereg((\.)([a-z0-9]{3,5})$, $file, $regs); echo ww = .$regs. brbr; i'm trying to figure out how to get the portion of the regex that's the extension of the file. my understanding of the docs, says that the extension should be in the $reg array any ideas/comments on where my mistake is would be appreciated... thanks -bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ereg question/prob...
In article [EMAIL PROTECTED], Bruce wrote: $file = .txt; ereg((\.)([a-z0-9]{3,5})$, $file, $regs); echo ww = .$regs. brbr; i'm trying to figure out how to get the portion of the regex that's the extension of the file. my understanding of the docs, says that the extension should be in the $reg array any ideas/comments on where my mistake is would be appreciated... Will it work with 123.123.txt ? If you have a look at the file functions in the manual, you'll find much better solutions like pathinfo(); -- Tim Van Wassenhove http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [mysql]Problem with PHP5
I have included the extension. Now I get Unable to load dynamic library 'C:\php\ext\php_mysql.dll' - The specified procedure could not be found I have in Windows\System32 the file libmysql.dll. I have also put it in the php\ext directory without any result. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP upgrade... issues???
Phew! However, While reading about php upgrades, I've got the impression that version 5, will not support MySQL by default... Does that mean that I'll have to ensure my hosts install an extra module, or worse case senario, I'll have to re-write all my pages, to take new code into effect... I' know I'm sounding liek a worried mother hen, but I can't seem to find confirmation on line?!?! Ho hum, nearly Friday eh? John W. Holmes [EMAIL PROTECTED] 15/07/2004 17:40 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP] PHP upgrade... issues??? [EMAIL PROTECTED] wrote: I've just got this mail from my host... = Dear customer, This email is sent to inform you that we'll upgrade the PHP version on your server to the latest stable version 4.3.8 within the next hour. = Are there any issues that I need to panic about...? I'm off to google now, but am just having a panic attack, and hope that I can sit back knowing that my PHP pages will still work... I wouldn't be too worried. PHP 4.3.8 Changelog: http://us2.php.net/ChangeLog-4.php -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
[PHP] Problem with ImageJPEG and quality 75
I have a problem with my image resize function When i resize/save an image with 'ImageJPEG($DEST_IMAGE,$OUTPUT_FILE)' everything works fine, but with 'ImageJPEG($DEST_IMAGE,$OUTPUT_FILE,100)' it displays only the first half of the image, the bottom is blank any suggestions on how to fix this ? regards, Ewout -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to tell if the file is already locked with flock()???
Hi! How do we tell if the file is already locked when someone use a flock() on the file?? FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Storing text with carriage returns in MySQL
I'm trying to use PHP to read text from an HTML textarea form field and store in in MySQL using the longtext data type but it's cutting off everything after the first carriage return. I suspect I need to iterate through the text looking for CRs then do something? But I don't know what. Can anyone offer any pointers? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to tell if the file is already locked with flock()???
[snip] How do we tell if the file is already locked when someone use a flock() on the file?? [/snip] If your flock attempt returns FALSE then it is likely locked already -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Storing text with carriage returns in MySQL
http://www.php.net/manual/en/function.addslashes.php Warren Vail -Original Message- From: Andrew Wood [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 12:19 PM To: php-gen Subject: [PHP] Storing text with carriage returns in MySQL I'm trying to use PHP to read text from an HTML textarea form field and store in in MySQL using the longtext data type but it's cutting off everything after the first carriage return. I suspect I need to iterate through the text looking for CRs then do something? But I don't know what. Can anyone offer any pointers? 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
AW: [PHP] Storing text with carriage returns in MySQL
Hi Andrew, I'm also saving html input from textarea fields into my msql DB...but try to use the filed type TEXT instead of LONGTEXT that it should work fine. Greetings, Ron -Ursprüngliche Nachricht- Von: Andrew Wood [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 15. Juli 2004 21:19 An: php-gen Betreff: [PHP] Storing text with carriage returns in MySQL I'm trying to use PHP to read text from an HTML textarea form field and store in in MySQL using the longtext data type but it's cutting off everything after the first carriage return. I suspect I need to iterate through the text looking for CRs then do something? But I don't know what. Can anyone offer any pointers? 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] Storing text with carriage returns in MySQL
The major difference between TEXT and LONGTEXT data types is the size (65k vs 4Meg). The function addslashes() will resolve many user input problems where the user; Inputs a quoted value in the middle of his string. Uses and and in text. Inputs other ASCII control characters like tab and bell (remember that one). Just to name a few. Usually MySQL will strip slashes when the column is retrieved, however care should be taken when displaying the value on a form (inside another text area should be no problem). Suppose a user codes the following bTEST/b to be stored in your database, you have to decide if you want that displayed on a web page as bold text or exactly as input. If you want it to appear exactly as the user typed it in, check out the htmlspecialchars() function. Hope this helps, Warren Vail -Original Message- From: Ron Stiemer [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 12:26 PM To: 'php-gen' Subject: AW: [PHP] Storing text with carriage returns in MySQL Hi Andrew, I'm also saving html input from textarea fields into my msql DB...but try to use the filed type TEXT instead of LONGTEXT that it should work fine. Greetings, Ron -Ursprüngliche Nachricht- Von: Andrew Wood [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 15. Juli 2004 21:19 An: php-gen Betreff: [PHP] Storing text with carriage returns in MySQL I'm trying to use PHP to read text from an HTML textarea form field and store in in MySQL using the longtext data type but it's cutting off everything after the first carriage return. I suspect I need to iterate through the text looking for CRs then do something? But I don't know what. Can anyone offer any pointers? 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ereg question/prob...
$regs is an array not a string ! try print_r or var_dump to determine $regexp's content Tim Van Wassenhove wrote: In article [EMAIL PROTECTED], Bruce wrote: $file = .txt; ereg((\.)([a-z0-9]{3,5})$, $file, $regs); echo ww = .$regs. brbr; i'm trying to figure out how to get the portion of the regex that's the extension of the file. my understanding of the docs, says that the extension should be in the $reg array any ideas/comments on where my mistake is would be appreciated... Will it work with 123.123.txt ? If you have a look at the file functions in the manual, you'll find much better solutions like pathinfo(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5 release HTTP Authentication not working on FreeBSD.
known problem, will be fixed soon in 5.0.1 which should be released asap William Bailey wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Guys, I've just upgraded from 5.0 rc3 to 5.0 release on freeBSD (using the ports) and now find that HTTP Authentication dosent work. Here is the test script that i am using: ?php ~ error_reporting(E_ALL); ~ ini_set('display_errors', true); ~ if (! (isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['PHP_AUTH_PW']) )) { ~ header('WWW-Authenticate: Basic realm=My Realm'); ~ header('HTTP/1.0 401 Unauthorized'); ~ echo 'Text to send if user hits Cancel button'; ~ exit; ~ } else { ~ echo pHello '{$_SERVER['PHP_AUTH_USER']}'./p; ~ echo pYou entered {$_SERVER['PHP_AUTH_PW']} as your password./p; ~ } ? And here is the output that i get: Notice: Undefined index: PHP_AUTH_USER in test.php on line 10 Hello ''. You entered pass as your password. As you can see PHP_AUTH_USER is on longer being set. Does anybody else have this issue or know of a fix? - -- Regards, William Bailey. Pro-Net Internet Services Ltd. http://www.pro-net.co.uk/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFA9o3ZzSfrYDJMXmERAmZqAKCunk+xl2w+RRIKOvbDTQEWjXbGCgCgxXsw DknafWhfiwLTYrusTzHl0gE= =IMNL -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
Yep, but to avoid his problem with empty Strings he should use something like: /Last Name: *(.*?)\n/ outerwise \s* will match the first newline and continue to the end of the next line ! Tim Van Wassenhove wrote: In article [EMAIL PROTECTED], Arik Raffael Funke wrote: implement following pattern Last Name:\s*(.*)\n. I get just 'Jason'. But what I currently get is: Jason Street: abc This is behaviour because (.*) is greedy. As you noticed, it matched Jason \nStreet:abc /Last Name:\s+(.*?)\n/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
Oh guess it would be even better and faster to only use: /Last Name:([^\n]*)/ and trim() the result :-) -- red Red Wingate wrote: Yep, but to avoid his problem with empty Strings he should use something like: /Last Name: *(.*?)\n/ outerwise \s* will match the first newline and continue to the end of the next line ! Tim Van Wassenhove wrote: In article [EMAIL PROTECTED], Arik Raffael Funke wrote: implement following pattern Last Name:\s*(.*)\n. I get just 'Jason'. But what I currently get is: Jason Street: abc This is behaviour because (.*) is greedy. As you noticed, it matched Jason \nStreet:abc /Last Name:\s+(.*?)\n/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to tell if the file is already locked with flock()???
http://de2.php.net/manual/en/function.is-writeable.php Jay Blanchard wrote: [snip] How do we tell if the file is already locked when someone use a flock() on the file?? [/snip] If your flock attempt returns FALSE then it is likely locked already -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
In article [EMAIL PROTECTED], Red Wingate wrote: Oh guess it would be even better and faster to only use: /Last Name:([^\n]*)/ In most environments is strpos and substr even faster ;) -- Tim Van Wassenhove http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing text with carriage returns in MySQL
That only seems to work for quotation marks and apostrophes etc. Not carriage returns? Unless I'm missing something. On 15 Jul 2004, at 20:23, Vail, Warren wrote: http://www.php.net/manual/en/function.addslashes.php Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File locking in PHP???
Hello, On 07/15/2004 12:28 PM, Scott Fletcher wrote: Hi! I saw the php function flock(), since I never used it before so I thought I would ask you folks a couple of questions. 1) Is this function good or is there a better function somewhere that I'm not aware of? It depends on what you want to do. There are also semaphores at least under Unix systems. 2) If the flock() activated the file lock then is it possible that I manually unlock the file? Like chmod or something through the Linux console for example. Externally? Only when the file is close or the program that opened is ended. 3) good example of script just in case.. You may want to take a look at this arbitrary content caching class. It uses file locks to prevent that multiple scripts attempt to access a cache file when it is being updated. http://www.phpclasses.org/filecache -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing text with carriage returns in MySQL
Umm this is very weird - I've checked the database and the string is only stored upto the first carriage return everything else appears to be missing, BUT, when I display it in the webpage (using stripslashes()) the entire original message is intact - but on a single line!!! :S On 15 Jul 2004, at 21:28, Vail, Warren wrote: Perhaps you have another problem. Do you have PHPMyAdmin access to the database? Could it be that your string is being stored OK, and the problem is on the retrieval end? Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing text with carriage returns in MySQL
Umm this is very weird - I've checked the database and the string is only stored upto the first carriage return everything else appears to be missing, BUT, when I display it in the webpage (using stripslashes()) the entire original message is intact - but on a single line!!! :S Magic On 15 Jul 2004, at 21:28, Vail, Warren wrote: Perhaps you have another problem. Do you have PHPMyAdmin access to the database? Could it be that your string is being stored OK, and the problem is on the retrieval end? Warren Vail -- 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] Storing text with carriage returns in MySQL
Sorry, its the crap software I'm using to view the DB! phpMyadmin shows that yes, the text is all there with CRs. so it IS something at the display end? any ideas, cos I haven't aclue? cheers AW On 15 Jul 2004, at 21:28, Vail, Warren wrote: Perhaps you have another problem. Do you have PHPMyAdmin access to the database? Could it be that your string is being stored OK, and the problem is on the retrieval end? Warren Vail -Original Message- From: Andrew Wood [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 1:22 PM To: php-gen Subject: Re: [PHP] Storing text with carriage returns in MySQL That only seems to work for quotation marks and apostrophes etc. Not carriage returns? Unless I'm missing something. On 15 Jul 2004, at 20:23, Vail, Warren wrote: http://www.php.net/manual/en/function.addslashes.php Warren Vail -- 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] Storing text with carriage returns in MySQL
Is your form method POST or GET, I know the browser will strip out returns, etc for a GET? Grabbing at straws here. Warren Vail -Original Message- From: Matthew Sims [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 1:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Storing text with carriage returns in MySQL Umm this is very weird - I've checked the database and the string is only stored upto the first carriage return everything else appears to be missing, BUT, when I display it in the webpage (using stripslashes()) the entire original message is intact - but on a single line!!! :S Magic On 15 Jul 2004, at 21:28, Vail, Warren wrote: Perhaps you have another problem. Do you have PHPMyAdmin access to the database? Could it be that your string is being stored OK, and the problem is on the retrieval end? Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Storing text with carriage returns in MySQL
Are you displaying it in a form control, like another TEXTAREA? Or are you displaying say in a table cell? I know that CR's are ignored by most normal html, unless coded between pre and /pre; Warren Vail -Original Message- From: Andrew Wood [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 1:40 PM To: php-gen Subject: Re: [PHP] Storing text with carriage returns in MySQL Sorry, its the crap software I'm using to view the DB! phpMyadmin shows that yes, the text is all there with CRs. so it IS something at the display end? any ideas, cos I haven't aclue? cheers AW On 15 Jul 2004, at 21:28, Vail, Warren wrote: Perhaps you have another problem. Do you have PHPMyAdmin access to the database? Could it be that your string is being stored OK, and the problem is on the retrieval end? Warren Vail -Original Message- From: Andrew Wood [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 1:22 PM To: php-gen Subject: Re: [PHP] Storing text with carriage returns in MySQL That only seems to work for quotation marks and apostrophes etc. Not carriage returns? Unless I'm missing something. On 15 Jul 2004, at 20:23, Vail, Warren wrote: http://www.php.net/manual/en/function.addslashes.php Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date difference
John Meyer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, Is there a function to determine the difference between two dates? I am asking so I can do some date verification for COPA. Convert your dates to timestamps which will be 10-digit integers (the time since 1.1.1970 in seconds) you can then substract/add them like normal numbers. $date = '2004-07-15 01:00:00'; $date2 = '2004-07-15 02:00:00'; $timestamp = strtotime($date); $timestamp2 = strtotime($date2); echo $timestamp2 - $timestamp1; // will output 3600 (seconds) Hope this helps. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing text with carriage returns in MySQL
Not sure if I understand the issue completely, but if it's a matter of displaying the text from the database you could use the nl2br function. http://us3.php.net/manual/en/function.nl2br.php Hope that helps, Brian on 7/15/04 4:40 PM, Andrew Wood at [EMAIL PROTECTED] wrote: Sorry, its the crap software I'm using to view the DB! phpMyadmin shows that yes, the text is all there with CRs. so it IS something at the display end? any ideas, cos I haven't aclue? cheers AW On 15 Jul 2004, at 21:28, Vail, Warren wrote: Perhaps you have another problem. Do you have PHPMyAdmin access to the database? Could it be that your string is being stored OK, and the problem is on the retrieval end? Warren Vail -Original Message- From: Andrew Wood [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 1:22 PM To: php-gen Subject: Re: [PHP] Storing text with carriage returns in MySQL That only seems to work for quotation marks and apostrophes etc. Not carriage returns? Unless I'm missing something. On 15 Jul 2004, at 20:23, Vail, Warren wrote: http://www.php.net/manual/en/function.addslashes.php Warren Vail -- 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] Storing text with carriage returns in MySQL
On Friday 16 July 2004 03:52, Vail, Warren wrote: The function addslashes() will resolve many user input problems where the user; When using MySQL it is better to use the more specific: mysql_real_escape_string() Usually MySQL will strip slashes when the column is retrieved No. Slashes (those that were used to escape characters) are never stored in the first place, and thus there are no slashes to strip upon retrieval. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Half of being smart is knowing what you're dumb at. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to tell if the file is already locked with flock()???
Um, I think I'll stick to file_exist instead and to unlock, I'll grab the IP address in the text file and match it against the current browser of whoever is using before deleting the file. That way, I'll know who is the guilty party if the person doesn't finish whatever he/she is doing on the browser. Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] How do we tell if the file is already locked when someone use a flock() on the file?? [/snip] If your flock attempt returns FALSE then it is likely locked already -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Got JavaScript error when using PHP's include()...
When an include file contain plain JavaScript codes, with the echo command before and after the include file. I get the javascript error saying undefined jsTest... Anyone know why is that? --snip-- echo tabletrtd/td/tr/table; echo script type='text/javascript'; include('test.inc'); echo var jsTest = 0; ; echo /script; echo forminput type='button/form; --snip-- Let's say the script in the test.inc contain --snip-- function test() { if (jsTest != 0) { //blah blah balh... } } --snip-- Thanks, FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Log all GET AND POST?
Robert Sossomon wrote: I was wondering if anyone knew of a way to log all GET and POST information being passed to a log file? Thanks, Robert $get = serialize($_GET); $post = serialize($_POST); and store the variables somewhere, eg. database -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP upgrade... issues???
[EMAIL PROTECTED] wrote: Phew! However, While reading about php upgrades, I've got the impression that version 5, will not support MySQL by default... Does that mean that I'll have to ensure my hosts install an extra module, or worse case senario, I'll have to re-write all my pages, to take new code into effect... I' know I'm sounding liek a worried mother hen, but I can't seem to find confirmation on line?!?! 4.3.8 is not version 5.0.0. Mysql support stays the same, and I'm sure your host will not dump mysql support even if it wasn't. 4.3.8 is merely a bugfix version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing text with carriage returns in MySQL
Vail, Warren wrote: The function addslashes() will resolve many user input problems where the user; Inputs a quoted value in the middle of his string. Uses and and in text. Inputs other ASCII control characters like tab and bell (remember that one). addslashes() does not escapecharacters nor control characters (other than NUL). It only affects single quotes, double quotes, backslashes, and NUL bytes. Just to name a few. Usually MySQL will strip slashes when the column is retrieved, Already mentioned, but there are no slashes to remove when reading data. The slashes simply escape the string to get it into the database. however care should be taken when displaying the value on a form (inside another text area should be no problem). It can be a problem if the text contains the string /textarea followed by whatever the user wants to inject onto your page. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File locking in PHP???
* Thus wrote Scott Fletcher: Nah! I'll settle for a simplier one... file_exists() by checking to see if the file exist then spit out the error message. Meaning the file is in use... Don't use file_exists() for that, it will fail miserable with racing conditions. a better more portable way would be to use mkdir(): if (mkdir('mylockdir', 0755) ) { // we've obtained a lock // do stuff // and unlock it rmdir('mylockdir'); } else { // unable to obtain lock } Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got JavaScript error when using PHP's include()...
You defined jsTest after the include where it should be before. On Thu, 2004-07-15 at 16:24, Scott Fletcher wrote: When an include file contain plain JavaScript codes, with the echo command before and after the include file. I get the javascript error saying undefined jsTest... Anyone know why is that? --snip-- echo tabletrtd/td/tr/table; echo script type='text/javascript'; include('test.inc'); echo var jsTest = 0; ; echo /script; echo forminput type='button/form; --snip-- Let's say the script in the test.inc contain --snip-- function test() { if (jsTest != 0) { //blah blah balh... } } --snip-- Thanks, FletchSOD -- Neal Owen | IT Programmer Marketing Resources, Inc. Main : 312.238.8923 x1218 Direct : 630.592.3118 [EMAIL PROTECTED] | http://www.mrichi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with super global '$_REQUEST'
I have a function in a class that unsets the superglobal $_REQUEST; Well, it's supposed to, it doesn't do it. I'm on version 4.2.3 of PHP. This page: http://us2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals says that $_REQUEST is a super global as of version 4.1.0. Is there some bug I don't know about or am I doing something wrong? Here's the code: ?PHP $_REQUEST[var1]=\scriptscript stuff/script; $_REQUEST[var2]=a_string_of_course; $_REQUEST[arr1][elem1]=scriptscript stuff2/script; $_REQUEST[arr1][elem2]=another_string_of_course; if( !defined('TEST_UNSET') ){ define('TEST_UNSET', TRUE); class abstract_environment{ var $_REQUEST; function abstract_environment(){ $this-_REQUEST=$_REQUEST; unset( $_REQUEST ); echo(unset was done); $this-_clean_all_vars(); } function _clean_all_vars(){ //ADD OTHER PROCESSING AS NEEDED $this-_strip_tags_arr( $this-_REQUEST ); } function _strip_tags_arr( $arr_or_solo ){ if( isset($arr_or_solo) ){ if( !is_array($arr_or_solo) ){ $arr_or_solo= strip_tags($arr_or_solo); } else { reset ($arr_or_solo); while (list($key, ) = each ($arr_or_solo)) { if( isset($arr_or_solo[$key]) ){ if( is_array($arr_or_solo[$key]) ){ $this-_strip_tags_arr($arr_or_solo[$key]); } else { $arr_or_solo[$key] = strip_tags($arr_or_solo[$key]); } } } } } } } } $abs_env=new abstract_environment; echo pre; print_r($_REQUEST); print_r( $abs_env ); echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem including images in safe_mode
On Thursday 15 July 2004 23:30, Frank Holtschke wrote: Even if you could prevent an included file from being parsed, I can't see how it would help you as you can't assign the contents to a variable. But you say that you sometimes have problems which implies that sometimes it works. Could you explain how it works? We just flush it on the display. the php-script is an image src like img src=showImage.php That's interesting. The showImage.php does an include of the image which is located out of the DocumentRoot. The image is generated by a cron script. Mostly it works but sometimes we have the problem described above. And anyway why are your images in safe_mode_include_dir in the first place? Cause php-scripts (owned by different uids = therefore the safe_mode_include_dir ) of various virtual servers make use of the image. Several suggestions: 1) If the various virtual servers have no need to perform file operations anywhere else then you may get away with setting open_basedir appropriately. 2) Use the safe_mode_gid switch. 3) If cronjob is owned by root then have it create images for each of the virtual servers and set permissions accordingly. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Why are we importing all these highbrow plays like `Amadeus'? I could have told you Mozart was a jerk for nothing. -- Ian Shoales */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email Forms
Hi, I am trying unsuccessfully to set up an email form and as far as I know my code is fine, but it won't send. I suspect that it's because my server requires authentication. Running my script on my Windows machine I get the following. Warning: mail() [function.mail http://www.php.net/function.mail ]: SMTP server response: 550 not local host myhost.ca, not a gateway in... On Linux I don't get a specific error message, the mail just never shows up. I am in the right ballpark here with the authentication, and if so, how can I get around this..? Thanks
Re: [PHP] problem with super global '$_REQUEST'
You can't unset $_REQUEST. All it does is unset the reference to it in the current context. It still exists elsewhere. If you *really* want to get rid of $_REQUEST, you should do it this way: unset($GLOBALS['_REQUEST']); But I would advise against that. Why exactly are you unsetting a superglobal? On Thu, 15 Jul 2004 15:00:15 -0700, Dennis Gearon [EMAIL PROTECTED] wrote: I have a function in a class that unsets the superglobal $_REQUEST; Well, it's supposed to, it doesn't do it. I'm on version 4.2.3 of PHP. This page: http://us2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals says that $_REQUEST is a super global as of version 4.1.0. Is there some bug I don't know about or am I doing something wrong? Here's the code: ?PHP $_REQUEST[var1]=\scriptscript stuff/script; $_REQUEST[var2]=a_string_of_course; $_REQUEST[arr1][elem1]=scriptscript stuff2/script; $_REQUEST[arr1][elem2]=another_string_of_course; if( !defined('TEST_UNSET') ){ define('TEST_UNSET', TRUE); class abstract_environment{ var $_REQUEST; function abstract_environment(){ $this-_REQUEST=$_REQUEST; unset( $_REQUEST ); echo(unset was done); $this-_clean_all_vars(); } function _clean_all_vars(){ //ADD OTHER PROCESSING AS NEEDED $this-_strip_tags_arr( $this-_REQUEST ); } function _strip_tags_arr( $arr_or_solo ){ if( isset($arr_or_solo) ){ if( !is_array($arr_or_solo) ){ $arr_or_solo= strip_tags($arr_or_solo); } else { reset ($arr_or_solo); while (list($key, ) = each ($arr_or_solo)) { if( isset($arr_or_solo[$key]) ){ if( is_array($arr_or_solo[$key]) ){ $this-_strip_tags_arr($arr_or_solo[$key]); } else { $arr_or_solo[$key] = strip_tags($arr_or_solo[$key]); } } } } } } } } $abs_env=new abstract_environment; echo pre; print_r($_REQUEST); print_r( $abs_env ); echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f6fde76071105215333! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to tell if the file is already locked with flock()???
Scott Fletcher wrote: Um, I think I'll stick to file_exist instead and to unlock, I'll grab the IP address in the text file and match it against the current browser of whoever is using before deleting the file. That way, I'll know who is the guilty party if the person doesn't finish whatever he/she is doing on the browser. IP address is not reliable identification. And you cannot use flock() either as the lock lasts only while the php script is executed. You should use some uniq string associated with the browser, either cookie or session id. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Email Forms
Hello, On 07/15/2004 07:06 PM, Php User wrote: I am trying unsuccessfully to set up an email form and as far as I know my code is fine, but it won't send. I suspect that it's because my server requires authentication. Running my script on my Windows machine I get the following. Warning: mail() [function.mail http://www.php.net/function.mail ]: SMTP server response: 550 not local host myhost.ca, not a gateway in... On Linux I don't get a specific error message, the mail just never shows up. I am in the right ballpark here with the authentication, and if so, how can I get around this..? That error means you need to authenticate to relay the message to the SMTP server. In Linux that does not happen because it does not relay messages to any SMTP server. The mail() function does not support SMTP authentication. Alternatively you may want to try this class that can connect to a SMTP server of choice and authenticate if necessary. If you do not want to change your PHP programs much, the class comes with a wrapper function named smtp_mail() that works compatibly with the mail() function but sends the message via SMTP: http://www.phpclasses.org/mimemessage You also need this for the actual SMTP delivery: http://www.phpclasses.org/smtpclass -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encrypting passwords from page to page -mcrypt question
I would like to go from page to page, submitting the password through a GET query string. Of course I wouldn't want to do this unencrypted. So is mcrypt the best option? When submitting the data, would I also need to sumit the IV as well as the encrypted data? Or am I completely off base with this one? Should I also base64_encode() this data when passing it? Scott Taylor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email Forms
On Friday 16 July 2004 06:06, PHP User wrote: I am trying unsuccessfully to set up an email form and as far as I know my code is fine, but it won't send. I suspect that it's because my server requires authentication. Well does it or does it not require SMTP AUTH? If it does then the standard mail() function will not work - google or look on www.phpclasses.org for some solutions. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* 95. Wow!! Look at this. --Top 100 things you don't want the sysadmin to say */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with super global '$_REQUEST'
OK, after lots of reading, I find out it's not possible to unset something that has been 'globalized' in a function, nor ANY global value. However, some online manual pages documented that it's possible to assign NULL to the value. Well that's NOT unset. But,that got me to thinking. What about assigning an unset variable to the global? IT WORKS! Change the line below: unset( $_REQUEST ); *--to--* $unset_variable; $_REQUEST = $unset_variable; VOILA! no more $_REQUEST super_global. Now, I need to see if it can still be assigned to as if it's a super global. Dennis Gearon wrote: I have a function in a class that unsets the superglobal $_REQUEST; Well, it's supposed to, it doesn't do it. I'm on version 4.2.3 of PHP. This page: http://us2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals says that $_REQUEST is a super global as of version 4.1.0. Is there some bug I don't know about or am I doing something wrong? Here's the code: ?PHP $_REQUEST[var1]=\scriptscript stuff/script; $_REQUEST[var2]=a_string_of_course; $_REQUEST[arr1][elem1]=scriptscript stuff2/script; $_REQUEST[arr1][elem2]=another_string_of_course; if( !defined('TEST_UNSET') ){ define('TEST_UNSET', TRUE); class abstract_environment{ var $_REQUEST; function abstract_environment(){ $this-_REQUEST=$_REQUEST; unset( $_REQUEST ); echo(unset was done); $this-_clean_all_vars(); } function _clean_all_vars(){ //ADD OTHER PROCESSING AS NEEDED $this-_strip_tags_arr( $this-_REQUEST ); } function _strip_tags_arr( $arr_or_solo ){ if( isset($arr_or_solo) ){ if( !is_array($arr_or_solo) ){ $arr_or_solo= strip_tags($arr_or_solo); } else { reset ($arr_or_solo); while (list($key, ) = each ($arr_or_solo)) { if( isset($arr_or_solo[$key]) ){ if( is_array($arr_or_solo[$key]) ){ $this-_strip_tags_arr($arr_or_solo[$key]); } else { $arr_or_solo[$key] = strip_tags($arr_or_solo[$key]); } } } } } } } } $abs_env=new abstract_environment; echo pre; print_r($_REQUEST); print_r( $abs_env ); echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with super global '$_REQUEST'
I found the answer, as my second post on this told. Why unset the globals? I plan on implementing filters on all User input to ALL scripts in the prepend file. And if someone wants to get a variable that was supplied by a user, they have to specifiy if it's going to be INT, STR(with options to remove run on spaces, validate email addr, remove carriage returns to prevent embedded email directives) 'NUM' type with formatting like in databases, and also, anti SQL injection escaping is possible. The programmer will HAVE to choose which filtering, but strip tags is automatic. I'm not going to have XSS holes or SQL injection on my site. Justin Patrin wrote: You can't unset $_REQUEST. All it does is unset the reference to it in the current context. It still exists elsewhere. If you *really* want to get rid of $_REQUEST, you should do it this way: unset($GLOBALS['_REQUEST']); But I would advise against that. Why exactly are you unsetting a superglobal? On Thu, 15 Jul 2004 15:00:15 -0700, Dennis Gearon [EMAIL PROTECTED] wrote: I have a function in a class that unsets the superglobal $_REQUEST; Well, it's supposed to, it doesn't do it. I'm on version 4.2.3 of PHP. This page: http://us2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals says that $_REQUEST is a super global as of version 4.1.0. Is there some bug I don't know about or am I doing something wrong? Here's the code: ?PHP $_REQUEST[var1]=\scriptscript stuff/script; $_REQUEST[var2]=a_string_of_course; $_REQUEST[arr1][elem1]=scriptscript stuff2/script; $_REQUEST[arr1][elem2]=another_string_of_course; if( !defined('TEST_UNSET') ){ define('TEST_UNSET', TRUE); class abstract_environment{ var $_REQUEST; function abstract_environment(){ $this-_REQUEST=$_REQUEST; unset( $_REQUEST ); echo(unset was done); $this-_clean_all_vars(); } function _clean_all_vars(){ //ADD OTHER PROCESSING AS NEEDED $this-_strip_tags_arr( $this-_REQUEST ); } function _strip_tags_arr( $arr_or_solo ){ if( isset($arr_or_solo) ){ if( !is_array($arr_or_solo) ){ $arr_or_solo= strip_tags($arr_or_solo); } else { reset ($arr_or_solo); while (list($key, ) = each ($arr_or_solo)) { if( isset($arr_or_solo[$key]) ){ if( is_array($arr_or_solo[$key]) ){ $this-_strip_tags_arr($arr_or_solo[$key]); } else { $arr_or_solo[$key] = strip_tags($arr_or_solo[$key]); } } } } } } } } $abs_env=new abstract_environment; echo pre; print_r($_REQUEST); print_r( $abs_env ); echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f6fde76071105215333! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: problem with super global '$_REQUEST'
You *can* unset it, you just have to unset the place where it really sits. When you have a global in a function, then unset it, you only disconnect the variable. unset doesn't destroy a variable, it just breaks the reference. As I said in my earlier e-mail, using this *will* work (I tested it): unset($GLOBALS['_REQUEST']); $GLOBALS is itself a superglobal.hmmm, wonder what would happen if you unset($GLOBALS['GLOBALS']) On Thu, 15 Jul 2004 15:25:55 -0700, Dennis Gearon [EMAIL PROTECTED] wrote: OK, after lots of reading, I find out it's not possible to unset something that has been 'globalized' in a function, nor ANY global value. However, some online manual pages documented that it's possible to assign NULL to the value. Well that's NOT unset. But,that got me to thinking. What about assigning an unset variable to the global? IT WORKS! Change the line below: unset( $_REQUEST ); *--to--* $unset_variable; $_REQUEST = $unset_variable; VOILA! no more $_REQUEST super_global. Now, I need to see if it can still be assigned to as if it's a super global. Dennis Gearon wrote: I have a function in a class that unsets the superglobal $_REQUEST; Well, it's supposed to, it doesn't do it. I'm on version 4.2.3 of PHP. This page: http://us2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals says that $_REQUEST is a super global as of version 4.1.0. Is there some bug I don't know about or am I doing something wrong? Here's the code: ?PHP $_REQUEST[var1]=\scriptscript stuff/script; $_REQUEST[var2]=a_string_of_course; $_REQUEST[arr1][elem1]=scriptscript stuff2/script; $_REQUEST[arr1][elem2]=another_string_of_course; if( !defined('TEST_UNSET') ){ define('TEST_UNSET', TRUE); class abstract_environment{ var $_REQUEST; function abstract_environment(){ $this-_REQUEST=$_REQUEST; unset( $_REQUEST ); echo(unset was done); $this-_clean_all_vars(); } function _clean_all_vars(){ //ADD OTHER PROCESSING AS NEEDED $this-_strip_tags_arr( $this-_REQUEST ); } function _strip_tags_arr( $arr_or_solo ){ if( isset($arr_or_solo) ){ if( !is_array($arr_or_solo) ){ $arr_or_solo= strip_tags($arr_or_solo); } else { reset ($arr_or_solo); while (list($key, ) = each ($arr_or_solo)) { if( isset($arr_or_solo[$key]) ){ if( is_array($arr_or_solo[$key]) ){ $this-_strip_tags_arr($arr_or_solo[$key]); } else { $arr_or_solo[$key] = strip_tags($arr_or_solo[$key]); } } } } } } } } $abs_env=new abstract_environment; echo pre; print_r($_REQUEST); print_r( $abs_env ); echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f7048930729073420354! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Offset error
Hello, error: PHP Notice: Undefined offset: 1 in /home/ant/test.app/teste3/getfiles.php on line 217 I have this Undefined offset error in PHP because I am trying to get a value from this $att[$k]-parameters[1]-value that sometimes does not exist with offset 1 as the parameters go up to 0 and not one. Can anyone tell me how to test the offset 1 or more in the array $att[$k]-parameters[1] so that I can avoid this error? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with super global '$_REQUEST'
Ok Why not just set the values in $_REQUEST then? AbstractEnvironment::stripTagsArr($_REQUEST); Or something like this: foreach($_REQUEST as $key = $val) { $_REQUEST[$key] = stripTagsNStuff($key, $val); } On Thu, 15 Jul 2004 15:45:45 -0700, Dennis Gearon [EMAIL PROTECTED] wrote: I found the answer, as my second post on this told. Why unset the globals? I plan on implementing filters on all User input to ALL scripts in the prepend file. And if someone wants to get a variable that was supplied by a user, they have to specifiy if it's going to be INT, STR(with options to remove run on spaces, validate email addr, remove carriage returns to prevent embedded email directives) 'NUM' type with formatting like in databases, and also, anti SQL injection escaping is possible. The programmer will HAVE to choose which filtering, but strip tags is automatic. I'm not going to have XSS holes or SQL injection on my site. Justin Patrin wrote: You can't unset $_REQUEST. All it does is unset the reference to it in the current context. It still exists elsewhere. If you *really* want to get rid of $_REQUEST, you should do it this way: unset($GLOBALS['_REQUEST']); But I would advise against that. Why exactly are you unsetting a superglobal? On Thu, 15 Jul 2004 15:00:15 -0700, Dennis Gearon [EMAIL PROTECTED] wrote: I have a function in a class that unsets the superglobal $_REQUEST; Well, it's supposed to, it doesn't do it. I'm on version 4.2.3 of PHP. This page: http://us2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals says that $_REQUEST is a super global as of version 4.1.0. Is there some bug I don't know about or am I doing something wrong? Here's the code: ?PHP $_REQUEST[var1]=\scriptscript stuff/script; $_REQUEST[var2]=a_string_of_course; $_REQUEST[arr1][elem1]=scriptscript stuff2/script; $_REQUEST[arr1][elem2]=another_string_of_course; if( !defined('TEST_UNSET') ){ define('TEST_UNSET', TRUE); class abstract_environment{ var $_REQUEST; function abstract_environment(){ $this-_REQUEST=$_REQUEST; unset( $_REQUEST ); echo(unset was done); $this-_clean_all_vars(); } function _clean_all_vars(){ //ADD OTHER PROCESSING AS NEEDED $this-_strip_tags_arr( $this-_REQUEST ); } function _strip_tags_arr( $arr_or_solo ){ if( isset($arr_or_solo) ){ if( !is_array($arr_or_solo) ){ $arr_or_solo= strip_tags($arr_or_solo); } else { reset ($arr_or_solo); while (list($key, ) = each ($arr_or_solo)) { if( isset($arr_or_solo[$key]) ){ if( is_array($arr_or_solo[$key]) ){ $this-_strip_tags_arr($arr_or_solo[$key]); } else { $arr_or_solo[$key] = strip_tags($arr_or_solo[$key]); } } } } } } } } $abs_env=new abstract_environment; echo pre; print_r($_REQUEST); print_r( $abs_env ); echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Offset error
if(isset($att[$k]-parameters[1])) { //use $att[$k]-parameters[1]-value } or, assuming indexes start at 0 and are sequential: if(count($att[$k]-parameters) 1) { //use $att[$k]-parameters[1]-value } On Thu, 15 Jul 2004 17:08:16 -0600, C.F. Scheidecker Antunes [EMAIL PROTECTED] wrote: Hello, error: PHP Notice: Undefined offset: 1 in /home/ant/test.app/teste3/getfiles.php on line 217 I have this Undefined offset error in PHP because I am trying to get a value from this $att[$k]-parameters[1]-value that sometimes does not exist with offset 1 as the parameters go up to 0 and not one. Can anyone tell me how to test the offset 1 or more in the array $att[$k]-parameters[1] so that I can avoid this error? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f70d90273879057181623! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] image
how do you catch an image request and instead of the image display php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] model view and control with php
I wanted to know has anyone implemented the model view and control (mvc) with php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] model view and control with php
Yep, just search the list for previous MVC discussions. On Thu, 15 Jul 2004 20:09:07 -0400, asolomon15 [EMAIL PROTECTED] wrote: I wanted to know has anyone implemented the model view and control (mvc) with php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f71aa0168881708919695! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image
On Friday 16 July 2004 08:06, php wrote: how do you catch an image request and instead of the image display php? Please elaborate. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Neil Armstrong tripped. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image
like i call an image if the img tag but instead of loading the image it loads a php script Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Friday 16 July 2004 08:06, php wrote: how do you catch an image request and instead of the image display php? Please elaborate. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Neil Armstrong tripped. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] image
I would recommend you start here; http://www.php.net/manual/en/ref.image.php As I understand you are trying to understand the process where an image tag in hmtl causes a browser to request an image be loaded, but because the image statement looks something like the following; img src=path/to/my/phpscript.php It causes the browser to request the server to send the phpscript.php file, and since the server knows that .php files are executable, the server then executes your module. If your module begins by outputting the appropriate mime headers that indicate the type of image the script will generate, it then takes the remaining characters sent by the script as the actual image itself. Hope this is what you are looking for. Warren Vail -Original Message- From: php [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 5:43 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] image like i call an image if the img tag but instead of loading the image it loads a php script Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Friday 16 July 2004 08:06, php wrote: how do you catch an image request and instead of the image display php? Please elaborate. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Neil Armstrong tripped. */ -- 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] image
On Friday 16 July 2004 08:43, php wrote: Please do not top post. like i call an image if the img tag but instead of loading the image it loads a php script img src=my.php It's still not clear what your eventual goal is. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Q: What's another name for the Intel Inside sticker they put on Pentiums? A: Warning label. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image
thanks Warren Vail [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would recommend you start here; http://www.php.net/manual/en/ref.image.php As I understand you are trying to understand the process where an image tag in hmtl causes a browser to request an image be loaded, but because the image statement looks something like the following; img src=path/to/my/phpscript.php It causes the browser to request the server to send the phpscript.php file, and since the server knows that .php files are executable, the server then executes your module. If your module begins by outputting the appropriate mime headers that indicate the type of image the script will generate, it then takes the remaining characters sent by the script as the actual image itself. Hope this is what you are looking for. Warren Vail -Original Message- From: php [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 5:43 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] image like i call an image if the img tag but instead of loading the image it loads a php script Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Friday 16 July 2004 08:06, php wrote: how do you catch an image request and instead of the image display php? Please elaborate. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Neil Armstrong tripped. */ -- 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] Encrypting passwords from page to page -mcrypt question
Scott Taylor wrote: I would like to go from page to page, submitting the password through a GET query string. Of course I wouldn't want to do this unencrypted. So is mcrypt the best option? I think to submit the password on the query string is a really bad idea. What will happend if a user decides to mail the URL to someone? Any recipient of that message would have access to the password protected data. In my opinion, passwords NEVER should be sent to the client computer in any form (encrypted or not). I will recomend to find a different way to authenticate the user on every page wich does not require sending him the password. Regards, Jordi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Embedded Email Directives
Dennis Gearon wrote: remove carriage returns to prevent embedded email directives In an other thread, I readed that sentence. I'm interested to find more information about that. I have some mail forms and want to make them as secure and possible, but do not know about what and where should I filter. Should I filter all CR and LF Just in headers or also I should do that in the message body? (Which is sent in the SMTP DATA section). Thanks, Jordi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php