php-general Digest 26 Jul 2004 08:46:24 -0000 Issue 2899 Topics (messages 191837 through 191870):
Parsing error when XML version is mentioned
191837 by: Suresh Manoharan
191839 by: eoghan
191841 by: Scrumpy
191842 by: Suresh Manoharan
191861 by: Jason Wong
191866 by: Justin French
Re: If...Or...Else
191838 by: Skippy
191870 by: Thomas Goyne
Re: Embedding JavaScript into a PHP generated web page
191840 by: Robert Frame
191850 by: Robert Frame
191851 by: Comex
191852 by: Ash Young
191860 by: Robert Frame
Re: class help (PLEASE)
191843 by: Jason Barnett
191847 by: PHP Gen
191848 by: Jason Barnett
191849 by: PHP Gen
PHP function speed testing
191844 by: Shawn McKenzie
191845 by: Jason Barnett
191862 by: Jason Wong
Regex (Phone Number)
191846 by: Albert Padley
Re: good PHP to PDF libary?
191853 by: Louie Miranda
Re: INSERT INTO using foreach
191854 by: Marek Kilimajer
URGENT: Space char in rewriterule
191855 by: Robert Winter
191858 by: Marek Kilimajer
Re: How to get all links from a webpage?
191856 by: Wudi
191863 by: Jason Wong
191867 by: Wudi
Re: IMPORTANT: Please Verify Your Message
191857 by: Mark
replace value of array by key of array in string variable with pre g_replace()
191859 by: Turbo
191868 by: Jason Wong
Sticky session after session_destroy...
191864 by: Aldwyn Clavin
available timezones
191865 by: Justin French
Re: IMPORTANT: Please Verify Your Message]
191869 by: EE
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]
----------------------------------------------------------------------
--- Begin Message ---Hey Guys, I am getting parse error [Parse error: parse error, unexpected T_STRING on line 1] when I use XML version info. <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>Testing Page</title> </head> <body> <p>Hi</p> </body> </html> When I store the above file as test.php and run in Apache, I am getting the parse error. The observartions are: - When I remove XML version and just mention <?xml?>, I am not getting the error. - When I store the file as .htm, then also I am not getting error Setting: - PHP Version 4.3.8 , Build Date Jul 13 2004 17:31:56 - Loaded as module on Apache/2.0.50 (Win32) Can you pls. help me understand why parsing error occurs and how to avoid it. Thanks. Suresh.
--- End Message ---
--- Begin Message ---instead of that line use this <? echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ?>
Can you pls. help me understand why parsing error occurs and how to avoid it.
--- End Message ---
--- Begin Message ---[EMAIL PROTECTED] (Suresh Manoharan) wrote in news:[EMAIL PROTECTED]: > I am getting parse error [Parse error: parse error, unexpected > T_STRING on line 1] when I use XML version info. > ><?xml version="1.0" encoding="utf-8"?> ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" >lang="en-US"> <head> [snip] > Can you pls. help me understand why parsing error occurs and how to > avoid it. I just start with "<!DOCTYPE..." on the first line and exclude the "<?xml..." line completely and both parsing and validation are fine.
--- End Message ---
--- Begin Message ---Thanks, Eoghan. It works. Good learning experience for me. Found more information in the following links: http://www.php.net/manual/en/language.basic-syntax.php http://www.php.net/manual/en/ini.sect.language-options.php#ini.short-open-tag "Eoghan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > instead of that line use this > <? > echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" > ?> > > > > Can you pls. help me understand why parsing error occurs and how to avoid > > it.
--- End Message ---
--- Begin Message ---On Monday 26 July 2004 05:39, Suresh Manoharan wrote: > Good learning experience for me. Found more information in the following > links: > > http://www.php.net/manual/en/language.basic-syntax.php > http://www.php.net/manual/en/ini.sect.language-options.php#ini.short-open-t >ag Also manual > Appendix P. List of Parser Tokens -- 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 ------------------------------------------ /* "A dirty mind is a joy forever." -- Randy Kunkee */
--- End Message ---
--- Begin Message ---On 26/07/2004, at 7:29 AM, Scrumpy wrote:
[EMAIL PROTECTED] (Suresh Manoharan) wrote in news:[EMAIL PROTECTED]:
[snip]I am getting parse error [Parse error: parse error, unexpected T_STRING on line 1] when I use XML version info.
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head>Can you pls. help me understand why parsing error occurs and how to avoid it.
I just start with "<!DOCTYPE..." on the first line and exclude the "<?xml..." line completely and both parsing and validation are fine.
That's a workaround, not a solution.
The problem is that <?... is a PHP short tag, so the PHP engine thinks <?xml version="1.0" encoding="utf-8"?> is PHP code, which it isn't, hence the errors spit out by the PHP engine.
Solution 1:
Turn off short tags in your php.ini file, so that only <?php ... ?> will turn on the PHP engine. This may require a large rewrite of existing scripts though.
Solution 2: Instead of <?xml version="1.0" encoding="utf-8"?> on line 1, use <? echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
In other words, let PHP's engine echo the XML declaration, avoiding the PHP parsing errors.
Regards
--- Justin French http://indent.com.au
--- End Message ---
--- Begin Message ---On Sun, 25 Jul 2004 15:42:42 +0200 "rush" <[EMAIL PROTECTED]> wrote: > "Jason Davidson" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > ah right.. :) > > Jason > > OR has a very low priority , and right argument is not evaluated if left > one is true. Same thing happens with ||, FWIW. The if condition is not evaluated further than it needs to be in either case. > In other words OR is here so that you could in pre exception > handling days easily write something like this: > > mysql_query(...) OR die; This also works with ||: mysql_query(...) || die; I just wanted to make things clear, because the way you said it above may lead to misinterpretations, such as believing that || makes all the elements in a condition evaluate even if not necessary, which is not true. So OR simply has lower precedence than ||, but no other hidden properties. Any idea why the need to have two logical operators with the same meaning BUT different precedences? I dig the need to put in OR as an alias, but why confuse people with the precedence issue? One would tend to think || and OR are perfectly interchangeable. -- Skippy - Romanian Web Developers - http://ROWD.ORG
--- End Message ---
--- Begin Message ---On Mon, 26 Jul 2004 11:11:21 +0300, Skippy <[EMAIL PROTECTED]> wrote:
Quoting Thomas Goyne <[EMAIL PROTECTED]>:
On Sun, 25 Jul 2004 23:15:41 +0300, Skippy <[EMAIL PROTECTED]> wrote:
> Any idea why the need to have two logical operators with the same
> meaning BUT
> different precedences? I dig the need to put in OR as an alias, but why
> confuse people with the precedence issue? One would tend to think || and
> OR > are perfectly interchangeable. >
Perl compatibility.
What good is the confusion in Perl then?
IIRC each operator in perl uses the predence they have in thier language of origin. (|| from C, or from batch scripting)
That may be completly wrong, as its been a while since I've touched perl.
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---After I posted this I did some more searching on google and found the following code, which works. echo '<EOT><script language="javascript">function myWindow(){ alert("javascript from php");}</script>'; I then tried it without the <EOT> tag and it still worked. Apparently I had something out of wack, probably a quote. Off hand though, can anyone tell me what <EOT> is? Thanks for the help. Rob "Robert Frame" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi There, > > I have a web page with a form that is generated by PHP, and part of my > design utilizes JavaScript to provide some error checking within the objects > in the form. I have written the javascript in an html document, but I am > having trouble blending the two together. > > I have tried sending the javascript within an echo statement, as well as > using straight HTML/JavaScript code, but nothing seems to work. > > Can anyone offer some help or direct me to a solution? > > Thanks, > Rob
--- End Message ---
--- Begin Message ---OK, now I am bewildered again. Sample Code <?php echo '<script language="text/javascript">'; echo '<!-- '; echo 'function myWindow() { alert("javascript from php")}'; echo '//--> </script>'; ?> ... <html><body><form ....> echo '<input type="submit" value="Window" name="Window" onclick="myWindow();"> '; </form></body></html> As soon as I hit the button 'Window' I get an ''object expected" error. Any thoughts? Rob "Robert Frame" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > After I posted this I did some more searching on google and found the > following code, which works. > > echo '<EOT><script language="javascript">function myWindow(){ > alert("javascript from php");}</script>'; > > I then tried it without the <EOT> tag and it still worked. Apparently I had > something out of wack, probably a quote. > > Off hand though, can anyone tell me what <EOT> is? > > Thanks for the help. > Rob > > "Robert Frame" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi There, > > > > I have a web page with a form that is generated by PHP, and part of my > > design utilizes JavaScript to provide some error checking within the > objects > > in the form. I have written the javascript in an html document, but I am > > having trouble blending the two together. > > > > I have tried sending the javascript within an echo statement, as well as > > using straight HTML/JavaScript code, but nothing seems to work. > > > > Can anyone offer some help or direct me to a solution? > > > > Thanks, > > Rob
--- End Message ---
--- Begin Message ---That wouldn't include newlines..
--- End Message ---
--- Begin Message ---I'd suggest putting some new line characters in after the <!-- as it will treat the JavaScript as a comment. So just add a new line character at the end of each of the echo statements. -- ash young :: http://evoluted.net/ -----Original Message----- From: Robert Frame [mailto:[EMAIL PROTECTED] Sent: 26 July 2004 01:13 To: [EMAIL PROTECTED] Subject: [PHP] Re: Embedding JavaScript into a PHP generated web page OK, now I am bewildered again. Sample Code <?php echo '<script language="text/javascript">'; echo '<!-- '; echo 'function myWindow() { alert("javascript from php")}'; echo '//--> </script>'; ?> ... <html><body><form ....> echo '<input type="submit" value="Window" name="Window" onclick="myWindow();"> '; </form></body></html> As soon as I hit the button 'Window' I get an ''object expected" error. Any thoughts? Rob "Robert Frame" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > After I posted this I did some more searching on google and found the > following code, which works. > > echo '<EOT><script language="javascript">function myWindow(){ > alert("javascript from php");}</script>'; > > I then tried it without the <EOT> tag and it still worked. Apparently > I had > something out of wack, probably a quote. > > Off hand though, can anyone tell me what <EOT> is? > > Thanks for the help. > Rob > > "Robert Frame" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi There, > > > > I have a web page with a form that is generated by PHP, and part of > > my design utilizes JavaScript to provide some error checking within > > the > objects > > in the form. I have written the javascript in an html document, but > > I am > > having trouble blending the two together. > > > > I have tried sending the javascript within an echo statement, as > > well as using straight HTML/JavaScript code, but nothing seems to work. > > > > Can anyone offer some help or direct me to a solution? > > > > Thanks, > > Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---Thanks Ash, you were on to the right solution. Because there is no newline character, there is nothing ending the JavaScript line. I had to add a ';' prior to the single quote ending the echo line. Each statement now looks like echo 'Info = new Array(4);'; Or to add a bit more code: <?php echo '<script language="JavaScript"> '; echo 'Info = new Array(4);'; for (i=0; i<4; i++) {Force_Info[i] = new Array(9);}'; ?> Thanks for the help, Rob "Ash Young" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'd suggest putting some new line characters in after the <!-- as it will > treat the JavaScript as a comment. > > So just add a new line character at the end of each of the echo statements. > > > -- > ash young :: http://evoluted.net/ > > -----Original Message----- > From: Robert Frame [mailto:[EMAIL PROTECTED] > Sent: 26 July 2004 01:13 > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Embedding JavaScript into a PHP generated web page > > OK, now I am bewildered again. > > Sample Code > > <?php > > echo '<script language="text/javascript">'; echo '<!-- '; echo 'function > myWindow() { alert("javascript from php")}'; echo '//--> </script>'; ?> ... > <html><body><form ....> > echo '<input type="submit" value="Window" name="Window" > onclick="myWindow();"> '; > </form></body></html> > > As soon as I hit the button 'Window' I get an ''object expected" error. > > Any thoughts? > Rob > > "Robert Frame" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > After I posted this I did some more searching on google and found the > > following code, which works. > > > > echo '<EOT><script language="javascript">function myWindow(){ > > alert("javascript from php");}</script>'; > > > > I then tried it without the <EOT> tag and it still worked. Apparently > > I > had > > something out of wack, probably a quote. > > > > Off hand though, can anyone tell me what <EOT> is? > > > > Thanks for the help. > > Rob > > > > "Robert Frame" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Hi There, > > > > > > I have a web page with a form that is generated by PHP, and part of > > > my design utilizes JavaScript to provide some error checking within > > > the > > objects > > > in the form. I have written the javascript in an html document, but > > > I > am > > > having trouble blending the two together. > > > > > > I have tried sending the javascript within an echo statement, as > > > well as using straight HTML/JavaScript code, but nothing seems to work. > > > > > > Can anyone offer some help or direct me to a solution? > > > > > > Thanks, > > > Rob > > -- > PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php
--- End Message ---
--- Begin Message --- No offense intended, but I'm not going to read through all of that. Narrow down the code block that gives you problems and then post that one block here... not the entire class.
--- End Message ---
--- Begin Message ------ Jason Barnett <[EMAIL PROTECTED]> wrote: > No offense intended, but I'm not going to read > through all of that. Narrow down > the code block that gives you problems and then post > that one block here... not > the entire class. > Hey Jason, No offense at all taken, am happy you read part of my help-email. Problem is, like I said, I dont have a clue about the workings of a class and all the pointing like this $this-> blah gets me totally confused so I really dont know which part IS the problem part. Anybody knowing of a good class tutorial...would be appreciated. I tried to figure it out by myself looking at the code, but I guess I have to learn about classes (have not come to that yet) before I know where the problem is, but having a look for the newline part I think this is the problem part: $preserve = md5(" \n\r"); $elaborate = preg_replace("/( )([\\n\\r]+){1}( )/", $preserve, $elaborate); $elaborate = preg_replace("/( )([\\n\\r^ ]+){1}/", $preserve, $elaborate); $elaborate .= "*/"; I know the class looks massive but if you copy and paste it into a editor that colors PHP code (I use editplus), you will see that a s***load of it is comments on how to use the class and layouts,css, initialization etc (even I could understand that so I'm guessing it has to pretty simple), then comes the preg_replace and eregi which confuses the crap out of me. Thanks, -Mag ===== ------ - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---Hey Jason, No offense at all taken, am happy you read part of my help-email. Problem is, like I said, I dont have a clue about the workings of a class and all the pointing like this
$this-> blah
(->) means blah is a property of the class. ($this) means an instance of the class.
gets me totally confused so I really dont know which part IS the problem part. Anybody knowing of a good class tutorial...would be appreciated.
phpfreaks have a lot of tutorials, so do codewalkers. You can probably find class tutorials at one of those sites.
--- End Message ---
--- Begin Message ---Thanks, Will first try learning RegEX then will move onto classes ore again will have problems in the future. Will screw around with the class and see what happens but if you do figure it out, please drop me a line. Thanks, Mag --- Jason Barnett <[EMAIL PROTECTED]> wrote: > > Hey Jason, > > No offense at all taken, am happy you read part of > my > > help-email. > > Problem is, like I said, I dont have a clue about > the > > workings of a class and all the pointing like this > > > > $this-> blah > > (->) means blah is a property of the class. ($this) > means an instance of the class. > > > > > gets me totally confused so I really dont know > which > > part IS the problem part. > > Anybody knowing of a good class tutorial...would > be > > appreciated. > > phpfreaks have a lot of tutorials, so do > codewalkers. You can probably find > class tutorials at one of those sites. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > ===== ------ - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message --- O.K. So I've written my application and debugged it, and now I want to try and optimize the speed. I have written a little test script to test the time of each PHP function that I can use in a certain situation (ereg, eregi, strpos). Problem is, no matter what I do, the first function I test in the script is always the slowest, even if I reorder them so that strpos() is first instead of ereg(). Doesn't matter which one it is. Maybe I did something stupid and just can't see it? Below is the code:
// define the stuff to use $GLOBALS['renderstart'] = 0;
$key = "testkey"; $teststring = "test500";
$test = array( 'testkey' => array ( 'test50' => array ( 'main' => 'admin.html', ), 'test500' => array ( 'main' => 'admin.html', ), 'default' => array ( 'main' => 'admin.html', ), ), );
// functions function start_timer() { $mtime = explode(" ", microtime()); $GLOBALS['renderstart'] = $mtime[1] + $mtime[0]; }
function stop_timer() { $mtime = explode(" ", microtime()); $renderstop = $mtime[1] + $mtime[0]; $rendertime = ($renderstop - $GLOBALS['renderstart']); printf(" [ %f seconds ]<br>\n", $rendertime); }
// test code $matchlen = 0; reset($test[$key]); start_timer(); foreach ($test[$key] as $ops => $vals) { if ((strlen($ops) > $matchlen) && ereg($ops, $teststring)) { $modops = $ops; $matchlen = strlen($modops); } } echo "ereg"; stop_timer();
$matchlen = 0; reset($test[$key]); start_timer(); foreach ($test[$key] as $ops => $vals) { if ((strlen($ops) > $matchlen) && eregi($ops, $teststring)) { $modops = $ops; $matchlen = strlen($modops); } } echo "eregi"; stop_timer();
$matchlen = 0; reset($test[$key]); start_timer(); foreach ($test[$key] as $ops => $vals) { if ((strlen($ops) > $matchlen) && ereg($ops, $teststring)) { $modops = $ops; $matchlen = strlen($modops); } } echo "strpos"; stop_timer();
Any ideas???
Thanks! -Shawn
--- End Message ---
--- Begin Message ---Shawn McKenzie wrote:
O.K. So I've written my application and debugged it, and now I want to try and optimize the speed. I have written a little test script to test
Several profilers / debuggers will help you optimize on speed... by telling you how much time the parser spends inside a function. There are really a lot of them out there, try google for "PHP profiler" and stick with what you like.
--- End Message ---
--- Begin Message ---On Monday 26 July 2004 06:21, Shawn McKenzie wrote: > O.K. So I've written my application and debugged it, and now I want to > try and optimize the speed. I have written a little test script to test > the time of each PHP function that I can use in a certain situation > (ereg, eregi, strpos). Problem is, no matter what I do, the first > function I test in the script is always the slowest, even if I reorder > them so that strpos() is first instead of ereg(). Doesn't matter which > one it is. Maybe I did something stupid and just can't see it? Below > is the code: Break out each test into separate programs. Also you may need to run each program multiple times and take the average to even out the effects of disk cache, memory cache and other vagaries. -- 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 ------------------------------------------ /* QOTD: "I thought I saw a unicorn on the way over, but it was just a horse with one of the horns broken off." */
--- End Message ---
--- Begin Message --- I have been struggling with a javascript regex validation for U.S. phone numbers all afternoon. This is part of Manuel Lemos' Formsgen class. This is limited to the 7 digit number sans 3 digit area code. To be complete, the regex should disallow a phone number that begins with 0 or 1, 555 or any digit followed by 11. Here is the regex I'm using:
^(?!\d[1]{2}|[5]{3})([2-9]\d{2})([-])\d{4}$
Manual Lemos indicated to me in an offline post that this should throw a javascript runtime error because of the (? at the beginning of the regex. I have tested it in over a dozen different browsers (Windows and Mac) and the only one that throws the runtime error is IE on the Mac. All others catch the errors I am trying to trap for with no runtime errors. Can this regex be improved on or do I have to live with the idiosyncratic behavior of Mac IE?
Thanks.
Albert Padley
--- End Message ---
--- Begin Message ---do those pdf class support Unicode? So far, pdflib only supports unicode. -- Louie Miranda http://www.axishift.com
--- End Message ---
--- Begin Message --- Alex Hogan wrote:Hi All,
I have a form with several values to insert.
I thought that I remember a thread that discussed using a loop to insert
$_POSTed values.
I am trying;
foreach($_POST as $key => $value){
if($key == 'Submit'){
exit;
i think you want break; or continue; here, exit; ends the script execution.
}
else{
$sql = "INSERT INTO registration ('$key')
VALUES ('$value')";
$result = mssql_query($sql);
}
}
I keep getting an invalid object 'registration' error. However
registration is the name of the table. I'm guessing it's someplace else
in the statement that I'm messing up on.
--- End Message ---
--- Begin Message ---I have the following rewriterule: RewriteRule ^(([0-9]|[A-Z]|[a-z]|_)+)$ redirect.php?$1 [L] that transforms http://mysite.com/XXX to http://mysite.com/redirect.php?XXX and I need to also include to space char, for example that transforms http://mysite.com/AB XX to http://mysite.com/redirect.php?AB XX I didn't find a way to write the " " characters. I tested with RewriteRule ^(([0-9]|[A-Z]|[a-z]|_| )+)$ redirect.php?$1 [L] but didn't work. Thanks! Rob
--- End Message ---
--- Begin Message --- Robert Winter wrote:I have the following rewriterule:
RewriteRule ^(([0-9]|[A-Z]|[a-z]|_)+)$ redirect.php?$1 [L]
that transforms http://mysite.com/XXX to http://mysite.com/redirect.php?XXX
and I need to also include to space char, for example
that transforms http://mysite.com/AB XX to http://mysite.com/redirect.php?AB XX
I didn't find a way to write the " " characters. I tested with RewriteRule ^(([0-9]|[A-Z]|[a-z]|_| )+)$ redirect.php?$1 [L] but didn't work.
Thanks! Rob
Did you try
RewriteRule ^([0-9A-Za-z_%]+)$ redirect.php?$1
?
--- End Message ---
--- Begin Message ---On Mon, 26 Jul 2004 02:03:56 +0800 Jason Wong <[EMAIL PROTECTED]> wrote: > On Sunday 25 July 2004 13:14, Wudi wrote: > > I repeat: > > > > Hmmm it needs to be able to *find* the links before it can replace them. > > > Just borrow the code that finds the links. > > The "get" links part, the bit which you're interested in, is the regex. So > just plug the regex into ereg() or for this application eregi() may be more > useful. Thank you. I have found a method to get links. But it's slow. The script replaced the links, marked it. And then foreach() all texts were marked. But the blank space always make troubles. Now I'm looking for another way to do it. BTW, what does "regex" mean? -------------------------------------------------- Comment: English is not my first language. Wudi <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---On Monday 26 July 2004 10:05, Wudi wrote: > Thank you. I have found a method to get links. But it's slow. > The script replaced the links, marked it. > And then foreach() all texts were marked. > But the blank space always make troubles. As you haven't posted any code nor described the problem in any detail I can only take a wild guess that you want to take a look at urlencode(), rawurlencode(). > Now I'm looking for another way to do it. > > BTW, what does "regex" mean? google > regex -- 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 ------------------------------------------ /* Beneath this stone lies Murphy, They buried him today, He lived the life of Riley, While Riley was away. */
--- End Message ---
--- Begin Message ---On Mon, 26 Jul 2004 11:44:04 +0800 Jason Wong <[EMAIL PROTECTED]> wrote: > On Monday 26 July 2004 10:05, Wudi wrote: > > > Thank you. I have found a method to get links. But it's slow. > > The script replaced the links, marked it. > > And then foreach() all texts were marked. > > But the blank space always make troubles. > > As you haven't posted any code nor described the problem in any detail I can > only take a wild guess that you want to take a look at urlencode(), > rawurlencode(). I read perlre just now, it's very long and very complex. Now, I can use the following script to parse link tags: $html = preg_replace("/(<A )([^>]+)(>)([^<]+)(<\/A>)/e", "\$this->ParseTagA(\"$2\", \"$4\")", $html); It works well and fast. I use "%20" and "%3D" replace " " and "=" to remove the problem about blank space and equal sign. -------------------------------------------------- Comment: English is not my first language. Wudi <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ------ Jason Wong <[EMAIL PROTECTED]> wrote: > On Sunday 25 July 2004 09:42, Mark wrote: > > Am I the only one who gets annoyed at these? > > No you're not. Look in the past week's archives. > > > [EMAIL PROTECTED], [EMAIL PROTECTED] is currently > > You've got the culprit here. Either lambast him publically (since > he doesn't > want to receive your private mail). Or do what this says: > > > http://www.tgpwizards.com/spamcease2/verify.php?id=1334886 > > Or set a filter to trash these messages. If he doesn't want my emails, so be it. Filter is set... Seems pretty incompetent to not be able to whitelist a dstribution list. BTW, I just got one that *implies* php-general is using their filter. There was no other address, and it appears to be forged from [EMAIL PROTECTED] Mark ===== Mark Weinstock [EMAIL PROTECTED] *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---Hi,
I have array variable and string variable.
I want to replace value of array by key of array in string variable with preg_replace().
Example : $message=array( 'name'=>'My Computer', 'version'=>'1.0' ); $strValue="I am $name,build version $version\n";
How's to replace?
Yingyos
--- End Message ---
--- Begin Message ---On Monday 26 July 2004 10:09, Turbo wrote: > I have array variable and string variable. > I want to replace value of array by key of array in string variable > with preg_replace(). > > Example : > $message=array( > 'name'=>'My Computer', > 'version'=>'1.0' > ); > $strValue="I am $name,build version $version\n"; > > How's to replace? I'm not sure what you're trying to do. Could you elaborate? In particular where does preg_replace() fit in? It seems you want $strValue to be "I am My Computer,build version 1.0\n". If so: 1) you have completely misunderstood what preg_replace() is for 2) Use: $strValue="I am {$message['name']},build version {$message['version']}\n"; 3) see manual > Types > Strings > 'Complex syntax' -- 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 ------------------------------------------ /* A woman without a man is like a fish without a bicycle. Therefore, a man without a woman is like a bicycle without a fish. */
--- End Message ---
--- Begin Message ---Hi all !
I'm developping a little web site with PHP via EasyPHP (http://www.easyphp.org) and I have a problem with sessions.
I use this software only to create and debugging PHP when I'm offline. :)
if (isset($_GET['log'])) {
switch($_GET['log']) {
case 'out':
session_start();
$_SESSION = array();
$destroy= session_destroy();
if ($destroy) { echo 'Session destroyed'; } // And it echoes "Session destroyed"
break;
}
}
Well, to be more explicit,
1. Log in with username and password to enter in member section (Success)
2. $_SESSION['login'] contains my username (Success, via an "echo $_SESSION['login']")
3. Browsing through WebSite and member section
4. Hitting link with code shown above (And it echoes "Session destroyed" and I got "Log in here" instead of $_SESSION['login'])
5. But... When I re-enter in the member section, no login prompt... and I got text with the username I entered before
session.auto_start Off session.bug_compat_42 Off session.bug_compat_warn On session.cache_expire 180 session.cache_limiter nocache session.cookie_domain no value session.cookie_lifetime 0 session.cookie_path / session.cookie_secure Off session.entropy_file no value session.entropy_length 0 session.gc_divisor 1000 session.gc_maxlifetime 1440 session.gc_probability 1 session.name PHPSESSID session.referer_check no value session.save_handler files session.save_path C:\Program Files\EasyPHP1-7\tmp\ session.serialize_handler php session.use_cookies On session.use_only_cookies Off session.use_trans_sid Off
Some ideas !?
PS: Sorry for english, my second language...
Jonathan Langlois [EMAIL PROTECTED]
--- End Message ---
--- Begin Message --- Is there any way to retrieve an array of the available timezones on a Unix system for use with putenv("TZ=...")?
Usually they're stored in /usr/share/zoneinfo/ on my Mac, but I don't like my chances of:
- them being in the same place on every server - them being readable via a PHP script
If there isn't such a function, a second option would be to check that whatever timezone I *plan* to use is available within the system.
<? putenv("TZ=Australia/Melbourne") ?> may have no affect on my scripts if the TZ is not recognised by the server.
--- Justin French http://indent.com.au
--- End Message ---
--- Begin Message ---What is this? I got this message few times from php.net...--- Begin Message --- Title: Verify EmailHello [EMAIL PROTECTED] ,
[EMAIL PROTECTED] is currently protecting themselves from receiving junk mail using Spamcease Just this once, click the link below so I can receive your emails.
You won't have to do this again.
http://www.tgpwizards.com/spamcease2/verify.php?id=1800309
�
--- End Message ---
--- End Message ---
