php-general Digest 14 Feb 2001 20:53:16 -0000 Issue 512 Topics (messages 39601 through 39739): Re: OOP in web development 39601 by: Nold, Mark 39603 by: Tim Ward 39606 by: Phil Driscoll 39701 by: Mark Maggelet Re: SOAP 39602 by: Bogdan Morar Re: Image in a Template 39604 by: Ankur Verma 39733 by: Gary Re: ereg_replace 39605 by: Robin Vickery 39619 by: Brian V Bonini Oracle Web & Php 39607 by: kaab kaoutar 39668 by: Christian Reiniger 39678 by: kaab kaoutar 39721 by: Adi Wibowo charactersets 39608 by: Dominick Vansevenant Re: could anyone please help me with this date coding? 39609 by: Tim Ward apache & php 39610 by: ited.mac.com download prompt not woking on macintosh 39611 by: Sebastian Stadtlich pro's and con's of storing images 39612 by: Adrian Murphy 39634 by: Thomas Deliduka Re: re:linebreak 39613 by: Jens Nedal Re: Bad Practices 39614 by: Sebastian Stadtlich 39615 by: Yasuo Ohgaki 39642 by: Krznaric Michael 39684 by: Michael McGlothlin Re: mysql_error() not really helping 39616 by: Christian Dechery Re: PHP Editors 39617 by: Matt DeLong 39686 by: thor 39691 by: Michael McGlothlin 39693 by: Andrew 39694 by: John Vanderbeck Re: Installation on win32 39618 by: Matt Williams 39704 by: Sean Kennedy Uploading files on Win98 SE 39620 by: Ulrich Hacke Re: Apache not starting after adding php via mod_so. 39621 by: Sieger, Roland adding lib files... 39622 by: Julia A . Case 39630 by: Rasmus Lerdorf PHP globals aren't really globals 39623 by: Christian Dechery 39625 by: Thierry Coopman 39627 by: Boget, Chris 39629 by: Christian Dechery 39631 by: Boget, Chris 39633 by: Rasmus Lerdorf 39635 by: John Vanderbeck 39638 by: Rog 39640 by: John Vanderbeck 39641 by: Christian Dechery 39646 by: John Monfort 39650 by: Rasmus Lerdorf 39697 by: Michael McGlothlin PHP and PGP 39624 by: Kevin Connolly fsockopen timeout not working 39626 by: Plamen Slavov $PHP_SELF in Netscape PART 2 39628 by: John Vanderbeck 39632 by: Rog 39637 by: John Vanderbeck 39644 by: Chris Lee 39652 by: John Vanderbeck 39657 by: John Vanderbeck 39661 by: Charlie Llewellin Help Work with files 39636 by: Karl J. Stubsjoen 39639 by: Brian V Bonini Link Exchange Robot 39643 by: Ben Ocean 39660 by: Michael Kimsal HTTP Authentication not getting unset 39645 by: Toby Miller 39656 by: Toby Miller 39665 by: Chris Lee 39718 by: Toby Miller 39719 by: Martin A. Marques 39720 by: Martin A. Marques 39723 by: Martin A. Marques date maniplations 39647 by: Don 39648 by: Boget, Chris need better solution 39649 by: Christian Dechery 39651 by: Chris Lee 39659 by: Michael Kimsal 39689 by: Christian Dechery 39713 by: Christian Reiniger Why??? 39653 by: Nguyen, David M 39654 by: Boget, Chris 39655 by: John Vanderbeck 39662 by: Philip Olson 39663 by: Nguyen, David M Re: PHP vs JSP 39658 by: Michael Kimsal @ Scope 39664 by: Karl J. Stubsjoen 39672 by: Web master 39709 by: Christian Reiniger Closing Databases 39666 by: Karl J. Stubsjoen 39669 by: Andrew Hill XML parsing without the PHP4 XML functions 39667 by: Stefen Lars 39674 by: Chris Lee Newbie file upload problem 39670 by: Tom Beidler Qoute problem 39671 by: Tanya Brethour 39677 by: Web master 39700 by: Tanya Brethour 39711 by: Christian Reiniger Undocumented Socket functions? 39673 by: Rog Is this "typecast" safe? 39675 by: John Vanderbeck 39687 by: Chris Lee <intput type=\"file\" ..... 39676 by: Brandon Orther 39680 by: Phil Driscoll 39681 by: Jon Haworth 39712 by: Christian Reiniger mysql int_val? 39679 by: bill freelance developer available - perl/php/mysql/c++/linux 39682 by: jeff saenz currency converter class 39683 by: Adrian Murphy foreach OCIBindByName() 39685 by: Butler, Shaun 39692 by: Thies C. Arntzen 39715 by: Butler, Shaun mcrypt! 39688 by: Kevin Connolly 39731 by: Alexander Wagner Database Connectivity Problems (Phorum) 39690 by: Fang Li require('asdf') 39695 by: Brandon Orther 39705 by: Chris Lee how do I do file maintenance with PHP? 39696 by: Kenneth R Zink II PDF Functions 39698 by: Mike Tuller 39706 by: Chris Lee 39732 by: Chris Carbaugh Re: Access my script 39699 by: Barry Fawthrop Passing vars 39702 by: Tanya Brethour ereg problem 39703 by: Janet Valade 39714 by: CC Zona 39722 by: Charlie Llewellin 39726 by: CC Zona 39728 by: Janet Valade File Upload equiv. with Java/JSP 39707 by: jason cox 39710 by: Michael Stearne uploading... 39708 by: Miguel Loureiro Upload moves the file doesn't copy it.. 39716 by: Dhaval Desai 39717 by: Boget, Chris concatenating strings and \n's for mail... 39724 by: Larry Rosenman 39725 by: Christian Cresante 39727 by: Larry Rosenman 39730 by: Larry Rosenman Re: parse speed vs require speed 39729 by: Michael McGlothlin Structuring large PHP programs 39734 by: John McCreesh gettimeofday() question 39735 by: John Vanderbeck Paging results 39736 by: Randy Johnson converting a web page 39737 by: Cybercandy Ltd Environment Variables ??? 39738 by: Barry Fawthrop Re: [PHP-DB] Passing vars 39739 by: Maureen 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] ----------------------------------------------------------------------
---------------------------------------------------------------------------- ----------------- Disclaimer: The information contained in this email is intended only for the use of the person(s) to whom it is addressed and may be confidential or contain legally privileged information. If you are not the intended recipient you are hereby notified that any perusal, use, distribution, copying or disclosure is strictly prohibited. If you have received this email in error please immediately advise us by return email at [EMAIL PROTECTED] and delete the email document without making a copy. ---------------------------------------------------------------------------- ----------------- I have to agree that OOP is much better in abstracting than user defined functions... why? To return some data and display in a HTML table it i do: $db = new DB; $db->query("SELECT foo from bar"); $t = new Table; echo $t->create($db->data); Pretty easy. Now i could have all these have be functions $data = query($connection_details,"SELECT foo from bar"); echo create_table($data); But.... What if i wanted a special connection specified as myDB that was consistant through out my site? Or what if my table creation function has over 30 different options setable (colours, fonts, spacing by cells, columns, rows and table)? This becomes difficult with pure functions as you end up with echo create_table($data,"nowrap","black",null,"white",null,null,null,"Tahoma",12, null,null,null,array(array("bold"))); instead of $t = new Table; $t->options = "nowrap"; $t->heading["bgcolor"] = "black"; $t->heading["fontcolor"] = "white"; $t->global["font"] = "tahoma"; $t->global["fontsize"] = 12; $t->column["total"]["format"] = "bold"; echo $t->create($db->data); // Create another table with similiar properties, but different data echo $t->create($mydb->data); What if wanted to make my table definition reusable (you would have to make sure all these class's are included like your functions) class myTable extends Table { var $options = "nowrap"; var $heading["bgcolor"] = "black"; var $heading["fontcolor"] = "white"; var $global["font"] = "tahoma"; var $global["fontsize"] = 12; var $column["total"]["format"] = "bold"; } Then from then on you could just call $t = new myTable; echo $t->create($db->data); Now if change my definition of what a myTable should look like i change it once, not in everyfile as you might with functions. (You could however define a new function called create_myTable that does something similiar). The last benefit is that with phpdoc and similiar tools class's can be autodocumented which is very nice. Readability, maintainability and reusability are much higher with OOP. Mark Nold [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> Senior Consultant Change is inevitable, except from vending machines. -----Original Message----- From: Jeff Warrington [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 14, 2001 4:42 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] OOP in web development 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? > >
oop should be used when you want to create things to manipulate in your program that are of a consistent structure. A simple example I use is for company contact details and addresses. By creating a contact class I can do ... include("path/contact.pc"); $thiscontact = new contact("company_code"); // and then $thiscontact->display(); $thiscontact->save(); $thiscontact->delete(); // etc. the class methods take care of all the mysql data gathering so you don't have to worry about it after you've written the class. If your data structure changes (or even the name of the database or server) just change the class definition. What I wouldn't use classes for is collecting variables together (use associative arrays). Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -----Original Message----- > From: Joe Sheble (Wizaerd) [mailto:[EMAIL PROTECTED]] > Sent: 13 February 2001 16:42 > To: [EMAIL PROTECTED] > Subject: 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? > >
I don't want to start an OOP flame thread here, so I'll shut up after this posting - it's just that nobody is speaking up for not using OOP :) The point needs to be made that code reuse, readability and maintainability do not come from whether or not you choose to use OOP techniques. They come from a combination of careful thought, planning, skill and experience. In almost all cases, whatever you write will be executed by a microprocessor that knows nothing of OOP, but just plods through a sequence of instructions, occasionally shooting off to execute a subroutine or two. What this shows is that whatever fine OOP constructs you devise they can be represented in the plain old procedural world. I'm pretty sure that most of the OOP tricks PHP does are done by pretending that things are objects but really they are arrays, and as you might expect, the procedural way to implement the same functionality is to use arrays! Mark's example comparing: create_table($data,"nowrap","black",null,"white",null,null,null,"Tahoma",12, null,null,null,array(array("bold"))); with: $t = new Table; $t->options = "nowrap"; $t->heading["bgcolor"] = "black"; $t->heading["fontcolor"] = "white"; $t->global["font"] = "tahoma"; $t->global["fontsize"] = 12; $t->column["total"]["format"] = "bold"; could more fairly have used something like: $t=create_table(); $t['options'] = "nowrap"; $t['heading']['bgcolor']= "black"; etc. As you can see, there is hardly any difference at all. My point is really that you can use whatever technique you want, but you can get your code reuse, readability and maintainability from either. As you might have guessed, I favour procedural as I feel that more of the code is visible and in my control. YMMV -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org
On Wed, 14 Feb 2001 19:21:20 +1030, Nold, Mark ([EMAIL PROTECTED]) wrote: >--------------------------------------------------------------------- >------- >----------------- >Disclaimer: The information contained in this email is intended only >for the >use of the person(s) to whom it is addressed and may be confidential >or >contain legally privileged information. If you are not the intended >recipient you are hereby notified that any perusal, use, >distribution, >copying or disclosure is strictly prohibited. If you have received >this >email in error please immediately advise us by return email at >[EMAIL PROTECTED] and delete the email document without >making a >copy. >--------------------------------------------------------------------- >------- >----------------- > >I have to agree that OOP is much better in abstracting than user >defined >functions... why? > >To return some data and display in a HTML table it i do: >$db = new DB; >$db->query("SELECT foo from bar"); > >$t = new Table; >echo $t->create($db->data); > > >Pretty easy. Now i could have all these have be functions > >$data = query($connection_details,"SELECT foo from bar"); >echo create_table($data); > >But.... > >What if i wanted a special connection specified as myDB that was >consistant >through out my site? Or what if my table creation function has over >30 >different options setable (colours, fonts, spacing by cells, >columns, rows >and table)? This becomes difficult with pure functions as you end up >with > > >echo >create_table($data,"nowrap","black",null,"white",null,null,null,"Taho >ma",12, >null,null,null,array(array("bold"))); > >instead of > >$t = new Table; >$t->options = "nowrap"; >$t->heading["bgcolor"] = "black"; >$t->heading["fontcolor"] = "white"; >$t->global["font"] = "tahoma"; >$t->global["fontsize"] = 12; >$t->column["total"]["format"] = "bold"; > >echo $t->create($db->data); you could do something like: $parameters["options"] = "nowrap"; $parameters["heading"]["bgcolor"] = "black"; $parameters["heading"]["fontcolor"] = "white"; $parameters["global"]["font"] = "tahoma"; $parameters["global"]["fontsize"] = 12; $parameters["column"]["total"]["format"] = "bold"; echo create_table($data,$parameters); The difference is a matter of style. >// Create another table with similiar properties, but different data >echo $t->create($mydb->data); > > > >What if wanted to make my table definition reusable (you would have >to make >sure all these class's are included like your functions) > > >class myTable extends Table { > var $options = "nowrap"; > var $heading["bgcolor"] = "black"; > var $heading["fontcolor"] = "white"; > var $global["font"] = "tahoma"; > var $global["fontsize"] = 12; > var $column["total"]["format"] = "bold"; >} > > >Then from then on you could just call > > >$t = new myTable; >echo $t->create($db->data); > >Now if change my definition of what a myTable should look like i >change it >once, not in everyfile as you might with functions. (You could >however >define a new function called create_myTable that does something >similiar). this is nothing you can't do without OOP. >The last benefit is that with phpdoc and similiar tools class's can >be autodocumented which is very nice. Maybe so, I never used it. To me, the main reason to use OOP is when you're dealing with Java or something and native code is dealing with your objects. For instance laying out widgets on a screen might need that your widget extend Widget and have a draw() method. I've never had a situation with php where I thought doing things this way would make things easier. - Mark
Search in: XML-RPC Home Page : http://www.xmlrpc.com/ or http://www.xmlhack.com/list.php?cat=25 Bogdan Morar www.bogmor.com Christopher Cheng wrote: > > Is there any development of SOAP extension to 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]
keep the images in a folder on the file system and link the filename of the picture to the product tuple in the dataabse. I would suggest you use the product ID as the filename for the picture in the folder. that shoudl amke it easier for you to administer. best regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "Gary" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 1:55 AM 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]
That is exactly what I ended up doing. Thanks to all. Gary Ankur Verma wrote: > keep the images in a folder on the file system and link the filename of the > picture to the product tuple in the dataabse. > > I would suggest you use the product ID as the filename for the picture in > the folder. that shoudl amke it easier for you to administer. > > best regards > > Ankur Verma > HCL Technologies > A1CD, Sec -16 > Noida, UP > India > > ----- Original Message ----- > From: "Gary" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 14, 2001 1:55 AM > 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]
>>>>> ""VB" == "Brian V Bonini" <[EMAIL PROTECTED]> writes: > 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? With ereg_replace it must be done seperately, but if you use preg_replace you can pass it a list of replacements. like this: <?php $string = "this is my string."; print $string . "<br>\n"; $string = preg_replace( array( '/my/', '/string/' ), array( 'your', 'bit of text' ), $string ); print $string . "<br>\n"; ?> The output would be: this is my string. this is your bit of text. -- Robin Vickery................................................. BlueCarrots, 14th Floor, 20 Eastbourne Terrace, London, W2 6LE
That's exactly what I want to do.... Thanks! > -----Original Message----- > From: Robin Vickery [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 14, 2001 5:05 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] ereg_replace > > > >>>>> ""VB" == "Brian V Bonini" <[EMAIL PROTECTED]> writes: > > > 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? > > With ereg_replace it must be done seperately, but if you use > preg_replace you can pass it a list of replacements. like this: > > <?php > $string = "this is my string."; > > print $string . "<br>\n"; > > $string = preg_replace( > array( '/my/', '/string/' ), > array( 'your', 'bit of text' ), > $string > ); > > print $string . "<br>\n"; > ?> > > The output would be: > > this is my string. > this is your bit of text. > > > -- > Robin Vickery................................................. > BlueCarrots, 14th Floor, 20 Eastbourne Terrace, London, W2 6LE > > -- > 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! is there a possiblily to use with in an Oracle Web server ? THANKS _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
On Wednesday 14 February 2001 11:44, kaab kaoutar wrote: > is there a possiblily to use with in an Oracle Web server ? RTFM (look at the manual, topic "Oracle functions") -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Even idiots can handle computers, and many do.
Hi! thanks but i'm talking of oracle server! i mean instead of using pws or IIS or apache , may i use php with an oracle server thanks >From: Christian Reiniger <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: [EMAIL PROTECTED] >Subject: Re: [PHP] Oracle Web & Php >Date: Wed, 14 Feb 2001 17:44:40 +0100 > >On Wednesday 14 February 2001 11:44, kaab kaoutar wrote: > > > is there a possiblily to use with in an Oracle Web server ? > >RTFM (look at the manual, topic "Oracle functions") > >-- >Christian Reiniger >LGDC Webmaster (http://sunsite.dk/lgdc/) > >Even idiots can handle computers, and many do. > >-- >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] > _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
On Wed, 14 Feb 2001, kaab kaoutar wrote: > Hi! > thanks but i'm talking of oracle server! i mean instead of using pws or IIS > or apache , may i use php with an oracle server > > thanks Yes, you could access oracle server using PHP without any web server. Just compile it as a CGI (without any kind of web server flag). But it still has the same instruction manual. Try looking at "Oracle Functions" or "Oracle 8 Functions" at PHP manual. Hope it help. Adi Wibowo ------------------------------- * Work matter : [EMAIL PROTECTED] * Private matter : [EMAIL PROTECTED] ------------------------------------------
Hello, I am outputting different french accents on my webpages. They are imported in MySQL and there with a simple select I can see the accents are in good condition: e.g.: Adresse lié à un atlas électronique But when I use PHP to process the label into for example a select box with option fields, I get something like this: e.g.: <option value='Adresse li‚ … un atlas ‚lectronique' >Adresse li‚ … un atlas ‚lectronique</option> I suppose I should change something in MySQl or in the PHP settings, can anyone point me to the setting? Thanks in advance, Dominick
> -----Original Message----- > From: Charles Mulford [mailto:[EMAIL PROTECTED]] > Sent: 13 February 2001 22:56 > To: PHP User Group > Subject: could anyone please help me with this date coding? > > > Hi all! could anybody help me? I am fairly new to PHP and I > inherited these > scripts from someone who doesn't work with me anymore. They > seem to puke on > this portion while running them on win2k, latest php4 and > mysql. On Linux > platform they work as they are supposed to. > thanks in advance! > > Charles Mulford > > ------------------------- > > $max_date = 90; > $ini_date = 0; > echo("\t<OPTION VALUE=\"NULL\"> </OPTION>\n"); > do { > $dis_date = date("D\. M\. d\, Y", strtotime ("+$ini_date day")); > $val_date = date("Y-m-d", strtotime ("+$ini_date day")); > echo("\t<OPTION VALUE=\"'$val_date'\">[$ini_date] this looks wrong, in effect you're outputting value = "'2001-02-14'" try just ... echo("\t<OPTION VALUE=\"$val_date\">[$ini_date] > $dis_date</OPTION>\n"); > } > while (++$ini_date <= $max_date); > > ------------------------- > Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html
help! i want to get started! how do configure Apache to work with PHP? apparently it is not because my browser will not "find" the test files.php. please help me to test it. i am using Mac OS X (pb) so i should follow any Unix procedure ok, i think. thank you.
Hi all I tried to build a script that displays the 'save-file dialog', because the files that should be downloaded are huge 32bit jpeg for printing. the problem is that it works in IE on PC, Netscape on PC and MAC, but not in IE on a MAC. the files are jpeg, IE on Mac either tried to open the files ( which does not work, because they are CYMK), or displayes the filename 'download.php' in the save dialog .... PLEASE HELP!!!! our designers can't be the only persons to use Mac on the world... i tried everycombination of the following headers, but without success... thanks sebastian code : /* header("Content-Type: application/octet-stream"); header("Content-Disposition: inline; filename=\"".basename($download)."\""); set_time_limit(0); readfile($download) or die ("File nicht gefunden oder sonstiger Fehler aufgetreten."); */ header("Content-Type: application/download\n"); header("Content-Disposition: inline; filename=\"$download\""); set_time_limit(0); readfile($download); /* header("Content-Type: application/download\n"); header("Content-Disposition: attachment; filename=\"$download\""); $fn=fopen("$download" , "r"); fpassthru($fn); */ /* header("Content-Type: doesn/matter\r\n"); header("Content-Disposition: filename=$download\r\n\r\n"); header("Content-Transfer-Encoding: binary\r\n"); readfile($download) or die ("File nicht gefunden oder sonstiger Fehler aufgetreten."); */ /* header("Content-Type: doesn/matter\r\n"); header("Content-Disposition: filename=$download"); header("Content-Transfer-Encoding: binary\r\n"); header("Content-Length: ".filesize($download)); readfile($download); */
I'm putting togeather a simple website buider app. i'm allowing users to upload images.I'm wondering whether i should store those images in a database or create dirs for each user.the mysql db has a relatively small capacity but storing them to the db might make it simpler for me. also ftp functions don't work on the server and my damn isp keeps fobbing me off when i ask him to do anything.
On 2/14/01 7:12 AM this was written: > I'm putting togeather a simple website buider app. > i'm allowing users to upload images.I'm wondering whether i should store > those images in a database or create dirs for each user.the mysql db has a > relatively small capacity but storing them to the db might make it simpler > for me. > also ftp functions don't work on the server and my damn isp keeps fobbing me > off when i ask him to do anything. I would make an upload form and put the image on the server. IMHO, but that's only because I've never really worked with BLOB values in mySQL -- Thomas Deliduka IT Manager ------------------------- New Eve Media The Solution To Your Internet Angst http://www.neweve.com/
Hy there everyone on the board 8), just a new listviewer droppign in. In case of displaying \n that are stored in a variable or com from a DB or inptu field you can also use nl2br($var) which automatically converts those linebreaks to <br> and so get displayed correctly. Though that will not work for the tabs. Jens ---------------------------------------------------------------------------- Ostry & Partner http://www.ostry.com Hietzingerhauptstr. 145 1130 Vienna, Austria +43 1 877 74 54-18 on 14.02.2001 6:41 Uhr, Steve Werby at [EMAIL PROTECTED] wrote: > "Deependra B. Tandukar" <[EMAIL PROTECTED]> wrote: >> I did with <br>. "\r\n" too is not giving a new line. > > Actually "\n" does create a newline. If you view the source code of the web > page from the browser you'll see that it works. "\n" is not an HTML tag. > It's not designed to create a newline in the HTML output sent to the > browser. As you discovered, the <BR> tag will do that. Hope that is clear. > "\n" is typically used in PHP code so that when one looks at the HTML code > sent to the browser one doesn't have to look at lines of HTML code that > contain hundreds upon hundreds of characters. > > -- > Steve Werby > COO > 24-7 Computer Services, LLC > Tel: 804.817.2470 > http://www.247computing.com/ >
OR you could tell apache to parse everything that ends with .inc with php. you can name it .inc .linux .linuxsucks .microsoftsucks (you'll need to have access to http.conf or .htaccess+right to override ...) sebastian > -----Ursprüngliche Nachricht----- > Von: Rick Hodger [mailto:[EMAIL PROTECTED]] > Gesendet: Mittwoch, 14. Februar 2001 09:51 > An: [EMAIL PROTECTED] > Betreff: Re: [PHP] Bad Practices > > > > "Jeff Oien" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > 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.? > > People who create scripts that include a need for access to a > SQL database, > meaning you need to give it a username and password then > making the damn > configuration file be called something stupid like config.inc. > > When you are scripting, using anything with a .inc extension > is just asking > for trouble. If someone requests that file, it'll get passed > straight to > them. It's a .inc, which means that PHP does not know to > parse it. Which > means, that person can see your usernames and passwords. And > because it's a > public package, they're far more likely to know the path to said file. > > -- > Rick Hodger > > > > -- > 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] >
> "Jeff Oien" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > 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.? > > People who create scripts that include a need for access to a SQL database, > meaning you need to give it a username and password then making the damn > configuration file be called something stupid like config.inc. I think putting PHP configuration files under web document directory is not recommended.For most PHP files, that user never have to see, are better to place outside of web docuemnt directory. However, I prefer to separate PHP code and HTML as much as possible. So I put some files that has non-standard extentions under web document direcutory. You can setup Apache to deny any request for *.inc file, or whatever extention, just like .htaccess. If you want to put *.inc, or whatever, I strongly recommend to deny all the request to those files. > When you are scripting, using anything with a .inc extension is just asking > for trouble. If someone requests that file, it'll get passed straight to > them. It's a .inc, which means that PHP does not know to parse it. Which > means, that person can see your usernames and passwords. And because it's a > public package, they're far more likely to know the path to said file. -- Yasuo Ohgaki
Hi, There certain common issues that arise with many beginners. Take a look at this article http://www.wdvl.com/Authoring/Languages/PHP/Debugging/ . At the end of this article is a check list of a few things to consider when everything doesn't go exactly right. Mike -----Original Message----- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 1:11 PM 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]
Which is why anyone with a clue makes any special extensions they use protected by the web server. Which is why I protect .inc, .cfg, .class, etc. It's also a good idea not to store config-type files in the web tree. Rick Hodger wrote: > "Jeff Oien" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> 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.? > > > People who create scripts that include a need for access to a SQL database, > meaning you need to give it a username and password then making the damn > configuration file be called something stupid like config.inc. > > When you are scripting, using anything with a .inc extension is just asking > for trouble. If someone requests that file, it'll get passed straight to > them. It's a .inc, which means that PHP does not know to parse it. Which > means, that person can see your usernames and passwords. And because it's a > public package, they're far more likely to know the path to said file. > > -- > Rick Hodger > > >
>Christian - > >You need to be checking the return values of the mysql_*() functions. Make >sure you're not calling them with a @mysql_*() as that will disable error >reporting. > >Perhaps you should give us some examples of what's failing and how? > >Also, if the server isn't yours the server admin may have turnd down the >level of error reporting in php so errors never even show up. See >http://www.php.net/manual/en/configuration.php and look at display_errors >and >error_reporting then check your server settings with phpinfo(). the server is local, I'm running it (apache 1.3.12)... I set the error_reporting to the default in php.ini, I even set error_reporting(E_ALL), but all I got were warnings about every thing PHP did, nothing MySQL related... but nevermind, I've already fixed me a function that I call EVERY query I run (altough I find this very annoying) that tells me when there's a sql syntax error... thanks . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br
Also try: http://www.textpad.com/ Thanks, Matt DeLong Studio 77 eBusiness & Wireless Solutions Provider 615.793.2947 www.studio77.com ----- Original Message ----- From: Brandon Orther <[EMAIL PROTECTED]> To: PHP User Group <[EMAIL PROTECTED]> Sent: Thursday, January 18, 2001 11:28 AM Subject: RE: [PHP] PHP Editors > I am not sure what OS you are running but for windows I use PHPED. Check it > out at www.phped.com > > -----Original Message----- > From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 18, 2001 7:03 AM > To: PHP Mailing List > Subject: [PHP] PHP Editors > > > So what editor is recommended? I'm a little familiar with Emacs (kinda > cool, but I'm use to keywords and such being colored - as in Interdev). > > 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] >
Personally, I've tried quite a few, including those mentioned. Somehow I always end up back in HomeSite (actually Cold Fusion Studio, the advanced brother of Homesite). But, if you want a free editor, try scITE available at www.scintilla.org, it's free and available for windows and linux. cheers, Thor. ---------- Original Message ---------------------------------- From: "Matt DeLong" <[EMAIL PROTECTED]> Date: Wed, 14 Feb 2001 07:18:57 -0600 >Also try: >http://www.textpad.com/ > > > >Thanks, > >Matt DeLong >Studio 77 > >eBusiness & Wireless Solutions Provider >615.793.2947 >www.studio77.com > > >----- Original Message ----- >From: Brandon Orther <[EMAIL PROTECTED]> >To: PHP User Group <[EMAIL PROTECTED]> >Sent: Thursday, January 18, 2001 11:28 AM >Subject: RE: [PHP] PHP Editors > > >> I am not sure what OS you are running but for windows I use PHPED. Check >it >> out at www.phped.com >> >> -----Original Message----- >> From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] >> Sent: Thursday, January 18, 2001 7:03 AM >> To: PHP Mailing List >> Subject: [PHP] PHP Editors >> >> >> So what editor is recommended? I'm a little familiar with Emacs (kinda >> cool, but I'm use to keywords and such being colored - as in Interdev). >> >> 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] >> > > >-- >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 write all my code in a normal plain-text editor, whatever is available on whatever OS I'm using - usually Linux. On MacOS I have a handy tool called BEdit (I think) that allows me to do a multiple-file search and replace. The only problem is it's a hassle to move a couple hundred makes of source files back and forth over the network so I'd rather do it on the server itself. Does anyone know of a good tool for doing such a search and replace? If it only works on individual files that is okay as I can always add the multiple-file abilties. I'd like it to be a freely available open source program if possible. I know I can do this sort of thing w/ Perl, and have, but Perl is a less than perfect tool in this case so I'd like something made for the purpose. Thanks. Matt DeLong wrote: > Also try: > http://www.textpad.com/ > > > > Thanks, > > Matt DeLong > Studio 77 > > eBusiness & Wireless Solutions Provider > 615.793.2947 > www.studio77.com > > > ----- Original Message ----- > From: Brandon Orther <[EMAIL PROTECTED]> > To: PHP User Group <[EMAIL PROTECTED]> > Sent: Thursday, January 18, 2001 11:28 AM > Subject: RE: [PHP] PHP Editors > > >> I am not sure what OS you are running but for windows I use PHPED. Check > > it > >> out at www.phped.com >> >> -----Original Message----- >> From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] >> Sent: Thursday, January 18, 2001 7:03 AM >> To: PHP Mailing List >> Subject: [PHP] PHP Editors >> >> >> So what editor is recommended? I'm a little familiar with Emacs (kinda >> cool, but I'm use to keywords and such being colored - as in Interdev). >> >> 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] >>
Actually, I find BBEdit quite nice for PHP - I keep two windows open, one to BBEdit and one to a telnet session on my linux server. The really cool part is I can cut and paste into vi using regular old command-c and command-v, since linux doesn't care about them :) So I drop the changes in, :w to apply, and then pull up a browser on the Mac to check... works great for me! regards, andrew > -----Original Message----- > From: Michael McGlothlin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 14, 2001 12:53 PM > To: Matt DeLong > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] PHP Editors > > > I write all my code in a normal plain-text editor, whatever is available > on whatever OS I'm using - usually Linux. On MacOS I have a handy tool > called BEdit (I think) that allows me to do a multiple-file search and > replace. The only problem is it's a hassle to move a couple hundred > makes of source files back and forth over the network so I'd rather do > it on the server itself. Does anyone know of a good tool for doing such > a search and replace? If it only works on individual files that is okay > as I can always add the multiple-file abilties. I'd like it to be a > freely available open source program if possible. I know I can do this > sort of thing w/ Perl, and have, but Perl is a less than perfect tool in > this case so I'd like something made for the purpose. Thanks. > > Matt DeLong wrote: > > > Also try: > > http://www.textpad.com/ > > > > > > > > Thanks, > > > > Matt DeLong > > Studio 77 > > > > eBusiness & Wireless Solutions Provider > > 615.793.2947 > > www.studio77.com > > > > > > ----- Original Message ----- > > From: Brandon Orther <[EMAIL PROTECTED]> > > To: PHP User Group <[EMAIL PROTECTED]> > > Sent: Thursday, January 18, 2001 11:28 AM > > Subject: RE: [PHP] PHP Editors > > > > > >> I am not sure what OS you are running but for windows I use > PHPED. Check > > > > it > > > >> out at www.phped.com > >> > >> -----Original Message----- > >> From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] > >> Sent: Thursday, January 18, 2001 7:03 AM > >> To: PHP Mailing List > >> Subject: [PHP] PHP Editors > >> > >> > >> So what editor is recommended? I'm a little familiar with Emacs (kinda > >> cool, but I'm use to keywords and such being colored - as in Interdev). > >> > >> 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] > >> > > > > -- > 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 still strongly recommend UltraEdit. It is SO flexible its unbelievable. It also allows you to load from and save to files on an FTP server which saves me , god I can't even measure how much that saves me. - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "Michael McGlothlin" <[EMAIL PROTECTED]> To: "Matt DeLong" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 12:53 PM Subject: Re: [PHP] PHP Editors > I write all my code in a normal plain-text editor, whatever is available > on whatever OS I'm using - usually Linux. On MacOS I have a handy tool > called BEdit (I think) that allows me to do a multiple-file search and > replace. The only problem is it's a hassle to move a couple hundred > makes of source files back and forth over the network so I'd rather do > it on the server itself. Does anyone know of a good tool for doing such > a search and replace? If it only works on individual files that is okay > as I can always add the multiple-file abilties. I'd like it to be a > freely available open source program if possible. I know I can do this > sort of thing w/ Perl, and have, but Perl is a less than perfect tool in > this case so I'd like something made for the purpose. Thanks. > > Matt DeLong wrote: > > > Also try: > > http://www.textpad.com/ > > > > > > > > Thanks, > > > > Matt DeLong > > Studio 77 > > > > eBusiness & Wireless Solutions Provider > > 615.793.2947 > > www.studio77.com > > > > > > ----- Original Message ----- > > From: Brandon Orther <[EMAIL PROTECTED]> > > To: PHP User Group <[EMAIL PROTECTED]> > > Sent: Thursday, January 18, 2001 11:28 AM > > Subject: RE: [PHP] PHP Editors > > > > > >> I am not sure what OS you are running but for windows I use PHPED. Check > > > > it > > > >> out at www.phped.com > >> > >> -----Original Message----- > >> From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] > >> Sent: Thursday, January 18, 2001 7:03 AM > >> To: PHP Mailing List > >> Subject: [PHP] PHP Editors > >> > >> > >> So what editor is recommended? I'm a little familiar with Emacs (kinda > >> cool, but I'm use to keywords and such being colored - as in Interdev). > >> > >> 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] > >> > > > > -- > 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] >
You will also need to add this for the module LoadModule php4_module "c:/php/sapi/php4apache.dll" M@ > -----Original Message----- > From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] > Sent: 14 February 2001 08:02 > To: 'Sean Kennedy'; PHP Mailing List > Subject: RE: [PHP] Installation on win32 > > > add this into your httpd.conf file: > > ############## PHP 4.0.3pl1 #################### > AddType application/x-httpd-php .php .phtml .php3 .html .inc > AddType application/x-httpd-php-source .phps > ############################################ > > Cheers, > Maxim Maletsky > > > > -----Original Message----- > From: Sean Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 14, 2001 4:32 PM > To: PHP Mailing List > Subject: [PHP] Installation on win32 > > > Ok, I am trying to install php4 on a win32 system as a module for > apache. I > have followed all the instructions for both apache and php. Now, when I > load up a page, it is blank, and when I view the source, I see my > php file. > For example... > > <?php > /*index.php*/ > echo ('Hello'); > ?> > > Now, when I load this in my browser, I see this as the source, but nothing > displays on the page. Anybody recognize this? Can anybody point > me in the > right direction? > > Thank you in advance. > > Sean Kennedy > > > -- > 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] >
I have done both of these things, as they are in the instructions. In the installation file, it lists the lines that need to be added to the htttpd.conf file for apache, and these are the lines. Anything else that needs to be done? (BTW, I appreciate the help) > You will also need to add this for the module > > LoadModule php4_module "c:/php/sapi/php4apache.dll" > > > M@ > > > > > > add this into your httpd.conf file: > > > > ############## PHP 4.0.3pl1 #################### > > AddType application/x-httpd-php .php .phtml .php3 .html .inc > > AddType application/x-httpd-php-source .phps > > ############################################ > > > > Cheers, > > Maxim Maletsky > > > > > > > > -----Original Message----- > > From: Sean Kennedy [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, February 14, 2001 4:32 PM > > To: PHP Mailing List > > Subject: [PHP] Installation on win32 > > > > > > Ok, I am trying to install php4 on a win32 system as a module for > > apache. I > > have followed all the instructions for both apache and php. Now, when I > > load up a page, it is blank, and when I view the source, I see my > > php file. > > For example... > > > > <?php > > /*index.php*/ > > echo ('Hello'); > > ?> > > > > Now, when I load this in my browser, I see this as the source, but nothing > > displays on the page. Anybody recognize this? Can anybody point > > me in the > > right direction? > > > > Thank you in advance. > > > > Sean Kennedy > > > > > > -- > > 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] >
Hello, I try to code a script where users can upload files to the server. Whenever I hit the submit button PHP crashes. I run PHP 3.0.17, Apache 1.3 on a Win98 SE machine. My code looks like this: <form action="myscript.php3" method="post" enctype="multipart/form-data"> <input type="file" name="myfile"> <input type="submit" value="Go"> </form> Is this a known problem in the Win32 distribution or has anyone some hints? Best regards, Uli
Hi gurus, this is a somewhat update of the previous mail, never received an answer to the original post. And it might be, that this list is the wrong audience for my real problem. The problem still exists, that apache httpd 1.3.14 is not starting, if the "php" related things are in httpd.conf at start time. However: if i comment the 2 lines, added by make install from php, in httpd.conf , start the server with apachectl start, uncomment those 2 lines and send kill -1 to the first httpd process, everything (even with oci8) works ok. Anybody seen this , please advise. Mit freundlichen Grüßen G.Roland Sieger, CIT Email : [EMAIL PROTECTED] Phone : (49) 89 5110 413 Fax : (49) 89 5110 532 Postanschrift : Süd-Chemie AG Lenbachplatz 6 80333 München > -----Ursprüngliche Nachricht----- > Von: Sieger, Roland > Gesendet: Montag, 12. Februar 2001 21:03 > An: [EMAIL PROTECTED] > Betreff: Apache not starting after adding php via mod_so. > > hello gurus, > > this is the first time, trying to solve a problem with this list. I > checked some of the archives, may be not all. So if that has been an > already asked question, please forgive. I also do not know anything > about the common "behaviour" on this list. > > But anyway : here is the problem: > > compiled apache (1.3.14) on a SuSe Linux - Box .. starts and works > with plain setup. > installed Oracle 8 client. installed php4.0.4.pl1, tested the thing > with plain php. Get the correct results off the oracle DataBase. > > With httdp.conf 2 lines are added from the php make/make install : > > LoadModule php_module libexec/libphp4.so > > and > > AddModule mod_php4.c > > the httpd server is not coming up does not give any log files. So i > assume httpd is dieing before he can get anywhere. > > any clues , every help appreciated. > > > Mit freundlichen Grüßen > > G.Roland Sieger, CIT > > Email : [EMAIL PROTECTED] > Phone : (49) 89 5110 413 > Fax : (49) 89 5110 532 > > Postanschrift : > Süd-Chemie AG > > Lenbachplatz 6 > > 80333 München >
If I have a lib.so file can I just link it in with php and have access to the functionality in lib.so? If not can someone show me the way to adding things to php? Julia (sorry if this is a stupid question) -- [ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]
No, you can't just add random .so libraries directly like that. You will have to write a PHP extension that maps the API implemented by your library to a set of user-callable PHP functions. The ext/ext_skel script gets you on your way towards writing such an extension, but you need to be an experienced C programmer to actually do this. -Rasmus On Wed, 14 Feb 2001, Julia A . Case wrote: > If I have a lib.so file can I just link it in with php and have access to the > functionality in lib.so? If not can someone show me the way to adding things to > php? > > Julia > (sorry if this is a stupid question) > > -- > [ Julia Anne Case ] [ Ships are safe inside the harbor, ] > [Programmer at large] [ but is that what ships are really for. ] > [ Admining Linux ] [ To thine own self be true. ] > [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ] > > > -- > 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've been programming in C all my life, and now I just started developing in PHP and I'm really enjoying it, it has all the missing improvements that C needed to be more user-likely. But one thin I can't get, how can PHP call a variabel global, if it isn't global. A global var, is a var defined outside all functions and it's available to all and altered by all, without having to redefine or call the var again. In PHP, for a var to be global you have to add a 'global $var' inside the function u want to use it. THis is not nice, what about if u have a form with 50 fields and want a function to validate all of them, u have to pass them all to the function or build a little piece of code to make all th $GLOBALS local right? Is this really the idea of global vars? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br
At 11:24 AM -0300 2/14/01, Christian Dechery wrote: >I've been programming in C all my life, and now I just started developing >in PHP and I'm really enjoying it, it has all the missing improvements that >C needed to be more user-likely. > >But one thin I can't get, how can PHP call a variabel global, if it isn't >global. >A global var, is a var defined outside all functions and it's available >to all and altered by all, without having to redefine or call the var again. > >In PHP, for a var to be global you have to add a 'global $var' inside the >function u want to use it. THis is not nice, what about if u have a form >with 50 fields and want a function to validate all of them, u have to pass >them all to the function or build a little piece of code to make all th >$GLOBALS local right? > >Is this really the idea of global vars? > Well having a form with LOTS of fields, it might be advisable to have the fields send an array straigt away have the name of your fields something like <.. name="feedback[name]" ..> and just use global $feedback and the whole array is at your disposition. This doens't change the way global is treated in PHP but might help you in your setup. having these in an array will also greatly make sessions easier, if you have to follow all these fields on multiple pages. -- Thierry Coopman - [EMAIL PROTECTED] My opinions are personal, and have really nothing or nothing to do with Keytrade! He who laughs last probably made a back-up.
> function u want to use it. THis is not nice, what about if u > have a form with 50 fields and want a function to validate > all of them, u have to pass them all to the function or build > a little piece of code to make all the $GLOBALS local right? > Is this really the idea of global vars? Yes. But with regards to form variables, all you need to do is make one variable global: $HTTP_POST_VARS it is an associative array that contains all the post variables from the form. Make it global and just loop through it. Chris
>> function u want to use it. THis is not nice, what about if u >> have a form with 50 fields and want a function to validate >> all of them, u have to pass them all to the function or build >> a little piece of code to make all the $GLOBALS local right? >> Is this really the idea of global vars? > >Yes. But with regards to form variables, all you need to do is >make one variable global: > >$HTTP_POST_VARS > >it is an associative array that contains all the post variables from >the form. Make it global and just loop through it. exactly, u need to loop to an array to get the globals u want. this is not the idea of global, global is global... if it's set outside of ALL functions it should be available 'with no extra code' to ALL functions, it works that way in all programming language I'm familiar with... why not in PHP? that's what I wanna know, why globals in PHP doesn't really work like globals? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br
> >Yes. But with regards to form variables, all you need to do is > >make one variable global: > >$HTTP_POST_VARS > >it is an associative array that contains all the post variables from > >the form. Make it global and just loop through it. > exactly, u need to loop to an array to get the globals u want. No, to the the variables/values that you want. > this is not the idea of global, global is global... if it's set outside > of ALL functions it should be available 'with no extra code' > to ALL functions, it works that way in all programming language > I'm familiar with... why not in PHP? that's what I wanna know, > why globals in PHP doesn't really work like globals? Perhaps I'm missing something. In order to access the value of any variable defined outside the scope of the function, you have to declare it as "global". This is true in every single instance. If you do not, then you cannot access the value of that variable. While it's been a while since I've worked with C, I seem to recall it being the case there as well. And in Pascal. And in VB. Again, it's been a while so I could be wrong (but don't think so). Also, PHP was written in C. Why would they institute a behaviour that was radically different than what is part of the parent language? Chris
> I've been programming in C all my life, and now I just started developing > in PHP and I'm really enjoying it, it has all the missing improvements that > C needed to be more user-likely. > > But one thin I can't get, how can PHP call a variabel global, if it isn't > global. > A global var, is a var defined outside all functions and it's available > to all and altered by all, without having to redefine or call the var again. That may be your definition of a global variable. It isn't mine. The fact that you have some way to access the variable from every scope makes it global by my definition. Also, all global variables are available via $GLOBALS['var_name']. And if you really do have 50 global variables, you should really appreciate this feature as your chances of having local/global variable overlaps which can cause weird bugs is that much higher. I would suggest grouping your variables into logical arrays of information and doing a 'global' on these arrays instead. > In PHP, for a var to be global you have to add a 'global $var' inside the > function u want to use it. THis is not nice, what about if u have a form > with 50 fields and want a function to validate all of them, u have to pass > them all to the function or build a little piece of code to make all th > $GLOBALS local right? If you have a form with 50 fields, name them like this: <input type="text" name="blah[abc]"> <input type="text" name="blah[def]"> <input type="text" name="blah[ghi]"> Then simply make do: global $blah > Is this really the idea of global vars? The idea is to avoid really nasty scope-related bugs that are common in C code that uses lots of global variables. Years and years ago when I wrote the first version of PHP I was working for a telco writing software for a large telephone switch. The code was huge and extremely ugly. Global variables everywhere. The team had been chasing a bug for about a week when I got stubborn and decided it was time to kill the bug. I printed out all the source code and laid it out in a long hallway as I crawled along with different coloured pens and manually traced my way through it as none of the debuggers we had at the time were of any use. After countless hours the bug turned out to be inside a function that silently modified a global variable which affected another piece of code in a completely different part of the program. I swore I would not have the same problem in PHP and thus the requirement for people to be explicit about using global variables inside functions. Hopefully it also forces a little bit of structure and organization on people. -Rasmus
> Perhaps I'm missing something. In order to access the value of any > variable defined outside the scope of the function, you have to declare > it as "global". This is true in every single instance. If you do not, then > you cannot access the value of that variable. While it's been a while > since I've worked with C, I seem to recall it being the case there as > well. And in Pascal. And in VB. Again, it's been a while so I could be > wrong (but don't think so). Not realy. In most languages, heck , all I can think of, the variable's scope is simply dependant on WHERE it was declared, not how it was declared. If in C/C++ you define a variable outside the scope of any function, then it becomes global and can be accessed by any function. I'm not arguing one side or the other, just stating :) I personally find the PHP way a bit annoiying, but its workable, and i'm SURE there was a reason for it. Just not sure what that reason was :) - John Vanderbeck - Admin, GameDesign > > Chris >
Rasmus wrote: >I swore I would not have the same problem in PHP and thus the requirement >for people to be explicit about using global variables inside functions. >Hopefully it also forces a little bit of structure and organization on >people. Hear, hear and thank you Rasmus. It seems to me that the several other ways folks have listed to solve this one example indicates that we don't really need the temporary convenience of wide open globals (temporary as in it doesn't end up very convenient when they create problems). Visit the Gates Motel webgame: http://www.gameslate.com/gatesmotel/
> Rasmus wrote: > >I swore I would not have the same problem in PHP and thus the requirement > >for people to be explicit about using global variables inside functions. > >Hopefully it also forces a little bit of structure and organization on > >people. > > Hear, hear and thank you Rasmus. It seems to me that the several other ways > folks have listed to solve this one example indicates that we don't really > need the temporary convenience of wide open globals (temporary as in it > doesn't end up very convenient when they create problems). I was always tought very simply, don't use globals :) However, that isn't always an option. I have no problems with the way PHP does things. I think its a good idea for the shelter. What I find interesting is that it seems when you are first learning a language, you use more globals, than when you are more experienced with it. When I first started programmig in C, 99% of my variables were global. Look at any of my C/C++ code nowadays, over 10 years later, and you will be hard pressed to find a global. PHP is still new to me, so i'm still trying to use alot of globals. Because of the way PHP handles it, i'm jumping through a few hoops. That is annoying, but I don't consider it a problem, because as I get better, I know I will go back through and rewrite things to not use globals. I guess my confusion is this: I am passing all my variables around between scripts by sending them through the URLs (index.php?mode=index). I guess what "annoys" me, is I would expect those to be available from inside the functions, but they aren't. - John Vanderbeck - Admin, GameDesign > > Visit the Gates Motel webgame: > http://www.gameslate.com/gatesmotel/ > > > -- > 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] > >
>The idea is to avoid really nasty scope-related bugs that are common in >C >code that uses lots of global variables. Years and years ago when I wrote >the first version of PHP I was working for a telco writing software for >a >large telephone switch. The code was huge and extremely ugly. Global >variables everywhere. The team had been chasing a bug for about a week >when I got stubborn and decided it was time to kill the bug. I printed >out all the source code and laid it out in a long hallway as I crawled >along with different coloured pens and manually traced my way through it >as none of the debuggers we had at the time were of any use. After >countless hours the bug turned out to be inside a function that silently >modified a global variable which affected another piece of code in a >completely different part of the program. > >I swore I would not have the same problem in PHP and thus the requirement >for people to be explicit about using global variables inside functions. >Hopefully it also forces a little bit of structure and organization on >people. thanks... now I have an answer I can swallow... cuz I simply didn't get why PHP (which came from C) had a differente behaviour according to globals. I never had any problem handling them, but in the other hand I never had 50 of them in a program. I can understand that making global every single form variable would take a whole lot of control by the compiler... I just came with a nice foreach() to make my globals local, and I have to put them in ALL my functions that handles form vars... I'll consider using arrays in my next forms.... but hey, don't worry... PHP really kicks ASP ass in all matters! :) cya . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br
I believe you use globals $var to ACCESS a global variable, not to define. If I understand correctly, and please correct me if I am wrong, this a way to ge around the name space... ex. for something like $my_var = 10; function test () { $my_var = 15; } because of these variables are in a different name space, they are not the same. If you intended to change the first variable, then you should do something like function test() { globals $my_var; $my_var = 15; } This would change the value of $my_var from 10 to 15. Please correct me, if I'm wrong. __________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+- On Wed, 14 Feb 2001, Christian Dechery wrote: > I've been programming in C all my life, and now I just started developing > in PHP and I'm really enjoying it, it has all the missing improvements that > C needed to be more user-likely. > > But one thin I can't get, how can PHP call a variabel global, if it isn't > global. > A global var, is a var defined outside all functions and it's available > to all and altered by all, without having to redefine or call the var again. > > In PHP, for a var to be global you have to add a 'global $var' inside the > function u want to use it. THis is not nice, what about if u have a form > with 50 fields and want a function to validate all of them, u have to pass > them all to the function or build a little piece of code to make all th > $GLOBALS local right? > > Is this really the idea of global vars? > > > . [ Christian Dechery ] > . Webdeveloper @ Tá Na Mesa! > . Listmaster @ Gaita-L > . http://www.tanamesa.com.br > > > > -- > 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 believe you use globals $var to ACCESS a global variable, not to > define. That's correct. To be perfectly correct here, what you are doing is creating a reference to the global variable. Think of it as an alias to the same variable as the global variable. global $foo; would be equivalent to: $foo = & $GLOBALS['foo']; With the latter giving you the ability to use a different name for the local reference to the globally-scoped variable. -Rasmus
It's somewhat annoying to have to tell the function which variables are global sometimes but overall it makes it easier to avoid stupid mistakes. It is a good push to make me less prone to making things global. Usually I just avoid using globals and then pack what I do use into appropiate arrays and thus save myself most the hassle. In several thousand lines of code I may have one or two global vars called. Boget, Chris wrote: >>> Yes. But with regards to form variables, all you need to do is >>> make one variable global: >>> $HTTP_POST_VARS >>> it is an associative array that contains all the post variables from >>> the form. Make it global and just loop through it. >> >> exactly, u need to loop to an array to get the globals u want. > > > No, to the the variables/values that you want. > >> this is not the idea of global, global is global... if it's set outside >> of ALL functions it should be available 'with no extra code' >> to ALL functions, it works that way in all programming language >> I'm familiar with... why not in PHP? that's what I wanna know, >> why globals in PHP doesn't really work like globals? > > > Perhaps I'm missing something. In order to access the value of any > variable defined outside the scope of the function, you have to declare > it as "global". This is true in every single instance. If you do not, then > you cannot access the value of that variable. While it's been a while > since I've worked with C, I seem to recall it being the case there as > well. And in Pascal. And in VB. Again, it's been a while so I could be > wrong (but don't think so). > Also, PHP was written in C. Why would they institute a behaviour > that was radically different than what is part of the parent language? > > Chris >
Does anyone know anything about using PGP with PHP pages? Any tutorials or examples would be much appreciated!! Thanks, Kev
Hi all, Does someone know why fsockopen timeout does not work? php3 $mydata=fsockopen($machine,$port,&$errno,&$errstr,30); I think that this function should fail after 30 seconds, but it just blocks the script. __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Ok, I made all the changes from $PHPSELF to $PHP_SELF, and i'm further along with Netscape than before. However, it now seems that there are still some statements that $PHP_SELF isn't evaluated in. However, now I can narrow it down to certain statements: WORKS: echo "<P CLASS=Normal><A HREF=$PHP_SELF?mode=index&category=root>Main</A> -> $category</P>"; DOES NOT WORK: echo '<BR><A HREF="', $PHP_SELF, '?mode=sub_category&category=', $category, '&sub_category=', urlencode($subcategories[$index]), '">', $subcategories[$index], '</A>'; - John Vanderbeck - Admin, GameDesign
John Vanderbeck wrote: >DOES NOT WORK: >echo '<BR><A HREF="', $PHP_SELF, '?mode=sub_category&category=', >$category, '&sub_category=', urlencode($subcategories[$index]), '">', >$subcategories[$index], '</A>'; You are using commas instead of periods, use ".$PHP_SELF." instead of ",$PHP_SELF," (and for the other instances as well). Visit the Gates Motel webgame: http://www.gameslate.com/gatesmotel/
> You are using commas instead of periods, use ".$PHP_SELF." instead of > ",$PHP_SELF," (and for the other instances as well). Huh? I am going off of the example from the PHP documentation: >From http://www.php.net/manual/en/function.urlencode.php echo '<A HREF="mycgi?foo=', urlencode ($userinput), '">'; So I am using that as a model: echo ' A HREF=" ', $PHP_SELF, '?mode=index&category=', urlencode($cateogory), ' ">Blah</A>'; - John Vanderbeck - Admin, GameDesign > > > Visit the Gates Motel webgame: > http://www.gameslate.com/gatesmotel/ > >
dont use ' , ' use ' . ' echo '<a href="' . $PHP_SELF . '">hello</a>'; -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""John Vanderbeck"" <[EMAIL PROTECTED]> wrote in message 005601c09696$08331480$[EMAIL PROTECTED]">news:005601c09696$08331480$[EMAIL PROTECTED]... > Ok, I made all the changes from $PHPSELF to $PHP_SELF, and i'm further along > with Netscape than before. However, it now seems that there are still some > statements that $PHP_SELF isn't evaluated in. However, now I can narrow it > down to certain statements: > > WORKS: > echo "<P CLASS=Normal><A > HREF=$PHP_SELF?mode=index&category=root>Main</A> -> $category</P>"; > > DOES NOT WORK: > echo '<BR><A HREF="', $PHP_SELF, '?mode=sub_category&category=', > $category, '&sub_category=', urlencode($subcategories[$index]), '">', > $subcategories[$index], '</A>'; > > > - 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] >
I converted everythign over to use '.' instead of ',' but I still get the same exact results. That is, $PHP_SELF is resolved to NULL, and every other variable to the correct data. Here is the new string: echo '<BR><A HREF="' .$PHP_SELF. '?mode=sub_category&category=' .$category. '&sub_category=' .urlencode($subcategories[$index]). '">' .$subcategories[$index]. '</A>'; I think i'm just going to give up on this and rewrite it, because it DOES work if I do the old double quotes bit. Just means I need to re-arrange it and do it in multiple ECHO statements, because I can't do the urlencode() in double quotes. But I would really like to understand WHY this doesn't work. Again, all other varaibles are properly resolved, and in IE $PHP_SELF is properly resolved. - John Vanderbeck - Admin, GameDesign
Ok, I feel like the big idiot now. I fixed the problem. It was because of the whole global bit. The ones that were not working were inside a function, the ones that were working were outside the function. I guess I ASSUMED (yeah we know what happens when you do that) that things like $PHP_SELF were always global. Sorry to have bothered everyone :( - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "John Vanderbeck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 10:59 AM Subject: [PHP] RE: $PHP_SELF in Netscape PART 2 > I converted everythign over to use '.' instead of ',' but I still get the > same exact results. That is, $PHP_SELF is resolved to NULL, and every other > variable to the correct data. Here is the new string: > > echo '<BR><A HREF="' .$PHP_SELF. '?mode=sub_category&category=' > .$category. '&sub_category=' .urlencode($subcategories[$index]). '">' > .$subcategories[$index]. '</A>'; > > > I think i'm just going to give up on this and rewrite it, because it DOES > work if I do the old double quotes bit. Just means I need to re-arrange it > and do it in multiple ECHO statements, because I can't do the urlencode() in > double quotes. But I would really like to understand WHY this doesn't work. > Again, all other varaibles are properly resolved, and in IE $PHP_SELF is > properly resolved. > > - 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] > >
A comma works when you use echo. Is there any reason why this is a bad idea? Charlie Llewellin ----- Original Message ----- From: "John Vanderbeck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 9:11 AM Subject: Re: [PHP] $PHP_SELF in Netscape PART 2 > > You are using commas instead of periods, use ".$PHP_SELF." instead of > > ",$PHP_SELF," (and for the other instances as well). > > Huh? I am going off of the example from the PHP documentation: > > >From http://www.php.net/manual/en/function.urlencode.php > echo '<A HREF="mycgi?foo=', urlencode ($userinput), '">'; > > So I am using that as a model: > echo ' A HREF=" ', $PHP_SELF, '?mode=index&category=', > urlencode($cateogory), ' ">Blah</A>'; > > - John Vanderbeck > - Admin, GameDesign > > > > > > > Visit the Gates Motel webgame: > > http://www.gameslate.com/gatesmotel/ > > > > > > > -- > 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 need to work with files on my web server. I need to be able move them, delete them, rename them etc... Is there a section in the documentation devoted to this? - How do I list files in a directory? Thanks!
exec fclose feof fflush fgetc fgetcsv fgets fgetss file file_exists fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype > -----Original Message----- > From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 14, 2001 10:14 AM > To: PHP Mailing List > Subject: [PHP] Help Work with files > > > Hello, I need to work with files on my web server. I need to be able move > them, delete them, rename them etc... > Is there a section in the documentation devoted to this? > - How do I list files in a directory? > > 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; There's a great little proggie I use to scout out potential link exchange partners for my clients called Zeus. <disclaimer> I have no financial interest in Zeus. </disclaimer> *However*, there are some facilities in this proggie I don't care for: facilities designed to slow one down (and presumably keep the company from being known as a developer of devices for spammers, not that I advocate spamming). I also have a Linux box with a T-1 line that could kick serious butt, and this (of course) is built for Windoze. That, plus the fact that I now find I need a whole bunch of these robots and I'd like to legally skate on the licencing fee :) Which (finally) brings me to my question: Does anyone know of an open source program that does the same thing? TIA, BenO
There are modules in CPAN that do some of this - the camel book I think has a chapter on that. Oreilly also has/had a book out regarding writing robots and such. Sample code should all work for perl - switching to PHP if you want/need shouldn't be too hard. Ben Ocean wrote: > Hi; > There's a great little proggie I use to scout out potential link exchange > partners for my clients called Zeus. > <disclaimer> > I have no financial interest in Zeus. > </disclaimer> > *However*, there are some facilities in this proggie I don't care for: > facilities designed to slow one down (and presumably keep the company from > being known as a developer of devices for spammers, not that I advocate > spamming). I also have a Linux box with a T-1 line that could kick serious > butt, and this (of course) is built for Windoze. That, plus the fact that I > now find I need a whole bunch of these robots and I'd like to legally skate > on the licencing fee :) Which (finally) brings me to my question: Does > anyone know of an open source program that does the same thing? > 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]
Hey all, New problem. I really hope there's something simple to do to fix it. Check out this scenario and tell me if there's a step that I'm missing. Inside my common footer on my site the very first call is to an include called UserAuth.inc.php. UserAuth.inc.php checks $REQUEST_URI to see if the present directory or URL is protected or not. If it is protected then it checks to see if $PHP_AUTH_USER is set. If it is then it runs through the usual HTTP Authentication. If it fails it goes to a failure page, if it succeeds then it logs the user in. Now I can surf around on the site and that same authentication will continue to be used for the rest of the site where ever another protected directory or file is found (as to be expected). Now to logout I have a page called logout.php. If you go to this page (which also includes the same footer) there is another action that takes place. If the $REQUEST_URI contains logout.php then I print the same "401" header that I print for authentication and unset $PHP_AUTH_USER, $PHP_AUTH_PW and $AUTH_USER. $AUTH_USER is the user authentication object in my class file UserAuth.class.php. I'm just unsetting this so that no code will still have record of the old authentication object to do anything with. Now if I try to read the $PHP_AUTH_USER or $PHP_AUTH_PW variables anyplace on the site they don't exist, until I go back to one of the protected pages. Then they miraculously re-appear and are readily available once again without requiring the user to log back in. If you've got any ideas, suggestions, guesses or references, please reply. I've run out of ideas. I can also provide the code that I'm using if you think it might just be a problem with my logic. I don't think this is the case as I shouldn't be able to read any variable that has been unset, but like I said, I'm running out of ideas. System: RedHat 6.1-6 i686 Kernel 2.2.13 Server: Apache 1.3.12 PHP: 4.0.3pl1 Thanks, Toby
Sorry, I meant common header, not footer. Inside my common "header" on my site ...... (which also includes the same "header") ....... ----- Original Message ----- From: "Toby Miller" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 10:37 AM Subject: [PHP] HTTP Authentication not getting unset Hey all, New problem. I really hope there's something simple to do to fix it. Check out this scenario and tell me if there's a step that I'm missing. Inside my common footer on my site the very first call is to an include called UserAuth.inc.php. UserAuth.inc.php checks $REQUEST_URI to see if the present directory or URL is protected or not. If it is protected then it checks to see if $PHP_AUTH_USER is set. If it is then it runs through the usual HTTP Authentication. If it fails it goes to a failure page, if it succeeds then it logs the user in. Now I can surf around on the site and that same authentication will continue to be used for the rest of the site where ever another protected directory or file is found (as to be expected). Now to logout I have a page called logout.php. If you go to this page (which also includes the same footer) there is another action that takes place. If the $REQUEST_URI contains logout.php then I print the same "401" header that I print for authentication and unset $PHP_AUTH_USER, $PHP_AUTH_PW and $AUTH_USER. $AUTH_USER is the user authentication object in my class file UserAuth.class.php. I'm just unsetting this so that no code will still have record of the old authentication object to do anything with. Now if I try to read the $PHP_AUTH_USER or $PHP_AUTH_PW variables anyplace on the site they don't exist, until I go back to one of the protected pages. Then they miraculously re-appear and are readily available once again without requiring the user to log back in. If you've got any ideas, suggestions, guesses or references, please reply. I've run out of ideas. I can also provide the code that I'm using if you think it might just be a problem with my logic. I don't think this is the case as I shouldn't be able to read any variable that has been unset, but like I said, I'm running out of ideas. System: RedHat 6.1-6 i686 Kernel 2.2.13 Server: Apache 1.3.12 PHP: 4.0.3pl1 Thanks, Toby
Ive found the same thing and currently do not have a workaround, it seems that browsers cache this. one method Ive thought of and never tested is to set a session variable, cross reference that SessionID, PHP_AUTH_PW, PHP_AUTH_USER are all valid, if not then your not loged in correctly. to log out just unset SessionID. any future pages will not load. even if the PW/USER are valid the Session wouldnt. If the browser has cookies disabled, you have compiled php with --trans-sid, and the user uses the back button the user would still be able to view cached pages. you might want to put some fancy no-cache headers in there somewhere and hope the browser supports them. you might even want to impliment a time based system, set the SessionID = time() on every header; but first check if the current SessionID < 30min old then invalid login vs updateing SessionID to equal current time() This would prevent anyone from viewing cached pages more then 30min old and force them to re-login.... -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Toby Miller"" <[EMAIL PROTECTED]> wrote in message 006901c0969f$cfcf2700$[EMAIL PROTECTED]">news:006901c0969f$cfcf2700$[EMAIL PROTECTED]... > Sorry, I meant common header, not footer. > > Inside my common "header" on my site ...... > (which also includes the same "header") ....... > > ----- Original Message ----- > From: "Toby Miller" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 14, 2001 10:37 AM > Subject: [PHP] HTTP Authentication not getting unset > > > Hey all, > > New problem. I really hope there's something simple to do to fix it. Check > out this scenario and tell me if there's a step that I'm missing. > > Inside my common footer on my site the very first call is to an include > called UserAuth.inc.php. > > UserAuth.inc.php checks $REQUEST_URI to see if the present directory or URL > is protected or not. > > If it is protected then it checks to see if $PHP_AUTH_USER is set. If it is > then it runs through the usual HTTP Authentication. If it fails it goes to a > failure page, if it succeeds then it logs the user in. > > Now I can surf around on the site and that same authentication will continue > to be used for the rest of the site where ever another protected directory > or file is found (as to be expected). > > Now to logout I have a page called logout.php. If you go to this page (which > also includes the same footer) there is another action that takes place. > > If the $REQUEST_URI contains logout.php then I print the same "401" header > that I print for authentication and unset $PHP_AUTH_USER, $PHP_AUTH_PW and > $AUTH_USER. $AUTH_USER is the user authentication object in my class file > UserAuth.class.php. I'm just unsetting this so that no code will still have > record of the old authentication object to do anything with. > > Now if I try to read the $PHP_AUTH_USER or $PHP_AUTH_PW variables anyplace > on the site they don't exist, until I go back to one of the protected pages. > Then they miraculously re-appear and are readily available once again > without requiring the user to log back in. > > If you've got any ideas, suggestions, guesses or references, please reply. > I've run out of ideas. I can also provide the code that I'm using if you > think it might just be a problem with my logic. I don't think this is the > case as I shouldn't be able to read any variable that has been unset, but > like I said, I'm running out of ideas. > > System: RedHat 6.1-6 i686 Kernel 2.2.13 > Server: Apache 1.3.12 > PHP: 4.0.3pl1 > > Thanks, > Toby > > > > > -- > 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] >
Chris, I was afraid of that. I do have a contingency plan that is very similar to what you suggested. Since this is all already interacting with the database I'm just going to set a timestamp in the database in that users record and use that to determine if someone is logged in or not. This would also give me the added benefit of expiring sessions after a set period of inactivity. Then the login will require that PHP_AUTH_USER, PHP_AUTH_PW, and the session timestamp are all valid. This should take care of the problem. Unfortunately, the back button will still allow users to see cached pages from logged in sessions, but I guess you can't have everything. :-) Thanks, Toby ----- Original Message ----- From: "Chris Lee" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 11:44 AM Subject: Re: [PHP] HTTP Authentication not getting unset > Ive found the same thing and currently do not have a workaround, it seems > that browsers cache this. one method Ive thought of and never tested is to > set a session variable, cross reference that SessionID, PHP_AUTH_PW, > PHP_AUTH_USER are all valid, if not then your not loged in correctly. to log > out just unset SessionID. any future pages will not load. even if the > PW/USER are valid the Session wouldnt. > > If the browser has cookies disabled, you have compiled php with --trans-sid, > and the user uses the back button the user would still be able to view > cached pages. you might want to put some fancy no-cache headers in there > somewhere and hope the browser supports them. > > you might even want to impliment a time based system, set the SessionID = > time() on every header; but first check if the current SessionID < 30min old > then invalid login vs updateing SessionID to equal current time() > > This would prevent anyone from viewing cached pages more then 30min old and > force them to re-login.... > > -- > > > Chris Lee > Mediawaveonline.com > > em. [EMAIL PROTECTED] > > ph. 250.377.1095 > ph. 250.376.2690 > fx. 250.554.1120 > > > > > > ""Toby Miller"" <[EMAIL PROTECTED]> wrote in message > 006901c0969f$cfcf2700$[EMAIL PROTECTED]">news:006901c0969f$cfcf2700$[EMAIL PROTECTED]... > > Sorry, I meant common header, not footer. > > > > Inside my common "header" on my site ...... > > (which also includes the same "header") ....... > > > > ----- Original Message ----- > > From: "Toby Miller" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, February 14, 2001 10:37 AM > > Subject: [PHP] HTTP Authentication not getting unset > > > > > > Hey all, > > > > New problem. I really hope there's something simple to do to fix it. Check > > out this scenario and tell me if there's a step that I'm missing. > > > > Inside my common footer on my site the very first call is to an include > > called UserAuth.inc.php. > > > > UserAuth.inc.php checks $REQUEST_URI to see if the present directory or > URL > > is protected or not. > > > > If it is protected then it checks to see if $PHP_AUTH_USER is set. If it > is > > then it runs through the usual HTTP Authentication. If it fails it goes to > a > > failure page, if it succeeds then it logs the user in. > > > > Now I can surf around on the site and that same authentication will > continue > > to be used for the rest of the site where ever another protected directory > > or file is found (as to be expected). > > > > Now to logout I have a page called logout.php. If you go to this page > (which > > also includes the same footer) there is another action that takes place. > > > > If the $REQUEST_URI contains logout.php then I print the same "401" header > > that I print for authentication and unset $PHP_AUTH_USER, $PHP_AUTH_PW and > > $AUTH_USER. $AUTH_USER is the user authentication object in my class file > > UserAuth.class.php. I'm just unsetting this so that no code will still > have > > record of the old authentication object to do anything with. > > > > Now if I try to read the $PHP_AUTH_USER or $PHP_AUTH_PW variables anyplace > > on the site they don't exist, until I go back to one of the protected > pages. > > Then they miraculously re-appear and are readily available once again > > without requiring the user to log back in. > > > > If you've got any ideas, suggestions, guesses or references, please reply. > > I've run out of ideas. I can also provide the code that I'm using if you > > think it might just be a problem with my logic. I don't think this is the > > case as I shouldn't be able to read any variable that has been unset, but > > like I said, I'm running out of ideas. > > > > System: RedHat 6.1-6 i686 Kernel 2.2.13 > > Server: Apache 1.3.12 > > PHP: 4.0.3pl1 > > > > Thanks, > > Toby > > > > > > > > > > -- > > 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]
El Mié 14 Feb 2001 12:37, Toby Miller escribió: > Hey all, Hi, This is far to long, so I'll strip a part of it. > Now if I try to read the $PHP_AUTH_USER or $PHP_AUTH_PW variables anyplace > on the site they don't exist, until I go back to one of the protected > pages. Then they miraculously re-appear and are readily available once > again without requiring the user to log back in. Yes, thats because the browser saves those variables (very bad idea, but what can I say... I didn't write the code of netscape or IE). At this moment I just finished coding a session login, logout hack. So I will suggest you to read about sessions, read some articles in phpbuilder, phpwizard and the documentation. Saludos... :-) -- System Administration: It's a dirty job, but someone told I had to do it. ----------------------------------------------------------------- Martín Marqués email: [EMAIL PROTECTED] Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------
El Mié 14 Feb 2001 13:04, Toby Miller escribió: > Sorry, I meant common header, not footer. > > Inside my common "header" on my site ...... > (which also includes the same "header") ....... Don't worry, I understood it. ;-) -- System Administration: It's a dirty job, but someone told I had to do it. ----------------------------------------------------------------- Martín Marqués email: [EMAIL PROTECTED] Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------
El Mié 14 Feb 2001 13:44, Chris Lee escribió: > Ive found the same thing and currently do not have a workaround, it seems > that browsers cache this. one method Ive thought of and never tested is to > set a session variable, cross reference that SessionID, PHP_AUTH_PW, > PHP_AUTH_USER are all valid, if not then your not loged in correctly. to > log out just unset SessionID. any future pages will not load. even if the > PW/USER are valid the Session wouldnt. Don't unset the session ID, just destroy the session with session_destroy(). > If the browser has cookies disabled, you have compiled php with > --trans-sid, and the user uses the back button the user would still be able > to view cached pages. you might want to put some fancy no-cache headers in > there somewhere and hope the browser supports them. This feature is pretty cool. If it can't but a cookie in the browser, it expands the URL with the SID, which is all you need, because the variables you register are on the server side (file, database). Saludos... :-) -- System Administration: It's a dirty job, but someone told I had to do it. ----------------------------------------------------------------- Martín Marqués email: [EMAIL PROTECTED] Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------
Hello, Sorry if I am confused by the date functions in the manual but I am. Here's what I want to do: I have a string in the form MM/DD/YYYY. I wish to: 1) convert it to a date 2) add $n days to it 3) convert back to a string in the same format above I believe I can accomplish [2] and [3] with: $mytdate = date("m/d/Y",mktime(0,0,0,date("m") ,date("d")+$n,date("Y"))); How do I accomplish step 1? Can I type cast a string to a date? Thanks, Don
> Sorry if I am confused by the date functions in the manual but I am. > Here's what I want to do: > I have a string in the form MM/DD/YYYY. I wish to: > 1) convert it to a date > 2) add $n days to it > 3) convert back to a string in the same format above > I believe I can accomplish [2] and [3] with: > $mytdate = date("m/d/Y",mktime(0,0,0,date("m") > ,date("d")+$n,date("Y"))); > How do I accomplish step 1? > Can I type cast a string to a date? No, but you can do this: $startDate = explode( "/", $dateString ); $mytdate = date( "m/d/Y", mktime( 0, 0, 0, $startDate[0], $startDate[1]+$n, $startDate[2] ); Chris
I need a better solution for reporting SQL errors. I'm used to work with ASP, and whenever a query has a syntax error, it stops the script and reports the error as if it was a compile error. This is very usefull, but int PHP it doesn't work like that, I know. I came with a function query_error() that I call after each query, that prints out the query, the error and the line... so I need to call it like this. if(!$rs) query_error($query,__LINE__); but having to writ this down after EVERY single query, along with the __LINE__ thing can get very boring, does anyone has a better solution? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br
works for me, just call it. change it to better match yours if you like. function check_db($query = 'Unavailble') { global $store_db; if ( mysql_errno() ) { echo "Error: Problem with DataBase : $store_db<br>\n"; echo "Error: " . mysql_errno() . ':' . mysql_error() . "<br>\n"; echo "Query: $query<br>\n"; exit(); } } I havent played with a more automatic metod, ie. error_reporting(); -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Christian Dechery"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I need a better solution for reporting SQL errors. I'm used to work with ASP, and whenever a query has a syntax error, it stops the script and reports the error as if it was a compile error. This is very usefull, but int PHP it doesn't work like that, I know. I came with a function query_error() that I call after each query, that prints out the query, the error and the line... so I need to call it like this. if(!$rs) query_error($query,__LINE__); but having to writ this down after EVERY single query, along with the __LINE__ thing can get very boring, does anyone has a better solution? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- 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 version of PHP are you using? If there's a syntax error in our statements, it stops execution, just like ASP. There are error_reporting levels you can play with, and have errors trigger certain functions to handle the errors gracefully. Christian Dechery wrote: > I need a better solution for reporting SQL errors. > > I'm used to work with ASP, and whenever a query has a syntax error, it stops > the script and reports the error as if it was a compile error. This is very > usefull, but int PHP it doesn't work like that, I know. > > I came with a function query_error() that I call after each query, that > prints out the query, the error and the line... so I need to call it like > this. > > if(!$rs) query_error($query,__LINE__); > > but having to writ this down after EVERY single query, along with the __LINE__ > thing can get very boring, does anyone has a better solution? > > . [ Christian Dechery ] > . Webdeveloper @ Tá Na Mesa! > . Listmaster @ Gaita-L > . http://www.tanamesa.com.br > > -- > 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]
>works for me, just call it. change it to better match yours if you like. > > function check_db($query = 'Unavailble') > { > global $store_db; > if ( mysql_errno() ) > { > echo "Error: Problem with DataBase : $store_db<br>\n"; > echo "Error: " . mysql_errno() . ':' . mysql_error() . "<br>\n"; > echo "Query: $query<br>\n"; > exit(); > } > } that's kinda what I have here... but the line of code isn't being shown... and that is the problem... I for one, think that in an error message the line of code is crucial. . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br
On Wednesday 14 February 2001 18:43, Christian Dechery wrote: > that's kinda what I have here... but the line of code isn't being > shown... and that is the problem... I for one, think that in an error > message the line of code is crucial. Check the manual for set_error_handler () -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Even idiots can handle computers, and many do.
Hi all, I have a PHP web form setup for user to fill in information then email it to me after pressing SUBMIT button. Everytime user uses double-quote(") or single(') it inserts (/) right in front of " or '. Does anyone know why and how to fix it? Please advise. Below is example of what I got from my email when user submits form to me. Topic: Added \"Initial login to the EMS\" procedure. Thanks in advance, David
> I have a PHP web form setup for user to fill in information > then email it to me after pressing SUBMIT button. Everytime > user uses double-quote(") or single(') it inserts (/) right in front > of " or '. Does anyone know why and how to fix it? Please advise. Look up: stripslashes(); Chris
I can help you there, as I had the same problem until someone else helped me. This is because PHP will escape the input it gets. I think this is dependant on some enviroment setting, but I can't recall which one. To fix it you call stripslashes($var); - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "Nguyen, David M" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 11:02 AM Subject: [PHP] Why??? > Hi all, > > I have a PHP web form setup for user to fill in information then email it to > me after pressing SUBMIT button. Everytime user uses double-quote(") or > single(') it inserts (/) right in front of " or '. Does anyone know why and > how to fix it? Please advise. Below is example of what I got from my email > when user submits form to me. > > > Topic: Added \"Initial login to the EMS\" procedure. > > > Thanks in advance, > David > > > > -- > 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] > >
This is because you have magic_quotes_gpc set to ON, this setting can be read about here : http://www.php.net/manual/en/configuration.php#ini.magic-quotes-gpc http://www.php.net/manual/en/function.get-magic-quotes-gpc.php Which, as you'll read about, adds the quotes automatically. Also, have a look here : http://www.php.net/manual/en/function.addslashes.php http://www.php.net/manual/en/function.stripslashes.php It will make sense. Regards, Philip Olson http://www.cornado.com/ On Wed, 14 Feb 2001, Nguyen, David M wrote: > Hi all, > > I have a PHP web form setup for user to fill in information then email it to > me after pressing SUBMIT button. Everytime user uses double-quote(") or > single(') it inserts (/) right in front of " or '. Does anyone know why and > how to fix it? Please advise. Below is example of what I got from my email > when user submits form to me. > > > Topic: Added \"Initial login to the EMS\" procedure. > > > Thanks in advance, > David > > > > -- > 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] >
The / is coming from $topic, how do I use stripslashes to remove / . Can someone give me an example how to code it? Here is my original PHP script: <? $to = "[EMAIL PROTECTED]"; $subject = "Update"; $message = "The following Webpage is added or updated:\n\nDate: $date\nEquipment : $equipment\nTopic: $topic\nURL: $url"; $mail_header = "From: $email"; mail( $to, $subject, $message, $mail_header ) or print "Could not send mail"; print ("<HTML>\n"); print ("<HEAD>\n"); print ("<TITLE>$title</TITLE>\n"); print ("</HEAD>\n"); print ("<BODY BACKGROUND=\"images/bkgrnd.jpg\" bgcolor=\"#FFFFFF\">\n"); print ("<H3>Thank you. Your submission has been sent. <br><br><A HREF=\"index.h tml\">Back</A> to Home Page.\n"); print ("</BODY>\n"); print ("</HTML>"); ========================================================== -----Original Message----- From: John Vanderbeck [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 14, 2001 10:07 AM To: Nguyen, David M; [EMAIL PROTECTED] Subject: Re: [PHP] Why??? I can help you there, as I had the same problem until someone else helped me. This is because PHP will escape the input it gets. I think this is dependant on some enviroment setting, but I can't recall which one. To fix it you call stripslashes($var); - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "Nguyen, David M" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 11:02 AM Subject: [PHP] Why??? > Hi all, > > I have a PHP web form setup for user to fill in information then email it to > me after pressing SUBMIT button. Everytime user uses double-quote(") or > single(') it inserts (/) right in front of " or '. Does anyone know why and > how to fix it? Please advise. Below is example of what I got from my email > when user submits form to me. > > > Topic: Added \"Initial login to the EMS\" procedure. > > > Thanks in advance, > David > > > > -- > 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]
Not really a JSP/PHP issue, but you mention that there's another developer. Are you in a bidding war with this person? If you're vying for business, don't get into putting JSP down, not out of hand anyway. Simply state the benefits that PHP has to offer. Our machines may be weird, but we've found that PHP running against servlets (on enhydra) - PHP generally runs faster. This all depends on the JVM underneath of course, and I don't remember which ones we tested. JSP seems to run even slower, though we didn't do scientific testing. :) This doesn't mean JSP is bad, but that for equivalent performance, you may need more expensive hardware, which affects a project's bottom line. Assumption is that this would be a dedicated server - I don't know of too many hosting companies that offer JSP service (sure they exist someplace tho). Compare compilation time of JSP pages vs. the compilation time of PHP4 through the APC. There doesn't seem to be any time at all with APC, yet with JSP there is/was a noticeable compilation lag on the first execution of a page - I've been told there are faster compilers, but we were using "standard" stuff. (getting over my head here, but I've *seen* the development effects of servlets, and JSP gets compiled into servlets, so there's even an extra step there). Again, if you're bidding, you'll lose if you just say 'JSP sucks'. There was an zdnet article a few weeks ago - JSP/ASP/CF/PHP. PHP was the fastest, JSP the slowest. Good luck - contact me offlist if you want to discuss this further. [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]
When you @ "at" a command (supress error messaging) within a function, is the scope of the @ within the function? Example: CloseODBC(1); # is error message supressed here too? function CloseODBC($connection_id) { # error messaging supressed @odbc_close($connection_id); }
My understanding is, it simple supress the any messages generated from the result. So I guess it is local. Karl J. Stubsjoen wrote: > When you @ "at" a command (supress error messaging) within a function, is > the scope of the @ within the function? > > Example: > > > CloseODBC(1); > > # is error message supressed here too? > > > function CloseODBC($connection_id) > { > # error messaging supressed > @odbc_close($connection_id); > > } > >
On Wednesday 14 February 2001 17:36, Karl J. Stubsjoen wrote: > When you @ "at" a command (supress error messaging) within a function, > is the scope of the @ within the function? > > Example: > > > CloseODBC(1); > > # is error message supressed here too? > > > function CloseODBC($connection_id) > { > # error messaging supressed > @odbc_close($connection_id); > > } Huh? When you call CloseODBC (), the code in that function is executed - and there odbc_close() is called with the "@" - so it doesn't report an error. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Even idiots can handle computers, and many do.
I am making ODBC connections and MySQL connections, and want to make sure I'm closing my connection properly. Someone once replied that you do not need to worry about terminating the query set (for MySQL), that PHP takes care of this for you, is this true for the ODBC connection as well? So what I am doing, is making a connection to the db, querying the db using select statements, and then releasing the db connection with: mysql_close or odbc_close. Is that good enough? Thanks! Karl
Karl, That should be good enough. What you were told is true - PHP does close connections when the script exits, but every so often this can fail, so closing the connection explicitly is good practice. 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: Wednesday, February 14, 2001 11:47 AM > To: PHP Mailing List > Subject: [PHP] Closing Databases > > > I am making ODBC connections and MySQL connections, and want to make sure > I'm closing my connection properly. Someone once replied that you do not > need to worry about terminating the query set (for MySQL), that PHP takes > care of this for you, is this true for the ODBC connection as well? > > So what I am doing, is making a connection to the db, querying > the db using > select statements, and then releasing the db connection with: mysql_close > or odbc_close. Is that good enough? > > Thanks! > > Karl > > > -- > 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 have recently been assigned the task of parsing an xml file and format the contents of the file in HTML. The xml file lies on another server. Our web space provider does not provide the XML functions (nor is he willing to install them) :-gr. I am sure that I am not the only who has come across this problem. Would someone have already created a few functions to parse xml that they are willing to share? I have the following structure to deal with: <faq> <item> <product>ProductName</product> <question>Why does it not work</question> <answer>Because it is not turned on<answer> <item> </faq> There are whole load of <item>s in the file. I then want to display the contents a bit like this: echo $product; echo $question; etc (of course with some HTML formatting, like a bulleted list). Any help would be really VERY appreciated! Thanks S _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
If your satisfied with IE5.0 customers you could do all that without php, use an XSL file. Now if you want PHP to parse the XML file, I can see why, your going to have to get XML installed. Have you considered other providors? there are lots. Im one of them. Ive been told there are ways of adding modules dynamically on runtime http://php.net/manual/en/function.dl.php Ive never needed it / used it. sorry :( -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Stefen Lars"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello all > > I have recently been assigned the task of parsing an xml file and format the > contents of the file in HTML. The xml file lies on another server. Our web > space provider does not provide the XML functions (nor is he willing to > install them) :-gr. > > I am sure that I am not the only who has come across this problem. > > Would someone have already created a few functions to parse xml that they > are willing to share? > > I have the following structure to deal with: > > <faq> > <item> > <product>ProductName</product> > <question>Why does it not work</question> > <answer>Because it is not turned on<answer> > <item> > </faq> > > There are whole load of <item>s in the file. > > I then want to display the contents a bit like this: > > echo $product; > echo $question; > > etc (of course with some HTML formatting, like a bulleted list). > > Any help would be really VERY appreciated! > > Thanks > > S > > > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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] >
I'm trying to get some the example files from Thickbooks to work, although I've also tried php.net and PHPBuilder with similar results. I'm dealing with an ISP so I can't view php.ini or change permissions directly. Using the most basic elements of the script I get errors immediately after trying to submit the form which posts the file. The errors vary across browsers. In IE I get "Attempt to load accessing url "http://.../do_upload.php" failed." Netscape gives an error something like "File does not exist." I've asked the ISP to check the permissions on the PHP temp directory and assign PHP the permission to write to my final destination directory. Which they say they have done. Any ideas where to look next? Thanks, Tom >>.>>.>>>.>>>>>.>>>>>>>>> <<<<<<<<<.<<<<<.<<<.<<.<<<.<<<<<< Tom Beidler Orbit Tech Services 805.682.8972 (phone) http://www.orbittechservices.com/ 805.682.5833 (fax) [EMAIL PROTECTED] >>.>>.>>>.>>>>>.>>>>>>>>> <<<<<<<<<.<<<<<.<<<.<<.<<<.<<<<<<
Hi! I was hoping that someone could help me out. I am not positive if I understand whats going on.. so let me try to explain. This is a process to modify news articles in a MySQL database. (From the point after picking the article to modify) PHP Script #1: I grab everything from the database and stick it into the HTML form (textarea, text, etc). I allow the user to modify whatever they want. PHP Script #2: This script takes the new information and displays it to the user.. it is a preview of what it will look like with the changes. PHP Script #3: Updates the news article in the database. Now the problem I am having.. is that the description and content fields have qoutes in them. For example: Description: I like to run and walk. I love "smelly cheese." So.. when it tries to update the database. It will only store this as the description: I like to run and walk. I love\\ I know that its because the qoutes are not being escaped correctly.. and it seems as though it is escaping the escape. So my question is.. how can I keep my qoutes? Just FYI.. I am making the user enter in the description and content in html. So i cant just change the qoutes to HTMLTags because it would change my <P> and <a href=> etc. Below is an example of the code (shortened for an example): PHP Script #1: Editing description print' </textarea><br> Description:<br><textarea name=describe cols=40 rows=10>'; echo $info["description"]; print' </textarea><br>'; PHP Script #2: (preview changes) <input type=hidden name=describe value="<?php print $describe?>"> <b>Description:</b><br> <?php print $describe?> <p> PHP Script #3: (update database) $sql = "UPDATE news SET release_date='$date', title='$title', description='$describe', contact='$contact', content='$test', type='$type' WHERE news_id=$id"; $result = mysql_query($sql) Thanks in advance. -Tanya
My approach towards this problem was to parse the data before inserting and before displaying. Before inserting the data entered by user, do something like str_replace($comments, "'","~") and do the same thing for " do a different character like | and then insert it into database. Do the reverse before displaying the data, it should fix your problem.. Tanya Brethour wrote: > Hi! I was hoping that someone could help me out. I am not positive if I > understand whats going on.. so let me try to explain. > > This is a process to modify news articles in a MySQL database. > > (From the point after picking the article to modify) > PHP Script #1: > I grab everything from the database and stick it into the HTML form > (textarea, text, etc). I allow the user to modify whatever they want. > > PHP Script #2: > This script takes the new information and displays it to the user.. it is > a preview of what it will look like with the changes. > > PHP Script #3: > Updates the news article in the database. > > Now the problem I am having.. is that the description and content fields > have qoutes in them. For example: > Description: I like to run and walk. I love "smelly cheese." > > So.. when it tries to update the database. It will only store this as the > description: > I like to run and walk. I love\\ > > I know that its because the qoutes are not being escaped correctly.. and > it seems as though it is escaping the escape. > > So my question is.. how can I keep my qoutes? > > Just FYI.. I am making the user enter in the description and content in > html. So i cant just change the qoutes to HTMLTags because it would change > my <P> and <a href=> etc. > > Below is an example of the code (shortened for an example): > > PHP Script #1: Editing description > > print' > </textarea><br> > Description:<br><textarea name=describe cols=40 rows=10>'; > echo $info["description"]; > print' > </textarea><br>'; > > PHP Script #2: (preview changes) > > <input type=hidden name=describe value="<?php print $describe?>"> > <b>Description:</b><br> > <?php print $describe?> <p> > > PHP Script #3: (update database) > $sql = "UPDATE news SET release_date='$date', title='$title', > description='$describe', contact='$contact', content='$test', type='$type' > WHERE news_id=$id"; > $result = mysql_query($sql) > > > Thanks in advance. > > -Tanya > > > > > > >
Let says I strip the slashes.. so it goes back to just normal qoutes.. and then do the str_replace("\"","|", $describe); $describe = stripslashes($describe); str_replace("\"","|",$describe); It doesnt replace the qoutes.. -Tanya On Wed, 14 Feb 2001, Web master wrote: > My approach towards this problem was to parse the data before inserting > and before displaying. > Before inserting the data entered by user, do something like > str_replace($comments, "'","~") and do the same thing for " do a > different character like | and then insert it into database. > Do the reverse before displaying the data, it should fix your problem.. > > Tanya Brethour wrote: > > > Hi! I was hoping that someone could help me out. I am not positive if I > > understand whats going on.. so let me try to explain. > > > > This is a process to modify news articles in a MySQL database. > > > > (From the point after picking the article to modify) > > PHP Script #1: > > I grab everything from the database and stick it into the HTML form > > (textarea, text, etc). I allow the user to modify whatever they want. > > > > PHP Script #2: > > This script takes the new information and displays it to the user.. it is > > a preview of what it will look like with the changes. > > > > PHP Script #3: > > Updates the news article in the database. > > > > Now the problem I am having.. is that the description and content fields > > have qoutes in them. For example: > > Description: I like to run and walk. I love "smelly cheese." > > > > So.. when it tries to update the database. It will only store this as the > > description: > > I like to run and walk. I love\\ > > > > I know that its because the qoutes are not being escaped correctly.. and > > it seems as though it is escaping the escape. > > > > So my question is.. how can I keep my qoutes? > > > > Just FYI.. I am making the user enter in the description and content in > > html. So i cant just change the qoutes to HTMLTags because it would change > > my <P> and <a href=> etc. > > > > Below is an example of the code (shortened for an example): > > > > PHP Script #1: Editing description > > > > print' > > </textarea><br> > > Description:<br><textarea name=describe cols=40 rows=10>'; > > echo $info["description"]; > > print' > > </textarea><br>'; > > > > PHP Script #2: (preview changes) > > > > <input type=hidden name=describe value="<?php print $describe?>"> > > <b>Description:</b><br> > > <?php print $describe?> <p> > > > > PHP Script #3: (update database) > > $sql = "UPDATE news SET release_date='$date', title='$title', > > description='$describe', contact='$contact', content='$test', type='$type' > > WHERE news_id=$id"; > > $result = mysql_query($sql) > > > > > > Thanks in advance. > > > > -Tanya > > > > > > > > > > > > > > >
On Wednesday 14 February 2001 17:56, Tanya Brethour wrote: > Hi! I was hoping that someone could help me out. I am not positive if I > understand whats going on.. so let me try to explain. > > This is a process to modify news articles in a MySQL database. > > (From the point after picking the article to modify) > PHP Script #1: > I grab everything from the database and stick it into the HTML form > (textarea, text, etc). I allow the user to modify whatever they want. (1) Be sure to run the data through htmlentities() before inserting it into the textarea. Otherwise stuff like "<" signs, ampersands ("&") etc will get munched. > PHP Script #2: > This script takes the new information and displays it to the user.. it > is a preview of what it will look like with the changes. Do a if (get_magic_quotes_gpc()) { $TextFromForm = stripslashes ($TextFromForm); } That will un-escape the quotes ('some \"text\"' -> 'some "text"'), i.e. give you the text as it should be. > PHP Script #3: > Updates the news article in the database. > > Now the problem I am having.. is that the description and content > fields have qoutes in them. For example: > Description: I like to run and walk. I love "smelly cheese." > > So.. when it tries to update the database. It will only store this as > the description: > I like to run and walk. I love\\ $Query = "UPDATE foo SET field1 = '" . addslashes ($TextFromForm) . "' WHERE ..."; The addslashes () here properly escapes the quotes in your string, so that the SQL parser can interpret it correctly. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Even idiots can handle computers, and many do.
Can anyone here decipher for me some of the undocumented Socket functions in PHP4? For instance, how do I use select() to multiplex multiple connections? With the functions that are documented, there is a nice example of a simple echoing TCP server, but it only accepts a single connection which has limited usage. Can anyone come up with an example to expand that to multiple connections. The suggestions in the manual to read man pages & C tutorials has helped me wrap my head around the multiplexing loop concept, but I still can't decipher how to actually create this using the functions available (mostly because I don't program in C). Visit the Gates Motel webgame: http://www.gameslate.com/gatesmotel/
I'm a little unsure of how variables are cast around in PHP, since it seems like VisualBasic where I don't declare any types, the compiler just figures it out. Would something like this be safe?.... $info = fread($file, filesize("blah"); $info = explode("\n", $info); echo $info[0]; .... - John Vanderbeck - Admin, GameDesign
Try it, it should be no problem. -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""John Vanderbeck"" <[EMAIL PROTECTED]> wrote in message 011a01c096a7$f8e78080$[EMAIL PROTECTED]">news:011a01c096a7$f8e78080$[EMAIL PROTECTED]... > I'm a little unsure of how variables are cast around in PHP, since it seems > like VisualBasic where I don't declare any types, the compiler just figures > it out. > > Would something like this be safe?.... > $info = fread($file, filesize("blah"); > $info = explode("\n", $info); > > echo $info[0]; > .... > > > - 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] >
Hello, I am trying to get the value for a file input field to have a starting value I can't seem to get it to work when using Value=\"C:\test.gif\" does anyone have any advise? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
>I am trying to get the value for a file input field to have a starting value >I can't seem to get it to work when using Value=\"C:\test.gif\" does anyone >have any advise? Stop trying! Any browser that would let you do this is opening up a fair old potential security hole. I'm pretty sure it can't be done. Cheers -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org
It may be that the \t in your string is being interpreted as a tab. Try using /, or escaping your \. Cheers Jon -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: 14 February 2001 17:14 To: PHP User Group Subject: [PHP] <intput type=\"file\" ..... Hello, I am trying to get the value for a file input field to have a starting value I can't seem to get it to work when using Value=\"C:\test.gif\" does anyone have any advise? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.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]
On Wednesday 14 February 2001 18:13, Brandon Orther wrote: > I am trying to get the value for a file input field to have a starting > value I can't seem to get it to work when using Value=\"C:\test.gif\" Let me guess - You're printing this in some string enclosed with double quotes (print ("Value=\"C:\test.gif\"");) ? Then you need to escape the "\" before the "t" - "\t" is a TAB character, and chances are good that the browser won't like that in a filename. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Even idiots can handle computers, and many do.
Does mySQL have an equivalent to PHPs intval() function? I have fields whose contents are "Less than 100", "Less than 200", "Less than 300", and I want to do a SELECT * FROM my_table WHERE $mynumber <= intval(myfield) thanks, bill
hey- If anyone is looking for a freelance web developer check me out. I have recently become available. We're talking perl/php/mysql/c++/linux and a bs degreee. jeff -- Jeff Saenz ([EMAIL PROTECTED]) Perl/PHP/SQL/Unix Consulting http://www.planetoid.net
anyone point me in the direction of a good currency converter class written in php. a euro converter will do! thanx.
So I want to bind multiple values that are in an associative array I have this code foreach ($binds as $key=>$value) { OCIBindByName($this->m_cursor,":$key",$value,-1); } but it only seems to work for one value in the array, the array conetents would be something like $binds["id"] = 54; $binds["name"] = Dick; anyone get this to work or have any idea why it works when the array only has one thing in it? Thanks in advance -- Shaun Butler [EMAIL PROTECTED] x2905
On Wed, Feb 14, 2001 at 12:35:10PM +0000, Butler, Shaun wrote: > > So I want to bind multiple values that are in an associative array > > I have this code > > > foreach ($binds as $key=>$value) > { > OCIBindByName($this->m_cursor,":$key",$value,-1); > } > > but it only seems to work for one value in the array, the array conetents > would be something like > > $binds["id"] = 54; > $binds["name"] = Dick; > > anyone get this to work or have any idea why it works when the array only has > one thing in it? Thanks in advance the values bound by ocibindbyname are "taken" from script-space when you call ociexecute() and then $value will have only one value. tc
On Wednesday 14 February 2001 17:55, you wrote: > On Wed, Feb 14, 2001 at 12:35:10PM +0000, Butler, Shaun wrote: > > So I want to bind multiple values that are in an associative array > > > > I have this code > > > > > > foreach ($binds as $key=>$value) > > { > > OCIBindByName($this->m_cursor,":$key",$value,-1); > > } > > > > but it only seems to work for one value in the array, the array conetents > > would be something like > > > > $binds["id"] = 54; > > $binds["name"] = Dick; > > > > anyone get this to work or have any idea why it works when the array only > > has one thing in it? Thanks in advance > > the values bound by ocibindbyname are "taken" from > script-space when you call ociexecute() and then $value will > have only one value. > > tc in case anyone needs this I fixed it by doing this foreach ($binds as $key=>$value) { $$key = $value; OCIBindByName($this->m_cursor,":$key",$$key,-1); } thanks tc -- Shaun Butler [EMAIL PROTECTED] x2905
Hi, Does anyone know where I might get the mcrypt dll for windows nt or win 98?? Thanks, Kev
Kevin Connolly wrote: > Does anyone know where I might get the mcrypt dll for windows nt or > win 98?? I dunno, but you could try http://www.php4win.de regards Wagner -- Three may keep a secret, if two of them are dead.
Hi, All, When I am trying to get phorum version: 3.2.11 setup on my site, I keep getting the following error when I try to add a forum. Warning: MySQL: A link to the server could not be established in db/mysql.php on line 52 Warning: Failed opening 'admin/forums/.php' for inclusion (include_path='') in C:\EPY\phorum\admin\index.php on line 665 Does anyone has any idea about this? Any help would be appriciated. Thanks! Fang
Hello, I am using the require() function to open up the head of my pages. In the head.php file it requires something relative to its path. What I want to do is be able to require('head.php') without having to copy all the files head.php requires into the folder of the script using this head.php file. I hope you can understand that thanXor Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
is this what you want ? somefile.php <?php include_once("$DOCUMENT_ROOT/include/header.inc"); ?> -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Brandon Orther"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I am using the require() function to open up the head of my pages. In the > head.php file it requires something relative to its path. What I want to do > is be able to require('head.php') without having to copy all the files > head.php requires into the folder of the script using this head.php file. > > I hope you can understand that thanXor > > Thank you, > > -------------------------------------------- > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.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] >
Ok here is the deal. I have a Linux server running PHP4 and MySQL and a directory full of images. The images that are currently being used should be listed in a table (members) in a column titled "pic1". What is the best way to pull the file names of the files and check them against the files in the table? I want all files that are not listed in the table to be deleted. Also, is there a way to limit file size? I don't want new images to be accepted if they exceed 250k. It takes too long for images to display if they are larger then that. Thanks in advance for any help. Kenneth R Zink II [EMAIL PROTECTED] ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
I finally got everything to install on RedHat 7, but I can't do anything with pdflib like I had expected. I get back Fatal error: Call to undefined function: pdf_new() in /var/www/html/pdfclock.php on line 7. Line 7 is $pdf = PDF_new(); This is rather frustrating that every time I try to install PHP on a machine it takes me a week to get it going. Here is what I have for the config from the srpm after modification as instructed earlier. ./configure \ --prefix=%{_prefix} \ --with-config-file-path=%{_sysconfdir} \ --disable-debug \ --enable-pic \ --enable-shared \ --enable-inline-optimization \ $* \ --with-exec-dir=%{_bindir} \ --with-regex=system \ --with-gettext \ --with-gd \ --with-jpeg-dir=%{_prefix} \ --with-png \ --with-zlib \ --with-gdbm \ --enable-debugger \ --enable-magic-quotes \ --enable-safe-mode \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-track-vars \ --enable-yp \ --enable-ftp \ --enable-wddx \ --with-mysql \ --with-xml \ --with-pdflib=/usr/lib/lipdf.so.0 \ --with-tiff Can someone look at this and tell me what else I need to put in to get this to work? Mike
Ive never quite seen a config like that, everybody does things differently. check your configure's output to make sure that it sais checking whether to include Pdflib 3.x support... yes checking for PDF_show_boxed in -lpdf... yes my config script looks like this... configure \ --disable-debug \ --enable-inline-optimization \ --enable-versioning \ --enable-trans-sid \ --enable-sockets \ --enable-xml \ --with-sablot \ --with-mhash \ --with-mcrypt \ --with-pgsql \ --with-mysql \ --with-zlib-dir=/usr/local \ --with-bz2 \ --with-jpeg-dir=/usr/local \ --with-xpm-dir=/usr/X11R6 \ --with-png \ --with-tiff \ --with-ttf \ --with-t1lib \ --with-gd \ --with-pdflib \ if your configure isnt finding pdflib it wont fail, it just wont include pdf support -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 "Mike Tuller" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I finally got everything to install on RedHat 7, but I can't do anything > with pdflib like I had expected. > > I get back Fatal error: Call to undefined function: pdf_new() in > /var/www/html/pdfclock.php on line 7. Line 7 is $pdf = PDF_new(); > > This is rather frustrating that every time I try to install PHP on a machine > it takes me a week to get it going. > > Here is what I have for the config from the srpm after modification as > instructed earlier. > > ./configure \ > --prefix=%{_prefix} \ > --with-config-file-path=%{_sysconfdir} \ > --disable-debug \ > --enable-pic \ > --enable-shared \ > --enable-inline-optimization \ > $* \ > --with-exec-dir=%{_bindir} \ > --with-regex=system \ > --with-gettext \ > --with-gd \ > --with-jpeg-dir=%{_prefix} \ > --with-png \ > --with-zlib \ > --with-gdbm \ > --enable-debugger \ > --enable-magic-quotes \ > --enable-safe-mode \ > --enable-sockets \ > --enable-sysvsem \ > --enable-sysvshm \ > --enable-track-vars \ > --enable-yp \ > --enable-ftp \ > --enable-wddx \ > --with-mysql \ > --with-xml \ > --with-pdflib=/usr/lib/lipdf.so.0 \ > --with-tiff > > Can someone look at this and tell me what else I need to put in to get this > to work? > > Mike > > > > > -- > 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] >
How about in /etc/ld.so.conf you make sure /usr/lib is in there. Then run /sbin/ldconfig. Also, why bother with the source RPM? I would rather just get the source tarball direct from PHP.net and run with it. Chris On Wed, 14 Feb 2001, Mike Tuller wrote: > Date: Wed, 14 Feb 2001 12:07:50 -0600 > To: php mailing list <[EMAIL PROTECTED]> > From: Mike Tuller <[EMAIL PROTECTED]> > Subject: [PHP] PDF Functions > > I finally got everything to install on RedHat 7, but I can't do > anything > with pdflib like I had expected. > > I get back Fatal error: Call to undefined function: pdf_new() in > /var/www/html/pdfclock.php on line 7. Line 7 is $pdf = PDF_new(); > > This is rather frustrating that every time I try to install PHP on a > machine > it takes me a week to get it going. > > Here is what I have for the config from the srpm after modification > as > instructed earlier. > > ../configure \ > --prefix=%{_prefix} \ > --with-config-file-path=%{_sysconfdir} \ > --disable-debug \ > --enable-pic \ > --enable-shared \ > --enable-inline-optimization \ > $* \ > --with-exec-dir=%{_bindir} \ > --with-regex=system \ > --with-gettext \ > --with-gd \ > --with-jpeg-dir=%{_prefix} \ > --with-png \ > --with-zlib \ > --with-gdbm \ > --enable-debugger \ > --enable-magic-quotes \ > --enable-safe-mode \ > --enable-sockets \ > --enable-sysvsem \ > --enable-sysvshm \ > --enable-track-vars \ > --enable-yp \ > --enable-ftp \ > --enable-wddx \ > --with-mysql \ > --with-xml \ > --with-pdflib=/usr/lib/lipdf.so.0 \ > --with-tiff > > Can someone look at this and tell me what else I need to put in to > get this > to work? > > Mike > > > > > -- > 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: "Barry Fawthrop" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 1:01 PM Subject: Access my script > I now have my .php3 script works well > How do I access / call this script automatically from a .html page > > or must it be set to a .shtml page ? > > without the user / viewer pressing a link or button >
Quick question.. If I have like 6 variables to pass to another PHP script... and some of the vars are actually multiple lines of text (lets say over 30 lines). What is the best way of doing this? I would like to avoid doing something like test.php?cheese=(30 lines of stuff) Thanks in advance! -Tanya
I am using the following statement to check phone numbers. if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { Can anyone tell me why this works for every character except the -. It doesn't see the hyphen as a valid part of the phone number, even though it recognizes the other characters, e.g. + or . Janet
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Janet Valade) wrote: > if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { > > Can anyone tell me why this works for every character except the -. It > doesn't see the hyphen as a valid part of the phone number, even though it > recognizes the other characters, e.g. + or . Try: if (!ereg("^[0-9+. )(-]{10,}$",$value)) -- CC
the - needs to be immediately after the [ to include that character. Otherwise it is a range indicator. Charlie ----- Original Message ----- From: "CC Zona" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 12:56 PM Subject: Re: [PHP] ereg problem > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Janet Valade) wrote: > > > if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { > > > > Can anyone tell me why this works for every character except the -. It > > doesn't see the hyphen as a valid part of the phone number, even though it > > recognizes the other characters, e.g. + or . > > Try: > if (!ereg("^[0-9+. )(-]{10,}$",$value)) > > -- > CC > > -- > 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] >
[rearranging back to bottom-posting order, for clarity] In article <006d01c096b8$4b9cf3e0$[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Charlie Llewellin") wrote: > ----- Original Message ----- > From: "CC Zona" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 14, 2001 12:56 PM > Subject: Re: [PHP] ereg problem > > > > In article <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] (Janet Valade) wrote: > > > > > if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { > > > > > > Can anyone tell me why this works for every character except the -. It > > > doesn't see the hyphen as a valid part of the phone number, even though > it > > > recognizes the other characters, e.g. + or . > > > > Try: > > if (!ereg("^[0-9+. )(-]{10,}$",$value)) > the - needs to be immediately after the [ to include that character. > Otherwise it is a range indicator. Not quite. The ereg_* functions are based on POSIX 1003.2, which states: "A bracket expression is a list of characters enclosed in `[]'. <snip> If two characters in the list are separated by ` -', this is shorthand for the full range of characters between those two (inclusive) in the collating sequence... <snip> To include a literal `-', make it the first __or last character__, _or the second end-point of a range_. <snip>" (emphasis added) -- CC
Thank you. That was exactly the problem. Janet > -----Original Message----- > From: Charlie Llewellin [SMTP:[EMAIL PROTECTED]] > Sent: Wednesday, February 14, 2001 11:00 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] ereg problem > > the - needs to be immediately after the [ to include that character. > Otherwise it is a range indicator. > > Charlie > ----- Original Message ----- > From: "CC Zona" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 14, 2001 12:56 PM > Subject: Re: [PHP] ereg problem > > > > In article <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] (Janet Valade) wrote: > > > > > if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { > > > > > > Can anyone tell me why this works for every character except the -. It > > > doesn't see the hyphen as a valid part of the phone number, even > though > it > > > recognizes the other characters, e.g. + or . > > > > Try: > > if (!ereg("^[0-9+. )(-]{10,}$",$value)) > > > > -- > > CC > > > > -- > > 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]
Does anyone know the difference between file upload handling in PHP and with Java/JSP? An example of the Java equiv. would be most appreciated. I already know how to do it with PHP and am trying to do a bit of conversion. I'm interested more in the backend processing. thx, jason __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
I'm not sure but I think that may be something still missing from JSP. I am not sure and believe I read about a class or something that handles it. Looking at java.sun.com would probably be your best bet. Michael jason cox wrote: > Does anyone know the difference between file upload > handling in PHP and with Java/JSP? An example of the > Java equiv. would be most appreciated. I already know > how to do it with PHP and am trying to do a bit of > conversion. I'm interested more in the backend > processing. > > thx, > > jason > > __________________________________________________ > 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 a problem when I'm making an upload of big images (see attach), even having,in first step, a function that checks the file size, but when images are bigger the message(attach) appears . Anyone have some problem ? How can I solv this one? T.Y. Best Regards Miguel Loureiro<[EMAIL PROTECTED] >
Hi! I have finally learned to upload file using php. But the problem is that When I upload a file, it disappears from it's place and moves to the location I have told it to go to. It's more like a cut & paste rather then copy and paste... My code is as follows: Index.html: ****************************************************** <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF"> <form method="post" action="upload.php"> <p> <input type="file" name="userfile"> <br> <br> <input type="submit" name="Submit" value="Upload"> </p> <p> </p> <p> </p> <p> </p> </form> </body> </html> ******************************************************* Below is upload.php: ******************************************************* <?php if (copy($userfile, "c:\\upload.txt")) { echo "Succesful"; } else { echo "failure"; } unlink($userfile); ?> ****************************************************** Thank You! Dhaval Desai __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
> I have finally learned to upload file using php. > But the problem is that When I upload a file, it > disappears from it's place and moves to the location I > have told it to go to. It's more like a cut & paste > rather then copy and paste... > if (copy($userfile, "c:\\upload.txt")) This is copying the file. > unlink($userfile); This is deleting the file, making it *seem* as if the file was moved. Chris
Greetings, I was trying to build up a multi-line body to use with the mail command, using code similar to: $mailbody = $mailbody . '\n' . $HTTP_POST_VARS["somefield"]; when I sent the mail, the \n showed up, not as a new line, but a literal \n. How do I fix this? This is with 4.0.4pl1. LER -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
You need to use "\n" for interpolation. --- Larry Rosenman <[EMAIL PROTECTED]> wrote: > Greetings, > I was trying to build up a multi-line body to > use with the mail > command, using code similar to: > $mailbody = $mailbody . '\n' . > $HTTP_POST_VARS["somefield"]; > > when I sent the mail, the \n showed up, not as a > new line, but a > literal \n. How do I fix this? > > This is with 4.0.4pl1. > > LER > > > -- > Larry Rosenman > http://www.lerctr.org/~ler > Phone: +1 972-414-9812 E-Mail: > [EMAIL PROTECTED] > US Mail: 1905 Steamboat Springs Drive, Garland, TX > 75044-6749 > > -- > 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] > __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
* Christian Cresante <[EMAIL PROTECTED]> [010214 13:27]: > You need to use "\n" for interpolation. Tried that too... Didn't work for me... > > --- Larry Rosenman <[EMAIL PROTECTED]> wrote: > > Greetings, > > I was trying to build up a multi-line body to > > use with the mail > > command, using code similar to: > > $mailbody = $mailbody . '\n' . > > $HTTP_POST_VARS["somefield"]; > > > > when I sent the mail, the \n showed up, not as a > > new line, but a > > literal \n. How do I fix this? > > > > This is with 4.0.4pl1. > > > > LER > > > > > > -- > > Larry Rosenman > > http://www.lerctr.org/~ler > > Phone: +1 972-414-9812 E-Mail: > > [EMAIL PROTECTED] > > US Mail: 1905 Steamboat Springs Drive, Garland, TX > > 75044-6749 > > > > -- > > 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] > > > > > __________________________________________________ > 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] -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
* Lewis Bergman <[EMAIL PROTECTED]> [010214 13:50]: > On Wed, 14 Feb 2001, you wrote: > > Greetings, > > I was trying to build up a multi-line body to use with the mail > > command, using code similar to: > > $mailbody = $mailbody . '\n' . $HTTP_POST_VARS["somefield"]; > > > > when I sent the mail, the \n showed up, not as a new line, but a > > literal \n. How do I fix this? > Did you try . "\r\n" . ? I use it though in many places just as you have "\n" Nope, will tonight though. > ... > > -- > Lewis Bergman > Texas Communications > 4309 Maple St. > Abilene, TX 79602 > 915-695-6962 -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Wouldn't the PHP cache/optimizing add-ons make it so it doesn't matter after the first time you run the script anyway? So even if the first pass was a few milliseconds slower it wouldn't be on future executions? Maxim Maletsky wrote: > My advise to you is to care about the portability of software rather then > it's speed. > include() and require() are not too painful, not too slow. You can easily > have 10 of them and by that your page will be slower by only few dozens of > milliseconds. However doing so you could reuse some parts of your code > having your software more dynamic. > > Cheers, > Maxim Maletsky > > -----Original Message----- > From: Soma Interesting [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 14, 2001 5:16 AM > To: [EMAIL PROTECTED] > Subject: [PHP] parse speed vs require speed > > > > 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] > >
What is the best practice for structuring a PHP program which is becoming too large to manage as a single file? Should it be broken into a number of includes, e.g.: switch ($whatever) { case 0: include('case0.php'); break; case 1: include('case1.php'); break; case 2: include('case2.php'); break; } or a number of functions: require('mylib'); switch ($whatever) { case 0: case0(); break; case 1: case1(); break; case 2: case3(); break; } Any thoughts, references to articles (couldn't find anything in PHPBuilder), etc gratefully received... Thanks - John
Hello, I need to be able to create files with unique names. One thought I had was to use the date functions. In windows API you can call a function that returns the number of milliseconds since, I think its January 1, 1970. That number would pretty much be garunteed to be unuquie (although it could be long, noone has to read these names). if I use the PHP gettimeofday() function and get the "usec" value, would this be the same thing? The manual is unclear about what the usecs is in reference to. - John Vanderbeck - Admin, GameDesign
Can somebody give me a url of an example or an example of how to page results so they can be view by clicking page 1 page 2 or back and next? results obtained from mysql database. Thanks Randy
I've written a little program to carry out a process similar to that of the dialectizer at http://rinkworks.com/dialect/ it loads a web page and then runs through the page translating certain words and phrases I would appreciate any comments or advice on the the process I've used and whether anyone can think of improvements in speed and efficiency that I might implement. The conversion dictionary is stored in a mysql database in two columns preconv and postconv I load this into a array and then iterate through the array using the following while ($row= mysql_fetch_array($sql_result)){ $page = eregi_replace("$row[0]","<b><font color='#FF0000'>".$row[1]."</b></font>",$page); } I've chosen eregi because the case insensivity is important. Any thoughts or comments? Allan
Why do the Environment Variables REMOTE_IDENT REMOTE_USER HTTP_FROM HTTP_IDENT and others exists IF they don't return any information ??? Is there anyway to find out Who visit's your site. (1) I'm trying to determine between Search Engines and actual Visitors (2) I'm trying to see who is interested in what I have. I have mailing list and guestbook, yet no-one clicks these Are there any "tricks" I can use to see who these people are ?? This is for a Christian Ministry site, if this is a factor Thanks Barry
I may be totally wrong or missing something, (if so, someone please let me know) but ... 1. One way would be to use the variables and urlencode them before passing them. $var1=urlencode($var1) then you have test.php?cheese="<?echo $var1?>" OR 2. Another way would be to use a form: <form method=post action="test.php"> and then add the 6 variables as <input type=hidden name="var1" value="<?echo $var1?>"> <input type=hidden name="var2" value="<?echo $var2?>"> <input type=hidden name="var3" value="<?echo $var3?>"> <input type=hidden name="var4" value="<?echo $var4?>"> <input type=hidden name="var5" value="<?echo $var5?>"> <input type=hidden name="var6" value="<?echo $var6?>"> and then have a submit button to take you to the next page. Tanya Brethour wrote: > Quick question.. > > If I have like 6 variables to pass to another PHP script... and some of > the vars are actually multiple lines of text (lets say over 30 lines). > What is the best way of doing this? > > I would like to avoid doing something like test.php?cheese=(30 lines of > stuff) > > Thanks in advance! > -Tanya