php-general Digest 24 Nov 2005 19:45:08 -0000 Issue 3813
php-general Digest 24 Nov 2005 19:45:08 - Issue 3813 Topics (messages 226398 through 226416): understanding session vars ? 226398 by: Gregory Machin 226401 by: David Grant 226403 by: Gregory Machin 226404 by: David Grant 226405 by: Gregory Machin 226406 by: David Grant 226408 by: Ford, Mike Re: Can't execute external program 226399 by: n.g. R: [PHP] Re: Can't execute external program 226400 by: Sebastian \En3pY\ Zdrojewski Re: readfile and get_file_contents don't work 226402 by: David Grant Re: preg_match_all for dummies 226407 by: n.g. 226413 by: Jochem Maas Regexp trouble 226409 by: Andy Pieters 226410 by: David Grant 226411 by: Frank Armitage 226412 by: Jochem Maas 226416 by: Andy Pieters great examples of using PHP to dynamically generate ASX files 226414 by: Graham Anderson Where is utypes.h ? 226415 by: ÕÅ˳ 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: php-general@lists.php.net -- ---BeginMessage--- Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different includes. But I cant get the vars to be persistant. note the page call it's self. ./index.php ?php session_start(); $_SESSION['menu'] ? htmlA href=./index.php?menu=1option 1/A/html // this works htmlA href=./index.php?other=dodiffernt action/A/html // this brakes it . when the user links here the 'menu' var is cleared ?php $_SESSION['menu'] = $_GET['menu']; echo $_SESSION['menu']; ? I would like the menu var (and others) to be persistant until it is reset or updated. how do I acheave this . Thanks -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096 ---End Message--- ---BeginMessage--- Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different includes. But I cant get the vars to be persistant. note the page call it's self. ./index.php ?php session_start(); $_SESSION['menu'] ? htmlA href=./index.php?menu=1option 1/A/html // this works htmlA href=./index.php?other=dodiffernt action/A/html // this brakes it . when the user links here the 'menu' var is cleared ?php $_SESSION['menu'] = $_GET['menu']; echo $_SESSION['menu']; ? I would like the menu var (and others) to be persistant until it is reset or updated. how do I acheave this . Thanks -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096 ---End Message--- ---BeginMessage--- I have a test script.. What i'm trying to achieve is once the user has clicked on link1 the value of item must equal x and if the user clicks on link2 the value of items must stay equal to x while setting action equal to y .. ?php session_start(); echo 'Welcome to testpg'; $_SESSION['time']= time(); if (isset($_GET['item'])){ $_SESSION['item'] = $_GET['item']; echo $_SESSION['item']; } if (isset($_GET['action'])){ $_SESSION['action'] = $_GET['action']; echo $_SESSION['action']; } ? htmlbr /a href=test.php?item=x?php echo strip_tags(SID); ?link1/a/html htmlbr /a href=test.php?action=y?php echo strip_tags(SID); ?link2/a/html thanks On 11/24/05, David Grant [EMAIL PROTECTED] wrote: Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different
[PHP] Re: Can't execute external program
put the executable into another directory rather than DOC_ROOT, maybe you have reached apache security settings. or try add `option +exec' to your apache conf, but be aware this maybe a security problem to your site to do so. On 11/24/05, Henry Castillo [EMAIL PROTECTED] wrote: Hi Still desperate DOCUMENT_ROOT is /var/www/html Check all settings at http://provi.voicenetworx.net:8080/t.php From the command line it runs perfectly: [EMAIL PROTECTED] html]# /var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new (no output, it just creates the file .new) Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? On 11/22/05, n.g. [EMAIL PROTECTED] wrote: is /var/www/html your web root dir ? maybe its the plobrem. On 11/23/05, Henry Castillo [EMAIL PROTECTED] wrote: That was on of the first things I checked: safe mode is set to off Any ideas... Henry Voip tech said the following on 11/20/2005 10:31 PM: Hello, I cannot get exec(), system() or passthru() to run an extenal program. From the command line it runs perfectly: snip I'm getting frustrated, Any help will be deeply appreciated Henry The answer is probably in your php.ini. Look into whether you are running in safe mode or not, and if you are whether you have your program in the safe_mode_exec_dir or not. Also check disable_functions to see if any of the ones you are having trouble with are listed. - Ben -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] R: [PHP] Re: Can't execute external program
Try verifying the following: - does the web server user (apache/nobody) have a shell? - can the web server user/group execute the file? (x permission) I believe this is your problem, the exec option for the apache would be useful if you need to run an executable from the apache service, not from the command line. Check out the earlier and I think you're gonna solve your issue. Regards, En3pY Sebastian Konstanty Zdrojewski URL: http://www.en3py.net/ E-Mail: [EMAIL PROTECTED] Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invito ad eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandone gentilmente comunicazione. Ogni utilizzo improprio è contrario ai principi del D.lgs 196/03 e alla legislazione Europea (Direttiva 2002/58/CE). -Messaggio originale- Da: n.g. [mailto:[EMAIL PROTECTED] Inviato: giovedì 24 novembre 2005 10.16 A: Henry Castillo Cc: php-general@lists.php.net Oggetto: [PHP] Re: Can't execute external program put the executable into another directory rather than DOC_ROOT, maybe you have reached apache security settings. or try add `option +exec' to your apache conf, but be aware this maybe a security problem to your site to do so. On 11/24/05, Henry Castillo [EMAIL PROTECTED] wrote: Hi Still desperate DOCUMENT_ROOT is /var/www/html Check all settings at http://provi.voicenetworx.net:8080/t.php From the command line it runs perfectly: [EMAIL PROTECTED] html]# /var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new (no output, it just creates the file .new) Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? On 11/22/05, n.g. [EMAIL PROTECTED] wrote: is /var/www/html your web root dir ? maybe its the plobrem. On 11/23/05, Henry Castillo [EMAIL PROTECTED] wrote: That was on of the first things I checked: safe mode is set to off Any ideas... Henry Voip tech said the following on 11/20/2005 10:31 PM: Hello, I cannot get exec(), system() or passthru() to run an extenal program. From the command line it runs perfectly: snip I'm getting frustrated, Any help will be deeply appreciated Henry The answer is probably in your php.ini. Look into whether you are running in safe mode or not, and if you are whether you have your program in the safe_mode_exec_dir or not. Also check disable_functions to see if any of the ones you are having trouble with are listed. - Ben -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.13.7/180 - Release Date: 23/11/2005 smime.p7s Description: S/MIME cryptographic signature
Re: [PHP] understanding session vars ?
Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different includes. But I cant get the vars to be persistant. note the page call it's self. ./index.php ?php session_start(); $_SESSION['menu'] ? htmlA href=./index.php?menu=1option 1/A/html // this works htmlA href=./index.php?other=dodiffernt action/A/html // this brakes it . when the user links here the 'menu' var is cleared ?php $_SESSION['menu'] = $_GET['menu']; echo $_SESSION['menu']; ? I would like the menu var (and others) to be persistant until it is reset or updated. how do I acheave this . Thanks -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] readfile and get_file_contents don't work
Hi Richard, Please ensure that the allow_url_fopen directive is set to On in your php.ini file. Cheers, David Grant Richard K. Miller wrote: I compiled PHP from source on Fedora Core 4, but I must have left something out because readfile and get_file_contents aren't working. If I try to connect to a http://; address I get the error failed to open stream: HTTP request failed. Any ideas why? Richard --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] understanding session vars ?
I have a test script.. What i'm trying to achieve is once the user has clicked on link1 the value of item must equal x and if the user clicks on link2 the value of items must stay equal to x while setting action equal to y .. ?php session_start(); echo 'Welcome to testpg'; $_SESSION['time']= time(); if (isset($_GET['item'])){ $_SESSION['item'] = $_GET['item']; echo $_SESSION['item']; } if (isset($_GET['action'])){ $_SESSION['action'] = $_GET['action']; echo $_SESSION['action']; } ? htmlbr /a href=test.php?item=x?php echo strip_tags(SID); ?link1/a/html htmlbr /a href=test.php?action=y?php echo strip_tags(SID); ?link2/a/html thanks On 11/24/05, David Grant [EMAIL PROTECTED] wrote: Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different includes. But I cant get the vars to be persistant. note the page call it's self. ./index.php ?php session_start(); $_SESSION['menu'] ? htmlA href=./index.php?menu=1option 1/A/html // this works htmlA href=./index.php?other=dodiffernt action/A/html // this brakes it . when the user links here the 'menu' var is cleared ?php $_SESSION['menu'] = $_GET['menu']; echo $_SESSION['menu']; ? I would like the menu var (and others) to be persistant until it is reset or updated. how do I acheave this . Thanks -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096 -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096
Re: [PHP] understanding session vars ?
Gregory, Values in the $_SESSION superglobal will persist over pages so long as session_start() is called on each page. Cheers, David Grant Gregory Machin wrote: I have a test script.. What i'm trying to achieve is once the user has clicked on link1 the value of item must equal x and if the user clicks on link2 the value of items must stay equal to x while setting action equal to y .. ?php session_start(); echo 'Welcome to testpg'; $_SESSION['time']= time(); if (isset($_GET['item'])){ $_SESSION['item'] = $_GET['item']; echo $_SESSION['item']; } if (isset($_GET['action'])){ $_SESSION['action'] = $_GET['action']; echo $_SESSION['action']; } ? htmlbr /a href=test.php?item=x?php echo strip_tags(SID); ?link1/a/html htmlbr /a href=test.php?action=y?php echo strip_tags(SID); ?link2/a/html thanks On 11/24/05, * David Grant* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different includes. But I cant get the vars to be persistant. note the page call it's self. ./index.php ?php session_start(); $_SESSION['menu'] ? htmlA href=./index.php?menu=1option 1/A/html // this works htmlA href=./index.php?other=dodiffernt action/A/html // this brakes it . when the user links here the 'menu' var is cleared ?php $_SESSION['menu'] = $_GET['menu']; echo $_SESSION['menu']; ? I would like the menu var (and others) to be persistant until it is reset or updated. how do I acheave this . Thanks -- Gregory Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.linuxpro.co.za http://www.linuxpro.co.za www.exponent.co.za http://www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info http://www.iberry.info (support and admin) +27 72 524 8096 -- Gregory Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.linuxpro.co.za http://www.linuxpro.co.za www.exponent.co.za http://www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info http://www.iberry.info (support and admin) +27 72 524 8096 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] understanding session vars ?
My test code is for test.php which is intended to call it's self, and starts with sesstion_start(). buy does not disply x after link2 is clicked on, but only y.. what am I missing ? Thanks On 11/24/05, David Grant [EMAIL PROTECTED] wrote: Gregory, Values in the $_SESSION superglobal will persist over pages so long as session_start() is called on each page. Cheers, David Grant Gregory Machin wrote: I have a test script.. What i'm trying to achieve is once the user has clicked on link1 the value of item must equal x and if the user clicks on link2 the value of items must stay equal to x while setting action equal to y .. ?php session_start(); echo 'Welcome to testpg'; $_SESSION['time']= time(); if (isset($_GET['item'])){ $_SESSION['item'] = $_GET['item']; echo $_SESSION['item']; } if (isset($_GET['action'])){ $_SESSION['action'] = $_GET['action']; echo $_SESSION['action']; } ? htmlbr /a href=test.php?item=x?php echo strip_tags(SID); ?link1/a/html htmlbr /a href=test.php?action=y?php echo strip_tags(SID); ?link2/a/html thanks On 11/24/05, * David Grant* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different includes. But I cant get the vars to be persistant. note the page call it's self. ./index.php ?php session_start(); $_SESSION['menu'] ? htmlA href=./index.php?menu=1option 1/A/html // this works htmlA href=./index.php?other=dodiffernt action/A/html // this brakes it . when the user links here the 'menu' var is cleared ?php $_SESSION['menu'] = $_GET['menu']; echo $_SESSION['menu']; ? I would like the menu var (and others) to be persistant until it is reset or updated. how do I acheave this . Thanks -- Gregory Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.linuxpro.co.za http://www.linuxpro.co.za www.exponent.co.za http://www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info http://www.iberry.info (support and admin) +27 72 524 8096 -- Gregory Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.linuxpro.co.za http://www.linuxpro.co.za www.exponent.co.za http://www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info http://www.iberry.info (support and admin) +27 72 524 8096 -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096
Re: [PHP] understanding session vars ?
Gregory Gregory Machin wrote: My test code is for test.php which is intended to call it's self, and starts with sesstion_start(). buy does not disply x after link2 is clicked on, but only y.. what am I missing ? x wouldn't display because it depends on $_GET['item'] being set, which isn't. Try var_dump($_SESSION) instead of the conditional echoing of the variables. Cheers, David Grant Thanks On 11/24/05, *David Grant* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Gregory, Values in the $_SESSION superglobal will persist over pages so long as session_start() is called on each page. Cheers, David Grant Gregory Machin wrote: I have a test script.. What i'm trying to achieve is once the user has clicked on link1 the value of item must equal x and if the user clicks on link2 the value of items must stay equal to x while setting action equal to y .. ?php session_start(); echo 'Welcome to testpg'; $_SESSION['time']= time(); if (isset($_GET['item'])){ $_SESSION['item'] = $_GET['item']; echo $_SESSION['item']; } if (isset($_GET['action'])){ $_SESSION['action'] = $_GET['action']; echo $_SESSION['action']; } ? htmlbr /a href=test.php?item=x?php echo strip_tags(SID); ?link1/a/html htmlbr /a href=test.php?action=y?php echo strip_tags(SID); ?link2/a/html thanks On 11/24/05, * David Grant* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: Hi I'm a bit stuck on session var, and thier implamentation, or my perseption thier of. I have a page and need certian vars to be persistat each time the page is called. This is done to detmin the content of the page through logic that calls different includes. But I cant get the vars to be persistant. note the page call it's self. ./index.php ?php session_start(); $_SESSION['menu'] ? htmlA href=./index.php?menu=1option 1/A/html // this works htmlA href=./index.php?other=dodiffernt action/A/html // this brakes it . when the user links here the 'menu' var is cleared ?php $_SESSION['menu'] = $_GET['menu']; echo $_SESSION['menu']; ? I would like the menu var (and others) to be persistant until it is reset or updated. how do I acheave this . Thanks -- Gregory Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.linuxpro.co.za http://www.linuxpro.co.za http://www.linuxpro.co.za www.exponent.co.za http://www.exponent.co.za http://www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info http://www.iberry.info http://www.iberry.info (support and admin) +27 72 524 8096 -- Gregory Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.linuxpro.co.za http://www.linuxpro.co.za http://www.linuxpro.co.za www.exponent.co.za http://www.exponent.co.za http://www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info http://www.iberry.info http://www.iberry.info (support and admin) +27 72 524 8096 -- Gregory Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.linuxpro.co.za http://www.linuxpro.co.za www.exponent.co.za http://www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info http://www.iberry.info (support and admin) +27 72 524 8096 -- PHP General Mailing List (http://www.php.net/) To
[PHP] Re: preg_match_all for dummies
lookbehind assertion require fixed length string as its parameter. but you intend to put arbitary length string between `!--' and `[!' so the solution can be 1, remove html comments first before do bbcode expansion. 2, change bbcode tags to something like `[!-- .* --!]', that is define a new tag of bbcode comments, which is independent to html comments. On 11/24/05, Kristen G. Thorson [EMAIL PROTECTED] wrote: I am a regex retard. I am trying to pull keywords out of this crazy bbcode-like file, but only for bbcode-like code NOT enclosed in HTML comments. I currently have managed to create this regex: '/(?!!--)\[!(\w+)::.*!\](?!--)/U' Which matches [!keyword::crazy bbcode!] and not !--[!keyword::crazy bbcode!]-- That's a step in the right direction. But it includes in the match keywords within phrases like this: !-- A sentence including some [!keyword::crazy bbcode!]. -- I want to ignore all bbcode within HTML quotes. How do I do this? thanks kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Tomorrow will be a good day :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] understanding session vars ?
On 24 November 2005 10:24, Gregory Machin wrote: I have a test script.. What i'm trying to achieve is once the user has clicked on link1 the value of item must equal x and if the user clicks on link2 the value of items must stay equal to x while setting action equal to y .. ?php session_start(); echo 'Welcome to testpg'; $_SESSION['time']= time(); if (isset($_GET['item'])){ $_SESSION['item'] = $_GET['item']; echo $_SESSION['item']; } if (isset($_GET['action'])){ $_SESSION['action'] = $_GET['action']; echo $_SESSION['action']; } htmlbr /a href=test.php?item=x?php echo strip_tags(SID); link1/a/html htmlbr /a href=test.php?action=y?php echo strip_tags(SID); link2/a/html This is not how you use html tags -- you need one html tag at the beginning of your output page, and one /html tag at the end. Additionally, you shouldn't need to strip_tags(SID) -- if the constant SID exists, it will be well-formed. What are the value of your session.use_trans_sid, session.use_cookies and session.use_only_cookies settings? Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
[PHP] Regexp trouble
Hi list I still fail to understand why regular expressions are causing me such a hard time. I used and tested my regexp in kregexpeditor (comes with Quanta [kdewebdev]) but when I put it in the php script it fails. ereg('^([\w]{3,3})[\s]([\d]{2,2})[\s]([\d]{2,2})[:]([\d]{2,2})[:]([\d]{2,2})' Does not match my query string. Which is Nov 22 06:51:36 Any ideas why? I mean Line start, followed by 3 word chars, followed by a space, followed by 2 digits, followed by a space, followed by two digits, folowed by a colon followed by 2 digits and followed by a colon, should match that date? With kind regards Andy -- Currently not listening to amaroK Geek code: www.vlaamse-kern.com/geek Registered Linux User No 379093 If life was for sale, what would be its price? www.vlaamse-kern.com/sas/ for free php utilities -- pgpB6BsWHneC5.pgp Description: PGP signature
Re: [PHP] Regexp trouble
Andy, Try preg_match instead of ereg. Cheers, David Grant Andy Pieters wrote: Hi list I still fail to understand why regular expressions are causing me such a hard time. I used and tested my regexp in kregexpeditor (comes with Quanta [kdewebdev]) but when I put it in the php script it fails. ereg('^([\w]{3,3})[\s]([\d]{2,2})[\s]([\d]{2,2})[:]([\d]{2,2})[:]([\d]{2,2})' Does not match my query string. Which is Nov 22 06:51:36 Any ideas why? I mean Line start, followed by 3 word chars, followed by a space, followed by 2 digits, followed by a space, followed by two digits, folowed by a colon followed by 2 digits and followed by a colon, should match that date? With kind regards Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regexp trouble
Andy Pieters wrote: Hi list I still fail to understand why regular expressions are causing me such a hard time. snip / Hi! Why don't you use 'preg_match'? And why do you use all those character classes? This: code $subject = 'Nov 22 06:51:36'; $pattern = '/^(\w{3})\s(\d{2})\s(\d{2}):(\d{2}):(\d{2})/'; if (preg_match($pattern, $subject, $matches)) { print_r($matches); } /code nicely prints: Array ( [0] = Nov 22 06:51:36 [1] = Nov [2] = 22 [3] = 06 [4] = 51 [5] = 36 ) Bye Frank -- tradeOver | http://www.tradeover.net ...ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regexp trouble
Andy Pieters wrote: Hi list I still fail to understand why regular expressions are causing me such a hard time. er, because they are hard? hey you failed! we have a club :-) I used and tested my regexp in kregexpeditor (comes with Quanta [kdewebdev]) but when I put it in the php script it fails. ereg('^([\w]{3,3})[\s]([\d]{2,2})[\s]([\d]{2,2})[:]([\d]{2,2})[:]([\d]{2,2})' I always use the preg_*() functions myself. and I always have to specify regexp delimiters ... $re = #^([\w]{3,3})[\s]([\d]{2,2})[\s]([\d]{2,2})[:]([\d]{2,2})[:]([\d]{2,2})#; $st = Nov 22 06:51:36; echo (preg_match($re, $st) ? Yes:No),\n; I ran the above and it returned 'Yes' for me. Does not match my query string. Which is Nov 22 06:51:36 Any ideas why? I mean Line start, followed by 3 word chars, followed by a space, followed by 2 digits, followed by a space, followed by two digits, folowed by a colon followed by 2 digits and followed by a colon, should match that date? With kind regards Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all for dummies
Kristen G. Thorson wrote: I am a regex retard. good for you ;-) why not take the easy route and simply strip out all HTML comments (and whatever maybe inside them) from the string(s) before you do the search for the 'bbcode'? I am trying to pull keywords out of this crazy bbcode-like file, but only for bbcode-like code NOT enclosed in HTML comments. I currently have managed to create this regex: '/(?!!--)\[!(\w+)::.*!\](?!--)/U' Which matches [!keyword::crazy bbcode!] and not !--[!keyword::crazy bbcode!]-- That's a step in the right direction. But it includes in the match keywords within phrases like this: !-- A sentence including some [!keyword::crazy bbcode!]. -- I want to ignore all bbcode within HTML quotes. How do I do this? thanks kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] great examples of using PHP to dynamically generate ASX files
Are there any great examples/tutorials of building advanced ASX files with PHP ? I have built a lot of playlists with Quicktime/ PHP/MYSQL...but I am a windows media noob any resources and/or examples are appreciated :) g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where is utypes.h ?
Hi List When I what to build PHP5 in Win32: Where is the utypes.h . === C:\work\php5\win32msdev php4ts.dsp /MAKE php4ts - Win32 Debug_TS php4ts.dsp File not found. Please verify that the path and file name are correct. Error: no project loaded. C:\work\php5\win32 C:\work\php5\win32msdev php5ts.dsp /MAKE php5ts - Win32 Debug_TS Configuration: EngineSelect - Win32 Debug--- - Configuration: ZendTS - Win32 Debug_TS Compiling... zend.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_alloc.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_API.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_builtin_functions.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_compile.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_constants.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_default_classes.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_dynamic_array.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_exceptions.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_execute.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_execute_API.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_extensions.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_hash.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_highlight.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_indent.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_ini.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_ini_parser.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_ini_scanner.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_interfaces.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_iterators.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_language_parser.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_language_scanner.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_list.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_llist.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_mm.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_object_handlers.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_objects.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_objects_API.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_opcode.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_operators.c c:\work\php5\zend\zend_alloc.h(31) : fatal error C1083: Cannot open include file : 'unicode/utypes.h': No such file or directory zend_ptr_stack.c c:\work\php5\zend\zend_alloc.h(31) : fatal error
Re: [PHP] Regexp trouble
Thanks all for your contributions. Seems like the missing link was the delimiter. On Thursday 24 November 2005 18:23, Frank Armitage wrote: And why do you use all those character classes? Err.. why NOT use character classes? What is easier [0-9] or \d or maybe [a-zA-Z] or [\w], ... ? With kind regards Andy -- Now listening to Top! Radio Live www.topradio.be/stream on amaroK Geek code: www.vlaamse-kern.com/geek Registered Linux User No 379093 If life was for sale, what would be its price? www.vlaamse-kern.com/sas/ for free php utilities -- pgposVVooZ7Uo.pgp Description: PGP signature
[PHP] Re: Can't execute external program
Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? From the command line it runs perfectly A PHP script runs with the permissions of the user that Apache runs as, usually nobody. When run from the command line, it inherits a different set of permissions (i.e., root). One option would be to put a copy of the executable in another directory, but OUTSIDE of your DOCROOT, and give it the same ownership and perms as nobody (or whatever Apache runs as). Of course, this makes your script 100% non-portable, if that matters. It is also possible that the executable may not run, if it depends on compiled libraries elsewhere on the server. WebDesigns Internet Consulting E-commerce Solutions Application Development Sandy Keathley Zend Certified Engineer [EMAIL PROTECTED] 972-569-8464 http://www.KeathleyWebs.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regexp trouble
Andy Pieters wrote: Err.. why NOT use character classes? What is easier [0-9] or \d or maybe [a-zA-Z] or [\w], ... ? Well, first of all the square brackets in [\w] aren't needed, \w already means 'any word character'. Secondly, [a-zA-Z] is not the same as \w: A word character is any letter or digit or the underscore character, that is, any character which can be part of a Perl word. The definition of letters and digits is controlled by PCRE's character tables, and may vary if locale-specific matching is taking place (see Locale support above). For example, in the fr (French) locale, some character codes greater than 128 are used for accented letters, and these are matched by \w. [http://www.php.net/manual/en/reference.pcre.pattern.syntax.php] Anyway I'm not really a great RegExp expert, a good starting point for understanding regexp and PHP is, as usual, the manual: http://www.php.net/manual/en/reference.pcre.pattern.syntax.php Bye! -- tradeOver | http://www.tradeover.net ...ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session cookies, domain (host:port) issues
hi some thoughts on session cookies... when setting the domain for the cookie, u could use $_SERVER['HTTP_HOST'] which would be 'example.com' or 'www.example.com' i.e. session_set_cookie_params(30*60, '/', $_SERVER['HTTP_HOST'], false); (assuming u don't want to set it for subdomains) if the webserver isn't running on port 80 then $_SERVER['HTTP_HOST'] is 'example.com:101'. on www.example.com:101 or sub.example.com:101, $_SERVER['SERVER_NAME'] is 'example.com' in which case the browser rejects it (which it's supposed to). ofcourse this could be solved by doing something like list ($host, $port) = split(':', $_SERVER['HTTP_HOST']); $host is 'sub.example.com' $port is '101' if the 'domain' parameter in session_set_cookie_params is empty or not specified along with the 'secure' field, it's handled properly by the server, accepted by the browser, etc. strange that not specifying it helps since u'd want ur script to run regardless of the server config and as long as u can set certain parameters and control whether it applies to subdomains or the primary domain. set-cookie2 supports the port directive (http://www.faqs.org/rfcs/rfc2965.html) Port[=portlist] dunno about implementation or browser support. it would be good if the php handled this either using set-cookie2 or stripping it from the domain...similar behaviour to when it's not specified. a comment was posted about this on the setcookie page (http://php.net/manual/en/function.setcookie.php#36202) which i think should be added to the function docs. anirudh -- ]# Anirudh Dutt pilot of the storm who leaves no trace like thoughts inside a dream -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php