Re: [PHP] Re: Mass Mailing Using PHP
Quoting Manuel Lemos [EMAIL PROTECTED]: You may just need to tune qmail to maximize the number of simultaneous deliveries according to the available bandwidth. How do I tune qmail in that manner ? If the answer is too long and complicated, pls flame me softly as this is already OT. For this reason, during deliveries of messages to many recipients, it is better to pause once in a while to let the queue be fully processed and do not stall other programs. Do you mean, say we fetched 100,000 addresses from database, we make our script sleep for a while after sending, say 1000 mails ? -- roger --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I formated a PHP script into colored HTML
Hi! How can I make a code into html format like this ?php $foo = 5bar; // string $bar = true; // boolean settype($foo, integer); // $foo 5 (integer) settype($bar, string); // $bar 1 (string) ? TABLE BORDER=0 BGCOLOR=#E0E0E0 CELLPADDING=5 TR TD code font color=#00 font color=#BBlt;?phpbr /$foo /fontfont color=#007700= /fontfont color=#DD5bar/fontfont color=#007700; /fontfont color=#FF8000// stringbr //fontfont color=#BB$bar /fontfont color=#007700= /fontfont color=#BBtrue/fontfont color=#007700;nbsp;nbsp;nbsp;/fontfont color=#FF8000// booleanbr /br //fontfont color=#BBsettype/fontfont color=#007700(/fontfont color=#BB$foo/fontfont color=#007700, /fontfont color=#DDinteger/fontfont color=#007700); /fontfont color=#FF8000// $foo 5nbsp;nbsp;nbsp;(integer)br //fontfont color=#BBsettype/fontfont color=#007700(/fontfont color=#BB$bar/fontfont color=#007700, /fontfont color=#DDstring/fontfont color=#007700);nbsp;nbsp;/fontfont color=#FF8000// $bar 1 (string)br //fontfont color=#BB?gt;/font /font /code/TD /TR /TABLE Shi MuQi LangFang ABC (China) v Tel:(86)-316-6838216 /(_)\ E-mail:[EMAIL PROTECTED] ^ ^
[PHP] Re: grabbing information from websites
instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Shell command in php script
Hi, I'm trying to find how to execute a shell command in a php script, I meen I would like for example to stop services like ssh or others in /etc/init.d with command stop and start it again. I've tried some commands without success, and I've missed something like script owner or group. I really don't know. Perhaps it sould be in php conf ? Is someone have any idea ? Thanks Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: grabbing information from websites
Champinoamn wrote: hi everyone, im fairly new to php scripting and was having trouble grabing information from a website. i have been able to grab information that is in amongst other text (for example, the word firemaking below) --- tda href=hiscoreuser.cgi?username=champinomancategory=12 class=cFiremaking/a/td td align=right7,386/tdtd align=right 61 /tdtd align=right 333,575 /td/tr --- but the number i want to grab is the 61. its on its own line which i think is the reason im having trouble. i have been using this: eregi (username=champinomancategory=13.*align=\right\(.*)/td,$line,$out) what am i doing wrong? have i posted enough information. thank you for the help. p.s. try and keep the answers fairly straight forward as i am new to this instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] grabbing information from websites
hi everyone, im fairly new to php scripting and was having trouble grabing information from a website. i have been able to grab information that is in amongst other text (for example, the word firemaking below) --- tda href=hiscoreuser.cgi?username=champinomancategory=12 class=cFiremaking/a/td td align=right7,386/tdtd align=right 61 /tdtd align=right 333,575 /td/tr --- but the number i want to grab is the 61. its on its own line which i think is the reason im having trouble. i have been using this: eregi (username=champinomancategory=13.*align=\right\(.*)/td,$line,$out) what am i doing wrong? have i posted enough information. thank you for the help. p.s. try and keep the answers fairly straight forward as i am new to this -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Shell command in php script
Vincent Fonteneau wrote: Hi, I'm trying to find how to execute a shell command in a php script, I meen I would like for example to stop services like ssh or others in /etc/init.d with command stop and start it again. I've tried some commands without success, and I've missed something like script owner or group. I really don't know. Perhaps it sould be in php conf ? Is someone have any idea ? Thanks Vincent use one of these ?php shell_exec('cmd'); exec('cmd');// synonim to `cmd` ? there a few more... but I can't remember which -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: grabbing information from websites
where abouts am i putting the modifier 'm' in the expression to allow the multilines? Champinoman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: grabbing information from websites
From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- 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] Need help in implementing Payment Gatewaydetails
Hi. Any one could tell me about how to implement VeriSign Payment Gateway. I mean I want to know how to implement the AVS and CSC filter settings in test mode and how to convert them in to live mode. Its Very Important Thanks in advance... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: grabbing information from websites
so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- 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] Re: grabbing information from websites
I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- 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] Re: grabbing information from websites
ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- 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] how to execute a remote command from php [done]
- Original Message - From: Sethi, Samir (IDS DMDS) [EMAIL PROTECTED] To: Victor Alvarez [EMAIL PROTECTED] Sent: Monday, September 27, 2004 5:47 PM Subject: RE: [PHP] how to execute a remote command from php Exactly, I had to generate keys for nobody and now I am able to execute remote commands. Thank you so much. Victor. I think when you execute the command it is run as user nobody. You may need to generate keys for the nobody account and update the authorized keys on the remote system. Samir. -Original Message- From: Victor Alvarez [mailto:[EMAIL PROTECTED] Sent: Monday, September 27, 2004 12:35 PM To: [EMAIL PROTECTED] Subject: [PHP] how to execute a remote command from php Hello, Since last week I am trying to execute a remote machine command from php without success. Since ssh ask for a password, I managed to use ssh with dsa authentication so it's possible to call the remote command without password and only with one line: ssh -l victor 192.168.129.211 -i /root/.ssh/id_dsa whoami. It works perfectly from command line but I have nothing if I try to do the same from php: exec(ssh -l victor 192.168.129.211 -i /root/.ssh/id_dsa \whoami\,$results); $results is empty after the execution. I wonder if somebody could answer this question. I have found no solution googling it. Thank you. Regards, Victor. If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website with a Instant Messenger
Raditha Dissanayake [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Ricardo Cezar wrote: Hello all, I want to put a instant messenger in a website. People connect to this website to stay in touch with each other. There is a photo album for everyone, a Forum, groups... The IM must work like ICQ, MSN and other, but via web. Users of the site can add other users to the list, and when people log in their status go ONLINE. Then we can open another window and chat, or send a message... Strange as it may seem. This is not asking too much. Jabber (http://www.jabber.org) can do all that. You will even find a couple of PHP classes to talk to a jabber server. Raditha Dissanayake. Thanks Raditha. I will look jabber.org for some docs. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website with a Instant Messenger
Use jabber. They had a web interface over a year ago, and it can be tweaked to operate with or without a locked down registration form. I had some scripts at my old job to handle just this very thing, but alas I did not get a chance to copy them before I left. It's pretty straight forward and jabber is trifling easy to get set up and running, especially on a RH system. Robert Ricardo Cezar wrote: Well, I think everybody starts there, including me! :) I´m searching google... But thanks :) Jay Blanchard [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] [snip] Where can I start? [/snip] http://www.google.com -- Robert Sossomon, Webmaster and IT Guru 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Testing Response of A Proxy with PHP?
* and then Marek Kilimajer declared oookay... i think i understand the page, but how would i imlement that $fp = fsockopen (proxy.server.net, 8080, $errno, $errstr, 30); if (!$fp) { echo $errstr ($errno)br\n; } else { fputs ($fp, OPTIONS * HTTP/1.0\r\nMax-Forwards: 0\r\n\r\n); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } You should get something like: HTTP/1.0 200 Ok Date: Sun, 26 Sep 2004 20:48:46 GMT Via: HTTP/1.1 proxy.server.net (Traffic-Server/4.0.18 [c s f ]) Allow: CONNECT, DELETE, GET, HEAD, OPTIONS, POST, PURGE, PUT, PUSH, TRACE Content-Length: 0 Well, it connects great! However, i get errors back about * being a bad url...? -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I formated a PHP script into colored HTML
On Tuesday 28 September 2004 12:40, [EMAIL PROTECTED] wrote: How can I make a code into html format like this You can have a look at the highlight_file() function. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Women, deceived by men, want to marry them; it is a kind of revenge as good as any other. -- Philippe De Remi */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] submit to a remote form without the use of curl?? Is it possible?
Stupid me completely forgot about the socket functions in PHP. Again, that's what I get for having too little coffee last night. Thanks for the help everyone. - Original Message - From: Chris Shiflett [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 27, 2004 11:06 PM Subject: Re: [PHP] submit to a remote form without the use of curl?? Is it possible? --- [EMAIL PROTECTED] wrote: Is it possible with php to submit to a remote form without the use of curl? You can use fsockopen: http://shiflett.org/hacks/php/http_post If your version of PHP supports streams, you can use streams: http://shiflett.org/hacks/php/streams_post Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming December 2004http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help in implementing Payment Gatewaydetails
suneel wrote: Hi. Any one could tell me about how to implement VeriSign Payment Gateway. I mean I want to know how to implement the AVS and CSC filter settings in test mode and how to convert them in to live mode. Its Very Important Thanks in advance... http://www.php.net/manual/en/ref.pfpro.php The rest you can get from Verisign. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: grabbing information from websites
i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=champinoman,r;); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',$line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- 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] Re: grabbing information from websites
fgets() will read in from file until end of line or end of file up to the No bytes given. Is there an end of line between the username=chapinoman and the td align=right70,277 ? If there is a line break then $line will never contain both strings. You may need to use fread() instead. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 14:47 To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: grabbing information from websites i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=ch ampinoman,r); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Web-App Frameworks?
Anyone with hands on PHP frameworks? I tried Mojavi, BlueShoes, GPF, PHP-MVC, and alot of more ( alot of them are available) I need the answer from an experienced programmer( not a php newbie ) rather an application designer or a windows-dna programmer who is into php. I have some sort of understanding and facts after using these frameworks. But I need some feedback from people who used it more than months experimented it in web-application design. Any sugestions? Any Comments? -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] files not uploading
I just switched hosts and I am now working on all the stuff that once worked but now doesn't. I have an image upload script with the following code: form method='post' enctype='multipart/form-data' action='?=$_SERVER['PHP_SELF'];??method=uploadid=? echo $id?' ?php for( $i = 0; $i $files_to_upload; $i++ ) { ? tr td colspan=5input type='file' name='file[]' style='width: 100%'/td /tr ?php } ? tr td colspan=4 align='center'input type='submit' value='Upload'/td /tr /form Then, here is part of the code doing the upload: snip //When REGISTERED_GLOBALS are off in php.ini $_POST= $HTTP_POST_VARS; $_GET = $HTTP_GET_VARS; //Upload the file if($_GET['method'] == upload) { echo 1br; $file_array = $HTTP_POST_FILES['file']; $uploads = false; for($i = 0 ; $i $files_to_upload; $i++) { echo 2br; if($HTTP_POST_FILES['file']['name'][$i]) { echo 3br; /snip It prints out the 2 but doesn't get into the 3 loopbut I am uploading files. I have tried it with $_FILES and $HTTP_POST_FILES. This worked on my last hosts servers but not the new host. Any ideas? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Mass Mailing Using PHP
On Tue, 28 Sep 2004 14:54:24 +0800, Roger Thomas [EMAIL PROTECTED] wrote: Quoting Manuel Lemos [EMAIL PROTECTED]: For this reason, during deliveries of messages to many recipients, it is better to pause once in a while to let the queue be fully processed and do not stall other programs. Do you mean, say we fetched 100,000 addresses from database, we make our script sleep for a while after sending, say 1000 mails ? An alternative solution is to insert a small delay using usleep() after each message is sent such that the queue never gets overfull to begin with. Also, keep in mind you are dealing with multiple possible constraints -- local resource limitations (CPU disk), and bandwidth available for connecting to remote hosts. For reference, I do this kind of thing on a fairly busy server, using Postfix, for nonprofit clients that do member newsletter mailings in the 5,000 to 10,000 piece range. I find that I am able to keep system load tolerably low by limiting my script to about 3-4 messages per second. In my case I am mostly concerned about managing local CPU. The queue never backs up. You will also want to look at protecting your script from dying prematurely by using ignore_user_abort() and set_time_limit() or equivalents. If you are sending only a few hundred messages, that shouldn't place much of a burden on your server, and you may not need to insert any delay at all. (Whereas if you are sending 100,000 messages, I'd have to guess you're a spammer, as any org with a legitimate reason to mail 100K people at once would be unlikely to be creating this script from scratch and asking basic questions in php-general. But I could be wrong.) good luck, pb -- paul bissex, e-scribe.com -- database-driven web development 413.585.8095 69.55.225.29 01061-0847 72°39'71W 42°19'42N -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Make cron file
Hi! I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. Regards. JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Make cron file
[snip] I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. [/snip] Type crontab -e and the cron file will be openedunless you're on a Windows machine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
Jay Blanchard wrote: [snip] I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. [/snip] Type crontab -e and the cron file will be openedunless you're on a Windows machine in both cases, this is the wrong list to ask this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple date/now() question
Hi, I have a field in the db called join_date_time(timestamp 14) which has data like: 20040928170708 20040916163619 etc This keeps track of the customer join date, I need to know if the client has joined in the last 24hrs or more than 24hrs back... Anybody have a function for this? or can help? am a bit confused because reading on google I see that there are 2 possible problems as MySql has its own time and PHP its own time (most of the time!) Thanks, Mag = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] simple date/now() question
[snip] data like: 20040928170708 20040916163619 etc Anybody have a function for this? or can help? am a bit confused because reading on google I see that there are 2 possible problems as MySql has its own time and PHP its own time (most of the time!) [/snip] http://www.php.net/date http://www.php.net/time You jsut have to accept how MySQL stores a dattime stamp, if you know how to read it you can manipulate with several time/date functions in PHP. Taking one of your stamps above... 20040916163619 2004-09-16 16:36:19 Then you can test to see if 16:36:19 if greater than or less than 24 hours ago -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
Juan Pablo Herrera wrote: Hi! I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. How about asking on the proper list? Or Google? Do we now add Cron to the list what this list supports? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Make cron file
[snip] Juan Pablo Herrera wrote: Hi! I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. How about asking on the proper list? Or Google? Do we now add Cron to the list what this list supports? [/snip] At least he is CRON'ing a php script -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
Jay Blanchard wrote: At least he is CRON'ing a php script Well, we can't have that. Maybe we can talk the OP to change his question...maybe he can ask how to set up a cron to sync his system clock with a time server. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
I do not understand what is the problem, you just add the the time format as should be and put the following at the beginning of your script: #!/usr/local/bin/php -q (or your path to the php interpreter) ?PHP php code here ? then you simply add the line (crontab -e) 0 3 * * * /area_backup/bin/sync.php [args] hope it helps, and yes, this is probably the wrong list mate ;-) Cheers, On Tue, Sep 28, 2004 at 11:47:51AM -0400, John Nichel wrote: Juan Pablo Herrera wrote: Hi! I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. How about asking on the proper list? Or Google? Do we now add Cron to the list what this list supports? -- John C. Nichel berGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Maciek Ruckgaber Bielecki All our lauded technological progress -- our very civilization - is like the axe in the hand of the pathological criminal. --Albert Einstein-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: [SPAM] Plan Ahead. Shop For Life Insuranc
-- Forwarded message -- From: BonusMail from MyPoints [EMAIL PROTECTED] Date: Mon, 27 Sep 2004 11:24:19 -0600 Subject: [SPAM] Plan Ahead. Shop For Life Insuranc To: [EMAIL PROTECTED] Justin, your current Point balance is 4,565 Quotes based on a composite of participating carriers, which have at least an A-rating by SP. Your premium may differ due to your health, smoking or other activities. Rates subject to underwriting and state availability. InsWeb is a service offered by InsWeb Insurance Services, Inc., a licensed agency in most states (CA#0C24350). If you wish to opt out of receiving future emails from InsWeb.com, please click here. This will not unsubscribe you from MyPoints. InsWeb Corporation - P.O. Box 580 - Gold River, CA - 95741-0580 Hurry Justin! This Point offer expires October 11th. Show me more. I'll receive 5 Points just for reading this message and visiting InsWeb.com. You won't see an automatic confirmation for clicking on the above link. The 5 Points for reading this message will show up in your account overnight. If you use a pop-up blocker: To receive your Points you must add MyPoints to the Allow list or disable your pop-up blocker. The Point offer for this BonusMail® expires at midnight Central Time on the above mentioned expiration date. Visit Member Services to: - Change your email information - Update your account information - Cancel your account MyPoints.com, Inc., 188 Embarcadero - 5th Floor, San Francisco, CA 94105 Shop through MyPoints - Earn Points for every purchase! See what your 4,565 Points can get you! Spend your Points with over 75 top brand name partners. You've received this email advertisement because you're a member of MyPoints. If you no longer wish to receive BonusMail, click here to unsubscribe, or email [EMAIL PROTECTED] and type unsubscribe in the subject line. ©1997-2004 MyPoints.com, Inc.® All rights reserved. !DSPAM:4158b1bd97816288916596! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
Juan, Are you trying to do so from inside a PHP script? If that is the case, you could do: $entry = $min $h $d $m $s $command $comment; $added = system (echo $entry /var/spool/cron/tabs/$user, $retval); if ($retval) { echo success; } else { echo failure; } Please notice that the code is not tested! Let us know if that helped! -- ES --- John Nichel [EMAIL PROTECTED] wrote: Juan Pablo Herrera wrote: Hi! I need make a cron file, for example a .job file: #mi hodimeseq job comment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. How about asking on the proper list? Or Google? Do we now add Cron to the list what this list supports? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: [SPAM] Plan Ahead. Shop For Life Insuranc
Justin Patrin wrote: -- Forwarded message -- From: BonusMail from MyPoints [EMAIL PROTECTED] Date: Mon, 27 Sep 2004 11:24:19 -0600 Subject: [SPAM] Plan Ahead. Shop For Life Insuranc To: [EMAIL PROTECTED] snip Why? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I formated a PHP script into colored HTML
There's also a pear package that might help you: http://pear.php.net/package/Text_Highlighter Cheers Chris Jason Wong wrote: On Tuesday 28 September 2004 12:40, [EMAIL PROTECTED] wrote: How can I make a code into html format like this You can have a look at the highlight_file() function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple date/now() question
Just select out records that are NOW() - (24 * 60 * 60)or if you use datetime field instead of timestamp, which is prolly better off ofr many reasons, use DATE_SUB(NOW(), INTERVAL 1 DAY) or something similar. you can get timestamps from datetime fields, if that is an issue for you... Jason Mag [EMAIL PROTECTED] wrote: Hi, I have a field in the db called join_date_time(timestamp 14) which has data like: 20040928170708 20040916163619 etc This keeps track of the customer join date, I need to know if the client has joined in the last 24hrs or more than 24hrs back... Anybody have a function for this? or can help? am a bit confused because reading on google I see that there are 2 possible problems as MySql has its own time and PHP its own time (most of the time!) Thanks, Mag = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.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
Re: [PHP] simple date/now() question
Hi, Thanks for replying. Just select out records that are NOW() - (24 * 60 * 60) I just need this for 1 record, when the user logs in I want to know if he has joined more than 1 day back or not... I am looking into php.net/date and php.net/time, but if have an example for me...:-) Thanks, Ryan or if you use datetime field instead of timestamp, which is prolly better off ofr many reasons, use DATE_SUB(NOW(), INTERVAL 1 DAY) or something similar. you can get timestamps from datetime fields, if that is an issue for you... Jason Mag [EMAIL PROTECTED] wrote: Hi, I have a field in the db called join_date_time(timestamp 14) which has data like: 20040928170708 20040916163619 etc This keeps track of the customer join date, I need to know if the client has joined in the last 24hrs or more than 24hrs back... Anybody have a function for this? or can help? am a bit confused because reading on google I see that there are 2 possible problems as MySql has its own time and PHP its own time (most of the time!) Thanks, Mag = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
sorry, my cuestion is about the construction of the job file with php. I send parameters via POST: day, hours, minute, sentence for execuite with cron. This is cached for a php file that make the job file. Well, my problem is make this php file.I think to use file() for this, but maybe somebody think other idea. Regards, JP Jay Blanchard wrote: [snip] I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. [/snip] Type crontab -e and the cron file will be openedunless you're on a Windows machine in both cases, this is the wrong list to ask this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GNU/Linux MacOsX Server different behaviour
Hi, I've an Apple G5 Xserve with MacOsX server 10.3 (Darwin 7.3.1) and PHP 4.3.2 and I need to run a PHP script containing this line: Linux: $temp=shell_exec(date 01/01/2004 +%a); Mac: $temp=shell_exec(date 010104 +%a); (man date says me how to write correctly date string in both cases) On Linux result is correct (e.g.'Mon'), on Mac output is empty. Is it a PHP problem, a php.ini lack (on Mac) or a permissions problem? Or anything else? Regards, thanks! Ciao Francesco --- Leggi la tua email con il tuo cellulare! Grazie a I.Box puoi leggere la tua email di superEva da SMS e dalla segreteria! http://webmail.supereva.it/ibox/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Loop within Loop help please
hi everyone, I have a simplified bit of code below: ?php foreach($someArray as $someVal) { //do some stuff } ? What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? How might i do that? Much thanks... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
Nick Wilson wrote: hi everyone, I have a simplified bit of code below: ?php foreach($someArray as $someVal) { //do some stuff } ? What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? How might i do that? Much thanks... $count = 0; foreach ( $someArray as $someVal ) { if ( is_int ( $count / 20 ) ) { // do this } // do this $count++; } -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loop within Loop help please
[snip] I have a simplified bit of code below: ?php foreach($someArray as $someVal) { //do some stuff } ? What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? [/snip] if ($count%20 == 0) http://ca3.php.net/manual/en/language.operators.arithmetic.php in the manual (look for Modulus). HTH. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
% operator: http://www.php.net/operators Nick Wilson wrote: hi everyone, I have a simplified bit of code below: ?php foreach($someArray as $someVal) { //do some stuff } ? What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? How might i do that? Much thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loop within Loop help please
[snip] What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? How might i do that? [/snip] With modulus ...http://us2.php.net/manual/en/language.operators.arithmetic.php ?php $count=0; foreach($someArray as $someVal) { if(0 == ($count % 20)){ // do some stuff } //do some stuff } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GNU/Linux MacOsX Server different behaviour
Reading the man page on a Mac it says that you are trying to set the system date if you provide a date, which you need to be root to be able to do. If you just run your command in the shell, you'll see that you get an operation not permitted error. Using the -r switch you can provide the seconds since Epoch to just display a 'date' you specify. For instance: date -r 97840 +%a Returns 'Mon' Check the shells you are running, the Mac defaults to bash under 10.3. You can always switch the default shell to get different behavior. On Sep 28, 2004, at 12:51 PM, Francesco Casalena wrote: Hi, I've an Apple G5 Xserve with MacOsX server 10.3 (Darwin 7.3.1) and PHP 4.3.2 and I need to run a PHP script containing this line: Linux: $temp=shell_exec(date 01/01/2004 +%a); Mac: $temp=shell_exec(date 010104 +%a); (man date says me how to write correctly date string in both cases) On Linux result is correct (e.g.'Mon'), on Mac output is empty. Is it a PHP problem, a php.ini lack (on Mac) or a permissions problem? Or anything else? Regards, thanks! Ciao Francesco --- Leggi la tua email con il tuo cellulare! Grazie a I.Box puoi leggere la tua email di superEva da SMS e dalla segreteria! http://webmail.supereva.it/ibox/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
* and then Pablo Gosse declared if ($count%20 == 0) http://ca3.php.net/manual/en/language.operators.arithmetic.php in the manual (look for Modulus). Yes, thankyou very much, got a bunch of similar replys in my personal inbox to ;-) And there was me sifting through the math functions! hehe... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
* and then Marek Kilimajer declared % operator: http://www.php.net/operators Thanks EVERYONE, i feel like i should have known that, but i didnt, my thanks! - and the guy that suggested the other way? that was how i was trying to do it ;-) -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loop within Loop help please
?php $count=0; foreach($someArray as $someVal) { $count++; if($count == 20) { // do some stuff $count = 0; } //do some stuff } ? How might i do that? Something like that. Justin Much thanks... -- Nick W -- 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] Loop within Loop help please
Nick Wilson wrote: hi everyone, I have a simplified bit of code below: ?php foreach($someArray as $someVal) { //do some stuff } ? What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? How might i do that? if($count % 20 == 0 ) { Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can't upload files
--sorry if you get this twice...it didn't seem to go through the first time-- I just switched hosts and I am now working on all the stuff that once worked but now doesn't. I have an image upload script with the following code: form method='post' enctype='multipart/form-data' action='?=$_SERVER['PHP_SELF'];??method=uploadid=? echo $id?' ?php for( $i = 0; $i $files_to_upload; $i++ ) { ? tr td colspan=5input type='file' name='file[]' style='width: 100%'/td /tr ?php } ? tr td colspan=4 align='center'input type='submit' value='Upload'/td /tr /form Then, here is part of the code doing the upload: snip //When REGISTERED_GLOBALS are off in php.ini $_POST= $HTTP_POST_VARS; $_GET = $HTTP_GET_VARS; //Upload the file if($_GET['method'] == upload) { echo 1br; $file_array = $HTTP_POST_FILES['file']; $uploads = false; for($i = 0 ; $i $files_to_upload; $i++) { echo 2br; if($HTTP_POST_FILES['file']['name'][$i]) { echo 3br; /snip It prints out the 2 but doesn't get into the 3 loopbut I am uploading files. I have tried it with $_FILES and $HTTP_POST_FILES. This worked on my last hosts servers but not the new host. Any ideas? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
I see lots of references to modulus, which works fantastic.. but how abut just testing if its equal to 20, then there isnt that extra arthmitc call.. this is just another way to do the same thing.. take your pick.. unless someone can see a bad reason for this method. $count = 0; foreach . { if($count == 20) { . $count = 0; } else { $count++; } } Nick Wilson [EMAIL PROTECTED] wrote: hi everyone, I have a simplified bit of code below: ?php foreach($someArray as $someVal) { //do some stuff } ? What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? How might i do that? Much thanks... -- Nick W -- 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] Loop within Loop help please
* and then Jesse Castro declared [snip] ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? [/snip] if($count is divisible by 20 exactly) Can be written as If ($count %20 == 0) % is the modulus operator and works like the division operator, only it returns the remainder instead of the quotient. Ahhh.. thankyou very much jesse, that's great! -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Match Vs Where - Fulltext Search
Hi all. It took me some time to discover that you can't use a MATCH | AGAINST statement unless you create an fulltext index of the fields to search at the same time. Strange, I know. What's more strange is that as I read more I wonder why people use it because it will only seartch complete words, will not search on words that are 3 characters or less, treats hyphenated words as seperate words and has a whole long list of excluded words. OK, so I'll use the following: [code]$query = SELECT * FROM MembersData WHERE `UserID` LIKE '$Keyword01' or `UserID` LIKE '$Keyword02' or `UserID` LIKE '$Keyword03' or `UserID` LIKE '$Keyword04' or `UserID` LIKE '$Keyword05'; $Data = mysql_query($query) or die(Error 1: . mysql_error());[/code] But the only problem I see with this is that although it allows me to search using wildcards and partial words it seems a very lengthy way of completing the task because I think I would have to repeat this statement with something like OR WHERE for each field I wanted to search. I know this post is lengthy and I apologise for putting you to sleep but I'd really love to get to the bottom of this one sometime soon. Has anyone else experienced similar frustrations searching their databases - I can't be the only one...! -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
So I understand, correct me if i am wrong, that your problem is just to append a line to the file ? if that is the case: //open and place pointer at the end of the file $fhandler = fopen(file,'a'); fputs($fhandler,$string_with_code); fclose($fhandler); if not, the case and you are having bad time trying to explain, i understand some spanish, so lets review it ;-) Cheers On Tue, Sep 28, 2004 at 01:45:09PM -0300, Juan Pablo Herrera wrote: sorry, my cuestion is about the construction of the job file with php. I send parameters via POST: day, hours, minute, sentence for execuite with cron. This is cached for a php file that make the job file. Well, my problem is make this php file.I think to use file() for this, but maybe somebody think other idea. Regards, JP Jay Blanchard wrote: [snip] I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. [/snip] Type crontab -e and the cron file will be openedunless you're on a Windows machine in both cases, this is the wrong list to ask this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Maciek Ruckgaber Bielecki I never think of the future. It comes soon enough. --Albert Einstein-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] __call and static methods
Is there a way to get __call to work for static methods? It doesn't seem to work by default and the docs are pretty sparse. Thanks, -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Match Vs Where - Fulltext Search
[snip] I know this post is lengthy and I apologise for putting you to sleep but I'd really love to get to the bottom of this one sometime soon. Has anyone else experienced similar frustrations searching their databases - I can't be the only one...! [/snip] What you are dealing with here, Michael, is a SQL/MySQL problem. We often have these problems. These problems do have a cure. Let me recommend a specialist at http://lists.mysql.com . /canIchargeaconsultingfee? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] __call and static methods
[snip] Is there a way to get __call to work for static methods? It doesn't seem to work by default and the docs are pretty sparse. [/snip] http://us4.php.net/manual/en/language.oop5.static.php may help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] __call and static methods
[snip] Is there a way to get __call to work for static methods? It doesn't seem to work by default and the docs are pretty sparse. [/snip] Found a little more info http://us4.php.net/manual/en/language.oop5.overloading.php ?php class Caller { private $x = array(1, 2, 3); function __call($m, $a) { print Method $m called:\n; var_dump($a); return $this-x; } } $foo = new Caller(); $a = $foo-test(1, 2, 3.4, true); var_dump($a); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: grabbing information from websites
The URL that you're grabbing there is a frameset, it's probably not the page you want to look at. When you right-click on the page you want to parse and select View Source and get the information you posted below, do the same thing but right-click and select Properties (in IE at least) and it'll tell you the URL that you're really looking at. My guess is that you're really parsing this source: htmlhead titleRuneScape - the massive online adventure game by Jagex Ltd/title meta name=Description content=RuneScape is a massive 3d multiplayer adventure, with monsters to kill, quests to complete, and treasure to win. You control your own character who will improve and become more powerful the more you play. meta name=Keywords content=Runescape, Jagex, free, games, online, multiplayer, magic, spells, java, MMORPG, MPORPG, gaming link rel=shortcut icon href=/favicon.ico type=image/x-icon / /head frameset cols=* frameborder=0 border=0 noframes body bgcolor=black text=white h3RuneScape/h3 RuneScape is a massive 3d multiplayer adventure, with monsters to kill, quests to complete, and treasure to win. You control your own character who will improve and become more powerful the more you play. pThis site uses frames, but your browser doesn't support them./p pTo play Runescape and browse our website, please download a recent web browser such as a href='http://www.microsoft.com'Microsoft Internet Explorer/a or a href='http://www.netscape.com'Netscape/a./p brbr pThe Jagex Team./p /body /noframes !--frame src=none.html noresize scrolling=no-- frame src=frame2.cgi?page=title.html noresize scrolling=auto !--frame src=none.html noresize scrolling=no-- /frameset /html Try echo'ing $line and looking at the data you're parsing. I bet it's what you see above. -TG -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 9:47 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: grabbing information from websites i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.c gi?username=champinoman,r); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right (.*)/td#mi',$line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right( .*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right( .*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/td m,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List
Re: [PHP] Loop within Loop help please
* and then Jason Davidson declared I see lots of references to modulus, which works fantastic.. but how abut just testing if its equal to 20, then there isnt that extra arthmitc call.. this is just another way to do the same thing.. take your pick.. unless someone can see a bad reason for this method. $count = 0; foreach . { if($count == 20) { . $count = 0; } else { $count++; } } That would be fine, but im afraid in my effort to make the example simple i forgot to ad a line: $count++; ;-) -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson [EMAIL PROTECTED] wrote: I see lots of references to modulus, which works fantastic.. but how abut just testing if its equal to 20, then there isnt that extra arthmitc call.. this is just another way to do the same thing.. take your pick.. unless someone can see a bad reason for this method. $count = 0; foreach . { if($count == 20) { . The only thing wrong with this method is that it doesn't fit the problem's specifications.The original poster wanted a way to trigger the code every 20 iterations of an unknown sized loop (implying that the loop would have 40 or more items), whereas the solution above only triggers it on iteration 20. Other than that, it's a perfectly wonderful piece of code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP as CGI: Denial of Service?
Hello there, PHP set up as CGI (either with binfmt and suEXEC or via suPHP) can expose your system to a denial of service attack. Even a very simple page like ? echo Hello world; ? can bog down a server completely if the reload button on the browser is pressed continously for some seconds. I already tried the RMax directives in httpd.conf and the memory limit in php.ini, but it does not seem to work, it is just being ignored. I think that so many processes are spawned that the system is out of control. I can get my load as high as 91 and my disk swaps for nearly 30 minutes until it works again. Sometimes even the kernel crashed with out of memory errors. Apart from trying out cgiwrap, I am completely helpless right now. Does anyone have an idea on what to do? I can't be possible that every PHP suEXEC install is a big security risk. Any tips are welcome! I experienced this problem with Apache 1.3 and 2.0. Thanks in advance, Florian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] __call and static methods
Hmm don't see clearly how could work for static methods :P On Tue, Sep 28, 2004 at 01:39:46PM -0500, Jay Blanchard wrote: [snip] Is there a way to get __call to work for static methods? It doesn't seem to work by default and the docs are pretty sparse. [/snip] Found a little more info http://us4.php.net/manual/en/language.oop5.overloading.php ?php class Caller { private $x = array(1, 2, 3); function __call($m, $a) { print Method $m called:\n; var_dump($a); return $this-x; } } $foo = new Caller(); $a = $foo-test(1, 2, 3.4, true); var_dump($a); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Maciek Ruckgaber Bielecki If my theory of relativity is proven successful, Germany will claim me as a German and France will declare that I am a citizen of the world. --Albert Einstein-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
Andrew Kreps wrote: On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson [EMAIL PROTECTED] wrote: I see lots of references to modulus, which works fantastic.. but how abut just testing if its equal to 20, then there isnt that extra arthmitc call.. this is just another way to do the same thing.. take your pick.. unless someone can see a bad reason for this method. $count = 0; foreach . { if($count == 20) { . The only thing wrong with this method is that it doesn't fit the problem's specifications.The original poster wanted a way to trigger the code every 20 iterations of an unknown sized loop (implying that the loop would have 40 or more items), whereas the solution above only triggers it on iteration 20. Other than that, it's a perfectly wonderful piece of code. You left this line out of Jason's post when you snipped it $count = 0; ie, everytime $count reached 20, run special code, and reset count to $20. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
You missed the $count = 0; right below it Andrew... his code works just like the modulus one... On Tue, 28 Sep 2004 12:10:21 -0700, Andrew Kreps [EMAIL PROTECTED] wrote: On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson [EMAIL PROTECTED] wrote: I see lots of references to modulus, which works fantastic.. but how abut just testing if its equal to 20, then there isnt that extra arthmitc call.. this is just another way to do the same thing.. take your pick.. unless someone can see a bad reason for this method. $count = 0; foreach . { if($count == 20) { . The only thing wrong with this method is that it doesn't fit the problem's specifications.The original poster wanted a way to trigger the code every 20 iterations of an unknown sized loop (implying that the loop would have 40 or more items), whereas the solution above only triggers it on iteration 20. Other than that, it's a perfectly wonderful piece of code. -- 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] __call and static methods
So, now you have found the static method docs, and you have found the very minimal __call() docs but you have not come close to answering anything about using call with static methods. For those who seem to miss the point, a static method call would be like: $a = Caller::test(1, 2, 3.4, true); I have tried defining __call as a static method, but that does not give the desired result either. -Jackson On Tue, 28 Sep 2004 13:39:46 -0500, Jay Blanchard [EMAIL PROTECTED] wrote: Found a little more info http://us4.php.net/manual/en/language.oop5.overloading.php ?php class Caller { private $x = array(1, 2, 3); function __call($m, $a) { print Method $m called:\n; var_dump($a); return $this-x; } } $foo = new Caller(); $a = $foo-test(1, 2, 3.4, true); var_dump($a); ? -- 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] __call and static methods
[snip] So, now you have found the static method docs, and you have found the very minimal __call() docs but you have not come close to answering anything about using call with static methods. [/snip] Sorry, I was just trying to help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] classes in php5
Hello all, I have a class Foo. In PHP4 I could create an instance of Foo in the following manner: $className = Foo; $fooInstance = new $className; This would yield the same result as: $fooInstance = new Foo; In my efforts to port this over to PHP5 I am having trouble. Not only do I not get back an instance of my Foo class, but the script execution stops entirely without so much as a warning. Is this a bug? Is there a new mechanism in PHP5, such as a getInstance function (i.e. object getInstance (string className))? Thanks in advance for any comments! Daniel
Re: [PHP] Loop within Loop help please
well, actually, the code resets the count var, so it makes absolutely no difference how many iterations the loop makes, it could iterated indefinately and still function identically. Jason Andrew Kreps [EMAIL PROTECTED] wrote: On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson [EMAIL PROTECTED] wrote: I see lots of references to modulus, which works fantastic.. but how abut just testing if its equal to 20, then there isnt that extra arthmitc call.. this is just another way to do the same thing.. take your pick.. unless someone can see a bad reason for this method. $count = 0; foreach . { if($count == 20) { . The only thing wrong with this method is that it doesn't fit the problem's specifications.The original poster wanted a way to trigger the code every 20 iterations of an unknown sized loop (implying that the loop would have 40 or more items), whereas the solution above only triggers it on iteration 20. Other than that, it's a perfectly wonderful piece of code. -- 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] classes in php5
On Tue, 28 Sep 2004 13:46:27 -0600, Daniel Watrous [EMAIL PROTECTED] wrote: In my efforts to port this over to PHP5 I am having trouble. Not only do I not get back an instance of my Foo class, but the script execution stops entirely without so much as a warning. My first suggestion would be to make sure that you have all warnings and errors turned on in your php.ini. That may give some more hints as to what's going wrong. If the script is stopping execution, there should be some sort of message associated with it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
Hey, im sorry, i didnt read the other responses to your post, ive posted the same thing... Jason Jason Davidson [EMAIL PROTECTED] wrote: well, actually, the code resets the count var, so it makes absolutely no difference how many iterations the loop makes, it could iterated indefinately and still function identically. Jason Andrew Kreps [EMAIL PROTECTED] wrote: On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson [EMAIL PROTECTED] wrote: I see lots of references to modulus, which works fantastic.. but how abut just testing if its equal to 20, then there isnt that extra arthmitc call.. this is just another way to do the same thing.. take your pick.. unless someone can see a bad reason for this method. $count = 0; foreach . { if($count == 20) { . The only thing wrong with this method is that it doesn't fit the problem's specifications.The original poster wanted a way to trigger the code every 20 iterations of an unknown sized loop (implying that the loop would have 40 or more items), whereas the solution above only triggers it on iteration 20. Other than that, it's a perfectly wonderful piece of code. -- 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] Re: grabbing information from websites
I agree with Trevor... but if he manages to nvigate to the page and try to parse it, he will end up finding the problem Graham said. He is only reading the first line. He can either use fread or shrink his regex to #align=right([0-9]*,?[0-9]*)/td# and make a loop using fgets. The second option is the worse one tough, the website probably has way more lines matching that criteria... But it works on that small piece of the source. On Tue, 28 Sep 2004 14:52:59 -0400, Gryffyn, Trevor [EMAIL PROTECTED] wrote: The URL that you're grabbing there is a frameset, it's probably not the page you want to look at. When you right-click on the page you want to parse and select View Source and get the information you posted below, do the same thing but right-click and select Properties (in IE at least) and it'll tell you the URL that you're really looking at. My guess is that you're really parsing this source: htmlhead titleRuneScape - the massive online adventure game by Jagex Ltd/title meta name=Description content=RuneScape is a massive 3d multiplayer adventure, with monsters to kill, quests to complete, and treasure to win. You control your own character who will improve and become more powerful the more you play. meta name=Keywords content=Runescape, Jagex, free, games, online, multiplayer, magic, spells, java, MMORPG, MPORPG, gaming link rel=shortcut icon href=/favicon.ico type=image/x-icon / /head frameset cols=* frameborder=0 border=0 noframes body bgcolor=black text=white h3RuneScape/h3 RuneScape is a massive 3d multiplayer adventure, with monsters to kill, quests to complete, and treasure to win. You control your own character who will improve and become more powerful the more you play. pThis site uses frames, but your browser doesn't support them./p pTo play Runescape and browse our website, please download a recent web browser such as a href='http://www.microsoft.com'Microsoft Internet Explorer/a or a href='http://www.netscape.com'Netscape/a./p brbr pThe Jagex Team./p /body /noframes !--frame src=none.html noresize scrolling=no-- frame src=frame2.cgi?page=title.html noresize scrolling=auto !--frame src=none.html noresize scrolling=no-- /frameset /html Try echo'ing $line and looking at the data you're parsing. I bet it's what you see above. -TG -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 9:47 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: grabbing information from websites i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.c gi?username=champinoman,r); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right (.*)/td#mi',$line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right( .*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right( .*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/td m,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From:
RE: [PHP] Loop within Loop help please
[snip] well, actually, the code resets the count var, so it makes absolutely no difference how many iterations the loop makes, it could iterated indefinately and still function identically. [/snip] That is quite true, but which is more elegant? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes in php5
you are just missing the (); it wont work either in php4 or php5 that way. $className = Foo; $fooInstance = new $className(); Cheers On Tue, Sep 28, 2004 at 01:46:27PM -0600, Daniel Watrous wrote: Hello all, I have a class Foo. In PHP4 I could create an instance of Foo in the following manner: $className = Foo; $fooInstance = new $className; This would yield the same result as: $fooInstance = new Foo; In my efforts to port this over to PHP5 I am having trouble. Not only do I not get back an instance of my Foo class, but the script execution stops entirely without so much as a warning. Is this a bug? Is there a new mechanism in PHP5, such as a getInstance function (i.e. object getInstance (string className))? Thanks in advance for any comments! Daniel -- Maciek Ruckgaber Bielecki The wireless telegraph is not difficult to understand. The ordinary telegraph is like a very long cat. You pull the tail in New York, and it meows in Los Angeles. The wireless is the same, only without the cat. --Albert Einstein-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to retrieve path to web server files
does that work for sub directories ... i.e. I have multiple mini sites that I run on my domain and they are just folders underneath... I.E. mydom.com --- mydom.com/123 --- mydom.com/ahr --- mydom.com/subsite4 On Sat, 25 Sep 2004 14:17:50 -0700, Jasper Howard [EMAIL PROTECTED] wrote: $base_dir = $_SERVER['document_root'] On Sat, 25 Sep 2004 14:17:16 -0700, Jasper Howard [EMAIL PROTECTED] wrote: On Sat, 25 Sep 2004 14:29:27 +0200, M. Sokolewicz [EMAIL PROTECTED] wrote: $path = getcwd(); Amc wrote: Hi, How can I get the string that is the path to the directories on my web server? I need to upload some files, but don't know what to supply for the destination path. In asp I used server.mappath, but I'm new to php. Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jasper Howard - Database Administration ApexEleven.com 530 559 0107 --- -- Jasper Howard - Database Administration ApexEleven.com 530 559 0107 --- -- 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 do you guys validate your xml schema's with php?
Just curious to see how everyone else does it when it comes to validating your xml against an xsd file. Right now I'm fighting a problem where I don't have DOM installed that would enable me the ability to write my own validator and none of the online validators seem to want to play nice with php HTTP post requests. How does everyone else validate their xml against a xsd file? -Brent This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
Jay Blanchard wrote: [snip] well, actually, the code resets the count var, so it makes absolutely no difference how many iterations the loop makes, it could iterated indefinately and still function identically. [/snip] That is quite true, but which is more elegant? Whichever way Martha Stewart would write it. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loop within Loop help please
Well, elegance, is in the eye of the beholder !!.. but ya, i certainly wasnt contesting the modulas solutiion, ive used mod in similar cases myself, i was just adding some variety. Jason Jay Blanchard [EMAIL PROTECTED] wrote: [snip] well, actually, the code resets the count var, so it makes absolutely no difference how many iterations the loop makes, it could iterated indefinately and still function identically. [/snip] That is quite true, but which is more elegant? -- 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] Re: how to retrieve path to web server files
this could be handy for you: print_r($_SERVER); or phpinfo(); On Tue, Sep 28, 2004 at 04:15:39PM -0400, GH wrote: does that work for sub directories ... i.e. I have multiple mini sites that I run on my domain and they are just folders underneath... I.E. mydom.com --- mydom.com/123 --- mydom.com/ahr --- mydom.com/subsite4 On Sat, 25 Sep 2004 14:17:50 -0700, Jasper Howard [EMAIL PROTECTED] wrote: $base_dir = $_SERVER['document_root'] On Sat, 25 Sep 2004 14:17:16 -0700, Jasper Howard [EMAIL PROTECTED] wrote: On Sat, 25 Sep 2004 14:29:27 +0200, M. Sokolewicz [EMAIL PROTECTED] wrote: $path = getcwd(); Amc wrote: Hi, How can I get the string that is the path to the directories on my web server? I need to upload some files, but don't know what to supply for the destination path. In asp I used server.mappath, but I'm new to php. Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jasper Howard - Database Administration ApexEleven.com 530 559 0107 --- -- Jasper Howard - Database Administration ApexEleven.com 530 559 0107 --- -- 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 -- Maciek Ruckgaber Bielecki The foundation of morality should not be made dependent on myth nor tied to any authority lest doubt about the myth or about the legitimacy of the authority imperil the foundation of sound judgment and action. --Albert Einstein-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SF Project: In Need of PHP MySQL Developers
I don't know if this is the right place to post this, so my fault if it isn't. I am looking for PHP MySQL Developers to help create a web-based RPG written using the latest versions of PHP and MySQL. I unfortunately am not a programmer, but hope to find programmers that can take my ideas and turn them into a working app. I started a project on SourceForge, about 3yrs ago...but I was aiming for a stand-alone RPG for computers using the Quake2 engine; but I've just recently changed it so that it can be web-based and OS independant. Here is the project page: http://sourceforge.net/projects/lamyle/ -- Michael Lauzon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can't upload files
On Wednesday 29 September 2004 01:44, blackwater dev wrote: Then, here is part of the code doing the upload: To be precise this is the part of the code which handles the upload. The files have already been uploaded and stored by your webserver long before your script starts executing. It prints out the 2 but doesn't get into the 3 loopbut I am uploading files. I have tried it with $_FILES and $HTTP_POST_FILES. This worked on my last hosts servers but not the new host. Any ideas? print_r() those two variables (and any others you can think of). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Don't let your status become too quo! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SF Project: In Need of PHP MySQL Developers
I don't know if this is the right place to post this, so my fault if it isn't. I am looking for PHP MySQL Developers to help create a web-based RPG written using the latest versions of PHP and MySQL. I unfortunately am not a programmer, but hope to find programmers that can take my ideas and turn them into a working app. I started a project on SourceForge, about 3yrs ago...but I was aiming for a stand-alone RPG for computers using the Quake2 engine; but I've just recently changed it so that it can be web-based and OS independant. Here is the project page: http://sourceforge.net/projects/lamyle/ -- Michael Lauzon Not to rag on you or that this isn't feasible but you sure do place a high reliance on PHP/MySQL when you haven't a clue how to use either one of them. And to go from a true 3D environment model to a...well, an SSI language with a database is quite a drastic change. With today's advance editors (Doom 3, Unreal, Half-Life 2 soon...) I would think using these would produce better and quicker results. And you don't even have to know how to code. Just learn the editors. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need some ideas
Hi guys, OK I need some ideas. Somebody created the stupidest XML file I've ever seen. And of course they can't change it, and I *must* be able to read it. I'm all out of brain power on thinking how to go about reading it. I typically use simplexml to read xml and that's where my knowledge end. Heres the problem: Catalog Rate RateCode1/RateCode RateCurrencyUSDRateCurrency RateValue123/RateValue /Rate RateDescription DescThis is dumn/Desc /RateDescription RateDescription DescNo reall reall dumb/Desc /RateDescription Rate RateCode1322/RateCode RateCurrencyUSDRateCurrency RateValue123/RateValue /Rate RateDescription DescSometimes one description, othertimes many/Desc /RateDescription and on and on /Catalog As you can see there is no hierachy to a RateDescription, its not part of Rate (nested in it) and many RateDescriptions can follow the same Rate. However, as the eye can tell the RateDescption(s) apply to the Rate element above. The problem is I can never know how many there are (if any) for a Rate. Any ideas how to go about doing this? Thanks, Yoed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need some ideas
Yoed Anis wrote: Hi guys, OK I need some ideas. Somebody created the stupidest XML file I've ever seen. And of course they can't change it, and I *must* be able to read it. I'm all out of brain power on thinking how to go about reading it. I typically use simplexml to read xml and that's where my knowledge end. Heres the problem: Catalog Rate RateCode1/RateCode RateCurrencyUSDRateCurrency RateValue123/RateValue /Rate RateDescription DescThis is dumn/Desc /RateDescription RateDescription DescNo reall reall dumb/Desc /RateDescription Rate RateCode1322/RateCode RateCurrencyUSDRateCurrency RateValue123/RateValue /Rate RateDescription DescSometimes one description, othertimes many/Desc /RateDescription and on and on /Catalog As you can see there is no hierachy to a RateDescription, its not part of Rate (nested in it) and many RateDescriptions can follow the same Rate. However, as the eye can tell the RateDescption(s) apply to the Rate element above. The problem is I can never know how many there are (if any) for a Rate. Any ideas how to go about doing this? Thanks, Yoed how about ignoring them? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Need some ideas
Well, that is one approach. how about ignoring them? :) -- 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] Changing mta in /etc/alternatives : how?
Sorry for the probably basic question, but I would like to change the default mta on my FC2 box from sendmail to exim. I believe to do this I need to change the 'entry' in /etc/alternatives/ to point to /usr/sbin/sendmail.exim instead of /usr/sbin/sendmail.sendmail. Doing a 'ls -al' on /etc/alternatives shows that the entries here are lrwxrwxrwx, what exactly is the 'l' and how do I change it? I have tried creating a test symbolic link such as : ln -isv /usr/sbin/sendmail.exim test but the colour coding of the resulting 'test' link is different to the existing ones. Can someone shed some light on this for me? Many thanks Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [IGNORE] [PHP] Changing mta in /etc/alternatives : how?
Sorry, mailed to the wrong list :( -Original Message- From: Graham Cossey [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 23:27 To: Php-General Subject: [PHP] Changing mta in /etc/alternatives : how? Sorry for the probably basic question, but I would like to change the default mta on my FC2 box from sendmail to exim. I believe to do this I need to change the 'entry' in /etc/alternatives/ to point to /usr/sbin/sendmail.exim instead of /usr/sbin/sendmail.sendmail. Doing a 'ls -al' on /etc/alternatives shows that the entries here are lrwxrwxrwx, what exactly is the 'l' and how do I change it? I have tried creating a test symbolic link such as : ln -isv /usr/sbin/sendmail.exim test but the colour coding of the resulting 'test' link is different to the existing ones. Can someone shed some light on this for me? Many thanks Graham -- 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] Loop within Loop help please
On Tue, 28 Sep 2004 16:22:18 -0300, Eduardo Sampaio [EMAIL PROTECTED] wrote: You missed the $count = 0; right below it Andrew... his code works just like the modulus one... Whoops, my mistake. I write code, really I do. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing mta in /etc/alternatives : how?
Graham Cossey wrote: Sorry for the probably basic question, but I would like to change the default mta on my FC2 box from sendmail to exim. I believe to do this I need to change the 'entry' in /etc/alternatives/ to point to /usr/sbin/sendmail.exim instead of /usr/sbin/sendmail.sendmail. Doing a 'ls -al' on /etc/alternatives shows that the entries here are lrwxrwxrwx, what exactly is the 'l' and how do I change it? I have tried creating a test symbolic link such as : ln -isv /usr/sbin/sendmail.exim test but the colour coding of the resulting 'test' link is different to the existing ones. Can someone shed some light on this for me? Try this: ?php phpinfo(); ? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache 2.0.51 and php 5.0.2 static compile
I'm sorry to ask a question that I'm sure exists in the documents, but I have yet to see it? How does one compile php 5.0.2. statically into your apache 2.0.51 binary, everything, I've seen thus far shows how to create a php shared module? Thank You -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need some ideas
On Tue, 28 Sep 2004 16:58:07 -0500, Yoed Anis [EMAIL PROTECTED] wrote: Hi guys, OK I need some ideas. Somebody created the stupidest XML file I've ever seen. And of course they can't change it, and I *must* be able to read it. I'm all out of brain power on thinking how to go about reading it. I typically use simplexml to read xml and that's where my knowledge end. [snip] Sorry if this is stating the obvious, but you may have to resort to the plain ol' labor-intensive expat functions: http://us4.php.net/xml pb -- paul bissex, e-scribe.com -- database-driven web development 413.585.8095 69.55.225.29 01061-0847 72°39'71W 42°19'42N -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: grabbing information from websites
i tried putting in fread() but still getting a blank screen. any other errors in here? ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=champinoman,r;); $line = fread ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',$line,$out)) { $rune = $out; } fclose($file); print $rune; ? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] fgets() will read in from file until end of line or end of file up to the No bytes given. Is there an end of line between the username=chapinoman and the td align=right70,277 ? If there is a line break then $line will never contain both strings. You may need to use fread() instead. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 14:47 To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: grabbing information from websites i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=ch ampinoman,r); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- 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] can't upload files
Doesn't print out anything. On Wed, 29 Sep 2004 05:32:32 +0800, Jason Wong [EMAIL PROTECTED] wrote: On Wednesday 29 September 2004 01:44, blackwater dev wrote: Then, here is part of the code doing the upload: To be precise this is the part of the code which handles the upload. The files have already been uploaded and stored by your webserver long before your script starts executing. It prints out the 2 but doesn't get into the 3 loopbut I am uploading files. I have tried it with $_FILES and $HTTP_POST_FILES. This worked on my last hosts servers but not the new host. Any ideas? print_r() those two variables (and any others you can think of). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Don't let your status become too quo! */ -- 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] __call and static methods
* Thus wrote Jackson Miller: So, now you have found the static method docs, and you have found the very minimal __call() docs but you have not come close to answering anything about using call with static methods. For those who seem to miss the point, a static method call would be like: $a = Caller::test(1, 2, 3.4, true); I have tried defining __call as a static method, but that does not give the desired result either. __call() is only available with a scope of an instance of an object. You can suggest adding this as a Feature/Request at bugs.php.net, if you desire such a thing. Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes in php5
* Thus wrote Maciek Ruckgaber Bielecki: you are just missing the (); it wont work either in php4 or php5 that way. $className = Foo; $fooInstance = new $className(); $a = new Foo; Is perfectly valid. Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes in php5
* Thus wrote Daniel Watrous: Hello all, I have a class Foo. In PHP4 I could create an instance of Foo in the following manner: $className = Foo; $fooInstance = new $className; This would yield the same result as: $fooInstance = new Foo; Can you provide the definition of your class Foo. what you describe works find in php5. Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes in php5
?php class Foo { } $className = Foo; $fooInstance = new $className; ? Works fine for me. It still works if you add methods or properties to Foo as well, I'm not sure why it wouldn't work for you, possibly you have another error along the lines somewhere. I am on PHP 5.0.1 BTW On Tue, 2004-09-28 at 19:42, Curt Zirzow wrote: * Thus wrote Daniel Watrous: Hello all, I have a class Foo. In PHP4 I could create an instance of Foo in the following manner: $className = Foo; $fooInstance = new $className; This would yield the same result as: $fooInstance = new Foo; Can you provide the definition of your class Foo. what you describe works find in php5. Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php