php-general Digest 13 Feb 2001 20:45:07 -0000 Issue 510 Topics (messages 39377 through 39485): Re: File Upload stuck in the midst 39377 by: Ankur Verma 39379 by: Ankur Verma Fatal error loading extension 39378 by: A. Giacomelli Here you have, ;o) 39380 by: James Moore 39381 by: Jonatan Bagge 39472 by: Thor M. Steindorsson php socket function 39382 by: Tissandié 39383 by: Ankur Verma user rights for an upload 39384 by: Bogdan Morar 39385 by: Ankur Verma limitation of file upload?? 39386 by: John LYC 39387 by: Ankur Verma 39389 by: John LYC 39390 by: Ankur Verma 39398 by: John LYC 39411 by: Christian Reiniger Re: problem with classes 39388 by: Siim Einfeldt aka Itpunk What Does This Mean? 39391 by: Ben Ocean 39393 by: Ankur Verma Your Opinion?! PHP4 coding style - Comment and Splitting source code 39392 by: Yasuo Ohgaki Re: problems with writing picture to the database. 39394 by: Siim Einfeldt aka Itpunk 39396 by: Siim Einfeldt aka Itpunk 39425 by: PHPBeginner.com foo[bar] _or_ foo['bar'] ? 39395 by: Matthias Krehl 39403 by: Phil Driscoll 39424 by: PHPBeginner.com 39442 by: Derek Sivers 39451 by: Phil Driscoll 39470 by: php3.developersdesk.com 39471 by: Andi Gutmans Re: checkboxes and arrays 39397 by: Christian Dechery PHP and Java (CVS version) 39399 by: Montgomery-Recht, Evan Re: Any image drawing tutorials anywhere? 39400 by: Alain \"Cyb\" 39405 by: Lucas Persona Re: help with classes 39401 by: Marcus Rasmussen 39412 by: Jesse Swensen Re: mysql_fetch_array and row referencing under 4.0.4pl1 39402 by: Scott Brown Re: PHP/Oracle mod 39404 by: Rouvas Stathis Re: Newbie: Images refs not loading (Broken Icons) How to? 39406 by: Tim Ward Re: mktime + 4 days 39407 by: Jason Stechschulte 39419 by: PHPBeginner.com Creating mail users with PHP 39408 by: Ian LeBlanc 39414 by: Rick Hodger Re: Reg. Exp. Help 39409 by: Christian Reiniger GD library 39410 by: Rahul Hari Bhide (robert)HELLO...all doubts about XML/APACHE/PERL/PHP/MOD 39413 by: Celestino Roberto Alejandro Re: Search & replace text 39415 by: PHPBeginner.com 39426 by: PHPBeginner.com Re: Regex help needed... 39416 by: PHPBeginner.com Re: create filesystem folder? 39417 by: PHPBeginner.com Re: Mail classes 39418 by: PHPBeginner.com Re: SELECT statement 39420 by: PHPBeginner.com 39421 by: PHPBeginner.com Re: How to check if vaiable is defined or not? 39422 by: PHPBeginner.com Re: How To Tell Which v. PHP? 39423 by: PHPBeginner.com Problems with date() - what have I missed? 39427 by: Jon Haworth 39444 by: Jon Haworth rename? 39428 by: Miguel Loureiro hidden form field. 39429 by: Angerer, Chad 39430 by: Ifrim Sorin 39434 by: Kevin McCarthy Mystery quotes 39431 by: John Hofstad-Parkhill 39432 by: Jon Haworth 39433 by: John Vanderbeck Any performance penalties for switch vs. if/else? 39435 by: John Guynn 39436 by: John Vanderbeck Setting Enviromental variables 39437 by: Scott Cookies 39438 by: Gary OOP in web development 39439 by: Joe Sheble (Wizaerd) 39474 by: Kath 39477 by: Mark Maggelet 39482 by: Joe Sheble (Wizaerd) 39485 by: Jeff Warrington PHP vs JSP 39440 by: Website4S.aol.com 39452 by: Pavel Jartsev 39454 by: Philip Olson Include 39441 by: Fabian Fabela 39445 by: Fabian Fabela Return ODBC Results to an array 39443 by: Karl J. Stubsjoen 39455 by: Ifrim Sorin 39457 by: Ifrim Sorin 39465 by: Andrew Hill Netscape not resolving $PHPSELF ?? 39446 by: John Vanderbeck 39448 by: Jon Haworth 39449 by: Pavel Jartsev 39450 by: John Vanderbeck 39456 by: John Vanderbeck 39466 by: Jason Stechschulte 39469 by: John Vanderbeck Re: Mysql locking tables and persistent connections.. 39447 by: Eduardo Dominguez PARANOID PERMISSIONS for apache? 39453 by: Derek Sivers 39458 by: Steve Smith Bad Practices 39459 by: Jeff Oien 39460 by: Benjamin Munoz 39461 by: Philip Olson locating the actual php executable 39462 by: Brandon Orther 39464 by: Brian Clark Re: Pay for help 39463 by: rbradley Knowledgebase & HelpDesk 39467 by: Ashwin Kutty 39468 by: Albrecht Guenther XML Parsing through Proxy 39473 by: Steve Haemelinck CDB 0.75 w/PHP 4.0.4pl1 39475 by: Ben Schumacher parse speed vs require speed 39476 by: Soma Interesting ereg_replace 39478 by: Brian V Bonini Image in a Template 39479 by: Gary 39480 by: Andrew 39481 by: John Huggins PHP+PGP+Apache! Newbie, please help!! 39483 by: Kevin Connolly Would Like to know 39484 by: Barry Fawthrop Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
tuirn on the following setting in your php.ini file register_globals = On currently it seems to be off in your settings file hope that helps regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "Dhaval Desai" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 2:10 PM Subject: [PHP] File Upload stuck in the midst > Hi! > > I am facing some problems while uploading files.. > I just copied the code from php.net from the section > "Handling File Uploads". > > My index.php pages has the following code: > > <html> > <head> > <title>File Uploads</title> > > </head> > <body> > <FORM ENCTYPE="multipart/form-data" > ACTION="action.php" METHOD=POST> > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" > value="2000"> > Send this file: <INPUT NAME="userfile" TYPE="file"> > <INPUT TYPE="submit" VALUE="Send File"> > </FORM> > > > </body> > </html> > > > > > ACtion.php has the following code: > > <?php > if (is_uploaded_file($userfile)) { > copy($userfile, "(c:\\)"); > } else { > echo "Possible file upload attack: filename > '$userfile'."; > } > /* ...or... */ > move_uploaded_file($userfile, "(c:\\)"); > ?> > > > I always get the error: message.. > > [Possible file upload attack: filename 'none'.] > > > Can anybody tell me what could be the possible reason > for this. > > > Thanx a lot! > Dhaval Desai > > __________________________________________________ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail - only $35 > a year! http://personal.mail.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
also take a good look at the following document http://www.php.net/manual/en/features.file-upload.php regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "Dhaval Desai" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 2:10 PM Subject: [PHP] File Upload stuck in the midst > Hi! > > I am facing some problems while uploading files.. > I just copied the code from php.net from the section > "Handling File Uploads". > > My index.php pages has the following code: > > <html> > <head> > <title>File Uploads</title> > > </head> > <body> > <FORM ENCTYPE="multipart/form-data" > ACTION="action.php" METHOD=POST> > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" > value="2000"> > Send this file: <INPUT NAME="userfile" TYPE="file"> > <INPUT TYPE="submit" VALUE="Send File"> > </FORM> > > > </body> > </html> > > > > > ACtion.php has the following code: > > <?php > if (is_uploaded_file($userfile)) { > copy($userfile, "(c:\\)"); > } else { > echo "Possible file upload attack: filename > '$userfile'."; > } > /* ...or... */ > move_uploaded_file($userfile, "(c:\\)"); > ?> > > > I always get the error: message.. > > [Possible file upload attack: filename 'none'.] > > > Can anybody tell me what could be the possible reason > for this. > > > Thanx a lot! > Dhaval Desai > > __________________________________________________ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail - only $35 > a year! http://personal.mail.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi, I have managed (with some struggle) to compile an extension for PHP. I tried to open a test page, loading the extension wit the dl command, and this is what I get: Fatal error: Unable to load dynamic library '/opt/gislab/php/extensions/php_mapscript.so' - ld.so.1: /opt/gislab/apache/bin/httpd: fatal: /opt/gislab/php/extensions/php_mapscript.so: required mapping 0x10000 size 0x82000, is already in use by file /opt/gislab/apache/bin/httpd in /opt/gislab/apache/htdocs/php/phpinfo_mapscript.php3 on line 21 ...any suggestions as to how to resolve this ? Thanks, Andrea
Hi: Check This!
You guys should really stop using outlook. ajay arora wrote: > Hi: > Check This! > > ------------------------------------------------------------------------ > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
or simpler yet, REMOVE WINDOWS SCRIPTING HOST! It does nothing useful (or at least the few useful things it does are things we can easily live without). All it does is open every possible door on a windows box to viruses and hackers. Without the WSH, none of these worms will work. cheers, Thor. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jonatan Bagge Sent: Tuesday, February 13, 2001 1:15 AM To: ajay arora Cc: php general Subject: Re: [PHP] Here you have, ;o) You guys should really stop using outlook. ajay arora wrote: > Hi: > Check This! > > ------------------------------------------------------------------------ > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi all, need some help about socket functions.
I try tu use socket function.
This is my script:if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
echo "socket() a echoué - raison : " . strerror($sock) . "\n";
}And this is the error I always get :
Fatal error: Call to undefined function: socket() in d:\myscript.php on line
175I'm using PHP with WIN NT. The error is the same with PHP Version 4.0.5-dev
, or PHP Version 4.0.4.
I've installed PHP from binary code, not with re-compiling source.First question : is socket function installed on php version for windows ?
Second : if yes, where is the problem.....Thank you for your help,François Tissandié.
Embrassez ceux que vous aimez
Atos-Infogérance
Tour MANHATTAN
6 Place de l'Iris
92400 Courbevoie Cedex
Tél. : 01.70.92.49.67
Fax. : 01.70.92.48.57
e-mail : [EMAIL PROTECTED]
in php you need to use the function fsockopen() instead of the socket() check up the php manual for the scoket cunctions at http://www.php.net/manual/en/ref.sockets.php you can also download a good example of a class that uses the socket functions to send and recieve email from http://myprojects.cjb.net/ Download the Kazzam Intranet Email System code from here which has the class and the example of how to use it for sending and recieving email regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: Tissandié To: Mailing Php (E-mail) Sent: Tuesday, February 13, 2001 2:44 PM Subject: [PHP] php socket function Hi all, need some help about socket functions. I try tu use socket function. This is my script: if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { echo "socket() a echoué - raison : " . strerror($sock) . "\n"; } And this is the error I always get : Fatal error: Call to undefined function: socket() in d:\myscript.php on line 175 I'm using PHP with WIN NT. The error is the same with PHP Version 4.0.5-dev , or PHP Version 4.0.4. I've installed PHP from binary code, not with re-compiling source. First question : is socket function installed on php version for windows ? Second : if yes, where is the problem..... Thank you for your help, François Tissandié. Embrassez ceux que vous aimez Atos-Infogérance Tour MANHATTAN 6 Place de l'Iris 92400 Courbevoie Cedex Tél. : 01.70.92.49.67 Fax. : 01.70.92.48.57 e-mail : [EMAIL PROTECTED]
Hi, On a linux system, I have an directory owned by the user X. How can I force an upload in that directory if my "apache user" is "nobody". I tried with PHP_AUTH_USER but doesn't work. I tried all the examples from php doc, all the "explorers" from zend.com, baut i don't find a good solution. I know are many solutions with ftp, Special directory in http.conf, but i'm looking for a php solution. Thanks in advance, Bogdan Morar
Interesting Query! Please let me know of any solution that you might come up with. regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "Bogdan Morar" <[EMAIL PROTECTED]> To: "Php general" <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 3:10 PM Subject: [PHP] user rights for an upload > Hi, > On a linux system, I have an directory owned by the user X. How can I > force an upload in that directory if my "apache user" is "nobody". I > tried with PHP_AUTH_USER but doesn't work. I tried all the examples from > php doc, all the "explorers" from zend.com, baut i don't find a good > solution. > > I know are many solutions with ftp, Special directory in http.conf, but > i'm looking for a php solution. > > Thanks in advance, > Bogdan Morar > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
is there limitations on file upload.. such as file size when using <input type=file>??? thanks
The maximum filesize for file uploads is either set in the php.ini file using the setting upload_max_filesize = 2M ; Maximum allowed size for uploaded files or you can also specify the maximum file upload size at runt time as follows <FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000"> Send this file: <INPUT NAME="userfile" TYPE="file"> <INPUT TYPE="submit" VALUE="Send File"> </FORM> consult the following section of the php manual for more info http://www.php.net/manual/en/features.file-upload.php hope that helps regards Ankur VermaHCL TechnologiesA1CD, Sec -16Noida, UPIndia ----- Original Message ----- From: "John LYC" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 3:24 PM Subject: [PHP] limitation of file upload?? > > is there limitations on file upload.. such as file size when using > <input type=file>??? > > thanks > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi.. can i upload a 50 Mb file thur this method?.. any complication? john Ankur Verma wrote: > The maximum filesize for file uploads is either set in the php.ini file > using the setting > > upload_max_filesize = 2M ; Maximum allowed size for uploaded files > > or you can also specify the maximum file upload size at runt time as follows > <FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST> > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000"> > Send this file: <INPUT NAME="userfile" TYPE="file"> > <INPUT TYPE="submit" VALUE="Send File"> > </FORM> > > consult the following section of the php manual for more info > http://www.php.net/manual/en/features.file-upload.php > hope that helps > regards > Ankur VermaHCL TechnologiesA1CD, Sec -16Noida, UPIndia > ----- Original Message ----- > From: "John LYC" <[EMAIL PROTECTED]> > To: "PHP List" <[EMAIL PROTECTED]> > Sent: Tuesday, February 13, 2001 3:24 PM > Subject: [PHP] limitation of file upload?? > > > > > is there limitations on file upload.. such as file size when using > > <input type=file>??? > > > > thanks > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
well! Nice question. I haven't gone beyond 2.5 MB on any occassion. but I guess theoretically this should be possible by setting the maximum upload file size setting using the methods already discusssed. Another thing that you might want to look out for in this case would be the maximum execution time of the script take a look at the max_execution_time setting in php.ini and the set_time_limit() function in the php manual. don't forget to tell me the results of this experiment of yours. :) :) regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India .----- Original Message ----- From: "John LYC" <[EMAIL PROTECTED]> To: "Ankur Verma" <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 3:46 PM Subject: Re: [PHP] limitation of file upload?? > Hi.. > can i upload a 50 Mb file thur this method?.. > any complication? > john > > Ankur Verma wrote: > > > The maximum filesize for file uploads is either set in the php.ini file > > using the setting > > > > upload_max_filesize = 2M ; Maximum allowed size for uploaded files > > > > or you can also specify the maximum file upload size at runt time as follows > > <FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST> > > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000"> > > Send this file: <INPUT NAME="userfile" TYPE="file"> > > <INPUT TYPE="submit" VALUE="Send File"> > > </FORM> > > > > consult the following section of the php manual for more info > > http://www.php.net/manual/en/features.file-upload.php > > hope that helps > > regards > > Ankur VermaHCL TechnologiesA1CD, Sec -16Noida, UPIndia > > ----- Original Message ----- > > From: "John LYC" <[EMAIL PROTECTED]> > > To: "PHP List" <[EMAIL PROTECTED]> > > Sent: Tuesday, February 13, 2001 3:24 PM > > Subject: [PHP] limitation of file upload?? > > > > > > > > is there limitations on file upload.. such as file size when using > > > <input type=file>??? > > > > > > thanks > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
well..... tried a 20++ mb file... it was just as good.. :) thanks for the help....! john Ankur Verma wrote: > The maximum filesize for file uploads is either set in the php.ini file > using the setting > > upload_max_filesize = 2M ; Maximum allowed size for uploaded files > > or you can also specify the maximum file upload size at runt time as follows > <FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST> > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000"> > Send this file: <INPUT NAME="userfile" TYPE="file"> > <INPUT TYPE="submit" VALUE="Send File"> > </FORM> > > consult the following section of the php manual for more info > http://www.php.net/manual/en/features.file-upload.php > hope that helps > regards > Ankur VermaHCL TechnologiesA1CD, Sec -16Noida, UPIndia > ----- Original Message ----- > From: "John LYC" <[EMAIL PROTECTED]> > To: "PHP List" <[EMAIL PROTECTED]> > Sent: Tuesday, February 13, 2001 3:24 PM > Subject: [PHP] limitation of file upload?? > > > > > is there limitations on file upload.. such as file size when using > > <input type=file>??? > > > > thanks > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
On Tuesday 13 February 2001 11:21, Ankur Verma wrote: > Another thing that you might want to look out for in this case would be > the maximum execution time of the script Shouldn't matter as the file is uploaded *before* the script is invoked. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "World domination. Fast." (Linus Torvalds about Linux)
Thanks all for your help Siim Einfeldt
Hi; I'm getting this error: >>> Unsatisfied dependencies for mod-php3-mysql-3.0.8-2: mod-php3 >= 3.0.8 <<< What does it mean and what should I do about it (if anything)? TIA, BenO
I am not very sure of what exactly does this this mean but I guess that the particular module that you are installing requires a cversion of PHP that has to be greater than 3.0.8. This is just a guess. I aplogize if it's wrong. regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "Ben Ocean" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 3:28 PM Subject: [PHP] What Does This Mean? > Hi; > I'm getting this error: > >>> > Unsatisfied dependencies for mod-php3-mysql-3.0.8-2: mod-php3 >= 3.0.8 > <<< > What does it mean and what should I do about it (if anything)? > TIA, > BenO > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hello all. I'm running PHP4 as Apache module under Linux. I would like to know good script coding style. I should not write long comments in code or not? With Zend Cache, comments should not matter. How about w/o Zend Cache? If I want to write long comments, should I get Zend Cache? Or can I ignore the overheads? For example, 50KB of comments for 25KB code - total 75KB script size. (Not considering disk access/load overhead. I would like to know PHP4's overheads) Whether I should split source code so that PHP4 can parse/compile as little code as possible or not. What is the best coding style you suggest? For example, 200KB script containing all code vs. split into several source files and load 100KB on average when it executed. What is your opinion? Thanks in advance. -- Yasuo Ohgaki
Thanks, I will take a look at it once more, probably will come with some more questions as at first it didn`t 'look like working', but it really worked and then suddenly I get complains that it doesn`t anymore Siim > read the manual on handling file uploads. It looks like you're using > $image_name which is the original image name on the client where you > want $image which is the temporary file name on the server. If your > server is running on the machine you access the form from it may look > like things are working right when they aren't. > >
O.K. I still got the problems. I`ll paste everything needed here and please, if anyone knows how to make it work, let me know. *First, the part of the form is the following: <INPUT TYPE="file" NAME="file"> the enctype in my form tag is ENCTYPE="multipart/form-data" and METHOD = POST *The code that actually *should* take care of the upload process to mysql, is the following: if (isset($file) AND $file != "none" AND strlen($file)>2){ $file_data = fread( fopen($file, 'r'), filesize($file) ); $theq = "INSERT INTO pildid (file_name,file_type,file_data,tyyp,subid,picnr) VALUES ('$file', '$file_type', '".addslashes($file_data)."','travels','$it','0')"; $result = mysql_query($theq); } And the errors I get, are': Warning: fopen("C:\\ajutine\\Kevad.jpg","r") - No such file or directory in /home/einfeldt/public_html/bt2/reis.php3 on line 62 Warning: Supplied argument is not a valid File-Handle resource in /home/einfeldt/public_html/bt2/reis.php3 on line 62 INSERT INTO pildid (file_name,file_type,file_data,tyyp,subid,picnr) VALUES ('C:\\ajutine\\Kevad.jpg', '', '','travels','9','0') Thanks Siim Einfeldt
I am not sure on how to help you with this out, this is because I've never done so before. Why would you put files inside a database. Just copy them in some folder and name within a logic, inserting only a small string in your DB or even without it. Then call the graphic. This is easier, faster, reliable, extendable. All these different databases support files to simply not to lose the war with their competitors. Not much programmers use it. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Siim Einfeldt aka Itpunk [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 8:01 PM Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] problems with writing picture to the database. O.K. I still got the problems. I`ll paste everything needed here and please, if anyone knows how to make it work, let me know. *First, the part of the form is the following: <INPUT TYPE="file" NAME="file"> the enctype in my form tag is ENCTYPE="multipart/form-data" and METHOD = POST *The code that actually *should* take care of the upload process to mysql, is the following: if (isset($file) AND $file != "none" AND strlen($file)>2){ $file_data = fread( fopen($file, 'r'), filesize($file) ); $theq = "INSERT INTO pildid (file_name,file_type,file_data,tyyp,subid,picnr) VALUES ('$file', '$file_type', '".addslashes($file_data)."','travels','$it','0')"; $result = mysql_query($theq); } And the errors I get, are': Warning: fopen("C:\\ajutine\\Kevad.jpg","r") - No such file or directory in /home/einfeldt/public_html/bt2/reis.php3 on line 62 Warning: Supplied argument is not a valid File-Handle resource in /home/einfeldt/public_html/bt2/reis.php3 on line 62 INSERT INTO pildid (file_name,file_type,file_data,tyyp,subid,picnr) VALUES ('C:\\ajutine\\Kevad.jpg', '', '','travels','9','0') Thanks Siim Einfeldt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi there! I'd really appreciate a clear statement whether to use better $foo = array('bar' => 'boing'); doWhatSoEver($foo[bar]); or $foo = array('bar' => 'boing'); doWhatSoEver($foo['bar']); Someone to know that? bye Matthias Matthias Krehl [EMAIL PROTECTED]
This is the correct format: > doWhatSoEver($foo['bar']); If your error reporting level is set high enough, php will complain about $foo[bar] unless you have defined bar as a constant elsewhere. -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org
foo['bar']; Unless the array key (or any other kind of key, like these in functions or in SQL statements) is an integer you should insert it between quotes. Let's say that stings should be treated as 'strings' and integers can be treated as integers. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Matthias Krehl [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 7:52 PM To: [EMAIL PROTECTED] Subject: [PHP] foo[bar] _or_ foo['bar'] ? Hi there! I'd really appreciate a clear statement whether to use better $foo = array('bar' => 'boing'); doWhatSoEver($foo[bar]); or $foo = array('bar' => 'boing'); doWhatSoEver($foo['bar']); Someone to know that? bye Matthias Matthias Krehl [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
>I'd really appreciate a clear statement whether to use better > $foo = array('bar' => 'boing'); > doWhatSoEver($foo[bar]); >or > $foo = array('bar' => 'boing'); > doWhatSoEver($foo['bar']); I had heard someone on the list say that it's always best to use quotes, for the same reason as XHTML, where every value MUST have quotes. But honestly I've been using only NO-quotes all year and find it much easier to read. And NEVER any problem! Also makes it easier when you need to use an array variable inside a quoted string: print "Hello there $client[name]";
Bad practice alert!!! Derek Sivers wrote: >I had heard someone on the list say that it's always best to use quotes, >for the same reason as XHTML, where every value MUST have quotes. > >But honestly I've been using only NO-quotes all year and find it much >easier to read. And NEVER any problem! > >Also makes it easier when you need to use an array variable inside a quoted >string: > >print "Hello there $client[name]"; If your php error reporting level is set to show warnings (which it should be on your development machines) then referring to $foo[bar] will give Warning: Use of undefined constant bar - assumed 'bar' in whatever/yourscript.php on line n So php only works in this case because it couldn't find bar in it's list of constants, and guessed at the mistake you made. This just slows things down. I can't see any advantage at all to missing the quotes out. Your example could be written print "Hello there {$client['name']}"; Sorry to sound stroppy :) Cheers -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org -----Original Message----- From: Derek Sivers <[EMAIL PROTECTED]> To: Matthias Krehl <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Tuesday, February 13, 2001 5:34 PM Subject: Re: [PHP] foo[bar] _or_ foo['bar'] ? > >>I'd really appreciate a clear statement whether to use better >> $foo = array('bar' => 'boing'); >> doWhatSoEver($foo[bar]); >>or >> $foo = array('bar' => 'boing'); >> doWhatSoEver($foo['bar']); > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
Addressed to: Derek Sivers <[EMAIL PROTECTED]> "Matthias Krehl" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from Derek Sivers <[EMAIL PROTECTED]> Tue, 13 Feb 2001 09:31:29 -0800 > > > >I'd really appreciate a clear statement whether to use better > > $foo = array('bar' => 'boing'); > > doWhatSoEver($foo[bar]); > >or > > $foo = array('bar' => 'boing'); > > doWhatSoEver($foo['bar']); > > > I had heard someone on the list say that it's always best to use quotes, > for the same reason as XHTML, where every value MUST have quotes. > > But honestly I've been using only NO-quotes all year and find it much > easier to read. And NEVER any problem! > > Also makes it easier when you need to use an array variable inside a quoted > string: > > print "Hello there $client[name]"; Several people have mentioned that this is a bad practice, but no one has mentioned why... There are two gotchas you have to look out for, that quotes will prevent. First, if you are using some_word as an array index and someone decides that it would be a good name for a built in function, constant, or statement all of a sudden all of your programs will break. Second, take one of your programs that uses some_word all over it, and add: define( 'some_word', 'something_else' ); into one of your include files, now life gets very interesting: $X[ 'some_word' ] = 'foo'; $X[ 'something_else' ] = 'bar'; echo $X[ some_word ]; // prints bar echo $X[ 'some_word' ]; // always works as expected. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
$foo[bar] only works for backwards compatibility. In fact writing bar without '' means that it's a constant and if that constant value is defined it will be substituted instead of the bar. If it's not defined it defaults to the string 'bar'. So if you want to do it right (and faster) do $foo['bar'] Andi At 05:48 PM 2/13/2001 +0000, Phil Driscoll wrote: >Bad practice alert!!! > >Derek Sivers wrote: > >I had heard someone on the list say that it's always best to use quotes, > >for the same reason as XHTML, where every value MUST have quotes. > > > >But honestly I've been using only NO-quotes all year and find it much > >easier to read. And NEVER any problem! > > > >Also makes it easier when you need to use an array variable inside a quoted > >string: > > > >print "Hello there $client[name]"; > >If your php error reporting level is set to show warnings (which it should >be on your development machines) then referring to >$foo[bar] >will give >Warning: Use of undefined constant bar - assumed 'bar' in >whatever/yourscript.php on line n > >So php only works in this case because it couldn't find bar in it's list of >constants, and guessed at the mistake you made. This just slows things down. > >I can't see any advantage at all to missing the quotes out. > >Your example could be written > >print "Hello there {$client['name']}"; > >Sorry to sound stroppy :) > >Cheers >-- >Phil Driscoll >Dial Solutions >+44 (0)113 294 5112 >http://www.dialsolutions.com >http://www.dtonline.org > > >-----Original Message----- >From: Derek Sivers <[EMAIL PROTECTED]> >To: Matthias Krehl <[EMAIL PROTECTED]> >Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]> >Date: Tuesday, February 13, 2001 5:34 PM >Subject: Re: [PHP] foo[bar] _or_ foo['bar'] ? > > > > > >>I'd really appreciate a clear statement whether to use better > >> $foo = array('bar' => 'boing'); > >> doWhatSoEver($foo[bar]); > >>or > >> $foo = array('bar' => 'boing'); > >> doWhatSoEver($foo['bar']); > > > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>$num_inputs = 5; // if you want 5 sets of checkboxes and text inputs. > >for ( $i = 0; $i < $num_inputs; $i++ ) > { > echo "<input type=checkbox name=checklist[$i]>Cb $i <input type=text >name=text[$i]>\n"; > } yeah... that can work, I think it's a little less messy than what I've done... I did it like this: for each checkbox I did echo "<input type=checkbox name=checklist[] value=$id> Cb1 <input type=text name=asset_$id>"; then I check if isset(${"asset_".$id}) in my code... it's working fine... but it's kinda 'dirty'... I'll try yours... thanks! :) ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer
I've noticed a problem with the config.m4 in the ext/java directory. Basic issue I'm running redhat 7.0 with the sun jdk installed in /usr/java/jdk1.3 I type in really simple after doing a buildconf I have my JAVA_HOME and PATH's setup to get all java exe's. configure --with-mysql=/usr --with-java=/usr/java/jdk1.3 now when I go to do a make it's trying to use zip and not jar, so what I did what I changed line 23 to match line 21 and everything compiles correctly. So it sounds like autoconf is not recognizing the PATH statement in my system. I'm not experienced enough with the autoconf and automake to really make this change so it works properly since I know that I didn't do the right thing to get it working. if someone else has a suggestion on how to fix it properly please let me know, and hopefully the CVS tree will get updated. evan
http://www.phpbuilder.com/columns/rasmus19990124.php3
Hello, I've seen this 'text images generators' but I would like to know where I can find some explanation about image manipulation like merging/mixing two or more images. Something like, I have a background image and some small image elements that will be somewher on that background image...for example, my background image is a table and I have some images like a book, a pen, a paper..and so on, and what I want to do is to create a final image where sometimes it will show two books and three pens on the table...sometimes it will be just a pen on the table... Have you ever seen something like that and where I can find information about that? Thanks, Lucas Persona [EMAIL PROTECTED]
You can allso do this: //foo.class.php class Foo{ var $bar; function Foo($bar){ $this->bar = $bar; } } //foo.php include("foo.class.php"); $bar = "1234"; $foo = new Foo($bar); //Now: $foo->bar = "1234" Regards: Marcus Rasmussen *********** REPLY SEPARATOR *********** On 14-02-2001 at 15:52 Joseph H Blythe wrote: >On Mon, 12 Feb 2001 21:04:30 -0800 >Joe wrote: > >JC> Is this closer to what you were looking for? >JC> - Joe >JC> >JC> <?PHP >JC> >JC> class Foo { >JC> >JC> var $bar; >JC> >JC> function mymethod(){ >JC> >JC> global $foo; >JC> $this->bar = $foo; >JC> >JC> } >JC> >JC> } >JC> >JC> $foo = "hello world"; >JC> >JC> echo "<html><body>"; >JC> >JC> $cls = new foo(); >JC> $cls->mymethod(); >JC> echo $cls->bar; >JC> >JC> echo "</body></html>"; >JC> ?> >JC> > >hmm sort of is, basically this works: > >// Foo.class.php >class Foo { > >var $bar; > > setBar($bar) { > $this->bar = $bar; > } > >} > >// foo.php >include("Foo.class.php"); >$foo = new Foo; >$bar = "1234567789"; >$foo->setBar($bar); > >Regards, > >Joseph > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED]
on 2/13/01 12:04 AM, Joe Conway at [EMAIL PROTECTED] wrote: > <?PHP > > class Foo { > > var $bar; > > function mymethod(){ > > global $foo; > $this->bar = $foo; > > } > > } > > $foo = "hello world"; > > echo "<html><body>"; > > $cls = new foo(); > $cls->mymethod(); > echo $cls->bar; > > echo "</body></html>"; > ?> This can be simplified by: <?php class Foo { function Foo($foo="") { $this->bar = $foo; } } $foo = "Hello World"; $cls = new Foo($foo); echo $cls->bar; ?> -- Jesse Swensen [EMAIL PROTECTED]
oh hell. Do I ever feel stupid now. That explains that test script perfectly.... now I just have to figure out whats wrong with the rest of my site.... Obviously, too much "What-the-f..." and not enough "lets look at this logically" occured. Sorry about that. I'll crawl back under my rock now. > -----Original Message----- > From: Steve Werby [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 13, 2001 12:26 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] mysql_fetch_array and row referencing > under 4.0.4pl1 > > > "Scott Brown" <[EMAIL PROTECTED]> wrote: > > I grabbed an example of of php.net dealing with just arrays > and it works > ... > > > > Here's what I'm seeing - THIS WORKS: > > <snip> > > while ( $row = mysql_fetch_array($rslt) ) > > { > > echo "<TR>\n"; > > echo "<TD>$row[ID]</tD>"; > </snip> > > > But put any one of these $row[...] with quotes around their > fieldnames and > I > > get: > > > > Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or > > `T_NUM_STRING' in /home/testnexus/public_html/test.php on line 16 > > > > (when line 16 = > > echo "<TD>$row["ID"]</tD>"; > > The double quotes enclose the contents of the echo statement, > but PHP chokes > because you have double quotes inside the echo statement. If > the exact line > above worked under PHP3.x I'm surprised. Solutions include: > > escaping the double quotes > echo "<TD>$row[\"ID\"]</TD>"; > > using no quotes or single quotes: > echo "<TD>$row['ID']</TD>"; > echo "<TD>$row[ID]</TD>"; > > breaking apart the echo statement: > echo "<TD>" . $row["ID"] . "</TD>"; > > I don't think there's any way around this. If you got it to work > differently in PHP3 I'd like to know how. If for some reason > you have a ton > of code you have to change now, you can write a PHP script which uses > regular expressions to find the double quotes to replace, > write out the new > files and cycle through all your files. It really wouldn't > be that hard, > but I still suspect that the double quotes would have been a > problem in PHP3 > too. > > -- > Steve Werby > COO > 24-7 Computer Services, LLC > Tel: 804.817.2470 > http://www.247computing.com/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > >
>From your mail, I understand that you cannot proceed past the compilation step. I've seen the same on previous versions of PHP for Linux, but now this is solved. Maybe the Solaris version didn't got the same fixes... Anyway, PHP will look at ORACLE_HOME for the required libraries which has now different semantics for Oracle. Now(Ora.8i.later) ORACLE_BASE points to old (Ora.8.0.xx) ORACLE_HOME. The new ORACLE_HOME should be $ORACLE_BASE/product/8.1.6 (or whatever version you have). Hope this helps. -Stathis. rbradley wrote: > > I'm really struggling configuring the php mod with oracle 8i support on > Solaris 8. > > ./configure --enable-track-vars --with-o8ci=/export/home/oracle > --with-oracle --enable-sigchild --with-apxs > > The ORACLE_HOME is set to /export/home/oracle. > > I am getting an error: > > checking Oracle Install-Dir... > +--------------------------------------------------------------------+ > | Notice: | > | If you encounter <defunc> processes when using a local Oracle-DB | > | please recompile PHP and specify --enable-sigchild when configuring| > | (This problem has been reported un Linux using Oracle >= 8.1.5) | > +--------------------------------------------------------------------+ > checking Oracle version... configure: error: Oracle needed libraries not found > > I installed the oracle 8i client prior to compiling. I've installed all > the compilers, Please God, WHAT HAVE I DONE WRONG..... If anyone out > there can help this poor wrech of a man. Please help me...... > > -- > Richard Bradley > CTO YourLink, inc. > (321) 452-6699 > IM lagoonr
> -----Original Message----- > From: Malouin Design Graphique [mailto:[EMAIL PROTECTED]] > Sent: 13 February 2001 03:26 > To: [EMAIL PROTECTED] > Subject: Newbie: Images refs not loading (Broken Icons) How to? > > > Hi, > > Is there anything wrong with this code below? > Any help or fix to this code would be very much appreciated. > > > > The file to get the data out (gif file): > -------------------------------- > <?php > > /* data_out.php3 */ > > $db = mysql_connect("www.server.com", "root", "password"); > mysql_select_db("db_name", $db); > $sql = "select * from table_name order by 'date'"; > $sql = "select * from table_name"; > $result = mysql_query($sql); > while ($row = mysql_fetch_array($result)) { > print("<tr><td bgcolor=\"#003399\">"); > printf("<img src=\"$indice_url\">%s</td></tr>\n", > $row["indice_url"]); printf("<img src=\"%s\">%s</td></tr>\n", $row["indice_url"], $row["indice_url"]); although not sure of the use of printf. I would do echo("<img src='" . $row["indice_url"] . "'>" . $row["indice_url"] . "</td></tr>\n"); > } > ?> > > > > > Here's the "tiny" table that feeds it: > -------------------------------- > CREATE TABLE indice ( > id int(11) DEFAULT '0' NOT NULL auto_increment, > date text, > indice text, > indice_url varchar(255), > PRIMARY KEY (id) > ); > -------------------------------- > > > > Merci, > > Yves > -- > > > ------------------------ > Malouin Design Graphique > http://www.malouin.qc.ca > > Québec (Québec) CANADA > > Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html
On Mon, Feb 12, 2001 at 11:06:16PM -0600, Christopher Allen wrote: > $tomorrow = date ("d", mktime(0,0,0,0,date("d") +4 ) ); > echo "Today + 4 days is $tomorrow <br>"; > screws up Feb et al.... If you add the month and year, it should work just fine. $tomorrow = date ("d", mktime(0,0,0,date("m"),date("d") +4,date("Y"))); -- Jason Stechschulte [EMAIL PROTECTED] -- It's all magic. :-) -- Larry Wall in <[EMAIL PROTECTED]>
$time = time(); $timePlus4Days = $time + 60*60*24*4; $tomorrow = date ("d", $timePlus4Days); Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Christopher Allen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 2:06 PM To: php Subject: [PHP] mktime + 4 days Hi! How to get this to work for every month: $tomorrow = date ("d", mktime(0,0,0,0,date("d") +4 ) ); echo "Today + 4 days is $tomorrow <br>"; screws up Feb et al.... Thanks, Christopher C. M. Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
I am attempting to create mail users with PHP. I have seen it done with perl and I am wondering if any of you have had success with doing it with PHP. So far this is the info I have. to create a user on a linux server you call "adduser -p password username" the only problem is you can not call that from the apache server.. as far as i know of anyways.. because only root can call that script... and PHP runs (for me anyways... ) under the apache username and group... Does anyone have any suggestions? Regards, Ian LeBlanc Web Development Rask, Inc. - www.rask.com Phone: (727) 517-2000 Fax: (727) 517-2001
Ian LeBlanc <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am attempting to create mail users with PHP. > I have seen it done with perl and I am wondering if any of you have had > success with doing it with PHP. Simple. Add each username and password to a plain text file. Once an hour, have another script running under root's crontab check that file for entries and create the users. -- Rick Hodger
On Tuesday 13 February 2001 04:59, Scott Mebberson wrote: > I think that maybe preg_match() or preg_match_all() is the answer but I > have know idea on how to make the regular expression I am using perl > comptaible. > > Here it is: > $txt = ereg_replace("src=\"([^>]+)\.(gif|jpg)\"", > "src=\"http://www.ezigraphics.com/images/about_0001." . //2. "\"", > $txt); $txt = preg_replace ('/src="([^>]+)\.(gif|jpg)"/', 'src="http://www.ezigraphics.com/images/about_0001.\\2"', $txt); Wasn't too hard, was it? :-) -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "World domination. Fast." (Linus Torvalds about Linux)
Hi , I am configuring php with the --with-gd option . My libgd.a is sitting in /usr/local/lib and other header files in /usr/local/include . ./configure --with-gd=/usr/local/lib gives me the following error : checking whether to include GD support... configure: error: Unable to find libgd.(a|so) anywhere under /usr/local/lib though the file is very much existant. Any ideas what is wrong??? ~Rahul
Hello...'m new in this list,and for this...Hello Hello to all people. ...and begin, with my first doubt... ..We (I, a friend, for the our job, need make application with xml, = better say, migrate a current system of news, to the structured of XML, = and procceses it with XLS, for generate directly the out, ..but, what is = the problem? (: matter)!!..we are developing with PHP3!, and reading the = specification only after vsion>4 support XLS, with Sablatron, and Expat = as parser of xml...but, i think? Why i can do this? if, the chief dont = like Perl...(: i suggest he, that we can make an script that take the = file xml, etc..and generate the out, with an interface with php = script...but say no!...and after, try make with php...then i think in = can i install PHP4 and PHP3 and run together?...HOW? ...Somebody know how work Xalan(: xml.apache.org...?)... ...How i can make a module for PHP3?(:_not PHP4!) Thanks...and=20 ..GOOD LUCK. Roberto Celestino.
ok, here's a scratch: $contents = file ($file); for($i=0; $i<sizeof($contents); $i++){ $staff .= eregi_replace("this", "with_this", $staff); } $fp = fopen ($file, "w"); $fputs ($staff); fclose ($fp); I think this should work ... Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: CDitty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 3:29 AM To: PHPBeginner.com Subject: RE: [PHP] Search & replace text Thanks for the idea. Can you give me an example of how to load a file into an array? My efforts failed. Thanks At 03:41 AM 2/12/01, you wrote: >instead of writing to you the code I'll give you an idea: > >1. you open the file and read it line-by-line assigning it to an array, >2. you loop that array parsing it line by line changing it's values with >RegEx the way you want. >3. you open the same file and, looping the array writing it down overriding >any existing data in the file. > >You are now set. > > >Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > [EMAIL PROTECTED] > www.phpbeginner.com > > > > >-----Original Message----- >From: CDitty [mailto:[EMAIL PROTECTED]] >Sent: Monday, February 12, 2001 5:12 AM >To: [EMAIL PROTECTED] >Subject: [PHP] Search & replace text > > >Hello all. I am trying to search through a text file on my server to >replace the user email. I can open the file and read it, but cannot get it >to "find" the actual string and replace it. Can someone look over my code >and see what the problem is? I am afraid that ereg is not my strongest >point. > >Also, at what point should I start writing the file out? Wouldn't there be >a permissions error if I was reading and writing at the same time? > >Thanks >CDitty > > >$oldemail = "[EMAIL PROTECTED]"; >$newemail = "[EMAIL PROTECTED]"; >$user = "cditty"; >$file = fopen("/path/to/the/user/file/$user.dat", "r"); >if(!$file){ > echo "<p>Unable to open remote file.\n"; > exit; >}else{ > echo "Success<br>"; >} >while (!feof($file)) { > $line = fgets($file, 255); > if(eregi($oldemail, $line, $out)) { > str_replace($oldemail, $newemail, $line); > } > >echo $line . "<BR>"; >} >fclose($file) > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED]
Sorry, I made a small mistake in my code ... this is correct: $contents = file ($file); for($i=0; $i<sizeof($contents); $i++){ $staff .= eregi_replace("this", "with_this", $contents[$i]); } $fp = fopen ($file, "w"); $fputs ($staff); fclose ($fp); Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: PHPBeginner.com [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 11:34 PM To: PHP; CDitty Subject: RE: [PHP] Search & replace text ok, here's a scratch: $contents = file ($file); for($i=0; $i<sizeof($contents); $i++){ $staff .= eregi_replace("this", "with_this", $staff); } $fp = fopen ($file, "w"); $fputs ($staff); fclose ($fp); I think this should work ... Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: CDitty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 3:29 AM To: PHPBeginner.com Subject: RE: [PHP] Search & replace text Thanks for the idea. Can you give me an example of how to load a file into an array? My efforts failed. Thanks At 03:41 AM 2/12/01, you wrote: >instead of writing to you the code I'll give you an idea: > >1. you open the file and read it line-by-line assigning it to an array, >2. you loop that array parsing it line by line changing it's values with >RegEx the way you want. >3. you open the same file and, looping the array writing it down overriding >any existing data in the file. > >You are now set. > > >Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > [EMAIL PROTECTED] > www.phpbeginner.com > > > > >-----Original Message----- >From: CDitty [mailto:[EMAIL PROTECTED]] >Sent: Monday, February 12, 2001 5:12 AM >To: [EMAIL PROTECTED] >Subject: [PHP] Search & replace text > > >Hello all. I am trying to search through a text file on my server to >replace the user email. I can open the file and read it, but cannot get it >to "find" the actual string and replace it. Can someone look over my code >and see what the problem is? I am afraid that ereg is not my strongest >point. > >Also, at what point should I start writing the file out? Wouldn't there be >a permissions error if I was reading and writing at the same time? > >Thanks >CDitty > > >$oldemail = "[EMAIL PROTECTED]"; >$newemail = "[EMAIL PROTECTED]"; >$user = "cditty"; >$file = fopen("/path/to/the/user/file/$user.dat", "r"); >if(!$file){ > echo "<p>Unable to open remote file.\n"; > exit; >}else{ > echo "Success<br>"; >} >while (!feof($file)) { > $line = fgets($file, 255); > if(eregi($oldemail, $line, $out)) { > str_replace($oldemail, $newemail, $line); > } > >echo $line . "<BR>"; >} >fclose($file) > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
try ereg_replace("^[ ]+(.)[ ]+$", '_\\1_', $here) I haven't tested it, but if it won't work, then do this: $here = ereg_replace("^[ ]+", '_', $here) $here = ereg_replace("[ ]$", '_', $here) this should work... Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Jesse Swensen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 4:39 AM To: PHPBeginner.com Subject: Re: [PHP] Regex help needed... Thank you for your suggest, but I don't want to just trim them, I need to display them as underscores (_). -- Jesse Swensen [EMAIL PROTECTED] > From: "PHPBeginner.com" <[EMAIL PROTECTED]> > Date: Tue, 13 Feb 2001 03:25:59 +0900 > To: "Jesse Swensen" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: [PHP] Regex help needed... > > rtrim() > > www.php.net/rtrim > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > [EMAIL PROTECTED] > www.phpbeginner.com > > > > > > -----Original Message----- > From: Jesse Swensen [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 13, 2001 2:15 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Regex help needed... > > > This should be a quick one, but I can't seem to wrap my brain around it. > All I need to do is replace leading or trailing spaces with underscores. If > there is spaces in between words, leave them alone. > > Suggestions? > > -- > Jesse Swensen > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > >
mkdir() Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: andrew [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 11:56 AM To: PHP General Subject: [PHP] create filesystem folder? subject says it all - any way to create a new folder in the filesystem? regards, andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Why reinvent the wheel? there are already a whole bunch of software like that has been written. Just search for it on sourceforge.com or hotscripts.com Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Josh G [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 1:47 PM To: PHP User Group Subject: [PHP] Mail classes Hi, I'm wondering what're the best classes available for reading/ sending emails? I want to do a webmail solution (for myself at first), and don't want to use IMP. I'd need to be able to handle attachments as well. Any pointers? Cheers, Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Yeah, sure you can: $sql="SELECT id, email FROM table WHERE user='$user' and pass='$pass'"; Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 2:30 PM To: PHP MAIL GROUP Subject: [PHP] SELECT statement Hi, Can you have a SELECT statement (using mysql) that goes something like $sql="SELECT id && email FROM table WHERE user='$user' and pass='$pass'"; and if you can't is there a away around this? Thanks Peter
There must be some funny problem. You code looks alright. Try to output mysql_error() in your code to see what happens. Or simply try it from command line. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 2:51 PM To: PHP MAIL GROUP Subject: RE: [PHP] SELECT statement ok I've changed my code to $sql = "SELECT id, email FROM users WHERE user='$user' and pass='$pass'"; but still no joy can any one suggest why? (& Yes email is a field in the table) Peter > Hi, > > Can you have a SELECT statement (using mysql) that goes something like > > $sql="SELECT id && email FROM table WHERE user='$user' and pass='$pass'"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
There's also possible to do a simple "try" if($variable) echo 'It contains something'; else echo 'Has nothing inside, unless it's a 0'; Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Ankur Verma [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 3:29 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] How to check if vaiable is defined or not? try using isset() or empty() see the php manual for more details Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "SED" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 4:51 AM Subject: [PHP] How to check if vaiable is defined or not? > Hi, > > I'm sending a form, with check-boxes, via post to PHP-script and if the > boxes are not checked they don't post value for its variable - Can I check > with a function if the variable is defined? (or should I focus on another > solution?) > > Regards, > Sumarlidi Einar Dadason > > SED - Graphic Design > > ------------------------------------------ > Phone: (+354) 4615501 > Mobile: (+354) 8960376 > Fax: (+354) 4615503 > E-mail: [EMAIL PROTECTED] > Homepage: www.sed.is <- New Homepage! > ------------------------------------------ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
it is even cooler to do: $version = floor(phpversion()); It will then return eigher 3 or 4. I use it all the time while creation install scripts. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Ankur Verma [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 3:51 PM To: [EMAIL PROTECTED]; PHP Subject: Re: [PHP] How To Tell Which v. PHP? use phpinfo(); Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "Jeff Oien" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 6:00 AM Subject: [PHP] How To Tell Which v. PHP? > Is there a script I can run to tell which version of PHP the > server is using to run it? > > Details: > Two reasons I ask. One is if I have a client on an unfamiliar > server with bad or no documentation. Or to test when using > .htaccess to use the .phtml extension for php3 when the server > would normally see that as a PHP2 file. > > Thanks. > Jeff Oien > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi list. I have a strange problem with a PHP script (WinNT/Apache/PHP4/MySQL). The line of code $dayname = date("D", mktime(0,0,0,$cmonth,$eventdate,$cyear)); should, if I understand it correctly, fill the variable $dayname with the three-letter abbreviation of the day of the week for the date I supply. I have $cmonth=3, $eventdate=26, and $cyear=2001. I would expect this to put "Mon" in $dayname, given that March 26th 2001 is a Monday. However, my script displays "Tue" which is a bit peculiar. As if that weren't enough, it isn't consistent in getting the days wrong. For example: November 30th 2000 was a Thursday. It gets this right. December 14th 2000 was a Thursday. It says it was a Tuesday. January 11th 2001 was a Thursday. It says it was a Monday. February 11th 2001 was a Sunday. It says it was a Monday. March 26th 2001 is a Monday. It says it is a Tuesday. What am I doing wrong? Is it something to do with last year (officially it wasn't a leap year but as 2000 is divisible by 4, many people thought it should be)? I'm in GMT so unless it's a BST thing I'm not being affected by a local time zone. All help gratefully appreciated.... Cheers Jon
Don't worry. False alarm. My bad. (etc) Hint for people experiencing a problem like this in the future: when passing variables to mktime(), ensure $cmonth=3 and not $cmonth="March", I find it helps a *lot* :-) Moral to the story: when having difficulties, echo your variables to the screen.... Cheers Jon -----Original Message----- From: Jon Haworth [mailto:[EMAIL PROTECTED]] Sent: 13 February 2001 14:38 To: '[EMAIL PROTECTED]' Subject: [PHP] Problems with date() - what have I missed? Hi list. I have a strange problem with a PHP script (WinNT/Apache/PHP4/MySQL). The line of code $dayname = date("D", mktime(0,0,0,$cmonth,$eventdate,$cyear)); should, if I understand it correctly, fill the variable $dayname with the three-letter abbreviation of the day of the week for the date I supply. I have $cmonth=3, $eventdate=26, and $cyear=2001. I would expect this to put "Mon" in $dayname, given that March 26th 2001 is a Monday. However, my script displays "Tue" which is a bit peculiar. As if that weren't enough, it isn't consistent in getting the days wrong. For example: November 30th 2000 was a Thursday. It gets this right. December 14th 2000 was a Thursday. It says it was a Tuesday. January 11th 2001 was a Thursday. It says it was a Monday. February 11th 2001 was a Sunday. It says it was a Monday. March 26th 2001 is a Monday. It says it is a Tuesday. What am I doing wrong? Is it something to do with last year (officially it wasn't a leap year but as 2000 is divisible by 4, many people thought it should be)? I'm in GMT so unless it's a BST thing I'm not being affected by a local time zone. All help gratefully appreciated.... Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi , having a hierarchy of directories, like A\b\d, A\c, I would like to move directory A\b\d to A\c\d , to (try) to get it I test something like rename(d,".. / c/d"), but I get " Warning: Rename failed (No such file or directory) in ", it's necessary create the directory first, I mean , Mkdir(second_d) ? but the command its RENAME... or there are other, better , ways to do what I want. Consider that the directory d have lots of things (files and directories...). T.Y Best Regards Miguel Loureiro <[EMAIL PROTECTED] >
Hello list, Can someone please explain to me in simple terms. What the exact reason is for putting hidden form fields into an html document that uses PHP to connect to a mySQL db .. or any db for that matter. I have looked around and have not gotten a good clear answer? Thanks. Chad Angerer
Hello, The reason is that you might want to pass to PHP script that process the form information that is not found in any other shown field of the form , for example an id code. HTH Sorin Ifrim ----- Original Message ----- From: Angerer, Chad <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 5:14 PM Subject: [PHP] hidden form field. > Hello list, > > Can someone please explain to me in simple terms. What the exact reason is > for putting hidden form fields into an html document that uses PHP to > connect to a mySQL db .. or any db for that matter. I have looked around > and have not gotten a good clear answer? > > Thanks. > > Chad Angerer > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
If you mean why would any script bother using a hidden form field to hold a value between html pages as opposed to holding it in a db field, I would answer there are reasons. One would be to use a hidden form field as a buffer so that you don't have to change a field's value until you are sure you want it to be in a persistent state. An example might be letting a user review values they have entered into form fields before committing them to the DB. At 09:14 AM 2/13/2001 -0600, Angerer, Chad wrote: >Hello list, > >Can someone please explain to me in simple terms. What the exact reason is >for putting hidden form fields into an html document that uses PHP to >connect to a mySQL db .. or any db for that matter. I have looked around >and have not gotten a good clear answer? > >Thanks. > >Chad Angerer > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED]
I'm encountering the following problem and now wonder if it's related to magic quotes. The code in the current, non-working form. Please note that for the <input..> there are no quotes or apostropies around the word "text" the size of 9, the name of proj[]. **************************************************************************** ******************* echo " <script language=\"JavaScript\">\n"; echo " <!-- // hide from older browsers\n"; echo " var cell = 0;\n"; echo " var temp;\n"; echo " for (row = 0; row < tasksOnPage; row++)\n"; echo " {\n"; echo " document.write(\"<tr>\" +\n"; echo " \"<font size=2 face=arial>\");\n"; echo " temp = Proj[row];\n"; echo " if (temp == \"\")\n"; echo " temp = \"(default)\";\n"; echo " document.write(\"<td><input type=text size=9 value='\" +\n"; echo " temp +\n"; echo " \"' name=proj[] notab readonly></td>\");\n"; echo " if (temp == \"(default)\")\n"; echo " temp = \"Requirement \" + Rqmt[row];\n"; echo " else\n"; echo " temp = Desc[row];\n"; **************************************************************************** ***************** This is the "View Source" from the browser (MSIE 5.5) output when the display is correct: <script language="JavaScript"> <!-- // hide from older browsers var cell = 0; var temp; for (row = 0; row < tasksOnPage; row++) { document.write("<tr>" + "<font size=2 face=arial>"); temp = Proj[row]; if (temp == "") temp = "(default)"; document.write("<td><input type=text size=9 value='" + temp + "' name=proj[] notab readonly></td>"); if (temp == "(default)") temp = "Requirement " + Rqmt[row]; else temp = Desc[row]; **************************************************************************** **************** Note the <input type=text size=9... Now look at the cache'd version that comes up when I View Source: (the page comes up in error, so I select View | Source from the MSIE menu) and get the following text: **************************************************************************** **************** <script language="JavaScript"> <!-- // hide from older browsers var cell = 0; var temp; for (row = 0; row < tasksOnPage; row++) { document.write("<tr>" + "<font size=2 face=arial>"); temp = Proj[row]; if (temp == "") temp = "(default)"; document.write("<td><input type="text" size="9" value="" + temp + "" name="proj[]" notab readonly></td>"); if (temp == "(default)") temp = "Requirement " + Rqmt[row]; else temp = Desc[row]; **************************************************************************** ********************** Somebody, somewhere, somehow inserted double quotes around type, size, name and value. This fails miserably. The only way I can make it go away is to delete all temporary internet files. The snippet meta... expires 0 is part of these pages.
Presumably if you have <input type=\"text\" size=\"9\"... in your script, that doesn't work either? Incidentally, you can use Shift-Refresh to force a server refresh in IE (saves you deleting everything next time!) HTH Jon -----Original Message----- From: John Hofstad-Parkhill [mailto:[EMAIL PROTECTED]] Sent: 13 February 2001 15:38 To: [EMAIL PROTECTED] Subject: [PHP] Mystery quotes I'm encountering the following problem and now wonder if it's related to magic quotes. The code in the current, non-working form. Please note that for the <input..> there are no quotes or apostropies around the word "text" the size of 9, the name of proj[]. **************************************************************************** ******************* echo " <script language=\"JavaScript\">\n"; echo " <!-- // hide from older browsers\n"; echo " var cell = 0;\n"; echo " var temp;\n"; echo " for (row = 0; row < tasksOnPage; row++)\n"; echo " {\n"; echo " document.write(\"<tr>\" +\n"; echo " \"<font size=2 face=arial>\");\n"; echo " temp = Proj[row];\n"; echo " if (temp == \"\")\n"; echo " temp = \"(default)\";\n"; echo " document.write(\"<td><input type=text size=9 value='\" +\n"; echo " temp +\n"; echo " \"' name=proj[] notab readonly></td>\");\n"; echo " if (temp == \"(default)\")\n"; echo " temp = \"Requirement \" + Rqmt[row];\n"; echo " else\n"; echo " temp = Desc[row];\n"; **************************************************************************** ***************** This is the "View Source" from the browser (MSIE 5.5) output when the display is correct: <script language="JavaScript"> <!-- // hide from older browsers var cell = 0; var temp; for (row = 0; row < tasksOnPage; row++) { document.write("<tr>" + "<font size=2 face=arial>"); temp = Proj[row]; if (temp == "") temp = "(default)"; document.write("<td><input type=text size=9 value='" + temp + "' name=proj[] notab readonly></td>"); if (temp == "(default)") temp = "Requirement " + Rqmt[row]; else temp = Desc[row]; **************************************************************************** **************** Note the <input type=text size=9... Now look at the cache'd version that comes up when I View Source: (the page comes up in error, so I select View | Source from the MSIE menu) and get the following text: **************************************************************************** **************** <script language="JavaScript"> <!-- // hide from older browsers var cell = 0; var temp; for (row = 0; row < tasksOnPage; row++) { document.write("<tr>" + "<font size=2 face=arial>"); temp = Proj[row]; if (temp == "") temp = "(default)"; document.write("<td><input type="text" size="9" value="" + temp + "" name="proj[]" notab readonly></td>"); if (temp == "(default)") temp = "Requirement " + Rqmt[row]; else temp = Desc[row]; **************************************************************************** ********************** Somebody, somewhere, somehow inserted double quotes around type, size, name and value. This fails miserably. The only way I can make it go away is to delete all temporary internet files. The snippet meta... expires 0 is part of these pages. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
What about just forcing the use of escaped quotes? Have you tried that? instead of: echo " document.write(\"<td><input type=text size=9 value='\" +\n"; try: echo " document.write(\"<td><input type=\"text\" size=\"9\" value='\" +\n"; - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "John Hofstad-Parkhill" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 10:38 AM Subject: [PHP] Mystery quotes > I'm encountering the following problem and now wonder if it's related to > magic quotes. > > The code in the current, non-working form. Please note that for the > <input..> there are no quotes or apostropies around the word "text" the size > of 9, the name of proj[]. > **************************************************************************** > ******************* > echo " <script language=\"JavaScript\">\n"; > echo " <!-- // hide from older browsers\n"; > > echo " var cell = 0;\n"; > echo " var temp;\n"; > > echo " for (row = 0; row < tasksOnPage; row++)\n"; > echo " {\n"; > echo " document.write(\"<tr>\" +\n"; > echo " \"<font size=2 face=arial>\");\n"; > > echo " temp = Proj[row];\n"; > echo " if (temp == \"\")\n"; > echo " temp = \"(default)\";\n"; > echo " document.write(\"<td><input type=text size=9 value='\" +\n"; > echo " temp +\n"; > echo " \"' name=proj[] notab readonly></td>\");\n"; > > echo " if (temp == \"(default)\")\n"; > echo " temp = \"Requirement \" + Rqmt[row];\n"; > echo " else\n"; > echo " temp = Desc[row];\n"; > **************************************************************************** > ***************** > This is the "View Source" from the browser (MSIE 5.5) output when the > display is correct: > > > <script language="JavaScript"> > <!-- // hide from older browsers > var cell = 0; > var temp; > for (row = 0; row < tasksOnPage; row++) > { > document.write("<tr>" + > "<font size=2 face=arial>"); > temp = Proj[row]; > if (temp == "") > temp = "(default)"; > document.write("<td><input type=text size=9 value='" + > temp + > "' name=proj[] notab readonly></td>"); > if (temp == "(default)") > temp = "Requirement " + Rqmt[row]; > else > temp = Desc[row]; > **************************************************************************** > **************** > Note the <input type=text size=9... > > Now look at the cache'd version that comes up when I View Source: > (the page comes up in error, so I select View | Source from the MSIE menu) > and get the following text: > **************************************************************************** > **************** > > <script language="JavaScript"> > <!-- // hide from older browsers > var cell = 0; > var temp; > for (row = 0; row < tasksOnPage; row++) > { > document.write("<tr>" + > "<font size=2 face=arial>"); > temp = Proj[row]; > if (temp == "") > temp = "(default)"; > document.write("<td><input type="text" size="9" value="" + > temp + > "" name="proj[]" notab readonly></td>"); > if (temp == "(default)") > temp = "Requirement " + Rqmt[row]; > else > temp = Desc[row]; > **************************************************************************** > ********************** > Somebody, somewhere, somehow inserted double quotes around type, size, name > and value. This fails miserably. The only way I can make it go away is to > delete all temporary internet files. > > The snippet meta... expires 0 is part of these pages. > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
If I have a complex if else statement and I replace it with a switch case statement do I loose any performance? I would think I would gain performance and the code is definitely easier to maintain but I wanted some other opinions. John Guynn This email brought to you by RFCs 821 and 1225.
In most cases, using a switch is preferrable. The code is cleaner, and the performance increases. This is true accross languages. - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "John Guynn" <[EMAIL PROTECTED]> To: "Php (E-mail)" <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 11:34 AM Subject: [PHP] Any performance penalties for switch vs. if/else? > If I have a complex if else statement and I replace it with a switch case > statement do I loose any performance? I would think I would gain > performance and the code is definitely easier to maintain but I wanted some > other opinions. > > John Guynn > > This email brought to you by RFCs 821 and 1225. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
I know that by using the header you can bring up a standard user authenication dialog box, that sets the EVs: $PHP_AUTH_USER $PHP_AUTH_PW But is it possible to use a custom form to set these variables manually for site wide useage? Thanks Scott
I am getting the following error message from the code below. Warning: Undefined index: getdwgnum in d:\apache\htdocs/getdwgnum.php on line 4 <?php $cook = mt_rand (5, 50000) ; $cookieinfo = $HTTP_COOKIE_VARS["getdwgnum"]; if ($cookieinfo > "") { $str = "where Cook = $cookieinfo"; $cx=odbc_pconnect("doc","",""); } else setcookie ("getdwgnum", $cook,time()+28800); ?> I want to look for a cookie and if it is not there I want to set one. Any ideas? Thanks, Gary
I've been using PHP for over a year now and have been successfully running three different websites developed with PHP, but I've never done anything with classes or objects. Even when returning data from a mySQL database, I use mysql_fetch_array() instead of mysql_fetch_object(). What am I missing by not using objects and classes, other than reusability? What are the real benefits to using OOPs in PHP?
I find the ability to write something once (say a mysql_connect(); statement) and be able to run it on any page just with $db->connect(); is pretty cool. While that may not seem cool, if you some day change a a PHP statement that exists on many pages, this lets you change it in one place, instead of having to copy it to dozens of other places. Also, what happens if you change your database password and now need to change a bunch of pages to have the new password? Problem solved in OOP, because the vars are all in the same file. - Kath, a recent converter to OOP, but enjoying every minute of it! ----- Original Message ----- From: "Joe Sheble (Wizaerd)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 11:41 AM Subject: [PHP] OOP in web development > I've been using PHP for over a year now and have been successfully running > three different websites developed with PHP, but I've never done anything > with classes or objects. Even when returning data from a mySQL database, I > use mysql_fetch_array() instead of mysql_fetch_object(). > > What am I missing by not using objects and classes, other than > reusability? What are the real benefits to using OOPs in PHP? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
On Tue, 13 Feb 2001 15:11:46 -0500, Kath ([EMAIL PROTECTED]) wrote: >I find the ability to write something once (say a mysql_connect(); >statement) and be able to run it on any page just with $db- >>connect(); is >pretty cool. > >While that may not seem cool, if you some day change a a PHP >statement that >exists on many pages, this lets you change it in one place, instead >of >having to copy it to dozens of other places. > >Also, what happens if you change your database password and now need >to >change a bunch of pages to have the new password? > >Problem solved in OOP, because the vars are all in the same file. You don't need OOP to keep your database connections in a separate file. You can either use classes or not but it's really just about style.
At 03:11 PM 2/13/01 -0500, you wrote: >> I find the ability to write something once (say a mysql_connect(); >> statement) and be able to run it on any page just with $db->connect(); is >> pretty cool. >> >> While that may not seem cool, if you some day change a a PHP statement that >> exists on many pages, this lets you change it in one place, instead of >> having to copy it to dozens of other places. >> >> Also, what happens if you change your database password and now need to >> change a bunch of pages to have the new password? >> >> Problem solved in OOP, because the vars are all in the same file. problem solved by building modular INC (or include) file... all the vars are in one file, and are included at the top of every other file, just as a class file would have to be.
In article <[EMAIL PROTECTED]>, "Joe Sheble (Wizaerd)" <[EMAIL PROTECTED]> wrote: depending on the nature of what you are doing, one of the things that i like about using classes is the ability to group functionality under a larger structure, the class. Instead of having a series of disconnected functions, i can instead write them as class methods. another feature that is a basic feature of oop stuff is the idea of inheritence. So you can have a base class (CAR) that defines behaviour common to all instanaces of that class (var wheels, var door, method car start, method car turn signal on, etc...) Then you can subclass the CAR class to define specific behaviour for a particular car model (SPORTSCAR - var turbo, method car turbo on, etc..). again, depending on what you are doing, this can be very beneficial. I suggest you start small and also take a look at other people's code. You will find alot of classes out there that make alot of sense and can give you ideas of new ways of doing things.... Jeff > I've been using PHP for over a year now and have been successfully > running three different websites developed with PHP, but I've never > done anything with classes or objects. Even when returning data from a > mySQL database, I use mysql_fetch_array() instead of > mysql_fetch_object(). > > What am I missing by not using objects and classes, other than > reusability? What are the real benefits to using OOPs in PHP? > >
Hi, Just wondering if anyone knows of any links to information relating to PHP vs JSP where PHP is my language of choice and another developer is recommending JSP but I know nothing about JSP to help me convince the buyer that PHP is a better choice. A question that was raised is that PHP cannot be integrated with C++ for large functions etc. My response was that I haven`t found a function that PHP cannot handle therefor integration was not a requirement Anyone else have any valid upside or downsides to the languages which could help Thanks Ade
[EMAIL PROTECTED] wrote: > > Hi, > > Just wondering if anyone knows of any links to information relating to PHP vs > JSP where PHP is my language of choice and another developer is recommending > JSP but I know nothing about JSP to help me convince the buyer that PHP is a > better choice. > ... Here's something: http://php.weblogs.com/jsp Maybe it helps a little. :) -- Pavel a.k.a. Papi
The general php mailing list discusses this every so often, here are a few threads : http://marc.theaimsgroup.com/?l=php-general&m=97948720824237&w=2 http://marc.theaimsgroup.com/?l=php-general&m=97621741324759&w=2 http://marc.theaimsgroup.com/?l=php-general&m=97413389003820&w=2 Can find more here : http://marc.theaimsgroup.com/?l=php-general&r=1&w=2&q=b&s=jsp Regards, Philip Olson http://www.cornado.com/ On Tue, 13 Feb 2001 [EMAIL PROTECTED] wrote: > Hi, > > Just wondering if anyone knows of any links to information relating to PHP vs > JSP where PHP is my language of choice and another developer is recommending > JSP but I know nothing about JSP to help me convince the buyer that PHP is a > better choice. > > A question that was raised is that PHP cannot be integrated with C++ for > large functions etc. > > My response was that I haven`t found a function that PHP cannot handle > therefor integration was not a requirement > > Anyone else have any valid upside or downsides to the languages which could > help > > Thanks > Ade > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hello, I have php 4.0.3pl1. I am trying to install phorum (phorum.org). In a php file (index.php in admin) there is the function include for a file (common.php), I get the following error. Warning: Failed opening 'common.php' for inclusion (include_path='/usr/share/php') in /home/web/vacagorda/jeans/htdocs/foro/administration/index.php on line 28 Why I can't include that file without putting it in the /usr/shar/php diretory? Thank you Fabian Fabela [EMAIL PROTECTED] "La información transmitida en el presente mensaje tiene la intención de estar dirigida únicamente a la persona o entidad que se refiere y puede contener información privilegiada y/o confidencial. Cualquier, revisión, retransmisión, diseminación o cualquier uso impropio o relacionado con dicha información por persona alguna distinta a la que fue dirigido este mensaje queda estrictamente prohibido. Si Usted ha recibido este mensaje o sus anexos por error, favor de contactar al remitente y elimine el material de cualquier computadora." "The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer."
Well The file is not in the same dir, but the php file that is calling it is using the chdir function to go to that dir, even if I put the file in the same dir I can't include it. Thank you. Fabian Fabela [EMAIL PROTECTED] www.vacagorda.com ----- Original Message ----- From: "Fabian Fabela" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 11:38 AM Subject: [PHP] Include Hello, I have php 4.0.3pl1. I am trying to install phorum (phorum.org). In a php file (index.php in admin) there is the function include for a file (common.php), I get the following error. Warning: Failed opening 'common.php' for inclusion (include_path='/usr/share/php') in /home/web/vacagorda/jeans/htdocs/foro/administration/index.php on line 28 Why I can't include that file without putting it in the /usr/shar/php diretory? Thank you Fabian Fabela [EMAIL PROTECTED]
Is there a way to return the results of a query straight into an array?
You can use mysql_fetch_array() for each row returned in the cursor. Sorin Ifrim ----- Original Message ----- From: Karl J. Stubsjoen <[EMAIL PROTECTED]> To: PHP Mailing List <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 7:32 PM Subject: [PHP] Return ODBC Results to an array > Is there a way to return the results of a query straight into an array? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
For ODBC, the function is odbc_fetch_into(). Sorin Ifrim ----- Original Message ----- From: Karl J. Stubsjoen <[EMAIL PROTECTED]> To: PHP Mailing List <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 7:32 PM Subject: [PHP] Return ODBC Results to an array > Is there a way to return the results of a query straight into an array? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Karl, http://www.php.net/manual/en/function.odbc-fetch-into.php Best regards, Andrew -------------------------------------- Andrew Hill - OpenLink Software Director Technology Evangelism eBusiness Infrastructure Technology http://www.openlinksw.com > -----Original Message----- > From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 13, 2001 12:33 PM > To: PHP Mailing List > Subject: [PHP] Return ODBC Results to an array > > > Is there a way to return the results of a query straight into an array? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
I'm having a problemin Netscape, any of my echo statements that use $PHPSELF, netscape isn't resolving $PHPSELF, but properly resolving all the other vars. There are several different types of echo statements, but here is a sample: echo '<BR><A HREF="', $PHPSELF, '?mode=sub_category&category=', $category, '&sub_category=', urlencode($subcategories[$index]), '">', $subcategories[$index], '</A>'; and: echo "<P CLASS=Normal><A HREF=$PHPSELF?mode=index&category=root>Main</A> -> $category</P>"; Any ideas? This works FINE in Internet Explorer. And all the other vars in those echo statements are properly resoved into value. - John Vanderbeck - Admin, GameDesign
Is the script in the root? I seem to remember reading about problems with this and Netscape (although that sounds so strange I'm doubting myself here :-) Try shoving it in a subdirectory and see what happens. It's got to be worth 30 seconds to find out - I'd do it right now only I don't have Netscape at work.... HTH Jon -----Original Message----- From: John Vanderbeck [mailto:[EMAIL PROTECTED]] Sent: 13 February 2001 17:42 To: [EMAIL PROTECTED] Subject: [PHP] Netscape not resolving $PHPSELF ?? I'm having a problemin Netscape, any of my echo statements that use $PHPSELF, netscape isn't resolving $PHPSELF, but properly resolving all the other vars. There are several different types of echo statements, but here is a sample: echo '<BR><A HREF="', $PHPSELF, '?mode=sub_category&category=', $category, '&sub_category=', urlencode($subcategories[$index]), '">', $subcategories[$index], '</A>'; and: echo "<P CLASS=Normal><A HREF=$PHPSELF?mode=index&category=root>Main</A> -> $category</P>"; Any ideas? This works FINE in Internet Explorer. And all the other vars in those echo statements are properly resoved into value. - John Vanderbeck - Admin, GameDesign -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
John Vanderbeck wrote: > > I'm having a problemin Netscape, any of my echo statements that use > $PHPSELF, netscape isn't resolving $PHPSELF, but properly resolving all the > other vars. There are several different types of echo statements, but here > is a sample: > > echo '<BR><A HREF="', $PHPSELF, '?mode=sub_category&category=', > $category, '&sub_category=', urlencode($subcategories[$index]), '">', > $subcategories[$index], '</A>'; > > and: > > echo "<P CLASS=Normal><A > HREF=$PHPSELF?mode=index&category=root>Main</A> -> $category</P>"; > > Any ideas? This works FINE in Internet Explorer. And all the other vars in > those echo statements are properly resoved into value. > Try $PHP_SELF. -- Pavel a.k.a. Papi
Well, yes the script was in the root (root of the URL not root of the server). I threw it into a subdirectory, but no go. Same problem. Very strange. - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "Jon Haworth" <[EMAIL PROTECTED]> To: "'John Vanderbeck'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 12:46 PM Subject: RE: [PHP] Netscape not resolving $PHPSELF ?? > Is the script in the root? I seem to remember reading about problems with > this and Netscape (although that sounds so strange I'm doubting myself here > :-) > > Try shoving it in a subdirectory and see what happens. It's got to be worth > 30 seconds to find out - I'd do it right now only I don't have Netscape at > work.... > > HTH > Jon > > > > -----Original Message----- > From: John Vanderbeck [mailto:[EMAIL PROTECTED]] > Sent: 13 February 2001 17:42 > To: [EMAIL PROTECTED] > Subject: [PHP] Netscape not resolving $PHPSELF ?? > > > I'm having a problemin Netscape, any of my echo statements that use > $PHPSELF, netscape isn't resolving $PHPSELF, but properly resolving all the > other vars. There are several different types of echo statements, but here > is a sample: > > echo '<BR><A HREF="', $PHPSELF, '?mode=sub_category&category=', > $category, '&sub_category=', urlencode($subcategories[$index]), '">', > $subcategories[$index], '</A>'; > > and: > > echo "<P CLASS=Normal><A > HREF=$PHPSELF?mode=index&category=root>Main</A> -> $category</P>"; > > > Any ideas? This works FINE in Internet Explorer. And all the other vars in > those echo statements are properly resoved into value. > > - John Vanderbeck > - Admin, GameDesign > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
----- Original Message ----- From: "Pavel Jartsev" <[EMAIL PROTECTED]> To: "John Vanderbeck" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, February 13, 2001 12:49 PM Subject: Re: [PHP] Netscape not resolving $PHPSELF ?? > > Try $PHP_SELF. > > -- > Pavel a.k.a. Papi > Thanks that fixed it. I didn't realize there were two version of this variable. Why? Hmm, strange that the other one worked fine with IE but not Netscape. I thought all thi was done server side, so what the heck does the browser have to do with it? - John Vanderbeck - Admin, GameDesign > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
> Thanks that fixed it. I didn't realize there were two version of this > variable. Why? Hmm, strange that the other one worked fine with IE but not > Netscape. I thought all thi was done server side, so what the heck does the > browser have to do with it? As far as I know, $PHP_SELF is the variable and NOT $PHPSELF. It works in IE because if no page is printed in the tag, it just reloads the same page anyway. If you look at your html source while using $PHPSELF, you will probably see something like this: <a href=>This is the link</a> Netscape realizes this is invalid html and complains, IE simply reloads the current page. -- Jason Stechschulte [EMAIL PROTECTED] -- But you have to allow a little for the desire to evangelize when you think you have good news. -- Larry Wall in <[EMAIL PROTECTED]>
> > Thanks that fixed it. I didn't realize there were two version of this > > variable. Why? Hmm, strange that the other one worked fine with IE but not > > Netscape. I thought all thi was done server side, so what the heck does the > > browser have to do with it? > > As far as I know, $PHP_SELF is the variable and NOT $PHPSELF. It works > in IE because if no page is printed in the tag, it just reloads the same > page anyway. If you look at your html source while using $PHPSELF, you > will probably see something like this: > > <a href=>This is the link</a> > > Netscape realizes this is invalid html and complains, IE simply reloads > the current page. > No, that can't be it, because it actually gets resolved....I have echo'd it out to the screen to verify, and it DOES get resolved in IE. - John Vanderbeck - Admin, GameDesign > -- > Jason Stechschulte > [EMAIL PROTECTED] > -- > But you have to allow a little for the desire to evangelize when you > think you have good news. > -- Larry Wall in <[EMAIL PROTECTED]> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
I am trying to avoid some concurrency problems by using locking tables in mysql. Problem is, I already locked the tables and still had a concurrency problem. Our first guess is that since we are accesing the table with the same user, then when it ignores the log since it is the same user. But this cant be the way it works. I imagine its per process, not per user. But then, we are using persistent connections. Does this influence table locking ?? any ideas or thoughts on this are greatly appreciated... I know I am missing something here.
Can anyone think of any downside to this idea? Set Apache to run as user/group "www:www" Set ownership of PHP files and folders to "www:www" And set permissions to 700 So that ONLY Apache can read them. Now - even if I give someone shell access to my box, or someone finds my personal login password, they still can't read my PHP passwords to MySQL. (Of course I'd have to be user "www" when uploading changes/files to the website.) Any other paranoid people tried this? Any downside to it?
On Tue, 13 Feb 2001, Derek Sivers wrote: > Can anyone think of any downside to this idea? > > Set Apache to run as user/group "www:www" > > Set ownership of PHP files and folders to "www:www" > And set permissions to 700 > So that ONLY Apache can read them. > > Now - even if I give someone shell access to my box, or someone finds my > personal login password, they still can't read my PHP passwords to MySQL. > > (Of course I'd have to be user "www" when uploading changes/files to the > website.) > > Any other paranoid people tried this? > Any downside to it? Yeah ... I can create a .php script to read anything that is www owned, and then just run that using a webbrowser... It'll have www permissions just like your programs do. Unfortunatly in a multi-user, php-module mode enviroment, making .php files secured from other users on the box is a near impossibility. Your best bet is to run php as a CGI program and use Apache's suExec functionality. This way you can keep all your php files under your login id's ownership. --Steve
Would people like to list bad practices and also point us newbies to any articles online dealing with syntax, correct use of single and double quotes etc.? I would like to get a good handle on these issues right from the beginning. As a Web designer I like to use standard HTML and do everything correctly even if the browser is forgiving. I notice that a LOT of programmers write bad HTML and I would imagine many of the publicly available PHP scripts aren't exactly kosher either. What are some of the most objectionable things you see? Thanks. Jeff Oien
Three good articles by the author of PHP Developer's Cookbook. Top 21 PHP progamming mistakes By Sterling Hughes http://zend.com/zend/art/mistake.php http://zend.com/zend/art/mistake1.php http://zend.com/zend/art/mistake2.php -Ben Munoz -----Original Message----- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 10:11 AM To: PHP Subject: [PHP] Bad Practices Would people like to list bad practices and also point us newbies to any articles online dealing with syntax, correct use of single and double quotes etc.? I would like to get a good handle on these issues right from the beginning. As a Web designer I like to use standard HTML and do everything correctly even if the browser is forgiving. I notice that a LOT of programmers write bad HTML and I would imagine many of the publicly available PHP scripts aren't exactly kosher either. What are some of the most objectionable things you see? Thanks. Jeff Oien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Be sure to check this out : Using Strings : --------------------------------------------------- http://www.zend.com/zend/tut/using-strings.php Don't put large blocks of HTML within echo or print, don't be afraid to escape out of PHP for that. Also, check out this three part series, here's the first : Top 21 PHP progamming mistakes - Part 1 of 3 : --------------------------------------------------- http://zend.com/zend/art/mistake.php They're very useful. Also, regarding SQL, don't do "SELECT * ..." all the time as it's overkill if not all fields are being used. Regards, Philip Olson http://www.cornado.com/ On Tue, 13 Feb 2001, Jeff Oien wrote: > Would people like to list bad practices and also point us > newbies to any articles online dealing with syntax, correct > use of single and double quotes etc.? > > I would like to get a good handle on these issues right > from the beginning. As a Web designer I like to use > standard HTML and do everything correctly even if the > browser is forgiving. I notice that a LOT of programmers > write bad HTML and I would imagine many of the publicly > available PHP scripts aren't exactly kosher either. What are > some of the most objectionable things you see? Thanks. > Jeff Oien > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hello, I am trying to locate the php executable on my server. Is there an easy way to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
Hi Brandon, @ 1:36:32 PM on 2/13/2001, [EMAIL PROTECTED] wrote: > I am trying to locate the php executable on my server. Is there an > easy way to do this? Linux, I assume? shell> su shell> updatedb shell> locate php | grep bin May find it. -Brian
Thankyou Boaz, I'm sorry, I just needed help. I didn't care if I had to pay or got free assistance. I also realize that paying for Open Source software help may not be etiquette either. Please forgive me I'll post this in the places Boaz Yahav wrote: > > Hi > > A good place to put this would be either in the projects area > of weberdev (http://www.weberdev.com/index.php3?GoTo=jobmatching/about.php3) > > or the jobs area (http://www.weberjob.com). > > Sincerely > > berber > > Visit http://www.weberdev.com Today!!! > To see where PHP might take you tomorrow. > > > -----Original Message----- > From: rbradley [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 13, 2001 3:43 AM > To: PHP > Subject: [PHP] Pay for help > > My company is willing to pay for some assistance in helping us install: > > PHP apache mod with oracle 8i functions on a Solaris 8 box. > > Are there any takers? > > -- > Richard Bradley > CTO YourLink, inc. > (321) 452-6699 > IM lagoonr > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Richard Bradley CTO YourLink, inc. (321) 452-6699 IM lagoonr
Anyone know of any project in the works right now that is a HelpDesk and Knowledgebase combined? Thanks..
Hello Ashwin, > Anyone know of any project in the works right now that is a HelpDesk and > Knowledgebase combined? The groupware PHProjekt ( www.PHProjekt.de/en ) has a request tracker (same as help desk) and the searchable knowledge base is basically the sum of all solved request with the status 'open to public'. Open source, requires PHP4 and MySQL. greetings Albrecht
Hi Anybody got an idea? I am sitting behind a proxy and I want to able to parse an XML. So I have to use fsockopen() to get through my firewall and get the page. So far, everything goes wel, but I am not able to parse the file, because I think it is not in XML format if I use "GET http://.... " Does anyone has an idea how I can solve this? My code so far (bits and pieces of anywhere :) ) Steve <?php ######################################################### # Parse XML through Proxy # ######################################################### // Define Variables # Proxy Settings $proxy_ip="proxy.server.be"; $proxy_port=8080; # XML Mapping $map_array = array( "NASDAQAMEX-DOT-COM" => "HEADER_TAG", "ISSUE-NAME" => "STOCK_NAME", "LAST-SALE-PRICE" => "LAST_SALE", "PREVIOUS-CLOSE-PRICE" => "PREVIOUS_SALE", "NET-CHANGE-PRICE" => "CHANGE", "NET-CHANGE-PCT" => "CHANGE_PCT", "TODAYS-HIGH-PRICE" => "TODAYS_HIGH", "TODAYS-LOW-PRICE" => "TODAYS_LOW", ); # XML File to Parse $xmlFile_Location="http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&sy mbol=NETA"; // Functions # StartElement Of Parser function startElement($parser, $name, $attrs=''){ global $map_array, $temp, $current_tag; $current_tag = $name; if ($format = $map_array[$name]){ switch($name){ case 'NASDAQAMEX-DOT-COM': //echo $HTTP_GET_VARS['ticker']; break; default: break; } } } # EndElement Of Parser function endElement($parser, $name, $attrs=''){ global $map_array, $temp, $current_tag; if ($format = $map_array[$name]){ switch($name){ case 'NASDAQAMEX-DOT-COM': return_page($temp); $temp = ''; break; default: break; } } } # Process the Data between XML-Tags function characterData($parser, $data){ global $current_tag, $temp, $catID; switch($current_tag){ case 'ISSUE-NAME': $temp['STOCK_NAME'] = $data; $current_tag = ''; break; case 'LAST-SALE-PRICE': $temp['LAST_SALE'] = $data; $current_tag = ''; break; default: break; } } # Create the XML Parser and set options $type="UTF-8"; $xml_parser = xml_parser_create($type); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($xml_parser, 'startElement','endElement'); xml_set_character_data_handler($xml_parser, 'characterData'); /* Open a connection through Proxy with Nasdaq and start parsing */ $sockPointer = fsockopen($proxy_ip,$proxy_port, $errNo, $errStr,30); //Connect to Proxy if( !$sockPointer ){ echo "$errStr Proxy not Available \n\n"; exit(); } else{ fputs($sockPointer,"GET $xmlFile_Location/ <?xml version=\"1.0\" ?>\n\n"); while (!feof($sockPointer)){ $Data = fgets($sockPointer, 100000); $tag= "<?xml version=\"1.0\" ?>\n\n"; if( eregi("xml version",$Data) ){ $Parse=1; } if($Parse==1){ if (!($Data = utf8_encode($Data))){ echo 'ERROR'."\n"; } if (!xml_parse($xml_parser, $Data, feof($sockPointer))){ die(sprintf( "XML error: %s at line %d\n\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } } fclose($sockPointer); } xml_parser_free($xml_parser); ?>
Hello- I'm trying to install PHP 4.0.4pl1 with support for CDB. I've installed CDB 0.75 and used makelib to create a libcdb.a that includes all the *.a's that cdb 0.75 has (alloc.a, buffer.a, byte.a, cdb.a & unix.a), but I've had no luck. Everytime I run compile, I get this error message: configure: error: cannot find necessary library I tried searching the list archives to see if anybody had a solution for this, but no luck. I even tried grabbing cdb 0.55, which somebody said worked, but still no luck. I would appreciate any help anybody could give me. Thanks, Ben Schumacher
I'm wondering if I should organize the functions for my project into a single large file and have only one include/require, or break the code out into separate function library files and use a number of includes/requires. With a single large function library I'm guessing PHP would parse this every time a page is called. So I could loose some overhead by separating my database functions into one file, my administration functions into another, my presentation functions into another, etc... then only including the function pages necessary - likely cutting the amount of code being parsed in half for any given page. But then I begin wondering about the speed of making a require() to each of these files. maybe three to five requires per page. Lastly, what about caching or compiling the function libraries so they're not being parsed each time? Any advice on this? - - - - - - - - - - - WARNING: Some experts believe that use of any keyboard may cause serious injury. Consult Users Guide. [EMAIL PROTECTED]
I know you can replace A or B or C with D but can you replace A with B and C with D exclusively with one call to ereg_replace or does this need to be done seperately? -Brian
Hi All, I am writing a catalog and shopping cart. Our clients want a image on the page for the product. The page is a template generated on the fly. I could put the images in the db and call it from there, but I don't like doing that. Is there another way to put the pic on the page? TIA Gary
Gary, Put the path to the pic in the database, and the pic in the filesystem. Ususally much faster, unless you have a very large number of pics in a folder. regards, andrew > -----Original Message----- > From: Gary [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 13, 2001 3:25 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Image in a Template > > > Hi All, > I am writing a catalog and shopping cart. Our clients want a image on > the page for the product. The page is a template generated on the fly. I > could put the images in the db and call it from there, but I don't like > doing that. Is there another way to put the pic on the page? > > TIA > Gary > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
In my humble opinion, I would place the actual images in your web directory and put the file names into the database so build your image tags. Sure the db can store the actual image data, but I really believe that the filesystem is the better medium for the raw files. Name the image relating to the product ID to keep the many files organized and unique. My two cents. > -----Original Message----- > From: Gary [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 13, 2001 3:25 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Image in a Template > > > Hi All, > I am writing a catalog and shopping cart. Our clients want a image on > the page for the product. The page is a template generated on the fly. I > could put the images in the db and call it from there, but I don't like > doing that. Is there another way to put the pic on the page? > > TIA > Gary > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hi, I'm trying to uses PGP with PHP and Apahce. I have Apache and PHP configured but am finding it difficult to find any information on how to use PGP with them! Any help would be much apreciated! Thanks, Kevin.
Can PHP direct the output to a file eg send the HTTP_USER_AGENT information to a file ?? Barry