Re: [PHP] Secure coockie is not available as variable
At 03:55 25.03.2003, Alexander Weber said: [snip] I send a secure cookie an it should be available as varible setcookie(pbas_usr, $row[usr], time()+600, , , 1); but the varable is empty. If it send the header without secure flag the cookie works well setcookie(pbas_usr, $row[usr], time()+600); Is there a special way to read out secure cookies? [snip] Is your script running under https? From the docs (http://www.php.net/manual/en/function.setcookie.php): secure indicates that the cookie should only be transmitted over a secure HTTPS connection. When set to 1, the cookie will only be set if a secure connection exists. The default is 0. Sorry if I'm OT here but you didn't mention https in your posting. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php regexp question
hi i've made a small php site that is searching against french documents stored in a mysql database. when it comes to rendering search results, the client has asked if the words that were searched for can be highlighted. no problem! i thought. just do a regexp replace and wrap a b tag around the matching terms. then i realised that the following would not produce a match: $string = Françoise; echo preg_match(/francoise/i,$string); so my question since mysql managed to produce a match here, is there perhaps a php regexp modifier that (maybe) knows how to make this match? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] installing cUrl
Hi, I am running windows XP and I am looking for a way to install Curl, cant seem to find a version that I can easily install just by clicking on Setup.exe , does anyone know how to install it on XP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array into another site
Hi I have an PHP array and want to send it into another PHP site. $arr = array(251,1,23,54,15,135,1651,156,13,123,321,123,32,54,654,456,32,1); ? script language=JavaScript type=text/javascript a href=\javascript: void(vindu2 = window.open('view.php?arr=?$arr;?','windowname','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=850, height=700')); vindu2.focus();\View/a /script Anybody knows how to do this? Fred -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array into another site
1. Missing an equal sign: ?=$ not ?$ window.open('view.php?arr=?=$arr;?','windo... 2. Check out serialize() http://www.php.net/manual/en/function.serialize.php window.open('view.php?arr=?=serialize($arr)?','windo... 3. However, this creates a URL which isn't particularly URL friendly (not sure, but perhaps maybe not even valid -- I don't know), so 4. based on your array's size, I'd just implode() it, and then explode() it back out on the new site: window.open('view.php?arr=?=implode('-',$arr)?','windo... Justin French on 25/03/03 8:50 PM, Fredrik ([EMAIL PROTECTED]) wrote: Hi I have an PHP array and want to send it into another PHP site. $arr = array(251,1,23,54,15,135,1651,156,13,123,321,123,32,54,654,456,32,1); ? script language=JavaScript type=text/javascript a href=\javascript: void(vindu2 = window.open('view.php?arr=?$arr;?','windowname','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=850, height=700')); vindu2.focus();\View/a /script Anybody knows how to do this? Fred -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problems with rename() - permission denied
Hello, I've a small problem, which mades me crazy... :\ I'm trying to rename() a swapfile to real destination file (atomic update). It works on differnt environments very well. Sadly not on my ISP-server I've added an chmod($swapfile,0777), but this has not solve the problem. The directories have all FULL access (read, write, etc.). The destiniation file too. I don't want 2 use the copy/unlink solution Do anyone have an idea? --- 8 --- if ( $file = fopen($swapfile,w) ) { fwrite($file,$out); fclose($file); chmod($swapfile, 0777); /* this fails with Permission denied */ rename($swapfile,$filename); /* ... but this works */ copy($swapfile,$filename); unlink($swapfile); } --- 8 Thanks 4 help... -- christian rosentreter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Spooky numbers
Greetings learned PHP(eople), This is what my lines look like in my text file : === Source : D:\ Dest : E:\ Files : *.* Options : *.* /S /E /V /R:5 /W:5 When I run the following code it takes the lines above and places them in an HTML table : $source = `grep Source : logs/$file`; $dest = `grep Dest : logs/$file`; $criteria = `grep Files : logs/$file`; $options = `grep Options : logs/$file`; This is the output on the HTML file : Source : F:\INETPUB\ Dest : D:\BACKUP\INETPUB\ Files : *.* Files : 12911 0 12911 0 0 0 Options : *.* /S /E /V /R:5 /W:5 Question is : What are those numbers that are inserted after the Files entry...and how do I get rid of `em...? Thanks for any assistance -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 A chicken is the eggs way of producing more eggs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problems with rename() - permission denied
Christian Rosentreter wrote: Hi Christian, I've a small problem, which mades me crazy... :\ I'm trying to rename() a swapfile to real destination file (atomic update). It works on differnt environments very well. Sadly not on my ISP-server I've added an chmod($swapfile,0777), but this has not solve the problem. The directories have all FULL access (read, write, etc.). The destiniation file too. I don't want 2 use the copy/unlink solution Do anyone have an idea? /* this fails with Permission denied */ rename($swapfile,$filename); /* ... but this works */ copy($swapfile,$filename); unlink($swapfile); I'm just speculating, but it's possible that your ISP is running from multiple machines: i.e. several webservers feeding off one fileserver. I had a similar problem with one of the sites that I work on, and that was the case. Might be worth asking your ISP if this is the case. The only solution in my case was to go the copy() unlink() way. It's not as if it's a huge workaround. ;) James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array into another site
At 11:21 25.03.2003, Justin French said: [snip] 1. Missing an equal sign: ?=$ not ?$ window.open('view.php?arr=?=$arr;?','windo... 2. Check out serialize() http://www.php.net/manual/en/function.serialize.php window.open('view.php?arr=?=serialize($arr)?','windo... 3. However, this creates a URL which isn't particularly URL friendly (not sure, but perhaps maybe not even valid -- I don't know), so 4. based on your array's size, I'd just implode() it, and then explode() it back out on the new site: window.open('view.php?arr=?=implode('-',$arr)?','windo... [snip] In both cases (serialize, and implode) you should urlencode the results: window.open('view.php?arr=?=urlencode(serialize($arr))?','windo... window.open('view.php?arr=?=urlencode(implode('-',$arr))?','windo... Should make for a valid URL then. However don't forget that passing application data via URL could pose a security risk to your application, depending on what the data actually represents, and how it is worked on. Consider also that URLs have some size limit (don't have the number at hand). -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] NewB Q on Arrays.
Hey All, I'm still a newB in php and mysql so I'm asking for your patience up front. i want to get a list of results from an array, which I can do with: $result=mysql_query(select * from mvlogtbl,$db); while ($row=mysql_fetch_array($result)){ echo $row[uid] $row[mvid]; } basically what I have is a database of movies linked to .avi files that are setup for streaming, the table mvlogtbl keeps a log of who has watched what. What i want to be able to do is determine if a certain user has watched a movie. But there are multiple entries for each user, a user may have watched the movie more than once, I don't really care, I just want to be able to tell if they have watched it or not... any help? Thanls - paul - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] count up from 7
Richard -- ...and then Richard Whitney said... % % Braindead! Hey, who are you callin' names?!? % % I need to evaluate a number if greater than 7 and add a value per increment. Greater than seven is easy. Adding a value is easy. Per increment can be a little tricky but we'll assume for the moment that the window is 1. The code $sum = 67 ; # starting value $trg = 7 ;# trigger value $add = 6 ;# what we add each time $num = 10 ; # what we're evaluating (hardcoded here!) for ( $num ; $trg $num ; $trg++ ) { $sum += $add ; } print when num = $num, sum = $sum\n ; should do for a starting point, though, and produces bash-2.05a$ php -q /tmp/inc.php when num = 10, sum = 85 bash-2.05a$ php -q /tmp/inc.php when num = 20, sum = 145 bash-2.05a$ php -q /tmp/inc.php when num = 7, sum = 67 bash-2.05a$ php -q /tmp/inc.php when num = 1, sum = 67 when run. Extra credit if you write it as a recursive function :-) % I'm frazzled and can't think straight. You can't ask straight, either :-) Give us more details! % % Thanks Guys! HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP] timout in mail script
Hi all, I have this script sending 1000 personalized emails. However when I press the start button in my browser so the script starts mailing I get no response for a long time from the script. Most of the time I don't get any response. When I retrieve all the emails I just sent (to myself, using 1000 aliases), I retrieve e.g. 1396 emails. Anybody knows how this is possible? Is it possible that the script is adressed again by the browser, so the whole mailing process starts again? regards Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] -
Re: [PHP] mail() Bcc:
John, et al -- One more nit to add to this... ...and then CPT John W. Holmes said... % ... % % You can do it like this: % % $headers = From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: % [EMAIL PROTECTED]; Yes, figuring that the added line break is just because of a dumb mail program :-0 % % or % % $headers = From: [EMAIL PROTECTED] % CC: [EMAIL PROTECTED] % BCC: [EMAIL PROTECTED]; This can get you into trouble because it isn't portable. Mail headers are supposed to end in return (\r) *and* newline (\n) but all you're doing here is saying to insert the end-of-line sequence for this operating system. If you're on a windows box you're fine (though you have a myriad of other problems ;-) but if you're on a *NIX box you're only sending newline and if you're on a Mac you're only sending return (I don't know enough Mac to know if an OS X Mac has newlines like a classic Mac or like a *NIX box). Use the all-run-together format or a .= buildup and manually specify the needed \r\n to avoid the headache. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] timout in mail script
At 12:24 25.03.2003, Wilbert Enserink spoke out and said: [snip] I have this script sending 1000 personalized emails. However when I press the start button in my browser so the script starts mailing I get no response for a long time from the script. Most of the time I don't get any response. When I retrieve all the emails I just sent (to myself, using 1000 aliases), I retrieve e.g. 1396 emails. Anybody knows how this is possible? Is it possible that the script is adressed again by the browser, so the whole mailing process starts again? [snip] From what you've said it looks as if your script is running in an endless loop. You may debug it by _not_ actually sending the mail, but echoing the mail() command to the browser, together with the vital variables you need. -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] timout in mail script
Hi ernest, I don't think it is looping, cause I also tried it with 10 and 100 and 250 emails. No problems there...! regards Wilbert - Original Message - From: Ernest E Vogelsinger [EMAIL PROTECTED] To: Wilbert Enserink [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 12:30 PM Subject: Re: [PHP] timout in mail script At 12:24 25.03.2003, Wilbert Enserink spoke out and said: [snip] I have this script sending 1000 personalized emails. However when I press the start button in my browser so the script starts mailing I get no response for a long time from the script. Most of the time I don't get any response. When I retrieve all the emails I just sent (to myself, using 1000 aliases), I retrieve e.g. 1396 emails. Anybody knows how this is possible? Is it possible that the script is adressed again by the browser, so the whole mailing process starts again? [snip] From what you've said it looks as if your script is running in an endless loop. You may debug it by _not_ actually sending the mail, but echoing the mail() command to the browser, together with the vital variables you need. -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Viewing PHP pages
What about naming your scripts .php4 that should work. Jochem Andy wrote: Hi Ben They say that the server is set up for PHP4, and they say it is something to do with my scripts. Not sure I believe them. My pages have the extension .php Andy Ben Edwards [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Server is probably set up wrong or your extensions are wrong. Check with the ISP wether you have PHP facilities, the extension is .php normally but sometimes .php3. At 03:55 24/03/2003 +, Andy wrote: Can someone help? I have uploaded my PHP pages, created in Dreamweaver MX to my hosting server but when I try to access the page the only option I get is to download it. What am I doing wrong? I have created the forms and guestbooks that mail information to me but these do not work, they are OK when I test them locally but not when they are uploaded. Thank you Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding out which file is retrieved over HTTP
David Otton wrote: On Sun, 23 Mar 2003 21:21:39 +0100, you wrote: The following short script retrieves a file over HTTP: $url = 'http://www.example.com/'; implode('',file($url)); // or file_get_contents() Now I'd like to find out which file was really retrieved, for instance http://www.example.com/index.html. Is this possible and how? [...] I need to write a small link-checker (Intranet), which reads in all links within a file and then looks if they're broken and collects some information. Unfortunately I didn't find a simple, free link-checker that's why I write my own. It would be good to find out the complete url, because I want to collect the file-endings (.php,.html, ...). I really think this already exists. You should probably search a bit harder. Maybe there are good standalone-link-checkers, but I need to integrate it in an application and my customer has some special wishes. Anyways I finished writing the link-checker. A thing which seemed a bit confusing to me is that if I open a non-existing website (fopen('http://www.amazon.de/nonsensestuff')) I always get an error message Success. It's the same thing if I use file(). The manual explains that fopen() returns false if the website could not be opened, that's why I don't know why this error message appears? Besides this Success-message is surely a very bad error message. I use PHP 4.2.3. Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] timout in mail script
At 12:53 25.03.2003, W. Enserink spoke out and said: [snip] I don't think it is looping, cause I also tried it with 10 and 100 and 250 emails. No problems there...! [snip] Well if you report receiving 1300+ mails when the script is supposed to send 1000 there's certainly something wrong ;-) Try to mark the first message so you can possibly see where it's about to start over again. Then hook in here with your debug efforts to see as to why it starts over. -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php4isapi.dll
Hello I am trying to install Cacti and it requires PHP.I have followed the instructions which require me to add the above dll and php extension into IIS. However, i have searched my entire hardrive, but can not find this dll so i cant continue. Please can somebody help? Thanks Robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4isapi.dll
Download PHP from http://www.php.net/downloads.php. You will find php4isapi.dll with it. Regards, Nikunj Virani - Original Message - From: Robin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 5:51 PM Subject: [PHP] php4isapi.dll Hello I am trying to install Cacti and it requires PHP.I have followed the instructions which require me to add the above dll and php extension into IIS. However, i have searched my entire hardrive, but can not find this dll so i cant continue. Please can somebody help? Thanks Robin -- 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 grep
Greetings learned PHP(eople) I`m using the following to strip values out of a file, however, the file I`m accessing contains multiple instance of the search criteria, and I only wanna return the first instance I`m just getting an empty variable and can`t figure it out... $criteria = `grep Files : logs/$file`; I`ve tried other things like 'grep --max-count=1 Files :...etc etc, and that don`t work Also tried shellexecarg (`grep blah blah blah);..still not working Any ideas -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 A chicken is the eggs way of producing more eggs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4isapi.dll
Thanks Nikunj Which actual download is it? The zip or the installer? Robin Nikunj Virani [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Download PHP from http://www.php.net/downloads.php. You will find php4isapi.dll with it. Regards, Nikunj Virani - Original Message - From: Robin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 5:51 PM Subject: [PHP] php4isapi.dll Hello I am trying to install Cacti and it requires PHP.I have followed the instructions which require me to add the above dll and php extension into IIS. However, i have searched my entire hardrive, but can not find this dll so i cant continue. Please can somebody help? Thanks Robin -- 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] curl
How can I tell if I have successfully installed curl on my windows XP machine? What is the syntax for sending a test curl command? I tried this and got a syntax error: curl http://www.netscape.com/; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4isapi.dll
I prefer and use Zip file. Regards, Nikunj - Original Message - From: Robin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 6:06 PM Subject: Re: [PHP] php4isapi.dll Thanks Nikunj Which actual download is it? The zip or the installer? Robin Nikunj Virani [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Download PHP from http://www.php.net/downloads.php. You will find php4isapi.dll with it. Regards, Nikunj Virani - Original Message - From: Robin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 5:51 PM Subject: [PHP] php4isapi.dll Hello I am trying to install Cacti and it requires PHP.I have followed the instructions which require me to add the above dll and php extension into IIS. However, i have searched my entire hardrive, but can not find this dll so i cant continue. Please can somebody help? Thanks Robin -- 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] curl
What does phpinfo() function says ? It should show you the curl module enabled. Regards, Nikunj Virani - Original Message - From: Diana Castillo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 6:06 PM Subject: [PHP] curl How can I tell if I have successfully installed curl on my windows XP machine? What is the syntax for sending a test curl command? I tried this and got a syntax error: curl http://www.netscape.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] Finding out which file is retrieved over HTTP
At 13:08 25.03.2003, Jens Lehmann spoke out and said: [snip] A thing which seemed a bit confusing to me is that if I open a non-existing website (fopen('http://www.amazon.de/nonsensestuff')) I always get an error message Success. It's the same thing if I use file(). The manual explains that fopen() returns false if the website could not be opened, that's why I don't know why this error message appears? Besides this Success-message is surely a very bad error message. I use PHP 4.2.3. [snip] If the website doesn't exist, but the web SERVER does, it will return something, usually a 404-message. fopen() doesn't check for HTTP result codes, it just opens the stream and retuirns whatever gets sent (with the single exception of omitting the headers, but without looking). So in fact an fopen() to a non-existing page will be seen as successful by fopen(). This is by design and afaik documented somewhere. To actually check on the HTTP status codes you need to run your own, either using cURL, or by doing your own stuff using fsockopen(). -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] substr() on part an ereg() capture
Hi, I have this ereg to turn URLs into links: eregi_replace(([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/=]), a href=\\\1://\\2\\3\ {$t}\\\1://\\2\\3/a, $str); ... found it in the manual i think, or maybe on weberdev.com examples Anyhoo, it places the whole link in between the a... and /a, which is fine for short links, but on longer links (in my case, around 60+ chars), it messes with my table or CSS layout. So, I'd like to subtr() the 2nd capture part down to 55 chars or something IF it's longer than 60, and append a ... to it. ANY ideas on how this is done? Or is this beyond regexp?? TIA Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr() on part an ereg() capture
couldn't you just do substr( $blah, 0, 55) or something similar? (i'm crap with syntax, so that's just off my head...) -skate- fatcuban.com - Original Message - From: Justin French [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 1:24 PM Subject: [PHP] substr() on part an ereg() capture Hi, I have this ereg to turn URLs into links: eregi_replace(([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/=]), a href=\\\1://\\2\\3\ {$t}\\\1://\\2\\3/a, $str); ... found it in the manual i think, or maybe on weberdev.com examples Anyhoo, it places the whole link in between the a... and /a, which is fine for short links, but on longer links (in my case, around 60+ chars), it messes with my table or CSS layout. So, I'd like to subtr() the 2nd capture part down to 55 chars or something IF it's longer than 60, and append a ... to it. ANY ideas on how this is done? Or is this beyond regexp?? TIA Justin -- 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] Benchmarking
Hi, I've been making a web ap PHP based, but I fear the number of arrays it has is too big. Is there any way to benchmark a script, or are there any recomendations or standards about how much time execution takes and how many resources it takes? Thanks, Reven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] connecting to mysql db
hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code ?php $link = mysql_connect(localhost, , ) or die(Could not connect: . mysql_error()); print (Connected successfully); mysql_select_db(test) or die(Could not select database: . mysql_error()); ? thanx iggy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] connecting to mysql db
Place the code in a file ( ie; dbcon.php ) and include that file in any page which may need it using an include statement: include(dbcon.php); Randy -Original Message- From: Iggy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] connecting to mysql db hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code ?php $link = mysql_connect(localhost, , ) or die(Could not connect: . mysql_error()); print (Connected successfully); mysql_select_db(test) or die(Could not select database: . mysql_error()); ? thanx iggy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connecting to mysql db
This really doesn't explain me much. I mean the difference between having that code on every page or calling it from an external page doesn't tell me if it is realy necessary to do it all the time. I guess I am looking for more generic explanation of the whole process rather than what you said. However I appreciate it much, since it seems to be much better coding practice Iggy Randy Rankin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Place the code in a file ( ie; dbcon.php ) and include that file in any page which may need it using an include statement: include(dbcon.php); Randy -Original Message- From: Iggy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] connecting to mysql db hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code ?php $link = mysql_connect(localhost, , ) or die(Could not connect: . mysql_error()); print (Connected successfully); mysql_select_db(test) or die(Could not select database: . mysql_error()); ? thanx iggy -- 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] connecting to mysql db
No dude. Create a file called whatever.inc that includes the code that you are using to connect to the db. In every php script ,that needs this connection to the db, you simply put: ?php include(whatever.inc); ? Mirco Ellis I-Soft Solutions e-mail: [EMAIL PROTECTED] Tel: +27414847161 -Original Message- From: Iggy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 15:50 To: [EMAIL PROTECTED] Subject: [PHP] connecting to mysql db hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code ?php $link = mysql_connect(localhost, , ) or die(Could not connect: . mysql_error()); print (Connected successfully); mysql_select_db(test) or die(Could not select database: . mysql_error()); ? thanx iggy -- 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] connecting to mysql db
Hi Iggy, I mean the difference between having that code on every page or calling it from an external page doesn't tell me if it is realy necessary to do it all the time. Yes, you do have to connect to the database in every script that needs to access it. Usually this is done at the start of the script, along with any calls to session_start() and other global stuff. For convenience and ease of maintenance, however, it makes good sense to write a separate file that does nothing but connect to the database. This separate file then needs to be attached to the running script via include(), at any point before the first call to the database. HTH Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] connecting to mysql db
This is the only way I know and probably the safest. This way you know there is connectivity because it is loaded rigth at the beginning. Mirco Ellis I-Soft Solutions e-mail: [EMAIL PROTECTED] Tel: +27414847161 -Original Message- From: Igor Frankovic [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 16:03 To: [EMAIL PROTECTED] Subject: RE: [PHP] connecting to mysql db But is it always necessary to do this or can you open this connection once and have it open throughout the next few pages (or as needed) and then close it? -Original Message- From: Mirco Ellis [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 8:00 AM To: 'Iggy' Cc: Php-General (E-mail) Subject: RE: [PHP] connecting to mysql db No dude. Create a file called whatever.inc that includes the code that you are using to connect to the db. In every php script ,that needs this connection to the db, you simply put: ?php include(whatever.inc); ? Mirco Ellis I-Soft Solutions e-mail: [EMAIL PROTECTED] Tel: +27414847161 -Original Message- From: Iggy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 15:50 To: [EMAIL PROTECTED] Subject: [PHP] connecting to mysql db hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code ?php $link = mysql_connect(localhost, , ) or die(Could not connect: . mysql_error()); print (Connected successfully); mysql_select_db(test) or die(Could not select database: . mysql_error()); ? thanx iggy -- 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] openssl php 4.3.1
On Mon, Mar 24, 2003 at 11:15:05PM -0500, Kalin Mintchev wrote: hi all, i have problems getting fopen() and fsockopen() to work over https.. here is the problem.. from the phpinfo: OpenSSL support enabled OpenSSL Version OpenSSL 0.9.6h 5 Dec 2002 OpenSSL 0.9.6h has a security vulnerability. PLEASe check http://www.openssl.org from php -m # php -m [PHP Modules] ctype mysql openssl overload pcre posix session standard tokenizer xml [Zend Modules] from the Appendix I regarding fopen() on php.net: Note: HTTPS is supported starting from PHP 4.3, if you have compiled in support for OpenSSL. and from the documentation on fsockopen() on php.net: As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client connection over TCP/IP to connect to the remote host. in a test file i have two lines of code like this: $file = https://someurl.com;; if (!($fp = fopen($file, r))) this produces an error but it doesn't point to any problem - like this: Warning: fopen(https://someurl.com.. in /path/to/file.php on line 45 if i change $file to http://someurl.com; it works fine... with fsockopen() the situation is kinda the same. code: $fp=fsockopen(ssl://www.foo.com, 443); error: Warning: fsockopen() [function.fsockopen]: no SSL support in this build in /path/to/file/... if i pul out the ssl:// part it works fine... now, i did read the posts on this list about curl. why curl isn't mentioned anywhere in the documentation for fopen() and fsockopen() if it's needed for those functions? why would i need curl compiled in php if i already have openssl compiled with it? the machine i'm using is a freeBSD 4.6 box with apache 1.3.27 and OpenSSL 0.9.6h, php is 4.3.1... i did similar posts on other php lists but everybody's quite.. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Member - Liberal International On 11 Sept 2001 the WORLD was violated. This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED] Society MUST be saved! Extremists must dissolve. Quebec - elir les gagnant qui peut deplacer le PQ la plus vite -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connecting to mysql db
leaving the connection open creates security questions, and also leaves resources open, what if a user closes his browser window, how do you know to close the connection? if you really want to make it simple, you can edit your php.ini to have the username and password as default in there, but again, this can be a security risk. i'm afraid the best way is to include connection code on every page... -- skate - fatcuban.com Iggy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This really doesn't explain me much. I mean the difference between having that code on every page or calling it from an external page doesn't tell me if it is realy necessary to do it all the time. I guess I am looking for more generic explanation of the whole process rather than what you said. However I appreciate it much, since it seems to be much better coding practice Iggy Randy Rankin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Place the code in a file ( ie; dbcon.php ) and include that file in any page which may need it using an include statement: include(dbcon.php); Randy -Original Message- From: Iggy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP] connecting to mysql db hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code ?php $link = mysql_connect(localhost, , ) or die(Could not connect: . mysql_error()); print (Connected successfully); mysql_select_db(test) or die(Could not select database: . mysql_error()); ? thanx iggy -- 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] session id
can somebody tell me why I am getting this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 when I use this code: session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } PHP is version 4.3.1 thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connecting to mysql db
At 14:49 25-3-2003, you wrote: hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code ?php $link = mysql_connect(localhost, , ) or die(Could not connect: . mysql_error()); print (Connected successfully); mysql_select_db(test) or die(Could not select database: . mysql_error()); ? maybe you are looking for: http://www.php.net/manual/en/function.mysql-pconnect.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 25 Mar 2003 14:41:21 -0000 Issue 1959
php-general Digest 25 Mar 2003 14:41:21 - Issue 1959 Topics (messages 140912 through 140962): Secure coockie is not available as variable 140912 by: Alexander Weber 140924 by: Ernest E Vogelsinger Charset problem with DBF database 140913 by: Alexander Weber ho to remove an empty space 140914 by: WebDev openssl php 4.3.1 140915 by: Kalin Mintchev 140917 by: Kalin Mintchev 140959 by: The Doctor counting .. 140916 by: Sebastian 140918 by: Nikunj Virani 140920 by: Sebastian 140922 by: Justin French SetUID Scripts with PHP. 140919 by: Nikunj Virani foreach() or for() 140921 by: Richard Whitney 140923 by: Tom Rogers php regexp question 140925 by: cpaul installing cUrl 140926 by: Diana Castillo array into another site 140927 by: Fredrik 140928 by: Justin French 140932 by: Ernest E Vogelsinger problems with rename() - permission denied 140929 by: Christian Rosentreter 140931 by: liljim Spooky numbers 140930 by: Chris Blake NewB Q on Arrays. 140933 by: inpho Re: count up from 7 140934 by: David T-G timout in mail script 140935 by: Wilbert Enserink 140937 by: Ernest E Vogelsinger 140938 by: W. Enserink 140941 by: Ernest E Vogelsinger Re: mail() Bcc: 140936 by: David T-G Re: Viewing PHP pages 140939 by: J.Veenhuijsen Re: Finding out which file is retrieved over HTTP 140940 by: Jens Lehmann 140949 by: Ernest E Vogelsinger php4isapi.dll 140942 by: Robin 140943 by: Nikunj Virani 140945 by: Robin 140947 by: Nikunj Virani PHP grep 140944 by: Chris Blake curl 140946 by: Diana Castillo 140948 by: Nikunj Virani substr() on part an ereg() capture 140950 by: Justin French 140951 by: skate Benchmarking 140952 by: reven connecting to mysql db 140953 by: Iggy 140954 by: Rankin, Randy 140955 by: Iggy 140956 by: Mirco Ellis 140957 by: Jon Haworth 140958 by: Mirco Ellis 140960 by: skate 140962 by: Chris Hayes session id 140961 by: Iggy Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- hello, I send a secure cookie an it should be available as varible setcookie(pbas_usr, $row[usr], time()+600, , , 1); but the varable is empty. If it send the header without secure flag the cookie works well setcookie(pbas_usr, $row[usr], time()+600); Is there a special way to read out secure cookies? THX, Alex ---End Message--- ---BeginMessage--- At 03:55 25.03.2003, Alexander Weber said: [snip] I send a secure cookie an it should be available as varible setcookie(pbas_usr, $row[usr], time()+600, , , 1); but the varable is empty. If it send the header without secure flag the cookie works well setcookie(pbas_usr, $row[usr], time()+600); Is there a special way to read out secure cookies? [snip] Is your script running under https? From the docs (http://www.php.net/manual/en/function.setcookie.php): secure indicates that the cookie should only be transmitted over a secure HTTPS connection. When set to 1, the cookie will only be set if a secure connection exists. The default is 0. Sorry if I'm OT here but you didn't mention https in your posting. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ ---End Message--- ---BeginMessage--- Hello, I have a DBF database with some ASCII characters like ALT+154 (Ü) etc. I read out the database but instead of an Ü i get an s. Tried out charsetconverting from/to ASCII, UTF-8/7 and ISO, but nothing gave me the rigth letter. Anybody an idea? THX Alex ---End Message--- ---BeginMessage--- somehow when I have try to develop an application where I read five or six values into an individual arrays the array who carries the emails has the email and an additional empty field after the email somehow complex well they way the information has been stored is that the email was the last value in the line of arrays and somehow carries always an empty field or the tab field I can see when I upload the data in binary mode however I tried around for some time how do remove an empty space in an erray I tried arround with $E2= str_replace( , , $Email); and I tried as well $E2= str_replace(nbsp;, , $Email); with no success it totally ignored the empty space in the email what is stored in this way:|data1|data2|[EMAIL PROTECTED] |data3|etc...|||. when I phrased the data file any help and advice would be
Re: [PHP] session id
On 25/3/03 2:37 pm, Iggy [EMAIL PROTECTED] wrote: can somebody tell me why I am getting this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 when I use this code: session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } PHP is version 4.3.1 thanx You cannot send any output until the session is set This includes html before the ?php tag or any print's or echo's -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session id
The function session_start is sending a cookie. This means that you can't echo anything before. Its the same rules as with setcookie. Iggy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] can somebody tell me why I am getting this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 when I use this code: session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } PHP is version 4.3.1 thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Disabling output control when using ob_start
I posted this problem a week ago, but no one answered so I try again: Is there a way to disable the call back function set by ob_start? I tried: ob_end_flush(); ob_end_clean(); ob_implicit_flush(true); Nothing seams to work. I can't detect the call back function and I can't prevent it either. The call back function is called no matter what! Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session id
can somebody tell me why I am getting this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21 when I use this code: session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } PHP is version 4.3.1 thanx You cannot send any output until the session is set This includes html before the ?php tag or any print's or echo's More specifically, whatever you have in search.php on line 8 is considered output and is ending the headers. Move session_start() before any output. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Disabling output control when using ob_start
At 15:41 25-3-2003, you wrote: I posted this problem a week ago, but no one answered so I try again: Is there a way to disable the call back function set by ob_start? I tried: ob_end_flush(); ob_end_clean(); ob_implicit_flush(true); Nothing seams to work. I can't detect the call back function and I can't prevent it either. The call back function is called no matter what! Michael What do you mean with callback function? I simply do it this way: ob_start(); include('modules/'.$file); $content=ob_get_contents(); ob_end_clean(); which puts the contents of that file in $content. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php regexp question
Just an idea: In $string replace any occurence of ç to c, search for offsets of francoise, and then add bold tags at the offsets (and end tags at offsets +strlen('francoise')) in the original string. cpaul wrote: hi i've made a small php site that is searching against french documents stored in a mysql database. when it comes to rendering search results, the client has asked if the words that were searched for can be highlighted. no problem! i thought. just do a regexp replace and wrap a b tag around the matching terms. then i realised that the following would not produce a match: $string = Françoise; echo preg_match(/francoise/i,$string); so my question since mysql managed to produce a match here, is there perhaps a php regexp modifier that (maybe) knows how to make this match? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Changing variables in a text file
I have a text file with a series of project variables. For example $var1=; $var2=; $template=blue; $anothervar=foo; Let say I need to change $template=blue; to $template=red;. How can I do that keeping the rest of the file intact? thanks, Luis
Re: [PHP] Changing variables in a text file
If you know what is suposed to be in the file you can simply build up a new file. If you don't know what is in there but only that you need to change this to that, use file functions and regexes. You might also consider using an array instead of plain variables, so your file will become $config['var1']=; $config['var2']=; $config['template']=blue; $config['anothervar']=foo; This will make updates easier, as you know you only need to write everything in $config. Luis Lebron wrote: I have a text file with a series of project variables. For example $var1=; $var2=; $template=blue; $anothervar=foo; Let say I need to change $template=blue; to $template=red;. How can I do that keeping the rest of the file intact? thanks, Luis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP grep
Chris, et al -- ...and then Chris Blake said... % % Greetings learned PHP(eople) Hiya! % % I`m using the following to strip values out of a file, however, the file % I`m accessing contains multiple instance of the search criteria, and I % only wanna return the first instance % I`m just getting an empty variable and can`t figure it out... % % $criteria = `grep Files : logs/$file`; Works for me. Are you running under safe mode, which will turn off backticks and shell_exec? HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] counting ..
Why do you think comment needs a number in the first place? Sebastian wrote: Hello all. rather dumb question. I have a pagination system, 25 results per page, which are user comments, I want to put a number on each comment so i am doing something like: $num=$num + 1; $number = $num; echo $number; But when i switch to the next 25 results it starts counting from 1 again, LoL. So i have to use $_GET right? If so can someone give me an example. Thanks in advanced. cheers, - Sebastian -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XSLT processing DocBook files - FO
I'm trying to automatically convert DocBook XML files into PDFs using PHP and the XSLT extension. First step is to convert them into FO, but I'm running into trouble with this script: ?php $xslt = xslt_create(); $xml = 'my_docbook_file.xml'; $xsl = '/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/fo/docbook.xsl'; $args = array(); $params = array( 'paper.type'= 'USletter', 'page.orientation' = 'portrait', ); $html = xslt_process($xslt, $xml, $xsl, NULL, $args, $params); if (!$html) { die('XSLT processing error: '.xslt_error($xslt)); } xslt_free($xslt); echo $html; ? I get the following parse warnings, and the output error: Warning: Sablotron error on line 244: variable 'page.orientation' not found in /home/cmv/www/doc/index.php on line 15 Warning: Sablotron error on line 254: variable 'paper.type' not found in /home/cmv/www/doc/index.php on line 15 Warning: Sablotron error on line 322: variable 'paper.type' not found in /home/cmv/www/doc/index.php on line 15 Warning: Sablotron error on line 322: circular reference to variable 'page.width.portrait' in /home/cmv/www/doc/index.php on line 15 Warning: Sablotron error on line 190: variable 'page.height' not found in /home/cmv/www/doc/index.php on line 15 XSLT processing error: variable 'page.height' not found How do I pass those variables/parameters to the XSLT process? Has someone else had experience with this? (Cc me offlist in your replies, please.) -- colineasydns com at dot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting ..
when it comes to the second page, you already know that page you are on 1,2,3,4... take that and multiply it by the defined number of results per-page, then start your counting. Jim - Original Message - From: Sebastian [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Monday, March 24, 2003 10:09 PM Subject: [PHP] counting .. Hello all. rather dumb question. I have a pagination system, 25 results per page, which are user comments, I want to put a number on each comment so i am doing something like: $num=$num + 1; $number = $num; echo $number; But when i switch to the next 25 results it starts counting from 1 again, LoL. So i have to use $_GET right? If so can someone give me an example. Thanks in advanced. cheers, - Sebastian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with file_exists()
Hi, I've been reported a weird problem with one of the scripts that we have, which uses the file_exists() function. It returned true once, and then the query ran again, and it reported false, on the same file. This was true for a lot of files in the same directory, but only over a cerain period of time. As I had time to try to investigate, the problem stopped occuring. This script has been used for a long time, and this is the first time that this has happened. I've checked some of the files that they were having problems with, and they have not been modified for a few days, so I doubt they were locked or anything like that. Does anyone have any idea what could be causing this? This is running Solaris 8, Apache 1.3.26 with PHP 4.2.1 compiled into it. I've also checked file permissions and they were all good. Any idea would be appreciated! Thanks a lot, Steve Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Please point me in the right direction
Hi All, I have a CGI application written in Delphi web services and I want to port it to the Linux environment. I was going to use Kylix but I'm concerned that Borland isn't keeping up with the fast paced Linux development (ie they are still on Redhat 7.2 and Redhat is about to release version 9.0 next month). The current CGI is a little complicated and relies heavily on OOP data structures. It processes the data then sends a stream to the web server for display in the browser. It's very fast and I am happy with the performace, but I must port it over to Linux. As I am very unfamiliar with the PHP environment, can someone point in the right direction? If I use PHP for the front-end, what is the best tool to create the CGI? I was considering using Python, but would Pearl be better? Any direction to get me started and headed in the right direction would be very appreciated Thanks, Jerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Persistent connections with mysql_pconnect()
On Tuesday 25 March 2003 09:02 am, skate [EMAIL PROTECTED] wrote: leaving the connection open creates security questions, and also leaves resources open, what if a user closes his browser window, how do you know to close the connection? So are you saying that persistent connections [ i.e. mysql_pconnect() ] should never be used? if you really want to make it simple, you can edit your php.ini to have the username and password as default in there, but again, this can be a security risk. i'm afraid the best way is to include connection code on every page... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Persistent connections with mysql_pconnect()
no, not at all... but there is a time and a place, and i don't think you should use pconnect just because you don't want to an include at the top of every page. - Original Message - From: John Hicks [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 5:11 PM Subject: [PHP] Persistent connections with mysql_pconnect() On Tuesday 25 March 2003 09:02 am, skate [EMAIL PROTECTED] wrote: leaving the connection open creates security questions, and also leaves resources open, what if a user closes his browser window, how do you know to close the connection? So are you saying that persistent connections [ i.e. mysql_pconnect() ] should never be used? if you really want to make it simple, you can edit your php.ini to have the username and password as default in there, but again, this can be a security risk. i'm afraid the best way is to include connection code on every page... -- 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] Persistent connections with mysql_pconnect()
no, not at all... but there is a time and a place, and i don't think you should use pconnect just because you don't want to an include at the top of every page. You still have to call pconnect() on every page if you use it. It doesn't leave it open for other requests, it leaves it open within the web server program. pconnect() is only useful on certain OS using certain web servers. Read the manual page on mysql_pconnect() for more information. ---John Holmes... - Original Message - From: John Hicks [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 5:11 PM Subject: [PHP] Persistent connections with mysql_pconnect() On Tuesday 25 March 2003 09:02 am, skate [EMAIL PROTECTED] wrote: leaving the connection open creates security questions, and also leaves resources open, what if a user closes his browser window, how do you know to close the connection? So are you saying that persistent connections [ i.e. mysql_pconnect() ] should never be used? if you really want to make it simple, you can edit your php.ini to have the username and password as default in there, but again, this can be a security risk. i'm afraid the best way is to include connection code on every page... -- 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] Please point me in the right direction
PHP is extremely easy for an experienced programmer to pick up quickly (assuming you know the basics of tcp/ip and web architecture). But experienced programmers also know the importance of the KISS principle. Why rewrite a system when you can port it? Kylix allows you to use Delphi on Linux. If it limits you to using Redhat 7.2, that should be no problem provided you apply all relevant security patches (which Redhat is pretty good at providing). In the meantime, start learning PHP. It is object oriented in its own way. When you are ready for a complete rewrite of the system, PHP may be all you need. A hybrid CGI/PHP system sounds unecessarily messy. (PHP can run in a CGI environment but is usually run in the more efficient Apache module environment.) The above is just my two cents' worth. I haven't used Kylix or Delphi, but believe both are descended from Borland's original (Turbo) Pascal. I've been programming since '72 but am new to PHP. I've been extremely gratified by how easy it's been to put together a relatively sophisticated system for a client in just a month or two after struggling for months to get Java and JSP to do much simpler tasks. --Frappy On Tuesday 25 March 2003 11:09 am, you wrote: Hi All, I have a CGI application written in Delphi web services and I want to port it to the Linux environment. I was going to use Kylix but I'm concerned that Borland isn't keeping up with the fast paced Linux development (ie they are still on Redhat 7.2 and Redhat is about to release version 9.0 next month). The current CGI is a little complicated and relies heavily on OOP data structures. It processes the data then sends a stream to the web server for display in the browser. It's very fast and I am happy with the performace, but I must port it over to Linux. As I am very unfamiliar with the PHP environment, can someone point in the right direction? If I use PHP for the front-end, what is the best tool to create the CGI? I was considering using Python, but would Pearl be better? Any direction to get me started and headed in the right direction would be very appreciated Thanks, Jerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problems with rename() - permission denied
On 25-Mar-2003 Christian Rosentreter wrote: Hello, I've a small problem, which mades me crazy... :\ I'm trying to rename() a swapfile to real destination file (atomic update). It works on differnt environments very well. Sadly not on my ISP-server I've added an chmod($swapfile,0777), but this has not solve the problem. The directories have all FULL access (read, write, etc.). The destiniation file too. I don't want 2 use the copy/unlink solution Do anyone have an idea? --- 8 --- if ( $file = fopen($swapfile,w) ) { fwrite($file,$out); fclose($file); chmod($swapfile, 0777); /* this fails with Permission denied */ rename($swapfile,$filename); /* ... but this works */ copy($swapfile,$filename); unlink($swapfile); } --- 8 On *nix, rename will fail if source and destination are different file systems. To test this : copy($swapfile,$filename); clearstatcache(); $src=stat($swapfile); $dst=stat($filename); printf('Source: %d, Dest: %d %s filesystem\n', $src[0], $dst, ($src[0] == $dst[0] ? 'same' : 'different')); Thanks 4 help... -- christian rosentreter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] substr() on part an ereg() capture
Looks like this one : http://examples.weberdev.com/get_example.php3?count=1567 so if someone manages to get this done, i would appreciate it if he can add a comment. thanks berber -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 3:24 PM To: php Subject: [PHP] substr() on part an ereg() capture Hi, I have this ereg to turn URLs into links: eregi_replace(([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/=]), a href=\\\1://\\2\\3\ {$t}\\\1://\\2\\3/a, $str); ... found it in the manual i think, or maybe on weberdev.com examples Anyhoo, it places the whole link in between the a... and /a, which is fine for short links, but on longer links (in my case, around 60+ chars), it messes with my table or CSS layout. So, I'd like to subtr() the 2nd capture part down to 55 chars or something IF it's longer than 60, and append a ... to it. ANY ideas on how this is done? Or is this beyond regexp?? TIA Justin -- 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] again: IIS vs Apache
Hi, I'm new here. I imagine that this question was made a lot of times in this list, but reading the archive i couldnt find a recently answer to this question: I want to convince my new lab partners (and director) to migrate our PHP site (over 1000 hits a day) to Apache/Linux. Could you give me some actual arguments or site to tell them? Is the Apache PHP module really better than the isapi module for IIS. thanks in advance. Matts - This mail sent through IMP: http://mail.info.unlp.edu.ar/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to solve include_path / safe_mode / open_basedir /document_root ?
Hi, I host some virtual servers in a Linux/apache/php 4 enviroment. I'd like to set up as secure as possible since the users have ftp access to upload files. So each virtual domain has a safe_mode/open_basedir settings in order to make it difficult to mess with each other's files. Unfortunatelly this seems to have a side effect. Whenever I need to provide tools/classes such as Jpgraph, Smarty and so on I have to copy to the user's directory since the include_path could not reach outside the document root/open_basedir directory. So, is there a way to configure so I have a secure enviroment and yet be able to define a common repository. Regards. __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array query
Hi, say I have two arrays: X and Y. How can i get the values I X that arent in Y and assign them to another array? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array query
www.php.net/array_diff shaun wrote: Hi, say I have two arrays: X and Y. How can i get the values I X that arent in Y and assign them to another array? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checking for existence of file
HI :) I've got a function (crude but works) that checks for a value in the url and then I call an image based on that value. if (isset($_GET['menu'])) { $img_pick = substr($_GET['menu'],0,1); } else { $img_pick = 1; } echo img src=\/images/mast_$img_pick.jpg\; What I'd like to do is check the directory 'images' first to see if 'mast_$img_pick.jpg' exists and if it doesn't, call a different image such as 'mast_default.jpg'. I'm sure this isn't hard, I'm just not sure how to start. TIA, verdon Ps. Please cc me if replying to list -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to solve include_path / safe_mode / open_basedir /document_root?
/safe_mode_include_dir/ *string* cid:[EMAIL PROTECTED] UID/GID checks are bypassed when including files from this directory and its subdirectories (directory must also be in include_path cid:[EMAIL PROTECTED] or full path must including). As of PHP 4.2.0, this directive can take a *semi-colon separated path* in a similar fashion to the include_path cid:[EMAIL PROTECTED] directive, rather than just a single directory. Robert Mena wrote: Hi, I host some virtual servers in a Linux/apache/php 4 enviroment. I'd like to set up as secure as possible since the users have ftp access to upload files. So each virtual domain has a safe_mode/open_basedir settings in order to make it difficult to mess with each other's files. Unfortunatelly this seems to have a side effect. Whenever I need to provide tools/classes such as Jpgraph, Smarty and so on I have to copy to the user's directory since the include_path could not reach outside the document root/open_basedir directory. So, is there a way to configure so I have a secure enviroment and yet be able to define a common repository. Regards. __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for existence of file
On Wednesday 26 March 2003 03:12, Verdon Vaillancourt wrote: I've got a function (crude but works) that checks for a value in the url and then I call an image based on that value. if (isset($_GET['menu'])) { $img_pick = substr($_GET['menu'],0,1); } else { $img_pick = 1; } echo img src=\/images/mast_$img_pick.jpg\; What I'd like to do is check the directory 'images' first to see if 'mast_$img_pick.jpg' exists and if it doesn't, call a different image such as 'mast_default.jpg'. I'm sure this isn't hard, I'm just not sure how to start. is_file() -- 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 -- /* Happiness is just an illusion, filled with sadness and confusion. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for existence of file
What I'd like to do is check the directory 'images' first to see if 'mast_$img_pick.jpg' exists and if it doesn't, call a different image such as 'mast_default.jpg'. I'm sure this isn't hard, I'm just not sure how to start. Maybe you can start with file_exists() or is_file() and somehow work from there??? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] openssl php 4.3.1
On Tue, 25 Mar 2003, The Doctor wrote: On Mon, Mar 24, 2003 at 11:15:05PM -0500, Kalin Mintchev wrote: hi all, i have problems getting fopen() and fsockopen() to work over https.. here is the problem.. from the phpinfo: OpenSSL support enabled OpenSSL Version OpenSSL 0.9.6h 5 Dec 2002 OpenSSL 0.9.6h has a security vulnerability. which one doesn't?! i don't think that's the problem of not getting it to work with fopen() and fsockopen() what about the curl issue??? cutting off the document??? is anybody that has had to deal with this problems on this list? i don't know where else to ask... PLEASe check http://www.openssl.org from php -m # php -m [PHP Modules] ctype mysql openssl overload pcre posix session standard tokenizer xml [Zend Modules] from the Appendix I regarding fopen() on php.net: Note: HTTPS is supported starting from PHP 4.3, if you have compiled in support for OpenSSL. and from the documentation on fsockopen() on php.net: As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client connection over TCP/IP to connect to the remote host. in a test file i have two lines of code like this: $file = https://someurl.com;; if (!($fp = fopen($file, r))) this produces an error but it doesn't point to any problem - like this: Warning: fopen(https://someurl.com.. in /path/to/file.php on line 45 if i change $file to http://someurl.com; it works fine... with fsockopen() the situation is kinda the same. code: $fp=fsockopen(ssl://www.foo.com, 443); error: Warning: fsockopen() [function.fsockopen]: no SSL support in this build in /path/to/file/... if i pul out the ssl:// part it works fine... now, i did read the posts on this list about curl. why curl isn't mentioned anywhere in the documentation for fopen() and fsockopen() if it's needed for those functions? why would i need curl compiled in php if i already have openssl compiled with it? the machine i'm using is a freeBSD 4.6 box with apache 1.3.27 and OpenSSL 0.9.6h, php is 4.3.1... i did similar posts on other php lists but everybody's quite.. thanks -- 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] warning when I compile PHP
What does this mean I get this when I compile PHP. It is all through the out put when make is run. What can I do to make it not be there cc1: warning: changing search order for system directory /usr/include cc1: warning: as it has already been specified as a non-system directory -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting ..
because my comment system is pretty much like forum style, sometimes a user referrers to another comment by it's number, etc... .. and because i want to ;) cheers, - Sebastian - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] | Why do you think comment needs a number in the first place? | Sebastian wrote: | | Hello all. | | rather dumb question. | | I have a pagination system, 25 results per page, which are user comments, I | want to put a number on each comment so i am doing something like: | | $num=$num + 1; | $number = $num; | echo $number; | | But when i switch to the next 25 results it starts counting from 1 again, | LoL. | | So i have to use $_GET right? If so can someone give me an example. | | Thanks in advanced. | | | cheers, | - Sebastian | | | | | -- | The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. | | | | | -- | 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] substr() on part an ereg() capture
$str = preg_replace('|(a[^]*[^]{55})[^]+(/a)|','$1...$2', $str); Justin French wrote: Hi, I have this ereg to turn URLs into links: eregi_replace(([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/=]), a href=\\\1://\\2\\3\ {$t}\\\1://\\2\\3/a, $str); ... found it in the manual i think, or maybe on weberdev.com examples Anyhoo, it places the whole link in between the a... and /a, which is fine for short links, but on longer links (in my case, around 60+ chars), it messes with my table or CSS layout. So, I'd like to subtr() the 2nd capture part down to 55 chars or something IF it's longer than 60, and append a ... to it. ANY ideas on how this is done? Or is this beyond regexp?? TIA Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie:restricting users to change data in a textarea
Hi Mirco, Try adding either readonly or disabled to the textarea tag: print textarea name=variable readonly rows=1 cols=10.stripslashes($row['variable'])./textareabr; Hope this helps, -Step [...] There is one field that I whant to stop them from changing. This field I also use in my sql query when updating the table,ie. where variable='$variable'. So what I did was simply this: tr\n; print \ttd$variable/td\n; print /tr\n; instead of: print textarea name=variable rows=1 cols=10.stripslashes($row['variable'])./textareabr; This definately stopped them from editing it but also disabled the mysql query from working. Can anyone just give me a couple of ideas how I can make this work. Thanks Mirco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mac IE File download problem - any solutions?
This is not a MAC IE problem, it is the way browsers work. If the MIME type is mapped to an application, the browser will launch the application. IE does it inline, while Netscape tends to launch it separately. You can send false headers with a made up type and a missing file extension, but then the browser will not know what type of file it is and the save as is harder for the user as they have to put the right extension on. It is a work around, but a really poor one. header(Content-disposition: filename=$filenamewithoutextension); header(Content-type:reallyreallyreallybigcsv); -Original Message- From: Step Schwarz [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 11:49 AM To: Daniel Leighton; [EMAIL PROTECTED] Subject: Re: [PHP] Mac IE File download problem - any solutions? [...] The problem: When downloading certain files on a Mac using IE 5.x, files are displayed within a browser window instead of downloading. This seems to occur mostly with quicktime files (.mov, .mp3). Some quicktime files work, while others with the same extension do not. [...] Hi Daniel, I believe this is a browser setting, is it not? Using the default setup of Explorer 5.2 for Mac, a clicked .mov file will play in IE. To change this behavior, go to Explorer Preferences... File Helpers, select QuickTime Movie and click Change... then switch Handling from View with Browser to Save to File. I would be surprised if a file header could override this.. but if you find a way, please let us know! -Step -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning when I compile PHP
As long as everything is working, ignore it. Richard Kurth wrote: What does this mean I get this when I compile PHP. It is all through the out put when make is run. What can I do to make it not be there cc1: warning: changing search order for system directory /usr/include cc1: warning: as it has already been specified as a non-system directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Grabbing image information from an html string
Let say I have an html string that looks like this: bTitleb img src=graphics/image1.jpgfoo bar bar fooimg src=graphics/image2.jpgSome more text. I would like to pull the image filenames from the html and end up with something like this $images=array(image1.jpg, image2.jpg) How can I do this? thanks, Luis R. Lebron Project Manager Sigmatech, Inc
Re: [PHP] Finding out which file is retrieved over HTTP
At 20:48 25.03.2003, Jens Lehmann spoke out and said: [snip] To actually check on the HTTP status codes you need to run your own, either using cURL, or by doing your own stuff using fsockopen(). I tried using fsockopen(), but still experience a problem, I want to use the following script to retrieve both, the headers and the actual file: You need to transmit the Host: header so the web server has a chance to know which virtual host you want to reach. Ideally you would also tell the server what type of content you can handle (see below). Also note that the correct line ending for MIME headers is always CRLF (\r\n): $hostname = 'www.example.com'; $file = '/index.php'; $ip = gethostbyname($hostname); $fp = fsockopen($ip, 80, $errno, $errstr); if ($fp) { fputs( $fp, GET .$file. HTTP/1.0\r\n . Host: $hostname\r\n . Accept: text/html\r\n . Accept: text/plain\r\n\r\n ); $src = ''; while (!feof ($fp)) $src .= fgets($fp, 4096); fclose ($fp); } This will get you the whole page, including all headers. -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Please point me in the right direction
Jerry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] As I am very unfamiliar with the PHP environment, can someone point in the right direction? If I use PHP for the front-end, what is the best tool to create the CGI? I was considering using Python, but would Pearl be better? OO in PHP is less than perfect, but in many cases you could probably stick to the PHP, and avoid a hassle of mixed system. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variables??
I'm having a problem with form data being recognized by a php script. If I send information with a GET the variable data appears in $GET[var] but not $var. I just upgraded to php4.2.2 and then 4.3.1 and I've been having this problem. I didn't have the problem with older versions. I suspect it is a configuration option I missed some place, just don't know what one. Also, the new 4.3.1 and one of my scripts fails because fopen() can't find a file, yet this works on the older version. Any help is appreciated. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Grabbing image information from an html string
if (preg_match('/(href|HREF)=?(\S+\.(jpg|png))?/',$line, $matches)){ $filename[] = $matches[2]; } -Original Message- From: Luis Lebron [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 7:07 AM To: Php-General (E-mail) Subject: [PHP] Grabbing image information from an html string Let say I have an html string that looks like this: bTitleb img src=graphics/image1.jpgfoo bar bar fooimg src=graphics/image2.jpgSome more text. I would like to pull the image filenames from the html and end up with something like this $images=array(image1.jpg, image2.jpg) How can I do this? thanks, Luis R. Lebron Project Manager Sigmatech, Inc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Grabbing image information from an html string
You need to use preg_match_all() and a more greedy expression that is not case sensitive.. preg_match_all('/src=(\S*)/i', $html, $matches); $image_array = $matches[1]; HTH, Kevin - Original Message - From: Dan Rossi [EMAIL PROTECTED] To: Luis Lebron [EMAIL PROTECTED]; Php-General (E-mail) [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 12:39 PM Subject: RE: [PHP] Grabbing image information from an html string if (preg_match('/(href|HREF)=?(\S+\.(jpg|png))?/',$line, $matches)){ $filename[] = $matches[2]; } -Original Message- From: Luis Lebron [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 7:07 AM To: Php-General (E-mail) Subject: [PHP] Grabbing image information from an html string Let say I have an html string that looks like this: bTitleb img src=graphics/image1.jpgfoo bar bar fooimg src=graphics/image2.jpgSome more text. I would like to pull the image filenames from the html and end up with something like this $images=array(image1.jpg, image2.jpg) How can I do this? thanks, Luis R. Lebron Project Manager Sigmatech, Inc -- 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] Default setting garbage
Why is it that when I send call this function: function GetNextDate($whichfriday, $month = , $frequency = 1, $basedate = ) with this line: GetNextDate(4, 2003-03, 5); that $frequency ends up ? Whether I set it myself when I call the function, or I leave it blank and let the function set it itself, it ends up with nothing in it. empty() returns 1, while isset() returns nothing on this.
Re: [PHP] variables??
- Original Message - From: Rick Gaine [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 1:25 PM Subject: [PHP] variables?? I'm having a problem with form data being recognized by a php script. If I send information with a GET the variable data appears in $GET[var] but not $var. I just upgraded to php4.2.2 and then 4.3.1 and I've been having this problem. I didn't have the problem with older versions. I suspect it is a configuration option I missed some place, just don't know what one. Also, the new 4.3.1 and one of my scripts fails because fopen() can't find a file, yet this works on the older version. Any help is appreciated. Rick Rick, this is an option in your php.ini file called register_globals. Set this to ON if you want this feature. HTH, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using include() or require() with PDF module
Two things come to mind... First, make sure the file is indeed being included/required and you don't have your paths messed up. Second, make sure you have the PDF stuff compiled into PHP. Make a page with ?php phpinfo(); ? as the only thing in it, then load it in your web browser and find the words PDF in there. I've not used PDF myself, so that's about the extent of my help. Sorry. d -Original Message- From: Bill Hudspeth [mailto:[EMAIL PROTECTED] Sent: Monday, March 24, 2003 11:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Using include() or require() with PDF module I wish to use the include() and/or the require() functions to include a block of PHP multiple times in my file. The block contains code for outputting PDF elements. Although other external code (functions for example) are successfully referenced using these commands, the PHP's PDF functions don't seem to work. Any ideas? -- 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] Default setting garbage
Good question. Are you certain your not misspelling frequency when you check it or try to look at it? Sorry if that sounds insulting.. just trying to search for the simplest explaination. : No, no. Not insulting at all. That's often my problem. But not in this case. I even went to the 'trouble' of copying and pasting $frequency wherever I needed. Original problem: Why is it that when I send call this function: function GetNextDate($whichfriday, $month = , $frequency = 1, $basedate = ) with this line: GetNextDate(4, 2003-03, 5); that $frequency ends up ? Whether I set it myself when I call the function, or I leave it blank and let the function set it itself, it ends up with nothing in it. empty() returns 1, while isset() returns nothing on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Default setting garbage
- Original Message - From: Liam Gibbs [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 2:10 PM Subject: [PHP] Default setting garbage Why is it that when I send call this function: function GetNextDate($whichfriday, $month = , $frequency = 1, $basedate = ) with this line: GetNextDate(4, 2003-03, 5); that $frequency ends up ? Whether I set it myself when I call the function, or I leave it blank and let the function set it itself, it ends up with nothing in it. empty() returns 1, while isset() returns nothing on this. Good question. Are you certain your not misspelling frequency when you check it or try to look at it? Sorry if that sounds insulting.. just trying to search for the simplest explaination. : - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variables??
It is considered more secure to declare the variable explicitly. $var = $_GET[var]; I'm having a problem with form data being recognized by a php script. If I send information with a GET the variable data appears in $GET[var] but not $var. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forcing a reload from a redirect
I have two pages, foo.php and bar.php. bar.php redirects the user to foo.php with the following code: header(Location: http://.$_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . foo.php); Normally, I want the browser to cache foo.php, it's content is fairly static. But, bar.php makes changes that will cause foo.php to change. How do I force foo.php to reload from the server whne I do this redirect? I've seen code that adds a random number as a search string on the end of the URL, but I want to avaoid that if possible. -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Formatting code.
Is there any documents on how code should be layed out? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Formatting code.
here's one. http://utvikler.start.no/code/php_coding_standard.html google will probably find a lot more... maybe not all PHP specific, but still relevant. On Wed, 26 Mar 2003, Philip J. Newman wrote: Is there any documents on how code should be layed out? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding out which file is retrieved over HTTP
Ernest E Vogelsinger wrote: At 20:48 25.03.2003, Jens Lehmann spoke out and said: [snip] To actually check on the HTTP status codes you need to run your own, either using cURL, or by doing your own stuff using fsockopen(). I tried using fsockopen(), but still experience a problem, I want to use the following script to retrieve both, the headers and the actual file: You need to transmit the Host: header so the web server has a chance to know which virtual host you want to reach. Ideally you would also tell the server what type of content you can handle (see below). Also note that the correct line ending for MIME headers is always CRLF (\r\n): $hostname = 'www.example.com'; $file = '/index.php'; $ip = gethostbyname($hostname); $fp = fsockopen($ip, 80, $errno, $errstr); if ($fp) { fputs( $fp, GET .$file. HTTP/1.0\r\n . Host: $hostname\r\n . Accept: text/html\r\n . Accept: text/plain\r\n\r\n ); $src = ''; while (!feof ($fp)) $src .= fgets($fp, 4096); fclose ($fp); } This will get you the whole page, including all headers. Thank you! This works fine. I can use this for reading the HTTP-Status. Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Backing Up Tables Using PHP
Hello, Trying to author my own PHP database table back up utility. A very simple one at that... Here's my sql statement to select everything in the table: $sql_daily = SELECT * FROM dailytable; $run_sql_daily = mysql_query($sql_daily); $result_sql_daily = mysql_fetch_array($run_sql_daily); Here's the code for showing me whats in the result array: for ($count_daily=0; $count_daily count($result_sql_daily); $count_daily++) { echo p; echo $result_sql_daily[$count_daily]; } exit; Does anyone out there know why it only prints one line of the table? It's a line in the middle of the table, it's not the first line, it's not the last line, it's in the middle of about 25 lines. Is this not the proper way to back up tables in a database? I'd like a back up copy of my tables on CD-ROM and I thought once this prints out correctly I'd just have it print to a text file and then place the text file on a cd Thanks, Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] flush not flushing?
hi , i have had similar issues its worked by doing a ob_flush before flush then u want a sleep statement so maybe try ob_flush(); flush(); sleep(2); ?? = Original Message From Bryan Koschmann - GKT [EMAIL PROTECTED] = Hello, I'm including a script I use to automatically e-mail overdue customers. My problem is I have to have it sleep to avoid upsetting the mailserver, but when I do, it seems to pause and sleep the total time (number of users x sleep(1)) then output the whole block. I'm testing it now by printing the name and email to the screen. Instead of: Customer 1 - [EMAIL PROTECTED] pause 1 sec Customer 2 - [EMAIL PROTECTED] pause 1 sec Customer 3 - [EMAIL PROTECTED] pause 1 sec I get big big big pause Customer 1 - [EMAIL PROTECTED] Customer 2 - [EMAIL PROTECTED] Customer 3 - [EMAIL PROTECTED] Here is the script. Any help would be great! Thanks, Bryan ?php $myname = My Company; $myemail = [EMAIL PROTECTED]; $now = strtotime(now); $nowdate = date(l, F jS Y, $now); $nowtime = date(H:i, $now); $nowmonth = date(F, $now); $nowyear = date(Y, $now); $duedate = strtotime(25 $nowmonth $nowyear); $duedate = date(l, F jS Y, $duedate); $t = mktime(0,0,0,date('m')+1,1,date('Y')); $expdate = date(l, F jS Y, $t); $expdatenum = date(w, $t); if ($expdatenum == 6) { $rendate = date(l, F jS Y, strtotime($expdate +2 days)); } else { $rendate = date(l, F jS Y, strtotime($expdate +1 day)); } $query = htmlspecialchars(execute goToExpire); $fp = fsockopen (111.222.333.444, 45678, $errno, $errstr, 30); // return_format can be either delimited or xml $connect = request connect Provider=SqlOleDb; Data Source=(local); Initial Catalog=MyCompany; Integrated Security=SSPI; /connect options return_formatdelimited/return_format delimiter~/delimiter text_qualifier/text_qualifier /options query $query /query /request ; $usercount = 0; if (!$fp) { echo $errstr ($errno)br\n; } else { fputs ($fp, $connect); flush(); // Create some headings for the table while (!feof($fp)) { $buffer = fgets($fp, 4096); $row = explode('~', $buffer); if (!empty($row[0])) { if ($row[0] == ERROR) { echo font face=arial size=5 color=#ffb$row[0]: $row[1] $row[2]/b/font\n; } else { if (username($row[4]) !== ) { $isbiz = str_replace(\r\n, , $row[6]); $accountnum = account($row[0]); $amountdue = amount($row[5]); if ($isbiz == True) { $fullname = name($row[1]); } elseif ($isbiz == False) { if (miname($row[3]) == ) { $fullname = name($row[2]) . . name($row[1]); } else { $fullname = name($row[2]) . . miname($row[3]) . . name($row[1]); } } flush(); $subject = Account Status: # . account($row[0]); $message = \r\n . $fullname\r\n . Account # . account($row[0]) . \r\n\r\n . Payment Reminder!\r\n\r\n . Our records indicate that we have not received your payment of \$$amountdue due\r\n . on $duedate for your Internet access account. Please\r\n . send in your payment to prevent any interruption in your service. Any\r\n . accounts with an open balance will expire on $expdate\r\n . at 5:00pm, and cannot be reactivated until $rendate at 9:00am.\r\n\r\n . If you have already sent in payment, please disregard this reminder. If\r\n . you believe your account to be up-to-date or believe this message to be in\r\n . error, feel free to call us at (555) 123-4567 or reply to this message to\r\n . discuss your account.\r\n\r\n\r\n . \tMy COmpany\r\n . \tBilling
[PHP] is this correct? regular expressions
just trying to say if $phone isn't all numbers set it to all zeros.. so is that right? cause i can't seem to get it to work. if (!ereg(^[0-9]$,$phone)) { $phone = 00; } thanks!
Re: [PHP] is this correct? regular expressions
At 23:22 25.03.2003, Jay Paulson said: [snip] just trying to say if $phone isn't all numbers set it to all zeros.. so is that right? cause i can't seem to get it to work. if (!ereg(^[0-9]$,$phone)) { $phone = 00; } thanks! [snip] This is if $phone is anything else than a single digit. You need to add either a plus or an asterisk after the closing bracket to denote multiple instances of the character set: if (!ereg(^[0-9]*$,$phone)) { You could also check if anything _not_ being a number exists within $phone: if (ereg([^0-9],$phone)) { -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] formatting textarea input on output
hi all, i have a textarea in a form which gets inserted into a table in my database (mySQL). When displaying this text back to the screen, how do i retain the line breaks etc. that were in the original input? thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Formatting code.
this code doc is excellent thanks , although some of it i agree on but i do differently , naming conventions etc .. i usually follow the PEAR standard although i dont do any pear code , its been the best thing ever to happen for php , as for a newbie when pear first came around it helped alot , its the only way i got my head around learning OO. = Original Message From Philip Hallstrom [EMAIL PROTECTED] = here's one. http://utvikler.start.no/code/php_coding_standard.html google will probably find a lot more... maybe not all PHP specific, but still relevant. On Wed, 26 Mar 2003, Philip J. Newman wrote: Is there any documents on how code should be layed out? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL and phpMyAdmin Issues
I am by no means an expert (even remotely) but I do recall instructions on exactly how to do this in the documentation for MySQL - I think under the how to upgrade section. - Charles On Monday, March 3, 2003, at 06:53 PM, Stephen Craton wrote: Hello, Yesturday I made a big mistake. I had to import a 60MB file into a database and I used ssh. I'm very unfamiliar with it and when I connected to the MySQL connection thing, I forgot to switch databases when I imported. This overwrite (I don't know why but it did) the users table in the mysql database and caused everything to get messy. For some reason, though, the sites on the server are still working with their old MySQL username and password (I'm not sure why since I imported a fresh install's mysql database from my local server). Everything seems to be working except phpMyAdmin. When I try logging in using the default user as root and password as nothing, it gives me an access denied error. It does this for every user we had in the database as well. Is there anyway I can fix this is ssh? The only option I can think of is reinstalling MySQL but even then we'll loose all the old databases and I'm not sure how to export the tables to a file in ssh. Any help here would be most obliging and I need a reply rather urgently in order to allow my hosted sites access to phpMyAdmin once again... Thanks, Stephen Craton http://www.melchior.us -- 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] Backing Up Tables Using PHP
Most RDB programs come with an integrated backup solution. You might want to look into those. As far as why your code is not working, you are not looping through the result set, you are only pulling one result. A database does not store data in order, it puts it where ever there's a hole, so the 25th record could very well hold the first spot in the file. You have more problems than not looping, echo $result_sql_daily[$count_daily]; is just going to print array() if I am not mistaken. To fix the problem that you asked about though, take out the part where you fetch the first result and replace the for statement with while ($result_sql_daily = mysql_fetch_array($run_sql_daily)){ -Original Message- From: Guru Geek [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 2:12 PM To: [EMAIL PROTECTED] Subject: [PHP] Backing Up Tables Using PHP Hello, Trying to author my own PHP database table back up utility. A very simple one at that... Here's my sql statement to select everything in the table: $sql_daily = SELECT * FROM dailytable; $run_sql_daily = mysql_query($sql_daily); $result_sql_daily = mysql_fetch_array($run_sql_daily); Here's the code for showing me whats in the result array: for ($count_daily=0; $count_daily count($result_sql_daily); $count_daily++) { echo p; echo $result_sql_daily[$count_daily]; } exit; Does anyone out there know why it only prints one line of the table? It's a line in the middle of the table, it's not the first line, it's not the last line, it's in the middle of about 25 lines. Is this not the proper way to back up tables in a database? I'd like a back up copy of my tables on CD-ROM and I thought once this prints out correctly I'd just have it print to a text file and then place the text file on a cd Thanks, Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formatting textarea input on output
At 23:30 25.03.2003, Charles Kline said: [snip] i have a textarea in a form which gets inserted into a table in my database (mySQL). When displaying this text back to the screen, how do i retain the line breaks etc. that were in the original input? [snip] nl2br() -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php