RE: [PHP] Nasty DoS in PHP
Mine produced the same error message as yours, Jason, but the memory and CPU usage continued until I hit the 'stop' button on the browser. It seemed to have overridden both time and memory limits, as it had racked up 320 megs of my RAM by the time I stopped it. It certainly didn't do that here, but it could be a difference between RAM, PHP and Apache versions (simple paranoia ;)) that causes it. PHP clearly sent the error *to my browser* and the browser stopped loading immediately (thus, the fatal error was indeed fatal, and PHP terminated at that time). J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Quicktime...
Twas 4/18/02 1:48 AM, when Pusta [EMAIL PROTECTED] said: Hello all, I'm new at PHP but learning and loving it. For a school project, I have to use PHP to display a video on a web page using QuickTime. Can anyone point me to where I can get some info on how to do this? http://developer.apple.com/quicktime/compatibility.html Has some cool notes and sample embed tags so that your quicktime will be playable on all platforms with ease... ~ Mike -- Mike Zornek | Project Leader Apple Student Developers The Insanely Great Site with the Insanely Long URL http://www.applestudentdevelopers.org Personal Site: http://www.mikezornek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nasty DoS in PHP
Very odd indeed. Well, here's my setup: Windoze2K PHP 4.1.2 Apache 1.3.something Accessing it via IE 6.0, although this should not have any bearing on anything I'd be interested in knowing your versions and the versions of the first guy that posted about this. Maybe he has the same setup as me, or close enough, but both of us are different from you. My browser just kept loading and loading like all was well, while task manager was skipping all over the place and I had to wait 5 - 10 seconds after I moved my mouse for the cursor to move. I timed the script, and after 30 secs, it was still going (although I stopped it soon thereafter to keep from having to reboot). So I reset php.ini's execution time limit down to 5 seconds and ran it twice more, and both times it went well past 5 seconds. Of course, none of this bothers me as I won't be putting while(01) { header(A) } into any of my scripts, nor was I ever planning on it! :) -Original Message- From: Jason Murray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 10:13 PM To: 'Jason Soza'; [EMAIL PROTECTED] Subject: RE: [PHP] Nasty DoS in PHP Mine produced the same error message as yours, Jason, but the memory and CPU usage continued until I hit the 'stop' button on the browser. It seemed to have overridden both time and memory limits, as it had racked up 320 megs of my RAM by the time I stopped it. It certainly didn't do that here, but it could be a difference between RAM, PHP and Apache versions (simple paranoia ;)) that causes it. PHP clearly sent the error *to my browser* and the browser stopped loading immediately (thus, the fatal error was indeed fatal, and PHP terminated at that time). J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nasty DoS in PHP | Windows only?
I'd be interested in knowing your versions and the versions of the first guy that posted about this. Maybe he has the same setup as me, or close enough, but both of us are different from you. Actually, I just thought about it - maybe you guys are both running it on Windows (shame on you ;)). I *have* actually seen PHP bring down IIS with a setcookie command. Since a setcookie issues headers, I thought fine, screw you, I'll set the headers myself, and it STILL brought IIS down. And indeed, the load *did* skyrocket and require a reboot of the server. I asked around here at the time if anyone had experienced this (look through the mailing list archive to find it) and at the time got more of a congratulatory salute from the list members than any real responses :) Maybe this is more of a PHP-on-IIS issue than an actual security issue in PHP. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ImageMagik
I have used PHP to generate a series of JPEG files, which after doing: convert -delay 0 *.jpg animated.gif make a rather nifty animated GIF file. Just one tiny problem... How the heck do 8 files, ~24 K each, turn into 3 *MEGS* worth of animation?... I mean, I've read the GIF spec, and there just ain't that much there... I've tried all the reasonable flags to convert I can find in man and Googled, but got nothing so far... Please Cc: me... And, I'm not being stupid, right?... There's no PHP image_frame() right?... Thanks. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nasty DoS in PHP | Windows only?
- Original Message - From: Jason Murray [EMAIL PROTECTED] To: 'Jason Soza' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, April 17, 2002 11:36 PM Subject: RE: [PHP] Nasty DoS in PHP | Windows only? I'd be interested in knowing your versions and the versions of the first guy that posted about this. Maybe he has the same setup as me, or close enough, but both of us are different from you. Actually, I just thought about it - maybe you guys are both running it on Windows (shame on you ;)). I *have* actually seen PHP bring down IIS with a setcookie command. Since a setcookie issues headers, I thought fine, screw you, I'll set the headers myself, and it STILL brought IIS down. And indeed, the load *did* skyrocket and require a reboot of the server. I know what you are saying. I've taken down apache on win32 with setcookie I asked around here at the time if anyone had experienced this (look through the mailing list archive to find it) and at the time got more of a congratulatory salute from the list members than any real responses :) Maybe this is more of a PHP-on-IIS issue than an actual security issue in PHP. I'm pretty sure they ran PHP on apache, not IIS. Maybe this problem is only with the win32 version of the PHP module. Nonetheless, a bug is still a bug. It would be nice if it wasn't there=) Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nasty DoS in PHP | Windows only?
I know what you are saying. I've taken down apache on win32 with setcookie [snip] I'm pretty sure they ran PHP on apache, not IIS. Maybe this problem is only with the win32 version of the PHP module. Yep, apparently I can't read. Apache, IIS, same header() probs. Nonetheless, a bug is still a bug. It would be nice if it wasn't there=) Agreed! :) J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache 2.0.35 php 4.2.0 RC4 includes
Greetings, Is anyone having problems with includes or include path with this configuration? I'm running Apache 2.0.35/php 4.2.0 RC4 on WinXP pro. Warning: Failed opening 'mod//index.php' for inclusion (include_path='.;c:\php4\pear') in D: \Internet\Apache\htdocs\urswerks\mod.php on line 14 -- The dogmas of the quiet past are inadequate for the stormy present. The occasion is piled high with difficulty, and we must rise to the occasion. As our case is new, so we must think anew, and act anew. We must disentrall ourselves, and then we shall save our country.We can not escape history. We will be remembered, in spite of ourselves. The fiery trial through which we pass will light us down in honor or dishonor, to the last generation. We shall nobly save, or meanly lose our last best hope of Earth. Annual Message to Congress, Concluding Remarks, December 1, 1862 - President Abraham Lincoln Copyleft 2001: http://www.gnu.org/licenses/fdl.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link
On Wednesday 17 April 2002 15:37, SHEETS,JASON (Non-HP-Boise,ex1) wrote: if(Criteria=$Input) { Header(Location: http://www.yourplace.com/Pagename.php;); exit; } elseif(Criteria=$SomethingElse) { Header(Location: http://www.yourplace.com/somewhereelse.php;); exit; } else { Header(Location: http://www.yourplace.com/error.php;); exit; } remember to use == also, otherwise your doing an assignment matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I handle file uploading for several files at one time?
Consider this block of code: form enctype=multipart/form-data action=... method=post ... input type=file name=photo1 size=50 input type=file name=photo2 size=50 input type=file name=photo3 size=50 input type=file name=photo4 size=50 input type=file name=photo5 size=50 ... /form In my PHP script, I have the following: for ($i = 1; $i = 5; $i++) { if (is_uploaded_file($HTTP_POST_FILES['userfile'][$i]['tmp_name'])) { $hasNoPics = false; move_uploaded_file($HTTP_POST_FILES['userfile'][$i]['tmp_name'], $DOCUMENT_ROOT/webmissions/pics/$username/ . $HTTP_POST_FILES['userfile'][$i]['name'] ); } else { echo Possible file upload attack. Filename: . $HTTP_POST_FILES['userfile'][$i]['name']; $hasNoPics = true; } } This block of code produces a riddling of PHP errors: Warning: Undefined index: userfile in c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 76 Warning: Undefined index: userfile in c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 82 Possible file upload attack. Filename: What I need to know is, what did I do wrong? I need to be able to move 1-5 submitted files at one time but I can't find any documentation on php.net that handles such an exotic piece of code. What do I do? Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] save html created by loop in variable
How about something like ... $agents = array(); If ($result = mysql_query(SELECT h.title, h.address, a.agentname FROM homes h, agents a WHERE h.owner=a.id AND a.id=$aid)) { while ($array = mysql_fetch_array($result)) { $agents[$array[agentname]][] = $array; } } foreach($agents as $agent=$addresses) { echo($agentbr); foreach($addresses as $address) { echo({$address[title]}, {$address[address]}); } } Please treat this as pseudo code, but you get the idea. Arrays of arrays can be really powerful for stuff like this. Tim Ward Internet Chess www.chessish.com http://www.chessish.com -- From: Jason Dulberg [SMTP:[EMAIL PROTECTED]] Sent: 18 April 2002 05:27 To: [EMAIL PROTECTED] Subject: RE: [PHP] save html created by loop in variable Thanks for your reply... I just tried it with ob_start(); and I think I'm almost on the right track. Just one small issue. Since the records are in a while loop, the results are printed line by line as expected. However, I need to print something obtained from the sql query just once then the rest to loop. //a.agentname displays only once and h.title/h.address will be in a list SELECT h.title, h.address, a.agentname FROM homes h, agents a WHERE h.owner=a.id AND a.id=$aid Basically what I'm after is displaying something like: Agent: Fred nice house, 123 street ugly house, 643 road Thanks again for your help on this. Jason -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: April 17, 2002 8:28 PM To: Jason Dulberg Cc: [EMAIL PROTECTED] Subject: Re: [PHP] save html created by loop in variable On Wed, 17 Apr 2002, Jason Dulberg wrote: I have a WHILE loop that I am interested in storing the html that is generated based on its results to a variable. This variable would then be echoed later on. Check in the manual under Output Buffering. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] what does is happening to the list
Eduardo Melo wrote: What is happening to the list ... No body anwser ... I will be waiting for some contact. we are finaly ignoring you as you are neither able to switch of HTML (as requested) as anybody else does nor understand the concept of which list is which (by crosposting to php-general *and* dev) -- Hartmut Holzgraefe [EMAIL PROTECTED] http://www.six.de/ +49-711-99091-77 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pb with checkbox
Hello, I've got a little pb with checkboxes. In my form I've got 5 checkboxes which have the same name sel. When I submit the form and when I display the form variable sel, it displays the last value only. I cannot catch all the value checked in the form. If I try this code with coldfusion or ASP it displays a coma delimited list of all the values I checked in the form. How to fix this pb with PHP? Thanks My code: !--- the form --- form action=catalog.php method=post table border=0 cellspacing=0 cellpadding=0 ?for ($i=1;$i=$nb;$i++){ tr td align=centerinput type=checkbox name=sel value=?=$attr[Title]?/td /tr ?}? /table /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pb with checkbox
On Thursday 18 April 2002 17:19, Frédéric Mériot wrote: Hello, I've got a little pb with checkboxes. In my form I've got 5 checkboxes which have the same name sel. When I submit the form and when I display the form variable sel, it displays the last value only. I cannot catch all the value checked in the form. If I try this code with coldfusion or ASP it displays a coma delimited list of all the values I checked in the form. How to fix this pb with PHP? My code: !--- the form --- form action=catalog.php method=post table border=0 cellspacing=0 cellpadding=0 ?for ($i=1;$i=$nb;$i++){ tr td align=centerinput type=checkbox name=sel Name your checkboxes like: name=sel[] In your script you would have access to an array called $sel which contains the values of your checkboxes. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Life does not begin at the moment of conception or the moment of birth. It begins when the kids leave home and the dog dies. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to create, name and start PHP sessions
Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FreeBSD fsockopen problem
fixed, chuck - Original Message - From: Charles Williams [EMAIL PROTECTED] To: Php-General (E-mail) [EMAIL PROTECTED] Sent: Wednesday, April 17, 2002 2:34 PM Subject: [PHP] FreeBSD fsockopen problem Hey all, I am in need of opening a UDP socket on a FreeBSD box. The following code works in Linux but not in FreeBSD. In FreeBSD $fp returns a valid resource number and $error equals 0 (no error), but there is NO service on that port when testing it. $fp = fsockopen (udp:// . $tmpserver, $tmpport, $errno, $errstr, 25); echo $fp , $errno , $errstr; if(!$fp) { $tpl-parse(CONTENT, notconnected, false); $tpl-parse(OUT, main, false); $tpl-p(OUT); exit; } In other words the block in the if statement doesn't execute. Anyone have any ideas what this is? thanks, chuck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pb with checkbox
Ok, thanks - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 18, 2002 11:31 AM Subject: Re: [PHP] Pb with checkbox On Thursday 18 April 2002 17:19, Frédéric Mériot wrote: Hello, I've got a little pb with checkboxes. In my form I've got 5 checkboxes which have the same name sel. When I submit the form and when I display the form variable sel, it displays the last value only. I cannot catch all the value checked in the form. If I try this code with coldfusion or ASP it displays a coma delimited list of all the values I checked in the form. How to fix this pb with PHP? My code: !--- the form --- form action=catalog.php method=post table border=0 cellspacing=0 cellpadding=0 ?for ($i=1;$i=$nb;$i++){ tr td align=centerinput type=checkbox name=sel Name your checkboxes like: name=sel[] In your script you would have access to an array called $sel which contains the values of your checkboxes. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Life does not begin at the moment of conception or the moment of birth. It begins when the kids leave home and the dog dies. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: verify file types when uploading to server...
Maybe you want to share with the rest of us, or at least me how you did it? :) /Micke Jas [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Nevermind... =) Jas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am wondering if any one has a good idea on how to do checking based on a files extension, what I am trying to accomplish is to be able to upload files to a webserver however I only want to have .jpg files uploaded. If anyone has a good way to do this please share. Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
session_name will retur the previos name of the session, so in your case $stuff will contain PHPSESSID and i think you have to call session_start(); before you do $HTTP_SESSION_VARS[username] = $username; so perhaps this will work: session_name(hasLoggedIn); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; Regards, Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mod_rewrite
Seriousely speaking, I don't think I can create you a working example here because your case might be a whole different one, so you'd better read the docs to get it right. To just give you an idea, here's what I use on PHPBeginner.com: # VHosts: RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f RewriteRule ^(.+) - [L] RewriteRule ^(.+) /index.php?%{QUERY_STRING}_PHPB_URL=$1 [L] basically in human language it is: Line 1: action: start Rewrite Engine Line 2: condition: if the requested file exists Line 3: solution: go to the untouched URL (the engine would stop here) Line 4: alternative: if arrived all the way to this line go to /index.php?query=URL So, in the root we only have one single file (index.php) amd all the requests are coming in to it as $_GET['_PHPB_URL'], there we take over the game and decide what instances to lunch up from some shared libraries outside the root. In your case I think it would still similar, except, you could read the apache docs better and assign more variables in your regex so you get the correct data. Don't be too lazy, soon or later you will need Regular Expression again, so thi is a good chance to learn them. :-) Cheers, Maxim Maletsky Founder, Chief Developer. www.PHPBeginner.com [ rswfire ] writes: I could really use your help with this. The examples I have received from everyone thus far have not worked, including the last one that you posted. This is the situation: I have multiple domains, each with multiple subdomains, all of which automatically point to the root of my web environment. I have only one file that does all of the work for all of these websites/webpages, and that is the index.php file in the root. This file is smart enough to parse the url being accessed and create an appropriate page based on a very complex set of rules. Originally, I was using the ErrorDocument 404 to make it access the index.php file, but this has some inherent flaws. The biggest problem was that forms that were being posted to a page that doesn't really exist never maintained the posted variables (due to the 404 redirect.) Another limitation was that it just created a bunch of unnecessary error messages in my error log since there are no real pages on my network, even though it pretends there is. So, I need to use mod_rewrite. That is apparent now. The problem is I know nothing about creating regular expressions. I simply need it to rewrite the url for any file that does not exist (it should not try to do so for a file that really does exist, say an image file) and it needs to have the following rule: A*.B*.C*/D*.E* Where A is a subdomain; B is the domain name; C is the top level domain; D/E are a file or directory. Some examples would be: http://www.swifte.net/ http://www.cao.swifte.net/petition-sign.html http://hsdnetwork.swifte.net/technicians.html http://www.hsdnetwork.swifte.net/technicians.html http://www.caofund.org/ http://www.hsdnetwork.com/ Can you tell me how to do this? I would appreciate your help so much!! -Samuel _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mod_rewrite
forget about using .htaccess for mod_rewrite. It often fails through it. Use it directly from httpd.conf Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] [ rswfire ] writes: .htaccess (returns 500 misconfiguration error message) { RewriteEngine on RewriteBase/ RewriteRule* index.php } http://swifte.net/phpinfo.php (i did not use braces in the .htaccess file) _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] debug NOTICE without disturbing browser
*This message was transferred with a trial version of CommuniGate(tm) Pro* Hi, If you want to see NOTICE errors, but not in the browser: - Set your own error_handler as described in the documentation - And include these lines: if ( ( $errno == E_USER_NOTICE ) || ( $errno == E_NOTICE ) ) system (echo $errno $errortype[$errno] $errmsg $filename $linenum | write pedro pts/0 ); else echo br=br$err brbr; It will send a message to user pedro. Pedro. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nasty DoS in PHP
Good day, Just reading this thread, figured I would put my $0.02 in. This is apparently a known problem. It seems to occur whenever the php script uses lots of memory, actually, and it does the same thing whether it's run standalone or as a module. I first experienced it when I had a PHP script load a 10 meg LDAP database into memory, which took some 90 Megs of RAM to do (overhead, I guess). If I ran the script standalone, it wouldn't quit right away. If it was run as a module, Apache would have to kill the child off (it logged this activity) if I asked Apache to shut down. If I ran the script a few times, all of the memory of the machine would be used up, and I'd have to kill off Apache to get it back. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Jason Soza [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:10 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Nasty DoS in PHP Mine produced the same error message as yours, Jason, but the memory and CPU usage continued until I hit the 'stop' button on the browser. It seemed to have overridden both time and memory limits, as it had racked up 320 megs of my RAM by the time I stopped it. Jason -Original Message- From: Jason Murray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 9:57 PM To: 'CC Zona'; [EMAIL PROTECTED] Subject: RE: [PHP] Nasty DoS in PHP So that was both as an Apache mod and a CGI binary? Sounds like it's reproducible. Running as an Apache module here, it terminated as expected at 30 seconds. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get Specific Data from an CSV format file to PHP
Dear all I had tried to fetch the data from CSV file by using PHP, what i did is fetch the whole file content! But now i only want specific data from that CSV file, is there anyway in php that can point the pointer to specific data i want? -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error Handling Class - Any Recommendations?
Anyone recommend a good one? I am in need of the following features: 1) Catch any type of errors, 2) Actions like: Show on the screen, log on a file or database, or email, 3) Different actions for each error level/warning type, etc.. I have searched Hotscripts, but only found classes to control server errors, like 404 or 503. On Sourceforge, no projects with files, and Google returns me thousands of unrelated pages and I couldn't filter the results until they were satisfactory ;-) I understand PEAR has somekind of error control, and it's my current DB Abstraction Layer's choice. If there's a way to keep using PEAR to handle other errors, I would be very glad if someone could point me to any tutorial or documentation about how to do so, Thanks, -- Julio Nobrega. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nasty DoS in PHP
Darren Gamble wrote: This is probably just one of those cases that by the time the application determines that its child has exceeded its configured limits in resources, there are not enough resources (memory in this case) left to do the housekeeping and kill off the child. An acceptable algorithm to handle this might be difficult, namely, Apache would possibly have to keep track of the amount of heap left to it, make a difficult decision to kill the child before it exceeded its configured limits. In the mean time, sendmail, running on the same machine as Apache, grabs a bunch of memory and Apache, doing its best with what it thinks is available, gets screwed anyway with its new, sophisticated algorithm. Sendmail dies too. Maybe kerneld dies too. The machine dies. Er, I'll leave this to the CS researchers. We ain't gonna solve problems like this. I am not even sure this is worth a bug report... If there could be a moral to this thread, it is, go buy a few more Gigs of memory. _justin === Good day, Just reading this thread, figured I would put my $0.02 in. This is apparently a known problem. It seems to occur whenever the php script uses lots of memory, actually, and it does the same thing whether it's run standalone or as a module. I first experienced it when I had a PHP script load a 10 meg LDAP database into memory, which took some 90 Megs of RAM to do (overhead, I guess). If I ran the script standalone, it wouldn't quit right away. If it was run as a module, Apache would have to kill the child off (it logged this activity) if I asked Apache to shut down. If I ran the script a few times, all of the memory of the machine would be used up, and I'd have to kill off Apache to get it back. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Jason Soza [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:10 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Nasty DoS in PHP Mine produced the same error message as yours, Jason, but the memory and CPU usage continued until I hit the 'stop' button on the browser. It seemed to have overridden both time and memory limits, as it had racked up 320 megs of my RAM by the time I stopped it. Jason -Original Message- From: Jason Murray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 9:57 PM To: 'CC Zona'; [EMAIL PROTECTED] Subject: RE: [PHP] Nasty DoS in PHP So that was both as an Apache mod and a CGI binary? Sounds like it's reproducible. Running as an Apache module here, it terminated as expected at 30 seconds. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get Specific Data from an CSV format file to PHP
Jack You may want to have a look at : http://cvs.php.net/cvs.php/pear/File Hope this helps Luc At 20:41 18/04/02 +0800, Jack wrote: Dear all I had tried to fetch the data from CSV file by using PHP, what i did is fetch the whole file content! But now i only want specific data from that CSV file, is there anyway in php that can point the pointer to specific data i want? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to get row by row from CSV file
Dear all I'm a beginner of php, i tried to get the CSV file, but it return like Column by Colume, but how i can get it in Row by Row, cause i want to point to specific data i want, but not the whole file content! -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Open Download-Box
Hello! I have a PDF-File, which the user should download (it should not open in the browser, even if the Adobe-Reader-Pluging is installed). I use: $filename = $DOCUMENT_ROOT./.$QUERY_STRING; $fd = fopen ($filename, rb); $contents = fread ($fd, filesize ($filename)); fclose ($fd); header(Content-type: application/octet-stream); header(Content-Disposition:attachment;filename=$savename); echo $contents; This doesn't work in IE (Version 6, 5 is not tested yet): When I get the download-box and I choose open instead of save, the download-box opens again! Then pressing open, everything is okay, but why is the box opened twice? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert
How to convert string in windows-1250 to asci, I need convert special national characters to standard english characters. Thank you roman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Re: Cross DB application
Hello, Sp wrote: Can someone with database expertise who has used metabase and adodb cut through this rhetoric and give an objective view of these two packages. From what I got from this convo is that metabase is slower but more portable but adodb is faster but not as portable. No, Metabase does much more than ADODB. When you do more, eventually things may take a little longer when you do less. This should be obvious. Anyway, if you really care about portability, you're only way out is Metabase. Other abstraction packages were not meant for portability but rather for interface makeup. I think you will be the better judge of that if you try looking at least at each package documentation. It is pointless to ask to people here when most of them only know one or the other package. Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Re: Cross DB application
Hello, Sp wrote: Can someone with database expertise who has used metabase and adodb cut through this rhetoric and give an objective view of these two packages. From what I got from this convo is that metabase is slower but more portable but adodb is faster but not as portable. No, Metabase does much more than ADODB. When you do more, eventually things may take a little longer when you do less. This should be obvious. Anyway, if you really care about portability, you're only way out is Metabase. If you are in doubt about the features, think at least about what you can do with each package to migrate your data when you decide to switch databases. Metabase is the only package that offer painless and failure proof method of migrating data using the XML schema support. With the other package you need to write custom scripts for migration which is a real pain and prone to error due to eventual bugs of software that you need to write on your own. Other abstraction packages were not meant for true portability but rather for interface makeup. I think you will be the better judge of that if you try looking at least at each package documentation. It is pointless to ask to people here when most of them only know one or the other package. You may also want to take a look at BinaryCloud which is a well designed and mature PHP application development framework. It works with Metabase and will save you countless hours of developing your applications from scratch. BinaryCloud http://binarycloud.tigris.org/ Metabase http://www.phpclasses.org/metabase Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Global variable
Maybe you could use sessions like: session_start(); session_register('verified'); $verified=0 Erich Kolb [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have developed a simple login script. Right now it will check a submitted username and password and verify it against a database. This part works fairly well, however I want to know how to assign a variable that will pass through to the next page(s) to do something like: if verified == 1 then {display the page} else {display error message} My apoligies on the syntax of the above, but hopefully you will get the idea. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] find value of image tag
How can I find the value of image tags in an HTML file: IMG SRC=some_value.jpg alt=blah height=xx width=yy No line breaks are in the tags but they do have other parameters. kind regards, bill hollett -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
Hello, Julio Nobrega Trabalhando wrote: Anyone recommend a good one? I am in need of the following features: 1) Catch any type of errors, 2) Actions like: Show on the screen, log on a file or database, or email, 3) Different actions for each error level/warning type, etc.. I have searched Hotscripts, but only found classes to control server errors, like 404 or 503. On Sourceforge, no projects with files, and Google returns me thousands of unrelated pages and I couldn't filter the results until they were satisfactory ;-) I understand PEAR has somekind of error control, and it's my current DB Abstraction Layer's choice. If there's a way to keep using PEAR to handle other errors, I would be very glad if someone could point me to any tutorial or documentation about how to do so, Why do you want to use a bloated 800 lines error handling class when PHP already has built-in functions to do exactly what you want? http://www.php.net/manual/en/ref.errorfunc.php Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $PHP_SELF question
I've got an include file that provides the basic framework for every page on my site, and at the bottom of each page, I want to spit out when the page was last updated. I used $PHP_SELF inside the include file, and got the include file's path. Is there a variable equivalent to $PHP_SELF that returns the path for the file that is being executed? Basically, if I'm running index.php, and I include template.php is there any way, from inside template.php, to get index.php short of passing it as a parameter? - Theo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nasty DoS in PHP | Windows only?
Actually, it occurs on Solaris as well. I just coded up the script, and it brought my server to its knees, though I was able to break it before it hanged hard. My configuration: * Solaris 8 108528-12 * PHP 4.1.1 as an executable (didn't try through Apache) * 512mb ram, 1 @ 440MHx UltraSPARC IIi My php.ini specifies: * max_execution_time = 120 * memory_limit = 128M Yet, I let the script run for a while (over two minutes) and it had managed to consume 80% of my cpu time and over one gig of virtual memory (phys + swap)! It should be noted that while this is indeed a very bad thing, the following snippet of C code is just as bad, yet it's not technically a bug -- just bad programming: int main(void) { void *p; while (1) p = malloc(1024); /*NOTREACHED*/ return 0; } /bsh/ Jason Murray wrote: I'd be interested in knowing your versions and the versions of the first guy that posted about this. Maybe he has the same setup as me, or close enough, but both of us are different from you. Actually, I just thought about it - maybe you guys are both running it on Windows (shame on you ;)). I *have* actually seen PHP bring down IIS with a setcookie command. Since a setcookie issues headers, I thought fine, screw you, I'll set the headers myself, and it STILL brought IIS down. And indeed, the load *did* skyrocket and require a reboot of the server. I asked around here at the time if anyone had experienced this (look through the mailing list archive to find it) and at the time got more of a congratulatory salute from the list members than any real responses :) Maybe this is more of a PHP-on-IIS issue than an actual security issue in PHP. Jason -- /-=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer. | \--=[ [EMAIL PROTECTED] ]=/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Handling Class - Any Recommendations?
On Thursday, April 18, 2002, at 08:53 AM, Julio Nobrega Trabalhando wrote: Anyone recommend a good one? I am in need of the following features: 1) Catch any type of errors, 2) Actions like: Show on the screen, log on a file or database, or email, 3) Different actions for each error level/warning type, etc.. If you want to roll your own, there's a DevShed article on the subject -- but I haven't read it, so I can't give you an opinion as to how good it is (whatever that would be worth). http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page1.html Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Open Download-Box
try header(Content-type: application/pdf); James -Original Message- From: Martin Thoma [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 9:20 AM To: [EMAIL PROTECTED] Subject: [PHP] Open Download-Box Hello! I have a PDF-File, which the user should download (it should not open in the browser, even if the Adobe-Reader-Pluging is installed). I use: $filename = $DOCUMENT_ROOT./.$QUERY_STRING; $fd = fopen ($filename, rb); $contents = fread ($fd, filesize ($filename)); fclose ($fd); header(Content-type: application/octet-stream); header(Content-Disposition:attachment;filename=$savename); echo $contents; This doesn't work in IE (Version 6, 5 is not tested yet): When I get the download-box and I choose open instead of save, the download-box opens again! Then pressing open, everything is okay, but why is the box opened twice? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
Hi Manuel! I am looking for anything that's already done, constructed, tested. PHP does have error handling, and I could code my own class to glue all functions/necessities together, but that would take too much time. Just something at least to start from is a good thing... Saves a lot of time, you know :-D If I can't find this class, I will make one and submit it to your website, okay? ;-) -- Julio Nobrega. Why do you want to use a bloated 800 lines error handling class when PHP already has built-in functions to do exactly what you want? http://www.php.net/manual/en/ref.errorfunc.php Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open Download-Box
try header(Content-type: application/pdf); Thanx, but it doesn't work, too, on IE. Another effect is, that Netscape now opens it in the broser window instead of downloding it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and if statement if a page isnt there using iframes
i am using iframes to display a page within a page the iframe is named and the page is dynamic the iframe displays a page using generated php. is there a way of using php to redirect to nopage.php if the page does not exist? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Re: [PHP] Re: Cross DB application
Hi Manuel, I still don't see a problem in others telling their experiences with certain packages. If someone has just used metabase or has just used adodb then I would like to hear how easy/hard it was to port to another database. -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: April 18, 2002 9:37 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Sp Subject: Re: [PHP-DB] Re: [PHP] Re: Cross DB application Hello, Sp wrote: Can someone with database expertise who has used metabase and adodb cut through this rhetoric and give an objective view of these two packages. From what I got from this convo is that metabase is slower but more portable but adodb is faster but not as portable. No, Metabase does much more than ADODB. When you do more, eventually things may take a little longer when you do less. This should be obvious. Anyway, if you really care about portability, you're only way out is Metabase. Other abstraction packages were not meant for portability but rather for interface makeup. I think you will be the better judge of that if you try looking at least at each package documentation. It is pointless to ask to people here when most of them only know one or the other package. Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
Thanx, however, I cannot retain the session_name when I go to the next URL. How do I retain the session_name especially when I have to use a form method=POST? I have a URL that will be the login Once you login you will have a session (that works now) That page with the session will have a form with five input=file type form elements Once submitted you will be at a thank-you page and files uploaded, but then the session is gone (session_name is back to PHPSESSID again) What do I do to keep it? I cannot use cookies and putting it in the URL? Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... session_name will retur the previos name of the session, so in your case $stuff will contain PHPSESSID and i think you have to call session_start(); before you do $HTTP_SESSION_VARS[username] = $username; so perhaps this will work: session_name(hasLoggedIn); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; Regards, Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
Hello, Julio Nobrega Trabalhando wrote: Hi Manuel! I am looking for anything that's already done, constructed, tested. PHP does have error handling, and I could code my own class to glue all functions/necessities together, but that would take too much time. Just something at least to start from is a good thing... Saves a lot of time, you know :-D If I can't find this class, I will make one and submit it to your website, okay? ;-) PHP built-in error handling support functions are very powerful and capable. What do you miss in them that you still need a class to handle it? Regards, Manuel Lemos -- Julio Nobrega. Why do you want to use a bloated 800 lines error handling class when PHP already has built-in functions to do exactly what you want? http://www.php.net/manual/en/ref.errorfunc.php Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting an array.
Hello, Here's what i'm working with. I'm figuring the distance between to points based on latitude and longitude. while ($row = mysql_fetch_array($result)) { //calculate distance between the two cities. $Lat2 = $row[Latitude]; $Lon2 = $row[Longitude]; $x = 69.1 * ($Lat2 - $Lat1); $y = 53 * ($Lon2 - $Lon1); $Distance = sqrt($x * $x + $y * $y); $Distance = ceil($Distance); if ($Distance 100){ echo $row[CompanyName].br; echo $row[Address].br; echo $row[City].br; echo $row[State].br; echo $row[ZipCode].br; echo $row[PhoneNumber].br; echo $row[FaxNumber].br; echo Approximant Distance = $Distance Milesbrbr; } } Here is where my question comes to play. How do I sort the $Distance so that 4 Miles will come up first 10 second 30 third ext.. I have tried useing sort() function but it doesn't work quite the way I want it to. Thanks for your help --Mike __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
I am looking for something like this: if (error($anything)) { $method = Array('show_on_page', 'email', 'file'); $my_error_message = 'We are in trouble!'; $severity = 'Light'; $error_class-LogError($method, $my_own_error_message, $natural_error_message, $severity, $file_where_happened, $line, $etc...); } So... class Error_Class { function LogError($method, $etc...) { if (in_array('email', $method)) { mail ('There was an error, bla bla bla', $etc...); } if (in_array('file', $method)) { fwrite('file.txt', $etc); } if ($severity == 'CRITICAL STUFF!!!') // Do everything that's possible! } } } Something like this, where errors messages and the actions I may take could be *more easily* personalized. ;-) Or maybe instead of $method and $severity and etc, pre-confifured vars, like if I pass to $error_class-LogError() an $var = '1': class Error_Class { if ($var == '1') { $this-WarningMethod('email', 'file'); } } And etc, etc, etc :-D I understand there's a lot of etc on my post, that's because I am still thinking about all the features that I think that would be useful on a such class... ;-) -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 Manuel Lemos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, PHP built-in error handling support functions are very powerful and capable. What do you miss in them that you still need a class to handle it? Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
you have to put this on top of every of your pages: - session_name(hasLoggedIn); $stuff = session_name(); session_start(); - session_name first sets the name. then you call session_start which will look for the sessionid in ${session_name()}. that is why you have to call session_name() BEFORE calling session_start(); Regards Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanx, however, I cannot retain the session_name when I go to the next URL. How do I retain the session_name especially when I have to use a form method=POST? I have a URL that will be the login Once you login you will have a session (that works now) That page with the session will have a form with five input=file type form elements Once submitted you will be at a thank-you page and files uploaded, but then the session is gone (session_name is back to PHPSESSID again) What do I do to keep it? I cannot use cookies and putting it in the URL? Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... session_name will retur the previos name of the session, so in your case $stuff will contain PHPSESSID and i think you have to call session_start(); before you do $HTTP_SESSION_VARS[username] = $username; so perhaps this will work: session_name(hasLoggedIn); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; Regards, Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nasty DoS in PHP | Windows only?
Just catching up on my emails and saw this thread. Just a note that it didn't happen under FreeBSD 4.5-R p3 PHP 4.1.2 (Apache module) 386M Ram, PIII 450 box The script died after the max_time setting, and apache's children returned back to their happy go lucky nature all by themselves... Billy S Halsey wrote: Actually, it occurs on Solaris as well. I just coded up the script, and it brought my server to its knees, though I was able to break it before it hanged hard. My configuration: * Solaris 8 108528-12 * PHP 4.1.1 as an executable (didn't try through Apache) * 512mb ram, 1 440MHx UltraSPARC IIi My php.ini specifies: * max_execution_time = 120 * memory_limit = 128M Yet, I let the script run for a while (over two minutes) and it had managed to consume 80% of my cpu time and over one gig of virtual memory (phys + swap)! It should be noted that while this is indeed a very bad thing, the following snippet of C code is just as bad, yet it's not technically a bug -- just bad programming: int main(void) { void *p; while (1) p = malloc(1024); /*NOTREACHED*/ return 0; } /bsh/ Jason Murray wrote: I'd be interested in knowing your versions and the versions of the first guy that posted about this. Maybe he has the same setup as me, or close enough, but both of us are different from you. Actually, I just thought about it - maybe you guys are both running it on Windows (shame on you ;)). I *have* actually seen PHP bring down IIS with a setcookie command. Since a setcookie issues headers, I thought fine, screw you, I'll set the headers myself, and it STILL brought IIS down. And indeed, the load *did* skyrocket and require a reboot of the server. I asked around here at the time if anyone had experienced this (look through the mailing list archive to find it) and at the time got more of a congratulatory salute from the list members than any real responses :) Maybe this is more of a PHP-on-IIS issue than an actual security issue in PHP. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
In your example, simply place this line in your code (on *every* page you want the session to be on): session_name(HasLoggedIn); session_register(username); If your PHP was compiled with '--enable-trans-sid' you shouldn't have to worry about anything else. PHP will automatically store the session ID in a cookie, or it will pass the session ID in your HTML links. If it wasn't compiled with '--enable-trans-sid', you'll need to use the constant SID. Example: -- ?php session_name(HasLoggedIn); session_register(username); ? Welcome ?=$username;?. !-- assumes user has already entered a username on some other page -- a href=nextpage.php??=SID;?Click here to continue./a -- Hope that helps! Check out http://www.php.net/manual/en/ref.session.php for more info -- Uchendu Nwachukwu newsreply AT unndunn DOT com - www.unndunn.com Phil Powell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanx, however, I cannot retain the session_name when I go to the next URL. How do I retain the session_name especially when I have to use a form method=POST? I have a URL that will be the login Once you login you will have a session (that works now) That page with the session will have a form with five input=file type form elements Once submitted you will be at a thank-you page and files uploaded, but then the session is gone (session_name is back to PHPSESSID again) What do I do to keep it? I cannot use cookies and putting it in the URL? Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... session_name will retur the previos name of the session, so in your case $stuff will contain PHPSESSID and i think you have to call session_start(); before you do $HTTP_SESSION_VARS[username] = $username; so perhaps this will work: session_name(hasLoggedIn); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; Regards, Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $PHP_SELF question
did u try $HTTP_REFERER ? that might do it... havent tested with an include though. Joel Theodore Brinkman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I've got an include file that provides the basic framework for every page on my site, and at the bottom of each page, I want to spit out when the page was last updated. I used $PHP_SELF inside the include file, and got the include file's path. Is there a variable equivalent to $PHP_SELF that returns the path for the file that is being executed? Basically, if I'm running index.php, and I include template.php is there any way, from inside template.php, to get index.php short of passing it as a parameter? - Theo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
Use PEAR_Error. It's really powerful and has yll you need. there's no logging method in PEAR_Error afaik, but you can easily do this with PEAR's Log class, same for mailing. use PEAR's mail class to send mails. I like PEAR very much. It has lots of good things to offer and is easily extendable for your needs. Regards Michael Julio Nobrega Trabalhando [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Anyone recommend a good one? I am in need of the following features: 1) Catch any type of errors, 2) Actions like: Show on the screen, log on a file or database, or email, 3) Different actions for each error level/warning type, etc.. I have searched Hotscripts, but only found classes to control server errors, like 404 or 503. On Sourceforge, no projects with files, and Google returns me thousands of unrelated pages and I couldn't filter the results until they were satisfactory ;-) I understand PEAR has somekind of error control, and it's my current DB Abstraction Layer's choice. If there's a way to keep using PEAR to handle other errors, I would be very glad if someone could point me to any tutorial or documentation about how to do so, Thanks, -- Julio Nobrega. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Open Download-Box
this is a problem of IE, not of PHP. it seems that IE is ignoring headers in some cases. Regards Michael Martin Thoma [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello! I have a PDF-File, which the user should download (it should not open in the browser, even if the Adobe-Reader-Pluging is installed). I use: $filename = $DOCUMENT_ROOT./.$QUERY_STRING; $fd = fopen ($filename, rb); $contents = fread ($fd, filesize ($filename)); fclose ($fd); header(Content-type: application/octet-stream); header(Content-Disposition:attachment;filename=$savename); echo $contents; This doesn't work in IE (Version 6, 5 is not tested yet): When I get the download-box and I choose open instead of save, the download-box opens again! Then pressing open, everything is okay, but why is the box opened twice? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert
How to convert string in windows-1250 to asci, I need convert special national characters to standard english characters. Discard all characters with a value over 127 (high bit set). ASCII is only defined for 7 bit encoding. Mark Charette -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: $PHP_SELF question
Try and create a new php file with the following code and read the result: ?php phpinfo(); ? thats it, a lot of useful info there! Regards Lars -Original Message- From: Joel Colombo [mailto:[EMAIL PROTECTED]] Sent: 18 April 2002 16:03 To: [EMAIL PROTECTED] Subject: [PHP] Re: $PHP_SELF question did u try $HTTP_REFERER ? that might do it... havent tested with an include though. Joel Theodore Brinkman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I've got an include file that provides the basic framework for every page on my site, and at the bottom of each page, I want to spit out when the page was last updated. I used $PHP_SELF inside the include file, and got the include file's path. Is there a variable equivalent to $PHP_SELF that returns the path for the file that is being executed? Basically, if I'm running index.php, and I include template.php is there any way, from inside template.php, to get index.php short of passing it as a parameter? - Theo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
I am now getting the following errors on every page: Warning: Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php:25) in c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 81 This is when I use the following block of code to first SET the session for the very first time: if (mysql_num_rows($results) == 0) { // Could not find info in db redirect to login library with error msg $errorHTML .= font color=ccWe could not find your information ; $errorHTML .= in our database. Please try again./fontp; $hasLoggedIn = 0; } else if (strcmp(session_name(), hasLoggedIn) != 0) { // Set up session variable with username and redirect to pic upload lib session_name(hasLoggedIn); $name = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; $HTTP_SESSION_VARS[ip] = $REMOTE_ADDR; // To prevent session stealing } I am completely confused! Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... you have to put this on top of every of your pages: - session_name(hasLoggedIn); $stuff = session_name(); session_start(); - session_name first sets the name. then you call session_start which will look for the sessionid in ${session_name()}. that is why you have to call session_name() BEFORE calling session_start(); Regards Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanx, however, I cannot retain the session_name when I go to the next URL. How do I retain the session_name especially when I have to use a form method=POST? I have a URL that will be the login Once you login you will have a session (that works now) That page with the session will have a form with five input=file type form elements Once submitted you will be at a thank-you page and files uploaded, but then the session is gone (session_name is back to PHPSESSID again) What do I do to keep it? I cannot use cookies and putting it in the URL? Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... session_name will retur the previos name of the session, so in your case $stuff will contain PHPSESSID and i think you have to call session_start(); before you do $HTTP_SESSION_VARS[username] = $username; so perhaps this will work: session_name(hasLoggedIn); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; Regards, Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
I am now getting the following errors on every page: Warning: Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php:25) in c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 81 This is when I use the following block of code to first SET the session for the very first time: if (mysql_num_rows($results) == 0) { // Could not find info in db redirect to login library with error msg $errorHTML .= font color=ccWe could not find your information ; $errorHTML .= in our database. Please try again./fontp; $hasLoggedIn = 0; } else if (strcmp(session_name(), hasLoggedIn) != 0) { // Set up session variable with username and redirect to pic upload lib session_name(hasLoggedIn); $name = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; $HTTP_SESSION_VARS[ip] = $REMOTE_ADDR; // To prevent session stealing } I am completely confused! Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... you have to put this on top of every of your pages: - session_name(hasLoggedIn); $stuff = session_name(); session_start(); - session_name first sets the name. then you call session_start which will look for the sessionid in ${session_name()}. that is why you have to call session_name() BEFORE calling session_start(); Regards Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanx, however, I cannot retain the session_name when I go to the next URL. How do I retain the session_name especially when I have to use a form method=POST? I have a URL that will be the login Once you login you will have a session (that works now) That page with the session will have a form with five input=file type form elements Once submitted you will be at a thank-you page and files uploaded, but then the session is gone (session_name is back to PHPSESSID again) What do I do to keep it? I cannot use cookies and putting it in the URL? Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... session_name will retur the previos name of the session, so in your case $stuff will contain PHPSESSID and i think you have to call session_start(); before you do $HTTP_SESSION_VARS[username] = $username; so perhaps this will work: session_name(hasLoggedIn); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; Regards, Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil Uchendu Nwachukwu [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In your example, simply place this line in your code (on *every* page you want the session to be on): session_name(HasLoggedIn); session_register(username); If your PHP was compiled with '--enable-trans-sid' you shouldn't have to worry about anything else. PHP will automatically store the session ID in a cookie, or it will pass the session ID in your HTML links. If it wasn't compiled with '--enable-trans-sid', you'll need to use the constant SID. Example: -- ?php session_name(HasLoggedIn); session_register(username); ? Welcome ?=$username;?. !-- assumes user has already entered a username on some other page -- a href=nextpage.php??=SID;?Click here to continue./a -- Hope that helps! Check out http://www.php.net/manual/en/ref.session.php for more info -- Uchendu Nwachukwu newsreply AT unndunn DOT com - www.unndunn.com Phil Powell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanx, however, I cannot retain the session_name when I go to the next URL. How do I retain the session_name especially when I have to use a form method=POST? I have a URL that will be the login Once you login you will have a session (that works now) That page with the session will have a form with five input=file type form elements Once
[PHP] Re: [PHP-DB] Re: [PHP] Re: Cross DB application
Hello, Sp wrote: Hi Manuel, I still don't see a problem in others telling their experiences with certain packages. If someone has just used metabase or has just used adodb then I would like to hear how easy/hard it was to port to another database. Sure, but what I meant is that since most people only have experienced one or the other, you only hear from people that can't compare both. If you want to hear experiences of people that tried Metabase, try asking in Metabase mailing list ( http://groups.yahoo.com/group/metabase-dev/ ) or BinaryCloud mailing lists ( http://binarycloud.tigris.org/servlets/ProjectMailingListList ). I think Alex Black (BinaryCloud project leader) has tried both MySQL and Oracle with Metabase. Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function returning true or errors
I am writing a function that performs some actions. I would like to return true if the actions succeed, or return an error message if the actions fail. How should I go about it? The following code doesn't do it, because the returned error message is interpreted as a boolean true (I think that's what's happening): if (custom_function() == true) { print Custom Function succeeded!; } else { print custom_function(); } I would actually rather just have the error message generated by the script that calls the function, but the function performs some logic that determines what kind of error message to give. I was thinking of having the function return 1 if succeeds, 2 if error code A, or 3 if error code B, and then a switch statement could decide what to do in the calling script -- but does this sound sloppy? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function returning true or errors
function custom_function() { if ($error == 0) { return true; } else { return Error!; } } if (custom_function() != Error!) { echo Success; } else { echo Error; } Also, you could still return false on your custom_function(), if before the return you $_SESSION['error'] = 'Error!';. Then you could check for false or true with your if (custom_function()) and echo/unset the $_SESSION['error'] part. -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am writing a function that performs some actions. I would like to return true if the actions succeed, or return an error message if the actions fail. How should I go about it? The following code doesn't do it, because the returned error message is interpreted as a boolean true (I think that's what's happening): if (custom_function() == true) { print Custom Function succeeded!; } else { print custom_function(); } I would actually rather just have the error message generated by the script that calls the function, but the function performs some logic that determines what kind of error message to give. I was thinking of having the function return 1 if succeeds, 2 if error code A, or 3 if error code B, and then a switch statement could decide what to do in the calling script -- but does this sound sloppy? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting an array.
Perhaps you could store $row in an array of arrays; store only $row within 100 miles. Add another field, Distance, to each row that holds the calculated distance. Then, after creating the array, sort the final array by Distance. - Original Message - From: Mike Mike [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 18, 2002 8:51 AM Subject: [PHP] Sorting an array. Hello, Here's what i'm working with. I'm figuring the distance between to points based on latitude and longitude. while ($row = mysql_fetch_array($result)) { file://calculate distance between the two cities. $Lat2 = $row[Latitude]; $Lon2 = $row[Longitude]; $x = 69.1 * ($Lat2 - $Lat1); $y = 53 * ($Lon2 - $Lon1); $Distance = sqrt($x * $x + $y * $y); $Distance = ceil($Distance); if ($Distance 100){ echo $row[CompanyName].br; echo $row[Address].br; echo $row[City].br; echo $row[State].br; echo $row[ZipCode].br; echo $row[PhoneNumber].br; echo $row[FaxNumber].br; echo Approximant Distance = $Distance Milesbrbr; } } Here is where my question comes to play. How do I sort the $Distance so that 4 Miles will come up first 10 second 30 third ext.. I have tried useing sort() function but it doesn't work quite the way I want it to. Thanks for your help --Mike __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
Hello, Julio Nobrega Trabalhando wrote: I am looking for something like this: if (error($anything)) { $method = Array('show_on_page', 'email', 'file'); $my_error_message = 'We are in trouble!'; $severity = 'Light'; $error_class-LogError($method, $my_own_error_message, $natural_error_message, $severity, $file_where_happened, $line, $etc...); } Did you know that the function error_log those exactly that what you want? http://www.php.net/manual/en/function.error-log.php Why using a bloated error handling class that what you want without requiring 800 lines of code that PEAR error handler does? Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: function returning true or errors
I think this is more along the lines of what was wanted :) function custom_function() { if( $problem1 ) { return 'Problem 1 occured!'; } elseif( $problem2 ) { return 'Problem 2 occured!'; } elseif( ... ) { ... } return true; } if( ($status = custom_function()) === true ) { echo Success; } else { echo $status; } Cheers, Rob. --- Julio Nobrega Trabalhando wrote: function custom_function() { if ($error == 0) { return true; } else { return Error!; } } if (custom_function() != Error!) { echo Success; } else { echo Error; } Also, you could still return false on your custom_function(), if before the return you $_SESSION['error'] = 'Error!';. Then you could check for false or true with your if (custom_function()) and echo/unset the $_SESSION['error'] part. -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am writing a function that performs some actions. I would like to return true if the actions succeed, or return an error message if the actions fail. How should I go about it? The following code doesn't do it, because the returned error message is interpreted as a boolean true (I think that's what's happening): if (custom_function() == true) { print Custom Function succeeded!; } else { print custom_function(); } I would actually rather just have the error message generated by the script that calls the function, but the function performs some logic that determines what kind of error message to give. I was thinking of having the function return 1 if succeeds, 2 if error code A, or 3 if error code B, and then a switch statement could decide what to do in the calling script -- but does this sound sloppy? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newline features and differences between php3 and php4
Morning all, I'm using the mail() function on a project for a client. His hosting provider currently offers php3, meanwhile I've been developing in php4. So far, I don't haven't found any problems other than the following: In php4, inside the mail function I use newline definitions to seperate data, and it works terrific. But in php3 mail() doesn't seem to parse the newline tags, and it prints them in the email body. Workarounds/fixes? Thanks in advance. -- Chris Hall hardwired industries -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
Thanks Manuel, that's indeed a large portion of my needs. But still, from the time of my first post, among the new replies, I have found dozens of features that I think it would be interesting, and currently there's nothing suited to my needs. So I will base my work largely on use error_log(), with a few twists. Why using a bloated error handling class that what you want without requiring 800 lines of code that PEAR error handler does? I didn't know and I kind knew it, that's why I asked for tips ;-) -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 Manuel Lemos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Did you know that the function error_log those exactly that what you want? http://www.php.net/manual/en/function.error-log.php Why using a bloated error handling class that what you want without requiring 800 lines of code that PEAR error handler does? Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newline features and differences between php3 and php4
On Thu, 18 Apr 2002, Chris Hall wrote: I'm using the mail() function on a project for a client. His hosting provider currently offers php3, meanwhile I've been developing in php4. So far, I don't haven't found any problems other than the following: In php4, inside the mail function I use newline definitions to seperate data, and it works terrific. But in php3 mail() doesn't seem to parse the newline tags, and it prints them in the email body. Workarounds/fixes? I don't think that's really what's happening. The newline tags (\n) are interpreted when the string is parsed, long before anything makes it to the mail() function. Do you have a brief but relevant code snippet? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting an array.
Sounds like it'd be a lot easier to let MySQL do the calculation and sorting. $userLatitude = 50; $userLongitude = 70; $sql = select companyname, blah, blah, ceiling(sqrt(pow(69.1 * (latitude - $userLatitude), 2) + pow(53 * (longitude - $userLongitude), 2))) as distance from mytable order by distance; miguel On Thu, 18 Apr 2002, Mike Mike wrote: Here's what i'm working with. I'm figuring the distance between to points based on latitude and longitude. while ($row = mysql_fetch_array($result)) { //calculate distance between the two cities. $Lat2 = $row[Latitude]; $Lon2 = $row[Longitude]; $x = 69.1 * ($Lat2 - $Lat1); $y = 53 * ($Lon2 - $Lon1); $Distance = sqrt($x * $x + $y * $y); $Distance = ceil($Distance); if ($Distance 100){ echo $row[CompanyName].br; echo $row[Address].br; echo $row[City].br; echo $row[State].br; echo $row[ZipCode].br; echo $row[PhoneNumber].br; echo $row[FaxNumber].br; echo Approximant Distance = $Distance Milesbrbr; } } Here is where my question comes to play. How do I sort the $Distance so that 4 Miles will come up first 10 second 30 third ext.. I have tried useing sort() function but it doesn't work quite the way I want it to. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ImageMagik
On Thu, 18 Apr 2002, Richard Lynch wrote: I have used PHP to generate a series of JPEG files, which after doing: convert -delay 0 *.jpg animated.gif make a rather nifty animated GIF file. Just one tiny problem... How the heck do 8 files, ~24 K each, turn into 3 *MEGS* worth of animation?... It's not unbelievable. JPEGs can be highly compressed, and expand to a lot of image data. Depending on the type of image, the GIF format might not be able to handle it very well. I'm guessing the images are pretty large physically ( 100 or hundreds of pixels in each dimension), correct? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function returning true or errors
On Thursday 18 April 2002 23:25, Erik Price wrote: I am writing a function that performs some actions. I would like to return true if the actions succeed, or return an error message if the actions fail. How should I go about it? The following code doesn't do it, because the returned error message is interpreted as a boolean true (I think that's what's happening): if (custom_function() == true) { print Custom Function succeeded!; } else { print custom_function(); } I would actually rather just have the error message generated by the script that calls the function, but the function performs some logic that determines what kind of error message to give. I was thinking of having the function return 1 if succeeds, 2 if error code A, or 3 if error code B, and then a switch statement could decide what to do in the calling script -- but does this sound sloppy? What I tend to do is define functions like so: function doo($dah, $dib, $error) { ... ... if success { return TRUE; } else { $error = You've committed a grave sin!; return FALSE; } } Then call as: if (doo(...)) { echo OK; } else { echo Error: $error; } -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Now I lay me down to sleep, I pray the Lord my soul to keep, If I should die before I wake, I'll cry in anguish, Mistake!! Mistake!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php snmp
Hello... Could some one please direct me in the right direction. I am trying to get an snmpwalk on an snmp device.. I have set up the community and IP correctly.. I can do a manually by doing the fallowing: snmpwalk 126.4.202.157 public from a terminal,,, and I do get some responses if I use the fallowing code threw apache.. ?php $a = snmpwalk(126.4.202.157, public, ); for ($i=0; $i count($a); $i++) { echo $a[$i]; } ? and call this threw a browser I get the fallowing: and it seem as the page times out... but its very quick...almost as soon as I call the page. Other PHP pages work fine... I'm running on a Dell PIII Duel 500 w/512Meg Ram running SuSE 7.3 SMP I have compiled net-snmp using ethereal.. I can see the snmp gets get-next ... as well as the responses... Anyone have any idea... ?? Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: function returning true or errors
On Thursday, April 18, 2002, at 11:38 AM, Julio Nobrega Trabalhando wrote: function custom_function() { if ($error == 0) { return true; } else { return Error!; } } if (custom_function() != Error!) { echo Success; } else { echo Error; } Your way would work perfect except that I simplified the function I posted, for illustrative purposes -- a mistake, I realize. The returned error message is actually composed of an imploded array, whose contents are entirely dependent on the code in the function (basically it varies depending on circumstances, so I can't write a test for it). I ended up just performing the checks in the script itself, rather than in a function, because I was only using a function as a subroutine to keep my script's switch() statement nice and clean. But in this case, it just was too much trouble (I was also running into a situation where I had to deal with a global variable, etc). Since I don't really need this anywhere else in the script, I don't really even need it to be a function. Thanks for your input though, Julio. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] function returning true or errors
Rather than using true and false you can use 1, 0 it saves key strokes, reduces script size, etc Also use ' instead of if you don't need it evaluated by PHP. if (custom_function) { print 'Custom Function succeeded!'; } else { print 'There was a problem!'; } One thing I've done in the past is return a variable with a message and an error code for example function check_sheet() { // if first name is less than 2 characters fail check and provide an error if (strlen($_POST['firstname']) '2') { $return['status'] = '0'; $return['message'][] = 'First name must be at least 2 characters long'; } // use if instead of elseif so we can return multiple error messages at once if (strlen($_POST['lastname']) '2') { $return['status'] = '0'; $return['message'][] = 'Last name must be at least 2 characters long'; } // if we have not encountered an error set return status to 1 (true) if (!isset($return['status']) { $return['status'] = '1'; } return $return; } Now in my main script I would perform checking like this // execute check_sheet function $check_sheet = check_sheet(); if ($check_sheet['status'] == '1') { // if the function returned 1 (true) display confirmation print 'Thank you for your submission!'; } else { // if the function returned 0 (false) display error messages for ($i=0; $icount($check_sheet['message']); $i++) { print $check_sheet['message'][$i] . 'br'; } } unset ($check_sheet); This is example code written in my client for reference. This code will allow you to return multiple error messages without echoing html code from a function. -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 9:25 AM To: [EMAIL PROTECTED] Subject: [PHP] function returning true or errors I am writing a function that performs some actions. I would like to return true if the actions succeed, or return an error message if the actions fail. How should I go about it? The following code doesn't do it, because the returned error message is interpreted as a boolean true (I think that's what's happening): if (custom_function() == true) { print Custom Function succeeded!; } else { print custom_function(); } I would actually rather just have the error message generated by the script that calls the function, but the function performs some logic that determines what kind of error message to give. I was thinking of having the function return 1 if succeeds, 2 if error code A, or 3 if error code B, and then a switch statement could decide what to do in the calling script -- but does this sound sloppy? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tabs + SELECTED
An interesting problem has surfaced while finishing the coding for an input form. The usual text inputs fields are in place for first name, surname, address etc. However, I've created a drop-down list for state and country. Since these drop-down lists have OPTION SELECTEDIn USA/Canada , tabbing in the form jumps over these drop-downs [simply becuase they're filled]. I would like them to be included in the tabbing. Originally I used tabindex to control the flow over optional fields. I deleted the tabindex since the behavior of the form was erratic and non-logical in flow. Any ideas on how to circumvent the default behavior of OPTION SELECTEDblah, blah , blah? Any assistance will be greatly appreciated, Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: verify file types when uploading to server...
Oops... Hope this helps others, here is what I did: // This is your form... form name=img1 method=post action=done.php target=box enctype=multipart/form-data input type=file name=img1 size=25 brbr input type=submit name=Submit value=save nbsp;nbsp; input type=reset name=reset value=reset /form // this is the script to upload the file // Note: if you want to only upload certain file types... change the eregi('.jpg$ sting to whatever your file extension should be // Also the directory in question needs permissions set to 755 for it to work. ?php if ($img1_name != eregi('.jpg$', $img1_name)) { @copy($img1, /path/to/directory/$img1_name) or die (Could not upload file, please try again after making sure the file is less than 2mb in size and the file name correct); } else { die(No file selected for upload, or the file was not the correct type. Please only upload .jpg files.); } ? Michael Andersson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Maybe you want to share with the rest of us, or at least me how you did it? :) /Micke Jas [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Nevermind... =) Jas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am wondering if any one has a good idea on how to do checking based on a files extension, what I am trying to accomplish is to be able to upload files to a webserver however I only want to have .jpg files uploaded. If anyone has a good way to do this please share. Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: verify file types when uploading to server...
Not sure what you're tring to achieve, but that only checks the file's name. You might want to use file (man 1 file) to verify that it actually is a JPEG, since people can put malicious data into a file named xxx.jpg and perhaps fool IE into doing bad things. miguel On Wed, 17 Apr 2002, jas wrote: Oops... Hope this helps others, here is what I did: // This is your form... form name=img1 method=post action=done.php target=box enctype=multipart/form-data input type=file name=img1 size=25 brbr input type=submit name=Submit value=save nbsp;nbsp; input type=reset name=reset value=reset /form // this is the script to upload the file // Note: if you want to only upload certain file types... change the eregi('.jpg$ sting to whatever your file extension should be // Also the directory in question needs permissions set to 755 for it to work. ?php if ($img1_name != eregi('.jpg$', $img1_name)) { @copy($img1, /path/to/directory/$img1_name) or die (Could not upload file, please try again after making sure the file is less than 2mb in size and the file name correct); } else { die(No file selected for upload, or the file was not the correct type. Please only upload .jpg files.); } ? Michael Andersson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Maybe you want to share with the rest of us, or at least me how you did it? :) /Micke Jas [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Nevermind... =) Jas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am wondering if any one has a good idea on how to do checking based on a files extension, what I am trying to accomplish is to be able to upload files to a webserver however I only want to have .jpg files uploaded. If anyone has a good way to do this please share. Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple select list
Hello All, I have seen what I am trying to do on other web sites, but they were written in client side scripting languages. This may or may not be a limitation of server side scripting languages. What I am trying to do is dynamically generate 2 drop down list. I want the second list to contain different values based on what people choose in the first drop down list. If someone could guide me to some documentation on how to accomplish this it would be greatly appreciated. Thanks, Preston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: verify file types when uploading to server...
Could you explain that a little more? thanks, Jas Miguel Cruz [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Not sure what you're tring to achieve, but that only checks the file's name. You might want to use file (man 1 file) to verify that it actually is a JPEG, since people can put malicious data into a file named xxx.jpg and perhaps fool IE into doing bad things. miguel On Wed, 17 Apr 2002, jas wrote: Oops... Hope this helps others, here is what I did: // This is your form... form name=img1 method=post action=done.php target=box enctype=multipart/form-data input type=file name=img1 size=25 brbr input type=submit name=Submit value=save nbsp;nbsp; input type=reset name=reset value=reset /form // this is the script to upload the file // Note: if you want to only upload certain file types... change the eregi('.jpg$ sting to whatever your file extension should be // Also the directory in question needs permissions set to 755 for it to work. ?php if ($img1_name != eregi('.jpg$', $img1_name)) { @copy($img1, /path/to/directory/$img1_name) or die (Could not upload file, please try again after making sure the file is less than 2mb in size and the file name correct); } else { die(No file selected for upload, or the file was not the correct type. Please only upload .jpg files.); } ? Michael Andersson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Maybe you want to share with the rest of us, or at least me how you did it? :) /Micke Jas [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Nevermind... =) Jas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am wondering if any one has a good idea on how to do checking based on a files extension, what I am trying to accomplish is to be able to upload files to a webserver however I only want to have .jpg files uploaded. If anyone has a good way to do this please share. Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Images don't save
Hi, You can right click on a image on your browser and choose save. I want to disable this option, how can i do this Greetings, Manu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] equivalent of qw?
Hi all, I often find myself creating long arrays like so $a = array( a b c d e f r foo bar etc ... ); is there an easy way I don't know about to quote those vars? Basically just looking for an easier way to make such an array without adding teh quotes and commas, something like perl's qw. Thanks! Jack Dempsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Images don't save
You can't. Period. Simple as that. Oh, and BTW, it's not even a PHP question... On Thu, 18 Apr 2002 20:10:13 +0200, Manu Verhaegen wrote: Hi, You can right click on a image on your browser and choose save. I want to disable this option, how can i do this Greetings, Manu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards, Gunther E. Biernat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multiple select list
http://www.zend.com/zend/tut/drop-down.php -- Julio Nobrega. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: equivalent of qw?
$str = 'a b c foo bar'; $array = explode(' ', $str); -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 Jack Dempsey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I often find myself creating long arrays like so $a = array( a b c d e f r foo bar etc ... ); is there an easy way I don't know about to quote those vars? Basically just looking for an easier way to make such an array without adding teh quotes and commas, something like perl's qw. Thanks! Jack Dempsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Images don't save
I'm not sure of it'll work, never tried it, but you might be able to show the pics using a Java applet..that way one cannot copy them. Jule. On Thursday 18 April 2002 14:17, Gunther E. Biernat typed on his or her keyboard, and sent me the following: You can't. Period. Simple as that. Oh, and BTW, it's not even a PHP question... On Thu, 18 Apr 2002 20:10:13 +0200, Manu Verhaegen wrote: Hi, You can right click on a image on your browser and choose save. I want to disable this option, how can i do this Greetings, Manu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards, Gunther E. Biernat -- Jule Slootbeek [EMAIL PROTECTED] http://blindtheory.cjb.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Images don't save
Actually you can do this if all you are trying to do is disable right clicking. If you are thinking this will stop people from getting your pictures this is not the case. When a picture is viewed by someone it is downloaded to there comp first. No way to disable this. To disable right clicking you would have to do it with java. -Original Message- From: Gunther E. Biernat [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:17 PM To: [EMAIL PROTECTED]; 'Php-General (E-mail) Subject: Re: [PHP] Images don't save You can't. Period. Simple as that. Oh, and BTW, it's not even a PHP question... On Thu, 18 Apr 2002 20:10:13 +0200, Manu Verhaegen wrote: Hi, You can right click on a image on your browser and choose save. I want to disable this option, how can i do this Greetings, Manu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards, Gunther E. Biernat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
Make sure you aren't sending any HTML to the browser for any reason before the session_start(); call. Surefire way to prevent this error: place the following line as the first line of PHP script you execute on every page: ob_start(); Check out http://www.php.net/ob_start for details on what that does. -- Uchendu Nwachukwu newsreply AT unndunn DOT com - www.unndunn.com Phil Powell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am now getting the following errors on every page: Warning: Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php:25) in c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 81 This is when I use the following block of code to first SET the session for the very first time: if (mysql_num_rows($results) == 0) { // Could not find info in db redirect to login library with error msg $errorHTML .= font color=ccWe could not find your information ; $errorHTML .= in our database. Please try again./fontp; $hasLoggedIn = 0; } else if (strcmp(session_name(), hasLoggedIn) != 0) { // Set up session variable with username and redirect to pic upload lib session_name(hasLoggedIn); $name = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; $HTTP_SESSION_VARS[ip] = $REMOTE_ADDR; // To prevent session stealing } I am completely confused! Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... you have to put this on top of every of your pages: - session_name(hasLoggedIn); $stuff = session_name(); session_start(); - session_name first sets the name. then you call session_start which will look for the sessionid in ${session_name()}. that is why you have to call session_name() BEFORE calling session_start(); Regards Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanx, however, I cannot retain the session_name when I go to the next URL. How do I retain the session_name especially when I have to use a form method=POST? I have a URL that will be the login Once you login you will have a session (that works now) That page with the session will have a form with five input=file type form elements Once submitted you will be at a thank-you page and files uploaded, but then the session is gone (session_name is back to PHPSESSID again) What do I do to keep it? I cannot use cookies and putting it in the URL? Phil Michael Virnstein [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... session_name will retur the previos name of the session, so in your case $stuff will contain PHPSESSID and i think you have to call session_start(); before you do $HTTP_SESSION_VARS[username] = $username; so perhaps this will work: session_name(hasLoggedIn); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS[username] = $username; Regards, Michael Phil Powell [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Will the following lines set up a session by the name of hasLoggedIn with HTTP_SESSION_VARS[username]? $stuff = session_name(hasLoggedIn); $HTTP_SESSION_VARS[username] = $username; session_start(); I am trying to create a page that sets a session variable upon successful login, problem is, the session_name() never changes it always remains the default PHPSESSID what am I doing wrong now? I fixed the problem with multiple files, that was bizarre! Thanx Phil Uchendu Nwachukwu [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In your example, simply place this line in your code (on *every* page you want the session to be on): session_name(HasLoggedIn); session_register(username); If your PHP was compiled with '--enable-trans-sid' you shouldn't have to worry about anything else. PHP will automatically store the session ID in a cookie, or it will pass the session ID in your HTML links. If it wasn't compiled with '--enable-trans-sid', you'll need to use the constant SID. Example: -- ?php session_name(HasLoggedIn); session_register(username); ? Welcome ?=$username;?. !-- assumes user has already entered a username on some other page -- a href=nextpage.php??=SID;?Click here to continue./a -- Hope that helps!
RE: [PHP] Images don't save
This is not PHP so does not really belong here but since you asked. Here is a java script that will disable right clicking and display a copyright. Script language='Javascript' !-- var message='Copyright (c) 1999 Sakki.'; function click(e) { if (document.all) { if (event.button == 2) { alert(message); return false; }} if (document.layers) { if (e.which == 3) { alert(message);return false; }}} if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; // --/script -Original Message- From: Fifield, Mike [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:21 PM To: 'Gunther E. Biernat'; [EMAIL PROTECTED]; 'Php-General (E-mail) Subject: RE: [PHP] Images don't save Actually you can do this if all you are trying to do is disable right clicking. If you are thinking this will stop people from getting your pictures this is not the case. When a picture is viewed by someone it is downloaded to there comp first. No way to disable this. To disable right clicking you would have to do it with java. -Original Message- From: Gunther E. Biernat [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:17 PM To: [EMAIL PROTECTED]; 'Php-General (E-mail) Subject: Re: [PHP] Images don't save You can't. Period. Simple as that. Oh, and BTW, it's not even a PHP question... On Thu, 18 Apr 2002 20:10:13 +0200, Manu Verhaegen wrote: Hi, You can right click on a image on your browser and choose save. I want to disable this option, how can i do this Greetings, Manu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards, Gunther E. Biernat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Images don't save
On Thu, 18 Apr 2002, Jule Slootbeek wrote: I'm not sure of it'll work, never tried it, but you might be able to show the pics using a Java applet..that way one cannot copy them. 1) A lot of people won't see your site then, and if you have many pictures on the page, it'll be slower than molasses. 2) Those who do see the pictures can still take a screen shot. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: verify file types when uploading to server...
Unix systems have a program called 'file' that will look inside a file to try to figure out what sort of data it contains, regardless of how it's named. Generally it just looks at the first few bytes for a telltale fingerprint but there are all sorts of rules for different file types. This is similar to the mechanism IE uses to override server-sent MIME types. You can send the path of your uploaded file to the 'file' command and parse the output to see what sort of data appears to be contained within. Try it on the command line to see what sort of output it produces for various file types. miguel On Thu, 18 Apr 2002, jas wrote: Could you explain that a little more? thanks, Jas Miguel Cruz [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Not sure what you're tring to achieve, but that only checks the file's name. You might want to use file (man 1 file) to verify that it actually is a JPEG, since people can put malicious data into a file named xxx.jpg and perhaps fool IE into doing bad things. miguel On Wed, 17 Apr 2002, jas wrote: Oops... Hope this helps others, here is what I did: // This is your form... form name=img1 method=post action=done.php target=box enctype=multipart/form-data input type=file name=img1 size=25 brbr input type=submit name=Submit value=save nbsp;nbsp; input type=reset name=reset value=reset /form // this is the script to upload the file // Note: if you want to only upload certain file types... change the eregi('.jpg$ sting to whatever your file extension should be // Also the directory in question needs permissions set to 755 for it to work. ?php if ($img1_name != eregi('.jpg$', $img1_name)) { @copy($img1, /path/to/directory/$img1_name) or die (Could not upload file, please try again after making sure the file is less than 2mb in size and the file name correct); } else { die(No file selected for upload, or the file was not the correct type. Please only upload .jpg files.); } ? Michael Andersson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Maybe you want to share with the rest of us, or at least me how you did it? :) /Micke Jas [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Nevermind... =) Jas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am wondering if any one has a good idea on how to do checking based on a files extension, what I am trying to accomplish is to be able to upload files to a webserver however I only want to have .jpg files uploaded. If anyone has a good way to do this please share. Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs + SELECTED
On Thursday, April 18, 2002, at 12:33 PM, Andre Dubuc wrote: Since these drop-down lists have OPTION SELECTEDIn USA/Canada , tabbing in the form jumps over these drop-downs [simply becuase they're filled]. I would like them to be included in the tabbing. Originally I used tabindex to control the flow over optional fields. I deleted the tabindex since the behavior of the form was erratic and non-logical in flow. Any ideas on how to circumvent the default behavior of OPTION SELECTEDblah, blah , blah? To the best of my knowledge, this action is out of your control, at least from the perspective of a PHP coder. It's the way the browser handles user input, and nothing your PHP script on the server can do will override this. In my browsers, Mozilla 0.9.9 Mac and IE5.1Mac, I don't get this behavior even when there is a SELECTED option. Although, I use the form option selected=yesblah blah/option. Try your code using this style, which incidentally is XHTML compliant, and maybe your browser will respond differently. Or perhaps there is some JavaScript technique that can help you, if you decide to go this route then you will want to investigate the *focus-related attributes. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function returning true or errors
On Thursday, April 18, 2002, at 11:56 AM, Jason Wong wrote: What I tend to do is define functions like so: function doo($dah, $dib, $error) { ... I had not even thought about passing an extra parameter by reference -- great idea. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php printer functions...
I'm running PHP 4.1.1 on a Win2K box. If I understand the manual correctly, the printer functions have been integrated into PHP as of v4.0.4. However, when I try to call any of the printer functions, nothing works. Any ideas or suggestions? TIA -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] difference between $foo and isset($foo)
Hi, I am looking at some codes. Some authors use $foo and isset($foo) interchangeably. Just to want to make sure that the statement, if ($foo) { ... } is different from if (isset($foo)) { ... } Right? if ($foo) means variable exists and can be null. Whereas, isset($foo) means that the value in $foo cannot be null? Regards, Norman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tabs + SELECTED
On Thursday 18 April 2002 02:31 pm, you wrote: On Thursday, April 18, 2002, at 12:33 PM, Andre Dubuc wrote: Since these drop-down lists have OPTION SELECTEDIn USA/Canada , tabbing in the form jumps over these drop-downs [simply becuase they're filled]. I would like them to be included in the tabbing. Originally I used tabindex to control the flow over optional fields. I deleted the tabindex since the behavior of the form was erratic and non-logical in flow. Any ideas on how to circumvent the default behavior of OPTION SELECTEDblah, blah , blah? To the best of my knowledge, this action is out of your control, at least from the perspective of a PHP coder. It's the way the browser handles user input, and nothing your PHP script on the server can do will override this. In my browsers, Mozilla 0.9.9 Mac and IE5.1Mac, I don't get this behavior even when there is a SELECTED option. Although, I use the form option selected=yesblah blah/option. Try your code using this style, which incidentally is XHTML compliant, and maybe your browser will respond differently. Or perhaps there is some JavaScript technique that can help you, if you decide to go this route then you will want to investigate the *focus-related attributes. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] Thanks Eric, That did the trick! The tabs work in drop-downs now. Btw, I'm using Konqueror with LM 8.2. It seems to have some quirks in it. Mozilla Galeon however don't seem to like my CSS stylesheet colors -- I'll have to figure that one out later. Regards, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference between $foo and isset($foo)
On Thu, 18 Apr 2002, Norman Zhang wrote: I am looking at some codes. Some authors use $foo and isset($foo) interchangeably. Just to want to make sure that the statement, if ($foo) { ... } is different from if (isset($foo)) { ... } Right? if ($foo) means variable exists and can be null. Whereas, isset($foo) means that the value in $foo cannot be null? Not quite (or maybe I just don't understand your sentence). if ($foo) will be true if $foo has been set to some non-null (and non-zero) value. It will be false if $foo==null. On the other hand, if (isset($foo)) will be true will be true if any value at all has been assigned to $foo, including null or zero. It will only be false if $foo has never been assigned in this scope. However, bear in mind that ($foo) will still evaluate to null even in this case. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: difference between $foo and isset($foo)
Norman Zhang [EMAIL PROTECTED] wrote: Right? if ($foo) means variable exists and can be null. Whereas, isset($foo) means that the value in $foo cannot be null? you've got it backwards. 'if (isset($foo))' tests that the variable has been set to some value, possibly including false or null. 'if ($foo)' tests that the value of the variable is true. jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Number checker
i want to check if a given string has only numbers for exampl $test = 343124312 TRUE $test1 = q34daf23423 FALSE Jeoren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] limit on extended classes
Is there a limit on how many times you can extend a class in PHP 4? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Number checker
On Thursday, April 18, 2002, at 02:58 PM, Jeroen Timmers wrote: i want to check if a given string has only numbers for exampl $test = 343124312 TRUE $test1 = q34daf23423 FALSE use either is_numeric(), or for whole numbers only, use a regex: preg_match('/^\d+$/', $test); Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Number checker
Jeroen Timmers wrote: i want to check if a given string has only numbers for exampl $test = 343124312 TRUE $test1 = q34daf23423 FALSE I'm tempted to say go read about ereg(), but since it's just as long to provide a response... return ereg( '^[[:alpha:]]*$', $testString ); Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] limit on extended classes
Erik Price wrote: Is there a limit on how many times you can extend a class in PHP 4? Was there ever? Curious to know! Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php