Re: [PHP] The future of PHP
As a small business owner (partner, actually), I can address this question below: Manuel Lemos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... AFAIK, it costs a lot more money to have any start and operate a e-commerce business than a telephone. What is the motivation to spend that much money? Internet hype? On our website, we use PHP/MySQL to serve up our complete schedule plus juggle event requests from different kinds of people, maintain the look of the site, and serve up audio clips. There's also a large backend component, including maintaining our contact lists (very important for a quartet), a database of all music we know and composers, in order to generate a quick program, our press kit, etc. The PHP end has over 4000 lines of code and MySQL has hundreds of tables. We aren't involved in retail, but that may change. To start up the website for my string quartet, there were a few sunk costs. The computer to develop on, the audio equipment to convert audio clips from recordings to streaming content, and then there is the monthly fee for hosting. I already owned the computer, as I use it for other things like having a computer in the house :). total extra cost: $0 I bought the audio equipment in order to enable the quartet to master our own CDs total relevant cost: $0 (in fact, we saved over what it would cost to go to a big studio) The hosting fee is $10/month. The registration fee for 2 domains (chiaraquartet.net/chiaraquartet.com) is $70/year internet access is free through the university we're in residence at. cost: $0 Total cost: $70+120=$190/year Total cost for phone line: $30/month without long distance. Total phone cost: $30*12 = $360/year There you have it. $360 is most definitely $190. Have we gotten any benefit off of the website? After a year of hosting (and not directly selling anything other than the quartet), several presenters have approached us through the website to offer concerts that paid much more than the cost of maintaining the website. We've gotten the same benefit from having a phone. So, it is definitely worth it, even for a business completely unrelated to technology or even retail sales. Regards, Greg Beaver -- The Chiara String Quartet http://www.chiaraquartet.net -- 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] Error
I still get this error. Can someone help me to solve this? MySQL Query Failed. Error 1030: Got error -1 from table handler $query = SELECT * FROM question WHERE answer'1' AND id250 ORDER BY id; $result = mysql_query($query) or die('MySQL Query Failed. Error '.mysql_errno().': '.mysql_error()); $number = mysql_num_rows($result); -- 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]
RE: [PHP] Error
On 25-Aug-2001 Martin Kampherbeek wrote: I still get this error. Can someone help me to solve this? MySQL Query Failed. Error 1030: Got error -1 from table handler $query = SELECT * FROM question WHERE answer'1' AND id250 ORDER BY id; $result = mysql_query($query) or die('MySQL Query Failed. Error '.mysql_errno().': '.mysql_error()); $number = mysql_num_rows($result); run: repair table question Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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]
Re: [PHP] Error
This is what I get: allach.question repair error The handler for the table doesn't support check/repair - Original Message - From: Don Read [EMAIL PROTECTED] To: Martin Kampherbeek [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, August 25, 2001 9:32 AM Subject: RE: [PHP] Error On 25-Aug-2001 Martin Kampherbeek wrote: I still get this error. Can someone help me to solve this? MySQL Query Failed. Error 1030: Got error -1 from table handler $query = SELECT * FROM question WHERE answer'1' AND id250 ORDER BY id; $result = mysql_query($query) or die('MySQL Query Failed. Error '.mysql_errno().': '.mysql_error()); $number = mysql_num_rows($result); run: repair table question Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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] Re: Displaying all variables currently set?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Ken) wrote: Is there a way to get PHP to list the names and/or contents of all variables? http://php.net/manual/en/function.get-defined-vars.php -- 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] global variable.
hi. I want to use glabal variable. ? global $a; ? but it doesnot work?? 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]
RE: [PHP] Re: send mail to mailing list using mail() or smtp?
I'm sending a huge amount of mails with php. How can I send mail directly to the smtp server? Right now I'm using pipe to send each mail to sendmail. Works fine with about 35 000 mails, but it takes ages to run. What would be the smartest way? Thanks! -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED]] Sent: 25. elokuuta 2001 3:54 To: [EMAIL PROTECTED] Subject: [PHP] Re: send mail to mailing list using mail() or smtp? My question - is this going to work for a few thousand emails? Depends on your server. What about 100,000? No way. Would it be better to send the mail directly to the smtp server? Yes. Can you foresee any problems? Several. The first one is you didn't read the archives or look for pre-existing code to talk to SMTP directly. :-) Manuel's upperdesign.com has one, and there are plenty of others. You could roll your own -- I did, so it can't be too tricky. :-) Also, at that volume, I think you're going to run into trouble just in talking to the all the SMTP servers. I *BELIEVE* one major speed-up can be achieved by sorting the outgoing emails by their recipient's domains... You may want to research how real mailing list software deals with this if you actually expect to hit 100K addresses. If they're all the same email, you'd be *WAY* better off just interfacing to majordomo, ezmlm, SmartList, or whatever other mailing list software was designed to handle this. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- 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] Re: File Upload and NT...
Hi, I had this problem. If you say that even without the getimagesize() it is not being uploaded. Then try this. If you declared $the_image in the input type=file name=the_image try using $the_image_name. From the manual this is what I figured out and it works (on linux) In PHP, the following variables will be defined within the destination script upon a successful upload, assuming that register_globals is turned on in php.ini. If track_vars is turned on, they will also be available in PHP within the global array $HTTP_POST_VARS. Note that the following variable names assume the use of the file upload name 'userfile', as used in the example above: * $userfile - The temporary filename in which the uploaded file was stored on the server machine. * $userfile_name - The original name or path of the file on the sender's system. Adrian On Fri, 24 Aug 2001, Joseph Koenig wrote: Sorry, I know file uploads are asked about all the time... I'm having an odd problem on a WinNT system. When I try to do my upload, I test the file to see the type of it: $image_info = GetImageSize($the_image); However, that line gives me: Warning: getimagesize: Unable to open '/Joe1/Desktop%20Folder/device_eval.gif' for reading. in D:\public\HJ\www.h-jenterprises.com\test\admin\item_functions.php on line 22 At first I had thought this would be a permissions issue, but the file it can't open is the one being uploaded. If I echo the file being uploaded, i get: Image Name: /Joe1/Desktop%20Folder/device_eval.gif I swear I looked at the archive and I've done this plenty of times before (but on Unix). This project is being done on NT, which I'm fairly unfamiliar with though. Any help would be much appreciated. Thanks, Joe -- 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] Re: text wrap in table
Hi, I got the answer from one earlier mail. I used nl2br(). It does just what I want. Adrian On Fri, 24 Aug 2001, Adrian D'Costa wrote: Hi, I am creating a program for a newspaper to publish their article online. There is a form what allows them to cut and past from their editors (word, pagemaker, staroffice). The data is being entered correctly. The problem is when I try and get the data from the table the whole matter scrolls off the screen. I need it to be formatted as the client cut and pastes it (headings, paras, etc). Below is my table and part of my program. mysql desc newsarticles; +--+--+--+-+++ | Field| Type | Null | Key | Default| Extra | +--+--+--+-+++ | id | int(5) | | PRI | NULL | auto_increment | | nid | int(5) | | MUL | 0 || | headline | varchar(100) | | ||| | article | mediumtext | | ||| | date | date | | | -00-00 || | imgpath | varchar(200) | YES | | NULL || +--+--+--+-+++ html head title? echo $row-headline; ?/title /head body bgcolor=white h1 align=center? echo $row-headline; ?/h1 h3 align=center? echo $row-description; ?/h3 table width=600 border=1 tr td valign=top width=70%font face=Arial size=2 color=bluestrong? echo $sd .-. $sm .-. $sy; ?/strongbrpre? echo $row-article; ?/pre/font/td td valign=top width=30%img src=? echo $row-imgpath; ? ? echo $iwh[3]; ? /td /tr /table /body /html I use the pre/pre to display with the line breaks. If I take of the pre it does not wrap but does not give the breaks. To my thinking maybe while entering the data we should give break the lines physically. This is part of my entry form. tr tdfont face=Arial size=2HeadLine/font/td tdinput type=text name=headline size=30 /tr tr tdfont face=Arial size=2Article/font/td tdtextarea name=article cols=60 rows=10/textarea/td /tr tr tdfont face=Arial size=2Upload Image/font/td tdinput type=file name=userfile size=30 wrap=ON/td /tr tr align=center td colspan=2input type=submit value=Submit/td /tr How do I get the text not to wrap and to preserve the formatting given by the client. Adrian -- 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] Re: HELP!!!
I'm not sure if it's right solution but I did this - $ins_u = mysql_query(INSERT INTO users (name,email) VALUES ('$u_name','$u_email')); $userid = mysql_insert_id(); instead for this - $ins_u = @mysql_query(INSERT INTO users (name,email) VALUES ('$u_name','$u_email')); $userid = @mysql_insert_id($ins_u); And it works perfectly Youri On 24 Aug 2001, at 20:51, Richard Lynch wrote: Your mysql_connect is wrong. Stop using just @ to suppress errors, and start doing something useful with http://php.net/mysql_error like sending it to http://php.net/error_log or something. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Brack [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Friday, August 24, 2001 3:25 PM Subject: HELP!!! I have a script with combination: $ins_u = @mysql_query(INSERT INTO users (name,email) VALUES ('$u_name','$u_email')); $userid = @mysql_insert_id($ins_u); It's working fine on local server but now I put it on the web and it sais: Warning: Supplied argument is not a valid MySQL-Link resource in /home/sites/site21/web/incr/submition.inc on line 30 (which is line above) Youri -- 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] global variable again?
hi. I use global in this form: ? global $a; $a=strtotime('now'); . . . echo $a; but in this line dont echo $a I dont know why?? 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] re:help!!!
you must define port or connection. for example in postgres: $conn = pg_connect( host=localhost dbname=big user=postgres password=123); result = pg_exec($conn,select * from personel where name='$ID' and date='now'); I wish your problem solve. nafiseh. -- 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] ImageCopyResampled() versus ImageCopyResized()
Has anyone out there used ImageCopyResampled()? This function was added in PHP 4.0.6 and requires GD 2.0.1 or later. So I haven't been able to try it out yed. I'm just wondering if it will deliver better image quality when you use it to render a shrunk-version of a graphic than ImageCopyResized(), which has been available for some time. Thanks, -D -- 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]
Re: [PHP] global variable again?
Look in the manual: language.variables.scope.html 'global' is meant to use inside a function for accessing vars that are not in a function (the main part). I use global in this form: ? global $a; $a=strtotime('now'); . . . echo $a; but in this line dont echo $a Using global this way does not make sense. Or you are not telling us about functions on this page. Chris H. -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- -- 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] PHP Install Problem - Please Help
Hi All, I'm running Suse Linux 7.1, Kernet 2.4 I have downloaded and installed the latest version of Apache and it's up and running OK It is installed in : /usr/local/apache To Install PHP, i have downloaded the Source and put it in: /usr/local/src/php-4.0.6 To Install PHP I have done this ( ihave specified the location of apxs as Suse Installed an Apache server also, but I want the one I've installed to /usr/local/apache): ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs Then I type: make make install Then I edit /usr/local/apache/conf/httpd.conf The required lines ARE there, ie. LoadModule php4_modulelibexec/libphp4.so AddModule mod_php4.c AddType application/x-httpd-php .php I have also copied /usr/local/src/php-4.0.6/php.ini-dist to /usr/local/lib/php.ini Now the problem : I then go to start my Server as follows: cd /usr/local/apache/bin ./httpd BUT Then I get this: Syntax error on line 236 of /usr/local/apache/conf/httpd.conf: API module structure `php4_module' in file /usr/local/apache/libexec/libphp4.so is garbled - perhaps this is not an Apache module DSO? Line 236 of /usr/local/apache/conf/httpd.conf is : LoadModule php4_modulelibexec/libphp4.so And If I check the file type of libphp4.so as follows: cd /usr/local/apache/libexec/ file libphp4.so I get : libphp4.so: ELF 32-bit LSB shared object, Intel 80386, version 1, not stripped SoCan anybody Help ??? I don't have MySQL installed yet - do I need to have that first ??? Thanks, Martin Stephenson. -- 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] How can I read the value of an existing cookie?
I am new to PHP (probably the question itself shows it...). I am setting up a cookie stating the language the user wishes to have the site written with. No problem up to here. Next time the user goes back to the site I want to read the cookie and, provided it exists, set up the site with the requested language. How can I retrieve the existing value of the cookie? (My cookie looks language,spanish or english or german,time()+1 year). Thank you for your support. Pere -- 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]
RE: [PHP] The future of PHP
hi rasmus: PHP is not marketed the way Java and .NET is. There are no multi-billion dollar corporations behind PHP and asking us, and apparently me personally, to make that happen is unrealistic; true, but who can afford java and .net? oracle..., certainly not the small and medium size companies certainly not african companies certainly not south american companies...and i really belive that's where promotional efforts should go; technology awareness is still low there but the potential is huge and we africans are looking just for this: cheap and reliable technology, that we can learn from which is exactly what open source is about... regards -- 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]
Re: [PHP] AudioGalaxy-like stuff
yeah... but other then returning the image, can it do stuff with DB and all? BTW.. I saw how it's done... it's Javascript all the way... and there's no call to a php script to switch the image... At 03:35 23/8/2001 +0100, you wrote: See this is the lack of my explaining powers :) U click the image, and JScript loads a new image named (image.php) this is infact a php script which returns a image... So it like doing img src=myscript.php where myscript.php will do some GD or something and return a image. That make sense? Bramp - Original Message - From: Christian Dechery [EMAIL PROTECTED] To: Andrew Brampton [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 12:57 PM Subject: Re: [PHP] AudioGalaxy-like stuff At 04:22 22/8/2001 +0100, you wrote: When you click on the image it reloads the image which is really a PHP page which returns a image. That way when it loads the image, it can actually run some PHP and do whatever is required, once done it returns the approiate image That make sense? well, it could, if PHP was client-side... but it isn't... how is it gonna call a PHP function to return something without having to call a PHP script to do that? Even if it is on the same script the page would still have to be reloaded... right? Or wrong? Can u give me some dumb example? . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- 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] sizeof(int)
I am a C programmer, looking to migrate some code to PHP (Unusual, but my colleagues request it). Can someone tell me the size (in bytes) of the type int in PHP. I need a 16 bit (2 byte) storage unit (I use a lot of bitwise operations) Thanx... -- 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]
RE: [PHP] Re: send mail to mailing list using mail() or smtp?
use php for everything from subscription management to email authoring and use a perl script to effectively send the emails At 10:08 25/08/01, Niklas Lampen wrote: I'm sending a huge amount of mails with php. How can I send mail directly to the smtp server? Right now I'm using pipe to send each mail to sendmail. Works fine with about 35 000 mails, but it takes ages to run. What would be the smartest way? Thanks! -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED]] Sent: 25. elokuuta 2001 3:54 To: [EMAIL PROTECTED] Subject: [PHP] Re: send mail to mailing list using mail() or smtp? My question - is this going to work for a few thousand emails? Depends on your server. What about 100,000? No way. Would it be better to send the mail directly to the smtp server? Yes. Can you foresee any problems? Several. The first one is you didn't read the archives or look for pre-existing code to talk to SMTP directly. :-) Manuel's upperdesign.com has one, and there are plenty of others. You could roll your own -- I did, so it can't be too tricky. :-) Also, at that volume, I think you're going to run into trouble just in talking to the all the SMTP servers. I *BELIEVE* one major speed-up can be achieved by sorting the outgoing emails by their recipient's domains... You may want to research how real mailing list software deals with this if you actually expect to hit 100K addresses. If they're all the same email, you'd be *WAY* better off just interfacing to majordomo, ezmlm, SmartList, or whatever other mailing list software was designed to handle this. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- 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]
Re: [PHP] AudioGalaxy-like stuff
well i've not looked how its done... but the PHP script that generates a image, will do DB stuff as well.. But I will go look how its done After looking its just how I said... They use a JSCript call to load a new image.. namly: www.AudioGalaxy.com/satQueue/ + SongID + ? + SID (Where SongID SID are used for something) Where this is actually calling a PHP script, that returns a image to be displayed while also doing some DB stuff... Does this clear it up for you? Andrew - Original Message - From: Christian Dechery [EMAIL PROTECTED] To: Andrew Brampton [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, August 25, 2001 1:44 PM Subject: Re: [PHP] AudioGalaxy-like stuff yeah... but other then returning the image, can it do stuff with DB and all? BTW.. I saw how it's done... it's Javascript all the way... and there's no call to a php script to switch the image... At 03:35 23/8/2001 +0100, you wrote: See this is the lack of my explaining powers :) U click the image, and JScript loads a new image named (image.php) this is infact a php script which returns a image... So it like doing img src=myscript.php where myscript.php will do some GD or something and return a image. That make sense? Bramp - Original Message - From: Christian Dechery [EMAIL PROTECTED] To: Andrew Brampton [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 12:57 PM Subject: Re: [PHP] AudioGalaxy-like stuff At 04:22 22/8/2001 +0100, you wrote: When you click on the image it reloads the image which is really a PHP page which returns a image. That way when it loads the image, it can actually run some PHP and do whatever is required, once done it returns the approiate image That make sense? well, it could, if PHP was client-side... but it isn't... how is it gonna call a PHP function to return something without having to call a PHP script to do that? Even if it is on the same script the page would still have to be reloaded... right? Or wrong? Can u give me some dumb example? . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- 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] Re: global variable.
Nafiseh Saberi [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi. I want to use glabal variable. ? global $a; ? but it doesnot work?? ... why do you think you need to use global here? global is used *in a function* to let it see external variables. You are not in a function, so I don't see why you think you need it. -- 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] Re: sizeof(int)
Saurabh Kapoor [EMAIL PROTECTED] wrote in message 001901c12d63$b1b62100$9e2823d9@killer666">news:001901c12d63$b1b62100$9e2823d9@killer666... I am a C programmer, looking to migrate some code to PHP (Unusual, but my colleagues request it). Can someone tell me the size (in bytes) of the type int in PHP. I need a 16 bit (2 byte) storage unit (I use a lot of bitwise operations) Try this: ?php $val = 2; $last = 1; $pow = 1; echo pre\n(0) 1\n(1) 2; while ($val $last) { $last = $val; $val = $val 1; $pow++; echo \n($pow) $val; } echo /pre; ? Running PHP 4.0.6 on WinMe, I get 32 bits. -- 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]
Re: [PHP] The future of PHP
Good Morning(CST USA here :)) PHP is represented at every important technical conference right alongside Perl and Python. When you hear someone talk about scripting languages, they will usually say Perl, Python and PHP. I don't see any problem with the current state of PHP marketing in the technical community. Is there any marketing done at various universitys? Beyond the the tech market these are new recruits to the arena. Has there ever been a poll done on where the people have picked up PHP? How many people are exposed thru conferences-educational-facilities-book stores etc? Thanks, CCMA -- 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]
Re: [PHP] local time v.s. server time
Hi Joe, GMT isn't affected by daylight savings (altough in the UK we are using British Summer Time at the moment, which is GMT +1), so that's the constant you can work from if you're not experiencing daylight savings schemes where you are. I have written out an example for you below. We get the Y-m-d H:i:s format of time using gmdate() (which Mysql likes). We convert that lot to a timestamp. The function I've created takes two arguments: whether to add or take time from the timestamp that is generated, and the offset in hours. So, to emulate what Mysql's now() function does, you can do something like this ? $now = GenerateOffset(-, 6); // takes off 6 hours. $query = @mysql_query(INSERT INTO table (datetime) VALUES ('$now'), $connection); ? And you should get correct datetime formats for your timezone into your table (providing you have put your correct offset from GMT). ? function GenerateOffset($plusminus, $offset) { $datetime = gmdate(Y-m-d H:i:s); list($date, $time) = explode( , $datetime); list($year, $month, $day) = explode(-, $date); list($hour, $minute, $second) = explode(:, $time); $timestamp = mktime($hour, $minute, $second, $month, $year, $day); if ($plusminus == +) { $newtime = $timestamp + (3600 * $offset); } else { $newtime = $timestamp - (3600 * $offset); } $newdate = date(Y-m-d H:i:s, $newtime); return $newdate; } ? Hope this helps. James Joe Sheble ) [EMAIL PROTECTED] wrote in message Alas, I don't have this luxury since it's not my server, but one that is hosted with a web hosting provider. They control the setup and configuration of the machines... since it's a shared server I doubt I'll convince them to set the timezone to my location, thus throwing everyone else on the same server out of whack... I can use the putenv() function though for use in PHP and then when saving the date and time into mySQL actually use the PHP date and time functions instead of the mySQL Now() function... Where would I find the TZ codes to use for my area? thanx -Original Message- From: Don Read [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 8:39 PM To: Joe Sheble (Wizaerd) Cc: General PHP List Subject: RE: [PHP] local time v.s. server time On 25-Aug-2001 Joe Sheble \(Wizaerd\) wrote: My website is hosted with a provider, and there is a three hour difference in timezones, so when saving date and times to the database, they reflect the server time and not my own local time. The clincher is I know I could do some time math and just substract 3 hours, but I live in Arizona, so we do not go through daylight savings time. So right now it's a three hour difference, but when the time change happens, I'll only be two hours behind. Because of this, what is the best method to get my local date and time entered into the database instead of the server date and time?? In my case the server is in Atlanta, but I have to sync with my credit-card processor on the left coast. So first i start the database (MySQL) on Pacific time with: - TZ=PST8PDT export TZ /usr/local/bin/safe_mysqld --user=mysql /dev/null To make PHP date/time functions jive, during initialization: putenv('TZ=PST8PDT'); // Server on Pacific time No matter that i'm in Texas (CST), everything is now reported on Pac time. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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]
RE: [PHP] The future of PHP
This is an aside ... At 02:08 AM 8/25/01 -0400, Cristopher Daniluk wrote: After following this thread for a while, it seems like there is a lot of discrepancy between what is success and what isn't for PHP. I do not believe PHP will ever become the ubiquitous web language, if for no other reason than because it isn't always the right choice for your web based project. Ubiquity comes from having a hammer, and treating everything like a nail. A person uses the tool he's comfortable with, and knows its quirks and shortcuts. I do not believe, despite periodic resurgence, that there will ever be one master language. Past candidates were ... Modula, ADA, Smalltalk ... others? Remember the fifth generation computers? The competent craftsman either uses the right tool, or knows how to quickly bodge something together with what is at hand. Same for programmers, of whatever sex. PHP is already a strong option in many corporate environments. Really from what I've seen lately, the only reason it loses out to Java, ASP (uggh), or other similar options is that it is difficult to find a team of qualified PHP developers. Even if you can get the project off the ground, the continual maintenance is a problem. I believe this does a great injustice to the many fine programmers who have mastered one or more languages, but have not yet encountered PHP. Anyone who has a sound working knowledge of Java, ASP, Python or Perl, and is a competent programmer, would become productive very quickly in PHP. T'aint that difficult. Even a VB user may come to appreciate its brevity and conciseness. g As for the maintenance issue, that relates more to design and judicious use of comments. It is very easy, particularly with PHP or ASP, to produce pages with a horrible, hard-to-follow commingling of straight HTML and scripting language, so that maintenance, for anyone, is very difficult. It is also easy to end up with obfuscated code in any of the main line, structured, languages. Miles Thompson Simply put, I think this means we have great potential to have long term success, as far as penetrating the corporate market. As employers start finding the qualified people out there, and as people re-train/relearn, and as fresh meat comes out, the job market will sustain our growth. I would say we don't need the multi-billion dollar backing to be successful as well. Linux, as you particularly mentioned, is shunned by a lot of suits, but it has grown - and that growth has sustained itself over the last 10 years, more relevantly the last 4-5. It's starting to get a little more attractive to suits as bigger and bigger and bigger companies sponsor or use it. I envision PHP going down this road as well, though I obviously don't expect the same grandeur that Linux has received. We will achieve this by doing exactly what Rasmus said - developing a good product. Though I must digress on the subject of technical conferences. While they're valuable and by all means we should be there, I believe the true value will come when people do our work for us - we need to prove to the world that it is cool to use PHP, and they'll make sure all their friends are cool too :) Regards, Cristopher Daniluk President CEO email: [EMAIL PROTECTED] direct: 330/530-2373 Digital Services Network, Inc Unleashing Your Potential voice: 800/845-4822 web: http://www.dsnet.net/ -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 25, 2001 1:52 AM To: Manuel Lemos Cc: [EMAIL PROTECTED] Subject: Re: [PHP] The future of PHP So, it is very hard to convince the anybody to bet all the farm in PHP. You may have the technical arguments, but is not enough, I'm afraid. You in particular, may not need to convince others to bet on PHP, but it is nothing like that for most people that want to live from software development. They have to put up with work/business opportunities that the market offers to live from it. So, today, I'm afraid that you already still have an hard time to convince people to dedicate only to PHP, even those that know and believe PHP is that great. PHP is represented at every important technical conference right alongside Perl and Python. When you hear someone talk about scripting languages, they will usually say Perl, Python and PHP. I don't see any problem with the current state of PHP marketing in the technical community. PHP is not marketed the way Java and .NET is. There are no multi-billion dollar corporations behind PHP and asking us, and apparently me personally, to make that happen is unrealistic. Like Linux 5 years ago, PHP is adopted by the techies and somewhat shunned by the suits because they haven't read about it in their latest advertisement-sponsored magazine. We can't possibly hope to compete with Sun and Microsoft when it comes to suit-oriented marketing drivel. What we can do is concentrate on what we do best. Writing a solid and very focused tool.
Re: [PHP] How can I read the value of an existing cookie?
on 8/25/01 6:20 AM, Pere at [EMAIL PROTECTED] wrote: I am setting up a cookie stating the language the user wishes to have the site written with. No problem up to here. Next time the user goes back to the site I want to read the cookie and, provided it exists, set up the site with the requested language. How can I retrieve the existing value of the cookie? (My cookie looks language,spanish or english or german,time()+1 year). $HTTP_COOKIE_VARS[language] if register_globals is on, you should be able to use $language mike Thank you for your support. Pere -- mike cullerton -- 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]
RE: [PHP] local time v.s. server time
Thanx James for your answers... perhaps I'm missing a piece of the puzzle, but here is how I corrected or fixed it. In my included file that gets included in every app and every page, I placed: putenv( TZ=America/Phoenix ); and all my dates are now local time. SO saving to a mySQL database now I merely pass in: $now = date( Y-m-d H:i:s ); $result = mysql_query( INSERT INTO table ( datetime ) values( '$now' ), $dbConn ); If I ever distribute this app (doubtful) I'll include a fairly extensive listing of timezones so the putenv() could be appropriately changed... the list I found and would most likely include is here: http://www.theprojects.org/dev/zone.txt -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 25, 2001 8:11 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] local time v.s. server time Hi Joe, GMT isn't affected by daylight savings (altough in the UK we are using British Summer Time at the moment, which is GMT +1), so that's the constant you can work from if you're not experiencing daylight savings schemes where you are. I have written out an example for you below. We get the Y-m-d H:i:s format of time using gmdate() (which Mysql likes). We convert that lot to a timestamp. The function I've created takes two arguments: whether to add or take time from the timestamp that is generated, and the offset in hours. So, to emulate what Mysql's now() function does, you can do something like this ? $now = GenerateOffset(-, 6); // takes off 6 hours. $query = @mysql_query(INSERT INTO table (datetime) VALUES ('$now'), $connection); ? And you should get correct datetime formats for your timezone into your table (providing you have put your correct offset from GMT). ? function GenerateOffset($plusminus, $offset) { $datetime = gmdate(Y-m-d H:i:s); list($date, $time) = explode( , $datetime); list($year, $month, $day) = explode(-, $date); list($hour, $minute, $second) = explode(:, $time); $timestamp = mktime($hour, $minute, $second, $month, $year, $day); if ($plusminus == +) { $newtime = $timestamp + (3600 * $offset); } else { $newtime = $timestamp - (3600 * $offset); } $newdate = date(Y-m-d H:i:s, $newtime); return $newdate; } ? Hope this helps. James Joe Sheble ) [EMAIL PROTECTED] wrote in message Alas, I don't have this luxury since it's not my server, but one that is hosted with a web hosting provider. They control the setup and configuration of the machines... since it's a shared server I doubt I'll convince them to set the timezone to my location, thus throwing everyone else on the same server out of whack... I can use the putenv() function though for use in PHP and then when saving the date and time into mySQL actually use the PHP date and time functions instead of the mySQL Now() function... Where would I find the TZ codes to use for my area? thanx -Original Message- From: Don Read [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 8:39 PM To: Joe Sheble (Wizaerd) Cc: General PHP List Subject: RE: [PHP] local time v.s. server time On 25-Aug-2001 Joe Sheble \(Wizaerd\) wrote: My website is hosted with a provider, and there is a three hour difference in timezones, so when saving date and times to the database, they reflect the server time and not my own local time. The clincher is I know I could do some time math and just substract 3 hours, but I live in Arizona, so we do not go through daylight savings time. So right now it's a three hour difference, but when the time change happens, I'll only be two hours behind. Because of this, what is the best method to get my local date and time entered into the database instead of the server date and time?? In my case the server is in Atlanta, but I have to sync with my credit-card processor on the left coast. So first i start the database (MySQL) on Pacific time with: - TZ=PST8PDT export TZ /usr/local/bin/safe_mysqld --user=mysql /dev/null To make PHP date/time functions jive, during initialization: putenv('TZ=PST8PDT'); // Server on Pacific time No matter that i'm in Texas (CST), everything is now reported on Pac time. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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
Re: [PHP] help
That will stop fread from producing errors. So, if you don't want to see any error's from fread, put a in front of it. This can also be done with other functions: $db = mysql_select_db(dbname); Tyler Longren On Sat, 25 Aug 2001 15:03:49 +1000 GaM3R [EMAIL PROTECTED] wrote: can anyone explain to me exactly what this would do differently? $data = fread($fp, filesize($file)); $data = fread($fp, filesize($file)); ... Cameron outworld.cx -- 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] Images Download
Hello, I want to create a script that would read the contents of an HTML file (I can use Snoopy class for that) and then, download some respective type of files from a page (let's say .zip files)... Any ideas how do I start or if anyone create something like that? Thank you and please, reply to [EMAIL PROTECTED] Rom __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.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]
Re: [PHP] How can I read the value of an existing cookie?
Thanks, Mike, for your help. Best regards, Pere Mike Cullerton [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 8/25/01 6:20 AM, Pere at [EMAIL PROTECTED] wrote: I am setting up a cookie stating the language the user wishes to have the site written with. No problem up to here. Next time the user goes back to the site I want to read the cookie and, provided it exists, set up the site with the requested language. How can I retrieve the existing value of the cookie? (My cookie looks language,spanish or english or german,time()+1 year). $HTTP_COOKIE_VARS[language] if register_globals is on, you should be able to use $language mike Thank you for your support. Pere -- mike cullerton -- 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] regenerate variables?
Hi, I know, the topic looks freaky, let me explain. I have a formular with many input fields called for example firm[0], firm[1] etc. Now I submit and have the values of this variables. But I have so many input fields, that I want to generate the variables by reading the names from a mysql table. I have an table with a field called firm. Now I read the name firm from the table in a variable called $field, put in in a loop an do like this: echo $ . $field[$counter]; Now I have back my $firm[0]. But how can I generate from this a variable to get back my value of this? I hope you understand me, great thanks for any help, because I get nearly crazy from this problem. best regards, Christian Springub -- 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] $i % 2 ? 0:
Hi Can someone explain to me what $i % 2 ? 0: means or what it does step by step? I was looking in PHP docs for ? and : and didn't find it there. I use this line in my script to assign different value for $bgcolor variable to color rows in result, but I want to understand what does it mean. Thank you in advance, Youri God is our provider http://www.body-builders.org -- 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]
Re: [PHP] $i % 2 ? 0:
it's an if/else shortcut. the part before the '?' is tested. '$i % 2' in your case. the part after the '?' is returned if the test evals to true. '0' in your case. the part after the ':' is returned if the test evels to false. i've never tried it with nothing after the ':' like in your case. guess it could be the same as an if without an else. hope this helps, mike on 8/25/01 10:38 AM, BRACK at [EMAIL PROTECTED] wrote: Hi Can someone explain to me what $i % 2 ? 0: means or what it does step by step? I was looking in PHP docs for ? and : and didn't find it there. I use this line in my script to assign different value for $bgcolor variable to color rows in result, but I want to understand what does it mean. Thank you in advance, Youri God is our provider http://www.body-builders.org -- mike cullerton -- 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]
Re: [PHP] $i % 2 ? 0:
Mike Cullerton [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... it's an if/else shortcut. the part before the '?' is tested. '$i % 2' in your case. the part after the '?' is returned if the test evals to true. '0' in your case. Documentation at http://www.php.net/manual/en/language.operators.comparison.php Think of ( A ? B : C ) as if (A) return B; else return C; For example, $a = 2; echo The value of a is . ($a == 2 ? : not ) . 2; -- 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]
Re: [PHP] help
Tyler Longren [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sat, 25 Aug 2001 15:03:49 +1000 GaM3R [EMAIL PROTECTED] wrote: can anyone explain to me exactly what this would do differently? $data = fread($fp, filesize($file)); $data = fread($fp, filesize($file)); That will stop fread from producing errors. So, if you don't want to see any error's from fread, put a in front of it. This can also be done with other functions: $db = mysql_select_db(dbname); You're thinking of the @ error-control operator. '=' is 'get a reference to the returned array'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Stripping line break characters
I need to strip line break characters (or whatever the character is that results from users hitting their enter key inside a TEXTAREA form input) from a string. These characters will appear anywhere in the string, not just at the end. In perl, the regex would look something like this... $a=a\nb\nc\nd\n\n\n; $b=$/; $a =~ s/$b//g; # produces abcd but i'm a newbie and i don't know how I can translate this to PHP syntax to do the same thing. Any help is appreciated! Thanks! providing the finest in midget technology -- 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] Re: Stripping line break characters
Rory O'Connor [EMAIL PROTECTED] wrote: $sql2=str_replace(,\n,$sql2); $sql2=str_replace(,\r,$sql2); you've got the first two arguments backwards. $sql2=str_replace(\n,,$sql2); $sql2=str_replace(\r,,$sql2); or with php4.0.5 (or later): $sql2=str_replace(array(\n,\r),,$sql2); for more details: http://www.php.net/manual/en/function.str-replace.php jim -- 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] relative filename /home/www... in stead of /www/.....
dear group, I use the $DOCUMENT_ROOT to make a complete file name. $fpname=$DOCUMENT_ROOT.'/includes/blocks/dynmenu.php'; It does not work on one site: the document root misses the /home/ start. I could just hardcode this but i'ld rather have a function that would work everywhere. What can i do? Warning: fopen(/www/ecodorp/admin/modules/dynmenu.src,r) - No such file or directory in /home/www/ecodorp/php/post/admin/modules/dynmenu.php on line 378 I cannot open /www/ecodorp/admin/modules/dynmenu.src Chris -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- -- 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] Re: source of global variable
I'm not sure of the problem but something like ? if ($condition) { echo $time} else { //do something else} ? You can also print or echo html from php if that helps your program flow like ? echo Table TRTHtitle/TH/TR TRTD$data/TD/TR /Table; ? Often you will want to generate the table rows in an if() or while() statement You can do the same thing with any html tags , javascript, etc. Web pages are not static so pass parameters you need through url A php trick is that a href=$PHP_SELF?params calls itself with the parameters you give it. This works on form action= statements too HTH Nafiseh Saberi wrote: hi. I write program with php,then for build table I must to close it, write html tag and then open php and continue,... I ask time in one line and in another line I want to show it. but I want the first line doesnot run in all condition. I think my problem will solve with static variables.??? thanks. -- Dell Coleman, Principal PICO Technology Corp. Victoria, BC Email [EMAIL PROTECTED] Web http://members.home.com/pico/ -- 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] Echo/Print
I am fairly new to PHP Scripting, and I am learning from a book. Throughout the book, print is used as the basic command to output text/variables.. yet I see almost everyone in here uses echo. Might I ask what the differences of the two are, and if there are any benefits of using one over the other? Thanks, Andy -- 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] Re: source of global variable
I think I did misunderstand -- php is not like C where you declare things global both in the main program and in subroutines. If you are not in a function everything is automatically global; in php functions you need to declare variables to be global. --so you don't need it the problem looks like the call to strtotime('now') see http://www.php.net/manual/en/function.strtotime.php for the proper usage -- 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] Re: Stripping line break characters
Hi! $sql2=str_replace(,\n,$sql2); $sql2=str_replace(,\r,$sql2); well that was easy: manual: string str_replace (string needle, string str, string haystack) and you did: str_replace (string str, string needle, string haystack) So better try $sql2=str_replace(\n,,$sql2); $sql2=str_replace(\r,,$sql2); Time to get some sleep ? ;-) cheers, Chris H. -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- -- 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] Program to check for cookies
Is there a program which will check for cookies before it allows access into the web site ? I want the user to enter the userid/password on a secure web server and pass the cookie information to the regular server. I don't want them to access regular web server without that cookie being enabled through the secure server. Thank You Sunil __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.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]
Re: [PHP] multi-dimensional array won't echo
Not only a good answer, but the best explanation. thanks, bill hollett Rasmus Lerdorf wrote: The first echo statement doesn't work, the second does. Anybody know why? $string1=15; $string2=27; $myarray[$string1][$string2]=syncopated; echo $myarray[$string1][$string2]br /\n; //displays Array[27] echo $myarray[$string1][$string2] . br /\n; //displays syncopated Complex variables inside quoted strings need to be dereferenced using {}'s eg. echo {$myarray[$string1][$string2]}br /\n; Or better yet: echo $myarray[$string1][$string2] . br /\n; -Rasmus -- 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]
Re: [PHP] Program to check for cookies
I have a form that submits data to a database, works great until someome puts in an apostrophe in the comments area...how do i escape this charecter upon insert? -- 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] Re: escaping special charecters upon submit
I have a form that submits data to a database, works great until someome puts in an apostrophe in the comments area...how do i escape this charecter upon insert? -- 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]
RE: [PHP] The future of PHP
Hmmm. Manuel what's that you're smoking? Where can I get some? M -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: 24 August 2001 20:30 To: [EMAIL PROTECTED] Subject: Re: [PHP] The future of PHP Hello, Egan wrote: On Fri, 24 Aug 2001 15:34:04 -0300, Manuel Lemos [EMAIL PROTECTED] wrote: Many small businesses would like to do e-commerce, but can't afford expensive consultants, expensive hardware, and expensive software tools developed by huge corporations. e-commerce? You mean B2C? Can small business live from that? I'm afraid not! Maybe I am wrong. :-) 100 years ago you could easily do business without a telephone. But what percentage of businesses today operate without a telephone? A web presence with web commerce will become a utility like the telephone. Having it will be more important than measuring artificial distinctions between B2C vs. B2B. Huh? That's a nice marketoid speech for you to talk Internet-ignorant people to get into e-commerce, but what does that have to do with my question? Can small business live from e-commerce today? Look at all the large corporations bleeding money and cutting staff. Mega-corporations are in decline, and their era is ending. Long live the small business! What? Large business are being affected because the whole networking business is in recession. Large corporations don't know you or care about you as an individual customer. You're just an account number to them. The only thing they care about is the big sale to other big corporations. But even then, do they really care? Not in my experience. The networking recession is just one symptom of their disease. Do you really believe that? As far as I can recall, this recession started when a mean judge convicted Microsoft for anti-trust practices. That caused NASDAQ crash that scared people away from investing in tech company stocks. Many Internet companies dried and without cash from the investors many went bankrupt. That affected all the small or big corporations that have grown and were dependent on the networking market. I don't think this affected much non-technological companies, big or small. So I don't think your anti-big corporations speech has much to do with this. Regards, Manuel Lemos -- 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]
Re: [PHP] konquerer and php
I should probably just forget I ever sent this post, but in case anyone is curious, the problem was that I was using the address cached in the address bar in Konqueror to open the home page of the application. For some reason this address was file: /var/ww/html/homepage.html instead of http://localhost/blahblahblah.html and I never noticed. So the html pages looked normal, but without the server, the php pages left something to be desired. Thanks, SW On Friday 24 August 2001 09:15, you wrote: Original message From: Scott [EMAIL PROTECTED] Date: Thu, Aug 23, 2001 at 08:29:07PM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] konquerer and php I have a database browser that I made with php and mysql. When I use it in Netscape it behaves normally. However when I view it using Konquerer, all kinds of php code shows up on the screen when I execute a php page. I thought that Konquerer might not be recognizing the ? and ? start and end tags so I tried script language=php and /script. However if I use these nothing at all shows up on the screen. Can someone tell me what the problem is? Thanks, SW -- 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 Reply For the script execution it doesn't matter at all which browser you use. PHP is processed server-side, so the browser just gets 'plain' HTML. I guess something else is wrong than using a different browser. /Reply -- 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] Re: escaping special charecters upon submit
http://www.php.net/manual/en/function.addslashes.php That should work fine. -Andy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a form that submits data to a database, works great until someome puts in an apostrophe in the comments area...how do i escape this charecter upon insert? -- 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] last bit of help ....
I need to output an array to a text file, now I have created the text file now I just need to write to it, well I need to get the output of the browser to this text file. HOw can i do this, oh and return each line ... heres the code that gets the output array1.php ? // Mail text file extractor. // Written to extract out certain parts of the file and output in a csv friendly format. // Dan McCullough include(functions.php); if ($submit) { $extract = eXtractor1($file_name,$tmp_file_name,$new_file_name); if ($extract) { //here goes, get the parsed file from the output of the grep command. //read the file and output $fcontents = file(/tmp/$tmp_file_name, r); // run this funtion to format and display the file in a certain output. function GetField($offset) { global $fcontents; global $new_file_name; return trim(substr($fcontents[$offset], strpos($fcontents[$offset], ))); } for($i = 0, $count = sizeof($fcontents); $i $count; $i += 6) { // Make the numbers 1-6 constants if desired echo GetField($i + 1) . , . GetField($i + 2) . , . GetField($i + 3) . , . GetField($i) . , . GetField($i + 5) . , . GetField($i + 4) . ,yesbr\n; } exit;} } ? html head titleExtractor/title /head body form method=post action=? echo $PHP_SELF; ? Please input the name of the text file.brbr File to extract: input type=text name=file_namebr Temp file name: input type=text name=tmp_file_namebr CSV File Name: input type=text name=new_file_namebr input type=submit name=submit value=submit /form /body /html function.php function eXtractor1($file_name,$tmp_file_name,$new_file_name) { global $file_name; global $tmp_file_name; global $new_file_name; $filename = /tmp/$tmp_file_name; $newfilename = /tmp/$new_file_name; if (!file_exists($filename)) { touch($filename); // Create blank file touch($newfilename); chmod($filename,0777); chmod($newfilename,0777); $command = cat /home/sites/projects/web/extractor/$file_name | egrep 'State:|Name:|Address:|City:|e-mail:|Zip:'$filename; system($command); ## nothing worked for me until I added this next line. system(exit(0)); } return $tmp_file_name; return $new_file_name; } ? anythoughts would be appreaciated dan = Dan McCullough --- Theres no such thing as a problem unless the servers are on fire! h: 603.444.9808 w: McCullough Family w: At Work __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.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]
Re: [PHP] Re: escaping special charecters upon submit
Tried addslashes also urlencode, neither worked... the input is from a comment area in a form...that adds data to a mysql database...the comments contain commas and apostrphes, that when you try to subit, screw up the execution of the insert Any help would be very very very very appreciateddriving me nuts. http://www.php.net/manual/en/function.addslashes.php That should work fine. -Andy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a form that submits data to a database, works great until someome puts in an apostrophe in the comments area...how do i escape this charecter upon insert? -- 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]
Re: [PHP] Echo/Print
Thanks! Helped a lot. -Andy Jeff Oien [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can read the notes lower on the page here to get a good idea: http://www.php.net/manual/en/function.print.php Jeff Oien I am fairly new to PHP Scripting, and I am learning from a book. Throughout the book, print is used as the basic command to output text/variables.. yet I see almost everyone in here uses echo. Might I ask what the differences of the two are, and if there are any benefits of using one over the other? Thanks, Andy -- 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]
Re: [PHP] Re: escaping special charecters upon submit
On 26-Aug-2001 [EMAIL PROTECTED] wrote: Tried addslashes also urlencode, neither worked... the input is from a comment area in a form...that adds data to a mysql database...the comments contain commas and apostrphes, that when you try to subit, screw up the execution of the insert Any help would be very very very very appreciateddriving me nuts. The Ouji board: 'check line 47' (but then it always sez that). How about posting some code ? Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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]
Re: [PHP] Re: escaping special charecters upon submit
mine always says ask don lol...actually got it figured out right after muy last post rawurlencode worked great Thanks though! On 26-Aug-2001 [EMAIL PROTECTED] wrote: Tried addslashes also urlencode, neither worked... the input is from a comment area in a form...that adds data to a mysql database...the comments contain commas and apostrphes, that when you try to subit, screw up the execution of the insert Any help would be very very very very appreciateddriving me nuts. The Ouji board: 'check line 47' (but then it always sez that). How about posting some code ? Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- 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]
Re: [PHP] The future of PHP
Hello Rasmus, Rasmus Lerdorf wrote: So, it is very hard to convince the anybody to bet all the farm in PHP. You may have the technical arguments, but is not enough, I'm afraid. You in particular, may not need to convince others to bet on PHP, but it is nothing like that for most people that want to live from software development. They have to put up with work/business opportunities that the market offers to live from it. So, today, I'm afraid that you already still have an hard time to convince people to dedicate only to PHP, even those that know and believe PHP is that great. PHP is represented at every important technical conference right alongside Perl and Python. When you hear someone talk about scripting languages, they will usually say Perl, Python and PHP. I don't see any problem with the current state of PHP marketing in the technical community. I think that is not the largest part of the PHP community. Let me explain: I believe the largest part of the community is made of those that develop Web sites and applications for some one else and do it for a living. Many of those don't always manage to make the technological decisions, their bosses do. There you have two problems: convince those bosses that PHP is still a superior technical solution to solve their development needs as they evolve, and then convince them that other languages/technologies that have been also evolving are not yet as good as PHP, despite they have been flooded of news from everywhere that they are much more advanced and better for the developer needs. The first problem is technical. You just keep developing PHP to satisfy the user needs as soon as you perceive them and that's it. The second problem is marketing. It doesn't matter for people that have to make the decisions how much better PHP in fact is if people don't hear about it. Even if they hear about it, it may not be enough if they hear much more from the rest (Java, ASP.Net, C#, , whatever). Here PHP looses bigtime. You may not want to believe me, but I am afraid that unless PHP is better marketted, soon or later its market acceptance will be weakened. PHP is not marketed the way Java and .NET is. There are no multi-billion dollar corporations behind PHP and asking us, and apparently me That's not my point. Some marketing is better than no marketing at all which is what you do today. There are plenty of ways to do some marketing on PHP that don't even cost money to you. personally, to make that happen is unrealistic. Like Linux 5 years ago, PHP is adopted by the techies and somewhat shunned by the suits because they haven't read about it in their latest advertisement-sponsored magazine. oh, man Linux was a different story. Expecting a similar future for PHP I'm afraid it may be wishful thinking. PHP is mostly focused on Web development. Web market is fading out. Even if you can do non Web programming with PHP, most people are not aware of that. You need to do some marketing to put in evidence that PHP is as much capable for non-Web programming. There you have another big problem that is there is no affordable way to compile and generate executables from PHP programs. I know that historically you never liked this ability into PHP programs, but that is a vital need for people that will want to distribute their programs like VB or Delphi programs. We can't possibly hope to compete with Sun and Microsoft when it comes to suit-oriented marketing drivel. What we can do is concentrate on what we do best. Writing a solid and very focused tool. Building the grassroot community and being visible at all relevant technical conferences. If we continue to do this, I see no reason for any dropoff in PHP popularity which leads directly to more and more corporate acceptance. You believe in whatever you want, off course, but I think it is time to adjust course. Assumming that the future of PHP is just a technical matter, I'm affraid you are neglecting an important part of the equation: the people. The needs and beliefs change through time. I am try to show my current view of what people feel and need today that I don't see addressed. You can see that and work on the changes if you agree. I have more ideias if you care to work on that direction. Regards, Manuel Lemos -- 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]
Re: [PHP] Re: The secrecy of PHP code
If your php-code is on a web-server which gives access to other than you they can read your code. An example could be other people being hosted on the same server.. Not necessarily. You can enable safe_mode and/or set an open_basedir in order to prevent those people from doing that. You should also ensure that your *nix permissions won't allow them to do that without interacting with the Web server. -- 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] Safe mode + /usr/share/php
Is it possible to use safe mode yet allow all scripts to include any files from /usr/share/php? Normal users ain't gonna have *write* access to that directory, so it shouldn't be much of a security concern, I just don't know how to do this. I know that I can disable safe_mode and enable open_basedir, but that will create yet another security hole because normal users will be able to alter LD_LIBRARY_PATH, which is not a very good idea. AFAIK, they can make PHP load a custom glibc and thus gain root access to the box if I allow them to do that. -- 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]
Re: [PHP] Safe mode + /usr/share/php
A recent feature addition (4.0.7) is a safe_mode_include_dir php.ini directive where you can do exactly this. -Rasmus On Sun, 26 Aug 2001, Artyom Plouzhnikoff wrote: Is it possible to use safe mode yet allow all scripts to include any files from /usr/share/php? Normal users ain't gonna have *write* access to that directory, so it shouldn't be much of a security concern, I just don't know how to do this. I know that I can disable safe_mode and enable open_basedir, but that will create yet another security hole because normal users will be able to alter LD_LIBRARY_PATH, which is not a very good idea. AFAIK, they can make PHP load a custom glibc and thus gain root access to the box if I allow them to do that. -- 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] thanks Dell coleman!
hi. thanks . can you describe more about a href=$PHP_SELF?params ??? nafiseh. -- 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] disable_functions....
Does anyone know if its possible to use disable_functions on only specified directories, and not all? Hopefully its possible.. -- 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]
Re: [PHP] disable_functions....
Any php.ini directive can be used in your httpd.conf on a per-dir basis. See the manual.. -Rasmus On Sat, 25 Aug 2001, Andy Ladouceur wrote: Does anyone know if its possible to use disable_functions on only specified directories, and not all? Hopefully its possible.. -- 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]
RE: [PHP] Re: escaping special characters upon submit
Try this: $text = nl2br(htmlspecialchars(stripslashes($text))); With $text being the data outputted. It will replace apostrophes, quotes, etc. with their proper html formatting. Example: input: PHP is Cool! html output: quot;PHP is Cool!quot; Then if you don't want the $quot;, or whatever is outputted depending on the input, you can write a script to strip them out if you like. There are lots of things you can do from this point. Anyway, hope that helps you out... Navid -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 25, 2001 2:49 PM To: Sunil Jagarlamudi; [EMAIL PROTECTED] Subject: [PHP] Re: escaping special charecters upon submit I have a form that submits data to a database, works great until someome puts in an apostrophe in the comments area...how do i escape this charecter upon insert? -- 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 Digest 26 Aug 2001 07:54:07 -0000 Issue 838
php-general Digest 26 Aug 2001 07:54:07 - Issue 838 Topics (messages 64449 through 64478): Re: Stripping line break characters 64449 by: Rory O'Connor 64450 by: jimw.apache.org 64458 by: Chris Hayes relative filename /home/www... in stead of /www/. 64451 by: Chris Hayes multi-dimensional array won't echo 64452 by: bill 64455 by: Rasmus Lerdorf 64460 by: bill Re: source of global variable 64453 by: Dell Coleman 64457 by: Dell Coleman Echo/Print 64454 by: Andy Ladouceur 64456 by: Jeff Oien 64468 by: Andy Ladouceur Program to check for cookies 64459 by: Sunil Jagarlamudi 64461 by: idesign.tampabay.rr.com Re: escaping special charecters upon submit 64462 by: idesign.tampabay.rr.com 64465 by: Andy Ladouceur 64467 by: idesign.tampabay.rr.com 64469 by: Don Read 64470 by: idesign.tampabay.rr.com Re: The future of PHP 64463 by: Martin Wright 64471 by: Manuel Lemos Re: konquerer and php 64464 by: Scott last bit of help 64466 by: Dan McCullough Re: The secrecy of PHP code 64472 by: Artyom Plouzhnikoff Safe mode + /usr/share/php 64473 by: Artyom Plouzhnikoff 64474 by: Rasmus Lerdorf thanks Dell coleman! 64475 by: nafiseh saberi disable_functions 64476 by: Andy Ladouceur 64477 by: Rasmus Lerdorf Re: escaping special characters upon submit 64478 by: Navid Yar 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] -- I have been trying similar arrangements, but to no avail. I think it has something to do with the actual string I am checking - it's an SQL statement. I am trying to create a log of SQL statements in a textfile, and the newline/return characters that people put in the TEXTAREA is screwing it up. But I can't for the life of me figure out why test code such as this does not strip out the \n's... - $sql = UPDATE contact set firstname = 'rory', lastname = 'jones', interest = 'rory', optin = 'yes', comments = 'hello\n\n,rory' WHERE id = 5055; $sql2=$sql; $sql2=str_replace(,\n,$sql2); $sql2=str_replace(,\r,$sql2); - it is still outputting the following to my log: - UPDATE contact set firstname = 'rory', lastname = 'jones' interest = 'rory' optin = 'yes' comments = 'hello ,rory' WHERE id = 5055; - Any help is appreciated! Thanks On Sat, 25 Aug 2001 11:17:43 -0700, Rory O'Connor [EMAIL PROTECTED] wrote: I had the same problem, I was writing the textarea to a text file,and reading it using fgets, therefor, any unspecified newlines would really mess my script up. This probably isn't the best solution, but it'swhat I used,and works fine. $data=$textarea; $data=str_replace(,\n,$data); $data=str_replace(,\r,$data); That's all there was to it, it replaced all newlines and returns with blanks. You can change it to replace with breaks if you are outputting to an HTML file, hope I was able to help, -Andy - Original Message - From: Rory O'Connor [EMAIL PROTECTED] Newsgroups: php.general To: PHP list [EMAIL PROTECTED] Sent: Saturday, August 25, 2001 9:27 AM Subject: Stripping line break characters I need to strip line break characters (or whatever the character is that results from users hitting their enter key inside a TEXTAREA form input) from a string. These characters will appear anywhere in the string, not just at the end. In perl, the regex would look something like this... $a=a\nb\nc\nd\n\n\n; $b=$/; $a =~ s/$b//g; # produces abcd but i'm a newbie and i don't know how I can translate this to PHP syntax to do the same thing. Any help is appreciated! Thanks! providing the finest in midget technology providing the finest in midget technology Rory O'Connor [EMAIL PROTECTED] wrote: $sql2=str_replace(,\n,$sql2); $sql2=str_replace(,\r,$sql2); you've got the first two arguments backwards. $sql2=str_replace(\n,,$sql2); $sql2=str_replace(\r,,$sql2); or with php4.0.5 (or later): $sql2=str_replace(array(\n,\r),,$sql2); for more details: http://www.php.net/manual/en/function.str-replace.php jim Hi! $sql2=str_replace(,\n,$sql2); $sql2=str_replace(,\r,$sql2); well that was easy: manual: string str_replace (string needle, string str, string haystack) and you did: str_replace (string str, string needle, string haystack) So better try $sql2=str_replace(\n,,$sql2); $sql2=str_replace(\r,,$sql2); Time to get some sleep ? ;-) cheers, Chris H. -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands --
Re: [PHP] POST without Content-Type?
Well, first of all, you are using an ancient version of PHP. That message was changed from a fatal error to a warning over a year ago. And if you really want to have PHP accept non-typed POST data, it's an obvious one-line change in main/SAPI.c -Rasmus On Sat, 25 Aug 2001, Chris Maresca wrote: All, I've been coding a PHP page that listens for a connection from an embedded device (a piece of hardware) that sends a POST query to Apache (and to my PHP pages...). I've having a problem that I can't seem to solve. The embedded application does not set a Content-Type header on the POST, so PHP fails with the following error: -- HTTP/1.1 200 OK Date: Sun, 26 Aug 2001 05:26:14 GMT Server: Apache/1.3.12 (Unix) (Red Hat/Linux) PHP/4.0.2 Connection: close Content-Type: text/html br bFatal error/b: No content-type in POST request in bUnknown/b on line b0/bbr Connection closed by foreign host. -- The connection that the embedded system makes looks like this: -- POST http://host.mysite.foo/dir/phppage HTTP/1.0 User-Agent: ImEmbedded Host: host.mysite.foo Content-Length: 123 Pragma: no-cache Cookie: embeddedsession=myverylongsessionvariablegeneratedbythehardware ?xml version=1.0? -- And below is some XML stuff... I've tried setting 'Content-Type' in $HTTP_POST_VARS, using mod_rewrite in Apache to change the content-type (with the -T flag) and looked at all the options in php.ini. I'm using PHP 4.0.2 w/Apache 1.3.12 (if you couldn't tell from the sig above...) Nothing works correctly. The mod_rewrite trick would work, but it makes everthing to that URL text/xml, including the PHP script, which no longer executes. I look on the mailing lists here and on usenet, but I don't see a good solution... Anyone have any ideas? At this point, I'm thinking of re-writing my code in Perl or Python since there seems to be no solution to this problem. Note that it's PHP that rejects the request, not Apache. I don't see why a missing content-type should do this. It should just default to text/plain or something. Anyway, thanks for any help. Chris. -- chris maresca internet systems architect -- www.chrismaresca.com linux, only up 138 days, because california has flaky power... -- 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] Error while passing parameters as path
All, I read the article by John Coggeshall on building search engine friendly pages. Now, I trying to pass my script parameters as path (instead of ?param=valueparam2=value2). However, for some reason I keep on getting the following error: Fatal error: Unable to open /home/mydomain/public_html/try.phtml/param1/123 in - on line 0 No input file specified. This is what I run: http://www.mydomain.com/try.phtml/param1/123 It seems like PHP is trying to read the file 123 at the given path. For some reason, PHP doesn't realize the try.phtml is the script. I am trying this with PHP3. However, my production server is running PHP4 and it works there. Is this a new feature in PHP4 or do I need to build PHP3 with some configuration for this to work? Thank you in advance. -- anas mughal -- 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]
RE: [PHP] Error while passing parameters as path
yes, I am running as CGI. How should that matter? Actually, I need to run as CGI because I have customized extensiont to PHP that my hosting company will not imbed in their PHP-Apache module. I am totally fine with that. Bottom line is that I need to run PHP as CGI. Is there a way for this work in that mode? -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 26, 2001 2:14 AM To: Anas Mughal Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Error while passing parameters as path Are you running PHP 3 as a CGI? Things work/don't work a bit differently in CGI mode. -Rasmus On Sun, 26 Aug 2001, Anas Mughal wrote: All, I read the article by John Coggeshall on building search engine friendly pages. Now, I trying to pass my script parameters as path (instead of ?param=valueparam2=value2). However, for some reason I keep on getting the following error: Fatal error: Unable to open /home/mydomain/public_html/try.phtml/param1/123 in - on line 0 No input file specified. This is what I run: http://www.mydomain.com/try.phtml/param1/123 It seems like PHP is trying to read the file 123 at the given path. For some reason, PHP doesn't realize the try.phtml is the script. I am trying this with PHP3. However, my production server is running PHP4 and it works there. Is this a new feature in PHP4 or do I need to build PHP3 with some configuration for this to work? Thank you in advance. -- anas mughal -- 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]