Re: [PHP] change Style Sheet by programming
I don't really understand your question, but... http://www.quirksmode.org/dom/changess.html http://www.quirksmode.org/book/examplescripts/dropdown/index.html On 3/6/07, Alain Roger [EMAIL PROTECTED] wrote: Hi, I'm creating a Class which should allow user to setup the default theme CSS file he would like to use to render a class object. therefore i have a simple function : public function SetTheme(string $ThemeName) { $this-m_ThemeUsed = $ThemeName; } which set the theme (CSS file) to use to render my object. However, how can i tell to my class to render or update his render with new CSS file theme ? can it be possible to provoke something like a refresh ? Or it is only a CSS or JS topic ? thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo text - anti-spam-spider measure
Richard Lynch wrote: You could also use %XX in HEX on the mailto: you can actually randomly mix and match hex and entity encoding, which is what the function I posted elsewhere in the thread does. My function also does that: http://themfund.com/snippets/test.php On 3/1/07, Jochem Maas [EMAIL PROTECTED] wrote: Richard Lynch wrote: You could also use %XX in HEX on the mailto: you can actually randomly mix and match hex and entity encoding, which is what the function I posted elsewhere in the thread does. On Tue, February 27, 2007 11:09 pm, Casey Chu wrote: It works. =P I tested it. Try it here! =P http://themfund.com/snippets/test.php On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: I'm not sure with both of your questions. I'm too lazy to try. Untested: But to encode it, you would use preg_replace_callback('~([\d\w])~', create_function('$a', 'return #.ord($a[0]).;;'), $theEmail); Hopefully that works? On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: How do I encode it? And would the href tag work? Casey Chu wrote: ^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo text - anti-spam-spider measure
http://themfund.com/snippets/test.php Has %HEX, #entity;, and even a entity version of the hex! On 2/28/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, February 28, 2007 1:20 am, Stut wrote: Of all the possible methods, entities are the easiest for bots to handle. They just need to decode the entities. More reliable methods involve using javascript to write out the mailto: tag. Do it in several statements. But even then, some of the smarter spiders will execute simple javascript like that. You can make it better by using onload to execute the javascript which means the spider will need to implement that, which I don't believe they do at the moment. Of course the best way is to use an image and don't link it. If it's just a way for visitors to contact you, use a contact form. You don't expose the email address and can control it a lot better. I'm no expert, but as far as I can tell from my readings on this subject, the reality is that spammers just don't bother to harvest them. Ongoing studies, older studies, newer studies. Everybody knows that the spammers *could* decode HEX or even the JS fairly trivially, but they don't. There are many theories [*] as to why that is, but the empirical evidence is that the obfuscation is very effective at reducing spam dramatically, no matter how silly that seems. * Maybe it's too much low hanging fruit. Maybe they don't want to risk hitting honey-pot emails. Maybe anybody smart enough to obfustcate is too smart to fall for the stupid spam anyway. ... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] echo text - anti-spam-spider measure
I'm not sure with both of your questions. I'm too lazy to try. Untested: But to encode it, you would use preg_replace_callback('~([\d\w])~', create_function('$a', 'return #.ord($a[0]).;;'), $theEmail); Hopefully that works? On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: How do I encode it? And would the href tag work? Casey Chu wrote: ^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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] echo text - anti-spam-spider measure
It works. =P I tested it. Try it here! =P http://themfund.com/snippets/test.php On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: I'm not sure with both of your questions. I'm too lazy to try. Untested: But to encode it, you would use preg_replace_callback('~([\d\w])~', create_function('$a', 'return #.ord($a[0]).;;'), $theEmail); Hopefully that works? On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: How do I encode it? And would the href tag work? Casey Chu wrote: ^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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] echo text - anti-spam-spider measure
^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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] echo text - anti-spam-spider measure
Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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] un include?
Maybe you could make a separate PHP file, include it there, then pass the results to the main file? On 2/10/07, jekillen [EMAIL PROTECTED] wrote: Hello all; Is there a way to un include a file once it has been included in a script? I have a situation where I need to include a php file for a variable and its value. Then I need to open the file and modify it in the same function 'that included the file. So far the function, as I test it does not appear to be making the intended changes to the file that has been included. And I am not getting any error messages. Am I asking too much: $fileToInclude = 'some_file.php'; function edit_included_file( $fileToInclude) { include($fileToInclude); // use some variable in it $fr = fopen($fileToInclude, 'r'); $str = fread($fr, filesize($fileToInclude)) fclose($fr); // make alterations to $str // reopen file and write the changes // done but in test function I have written changes have not been made } looked through the O'Reilly book Programming Php and could not find a clue. Thanks in advance Jeff K -- 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] Writting a simple proxy in PHP
Try using cUrl. On 2/6/07, Jochem Maas [EMAIL PROTECTED] wrote: Alessandro Vernet wrote: I would like to forward on the server side (also called proxy or server-side redirect) some queries that get to my PHP script. A naive approach is to do: print(implode(, file(http://localhost:8090; . $REQUEST_URI))); Where http://localhost:8090 is the address I want to proxy to. But of course, this only works for simple GET requests. It does not forward headers (like Authentication), and won't work if the request is a POST. Has anyone a suggestion on how I could implement a better proxy? I am not looking for a perfect solution. Something that would forward headers and handle posts would be good enough. if your using apache then you should look at the ProxyPass directive - very hand, STW or STA for more detailed info. Alex -- 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] DATE
Read http://us3.php.net/manual/en/function.strtotime.php. It might help. On 1/27/07, Ron Piggott [EMAIL PROTECTED] wrote: I have date in the variable $date_reference in the format -MM-DD. How do I find out the date before this and the date after this? Ron -- 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] Validating a link in php
Try changing that url to www.youtube.com:80/v/JqO8ZevPJNk On 1/25/07, Robert Porter [EMAIL PROTECTED] wrote: Frank Arensmeier wrote: Did you take a look at the error numbers / messages returned by fsockopen? What do they say? Actually, I only get warnings, not errors, but here's what they say: Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/je/jefflynnesongs.com/jlvids/jlvids.php on line 98 Warning: fsockopen(): unable to connect to www.youtube.com/v/JqO8ZevPJNk:80 in /var/www/html/je/jefflynnesongs.com/jlvids/jlvids.php on line 98 Another thing that poped up in my mind - curl. Tried that? Hmmm... I just did some experimenting and it looks promising. Here's the code that appears to work: $ch = curl_init(http://www.youtube.com/v/JqO8ZevPJNk;); if (curl_exec($ch)) //Do stuff for a valid URL else //Do stuff for an invalid URL Many thanks! I'm loving PHP, but I've got a lot to learn. Robert -- 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] Javascript detection , working version
That book is so cool! =P Anyways, it said that browsers with Javascript, but not a recent enough Javascript would not display the Noscript. On 1/13/07, tedd [EMAIL PROTECTED] wrote: At 9:32 PM -0800 1/11/07, Jürgen Wind wrote: tedd wrote: index.php, jstest110.php) , make it one. ok ---8--- It would be cool if I could send js value via a POST instead of GET-- can that be done? have a look http://149.222.235.16/jstest/70112/index.php ( POST version ) tedd PS: I read somewhere that using noscript is not recommended. any info? Yes, I knew I read it somewhere (my memory is not as good as it used to be). In the book PPK on Javascript (most excellent book btw http://www.quirksmode.org/book/), on page 57 he says Therefore, it's best not to use the noscript tag at all. I leave it to you to buy the book to find out why. But basically, browsers that don't use javascript don't see that tag and those that do, don't use it. As such, the tag has no real use. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.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] password protecting files, only allowing authorized users
This is impossible with only PHP. You might need a combination of PHP and AJAX [Javascript]. On 1/11/07, Dave [EMAIL PROTECTED] wrote: Hello, I'm using php and apache2 on a freebsd box. I know about .htaccess that the web server can provide, but i'm looking for something php can do, i want it to pop up a page when a user requests certain files, asking for a username and password. If those are valid the user is taken to a page where the files requested can be downloaded. I'd rather not use a mysql database and keep this user information in a flat file, as what i am trying to do is on a small scale. I am also interested in blocking direct access to the files, for instance if someone puts in their direct url they should not be retrievable, but instead php should give an error msg. Any help appreciated. Thanks. Dave. -- 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 Manipulation of WMV
Hello. Is there a way to manipulate WMV files with PHP? I need to do so with an include(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Manipulation of WMV
Okay, sorry if I wasn't clear. I need to get frames from a WMV dynamically with PHP. If the way to do is not a native PHP function, I need to use an include() to get the functions because I can't use extensions. On 1/7/07, Jochem Maas [EMAIL PROTECTED] wrote: Casey Chu wrote: Hello. Is there a way to manipulate WMV files with PHP? I need to do so with an include(). the mind boggles as to what the correlation is between needing to manipulate a file and having to use include. with regard to file manipulation - a file is a file is a file, if you can read from it and write to it then you can manipulate... undoubtedly that's not very helpful. try explaining what it is that you want to do with the WMV, there may be a way to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Access array data in foreach?
$value holds the value of the current array element. On 1/6/07, William Stokes [EMAIL PROTECTED] wrote: Hello, I Have an array $toplevel containing arrays: Array ( [0] = Array ( [0] = 1 [1] = 1 [2] = eka [3] = eka.php ) [1] = Array ( [0] = 2 [1] = 1 [2] = toka [3] = toka.php ) [2] = Array ( [0] = 3 [1] = 1 [2] = kolmaz [3] = kolmas.php ) [3] = Array ( [0] = 4 [1] = 1 [2] = nepa [3] = nepa.php ) ) How access the data in foreach? Now I do this and it prints Array[2] to screenin every loop. foreach ($toplevel as $value){ print myTest.addLabel('labelBullet', '$toplevel[2][2]', $TopLevelCounter+1, 250, '#CC', '#aa', '$toplevel[3]', 'left');\n; $TopLevelCounter ++; } But print $toplevel[2][2] outside foreach prints kolmaz like I suppose it should Thanks again -Will -- 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] software recommendation: ServiceCapture
I already have one, but this one looks better! I don't want to pay though... On 1/2/07, Paul Novitski [EMAIL PROTECTED] wrote: I've recently discovered a tool that I recommend for web work: ServiceCapture by Kevin Langdon http://kevinlangdon.com/serviceCapture/ It acts as an HTTP proxy, inserting itself between browser and the net, and logs the details of http requests and responses. It's been a great help to me lately while working on a PHP-Flash dialog via AMF-PHP, and will undoubtedly save time on future projects when I need to debug cookies and posts. (This is a spontaneous, unsolicited, uninvested recommendation. I just really like the software and thought you might find it useful.) Regards, Paul __ Juniper Webcraft Ltd. http://juniperwebcraft.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] Pushing a file to the browser
What do you mean by `pushing`? On 9/15/06, Mike Mannakee [EMAIL PROTECTED] wrote: Hello, I have a script I've created which takes a file upload, monkeys with the data in it, and needs to push the new file out to the browser. Everything is coded and working up to that last point, but I've never pushed out a file to the browser before. Does anyone have the code for this laying around that I can see (and modify)? Mike -- 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] Chocked
He probably meant shocked and shocking. On 12/29/06, Jim Lucas [EMAIL PROTECTED] wrote: Peter Lauri wrote: I was chocked when I got my additional dedicated server from my server provider. I assumed everyting would have been the same as I ordered the server with same package name etc. The chocking part was that the server had PHP5 and not PHP4. Ok, it is not a hard piece of work to get it working, but one thing stunned me :-) Assuming that I have the following structure: /index.php /classes/first.class.php /classes/second.class.php Index.php: include_once(classes/first.class.php); first.class.php include_once(second.class.php); This worked fine, but this time I get an open dir error. Is this something that is new to PHP5 for this, or do I just need to config the server to accept this sloppy including of files? Best regards, Peter Lauri http://www.dwsasia.com/ www.dwsasia.com - company web site http://www.lauri.se/ www.lauri.se - personal web site http://www.carbonfree.org.uk/ www.carbonfree.org.uk - become Carbon Free More the likely it is a difference in the include_path setting which can be found in the php.ini file. This can also override this setting in the VirtualHosts block and .htaccess file. Check these locations for any additional include_path changes in the old system. sometimes you will see things like include_path = '/path/to/htdocs:.:/var/www/html' or other variations of this Jim Lucas -- 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] New User Sign up Notification
What do you mean by now? On 12/22/06, JMCS Niagara (Jeff) [EMAIL PROTECTED] wrote: hi there. I'm looking to create a new user signup. So when someone signs up, it emails admin the Username, Real Name, and IP address. I have this code called newusersignupnotification.php ?php $to = '[EMAIL PROTECTED]'; // The email address you want the notification sent to $subject = 'Member has registered on YoS'; // What do you want the subject line of your notification to be? $memberSpecs = hr size=2 width=300 align=left. bUsername:/b .$_SESSION['username']. br. bReal Name:/b .$_SESSION['firstname']. .$_SESSION['lastname']. br. bDate/b .date('l dS \of F Y h:i:s A'). br. bIP address:/b .$_SERVER['REMOTE_ADDR']. br. bSystem Specs:/b .$_SERVER['HTTP_USER_AGENT']. br; $headers = Content-type: text/html \nFrom: [EMAIL PROTECTED]; $body = body br table cellspacing=1 cellpadding=2 align=center tr td bfont face=arial size=2A new member has registered! /font/b /td/tr tr td font face=arial size=2 .$memberSpecs. /font /td/tr/table /body; mail($to,$subject,$body,$headers); ? When I place this in the join.php file .. When someone goes to join.php it automatically emails it .. and I get date, time, ip, etc etc everything except for the username and first name.. Obviously, because the person hasn't typed in anything. When they filled out the sign up form, There's a button that says Sign Up .. Basically, when they click this button, NOW is when I want it to email me the details. Any ideas? Thanks guys -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script's length, echo, and execution speed
Yeah, try testing. Maybe something like this: ?php $form = form action=' ' method='post'textarea name='code'/textareabr /button type='submit'Execute/button/form; if ($_POST['code']) { echo div style='border: 1px'; $time_start = microtime_float(); eval($_POST['code']); $time_end = microtime_float(); echo br /Loading took: . $time_end - $time_start. '/div'; } echo div style='float: left'$form/div; // Note: This script is extremely dangerous and is not tested. ? On 12/23/06, Paul Novitski [EMAIL PROTECTED] wrote: At 12/23/2006 10:33 AM, Jean-Christophe Roux wrote: Hello, I have this php script of 3,500 lines with a big switch that is such that on each pass maybe 300 lines of codes are executed at most. The current speed of the file is ok. I like to keep the file like that because at each pass there is a check on the whole script and it fails if there is a typo somewhere. Also, I like to have one file instead of many files. But I am wondering if speed is not severaly hurt. What are the general guidelines in terms of length of script? Also, I am writing things like that: echo 'table'; echo 'tr'; echo tdContent/td; echo '/tr'; echo '/table'; I like it this way because the script is visually very well aligned, with one action per line and that makes things easier for me to read and understand. But, so many echoes may be considered bad practice; maybe it impacts speed significantly. Are you encountering a speed problem or just pondering this theoretically? My guess is that ECHO 'TEXT'; is one of the fastest, most optimized operations the PHP interpreter executes. But you don't need to guess at it: time it. Check the server logs, or output the current time at the beginning and end of script execution. My guess is that the difference between the execution of your script and one much smaller will lie in a scale of tens or hundreds of milliseconds. Servers are bloody fast; that's their job. In general I think it's smarter to spend your time making your script easy to read and proofread for you, the human slow link in the development chain, than it is to make it faster to run on a machine. Machines will keep getting faster; you're not likely to. That said, there are things you can do that make your script more efficient to execute AND to maintain. Personally I favor separating out the HTML into larger, pure chunks that can be proofread more easily than when tags and attributes are atomized and strewn throughout the logic. Regards, Paul -- 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] New User Sign up Notification
I still do not understand. Isn't that what your script already does? On 12/23/06, Casey Chu [EMAIL PROTECTED] wrote: What do you mean by now? On 12/22/06, JMCS Niagara (Jeff) [EMAIL PROTECTED] wrote: hi there. I'm looking to create a new user signup. So when someone signs up, it emails admin the Username, Real Name, and IP address. I have this code called newusersignupnotification.php ?php $to = '[EMAIL PROTECTED]'; // The email address you want the notification sent to $subject = 'Member has registered on YoS'; // What do you want the subject line of your notification to be? $memberSpecs = hr size=2 width=300 align=left. bUsername:/b .$_SESSION['username']. br. bReal Name:/b .$_SESSION['firstname']. .$_SESSION['lastname']. br. bDate/b .date('l dS \of F Y h:i:s A'). br. bIP address:/b .$_SERVER['REMOTE_ADDR']. br. bSystem Specs:/b .$_SERVER['HTTP_USER_AGENT']. br; $headers = Content-type: text/html \nFrom: [EMAIL PROTECTED]; $body = body br table cellspacing=1 cellpadding=2 align=center tr td bfont face=arial size=2A new member has registered! /font/b /td/tr tr td font face=arial size=2 .$memberSpecs. /font /td/tr/table /body; mail($to,$subject,$body,$headers); ? When I place this in the join.php file .. When someone goes to join.php it automatically emails it .. and I get date, time, ip, etc etc everything except for the username and first name.. Obviously, because the person hasn't typed in anything. When they filled out the sign up form, There's a button that says Sign Up .. Basically, when they click this button, NOW is when I want it to email me the details. Any ideas? Thanks guys -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Excluding apostrophe's
It should be like this: ?php $username=***; $password=***; $database=***; mysql_connect(humbug,$username,$password); @mysql_select_db($database) or die( Unable to select database); $name = mysql_real_escape_string($_POST['name']); $email = mysql_real_escape_string($_POST['email']); $comments = mysql_real_escape_string($_POST['comments']); /* if (!$name || !$email || !$comments) die(); (or something like that) */ $query = INSERT INTO remarks VALUES ('','$name','$email','$comments'); mysql_query($query); mysql_close(); ? On 12/22/06, Paul Novitski [EMAIL PROTECTED] wrote: RAFMTD (Ian) wrote: ... $name = mysql_real_escape_string ($_POST['name']); ... mysql_connect(humbug,$username,$password); ... the script fails with the following report Warning: mysql_real_escape_string(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) At 12/22/2006 05:36 AM, Stut wrote: You need to connect to the database before using mysql_real_escape_string. Ian, this is a perfect example of when it comes in handy to consult the documentation: http://ca.php.net/manual/en/function.mysql-real-escape-string.php string mysql_real_escape_string ( string unescaped_string [, resource link_identifier] ) Escapes special characters in the unescaped_string, taking into account the current character set of the connection ... link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If by chance no connection is found or established, an E_WARNING level warning is generated. Remember, my son, PHP-general helps those who help themselves. Piously, Poop Paul -- 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] Video question
Maybe you could try some complicated file splitting thing? Like [dynamically] split the video into 10 pieces and send them in a jumbled mess, and decode them using something like flash? On 12/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: To view a video, you do have to download it. But you don't have to download all of it at once. If a user did have to download the whole video and you still wanted to protect it, you'd want to look into some kind of DRM (digital rights management) solution probably. YouTube and similar streaming sites use a Flash video player that streams the video so the user only has a bit of the video at a time in memory. Technically a user could still use a program to record what they're viewing, but it's a lot tricker than just grabbing a video out of their browser's cache folder. Divx also has a newish streaming solution that I *think* supports some form of security. Don't quote me on that though. I believe it has a download option built into it. Not sure if you can disable it. More info here: http://www.divx.com/divx/webplayer/ All in all, most of the solutions you're going to find are not PHP oriented. You might use PHP to handle the listing and selection of the videos, but not so much the streaming and security aspects. Hopefully this has given you some places to start looking for a real solution. Good luck! -TG = = = Original message = = = At 11:08 AM -0500 12/19/06, John Messam wrote: How do I display video on my php page and prevent the video from being downloaded. This is a common misconception. If a user see's anything on (actually from) your web page then that means that the user's browser has already downloaded it. If this wasn't true, then how can his browser display it? It's similar to saying I want to broadcast my radio signal and I want you to listen to it, but I don't want you to receive it. Now, a solution would be if you developed a viewer that the user could download and use to view *your* keyed video images that would only work depending upon your distribution of *your* keys. You might look to Flash for that -- if I had to do it, that's where I would start. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.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] ECHO
Why do you need to change its functionality? On 12/18/06, Fahad Pervaiz [EMAIL PROTECTED] wrote: ECHO is a language construct but still is there any work around to override it or change its functionality??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ECHO
You could try to manipulate what the echo's output by ob_start(), etc. Or maybe you could change the standard output? On 12/18/06, Fahad Pervaiz [EMAIL PROTECTED] wrote: I have written a framework for internationalization. Now i have incoorperate it into and existing system that is huge and it will take alot of time to change ECHO to a function call, so i want to override its implementation so that i can use it for my own purposes with having to change all the echo calls -- Regards Fahad Pervaiz www.ecommerce-xperts.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] heredoc
I usually use an include rather than a heredoc. On 12/18/06, Paul Novitski [EMAIL PROTECTED] wrote: At 12/18/2006 10:14 PM, clr wrote: Please can someone advise me on heredoc and its shortcommings, I am designing a complex site and elected to use DIV's as opposed to frames. Heredoc seems to be ideal in that I can do all processing first and then layout with relative ease. I was wondering if it was acceptable to use and maintain going forward as i have read on a few mailing archives that this is a cheat and lazy and to be depreciated?? Yikes! Then a scoundrel I must be indeed. I love using heredoc, primarily because it lets me compose blocks of pure output text without interrupting it with control structures, nested quotes, and concatenation syntax, even when it contains nested variables. It helps me to separate logic from markup, something that benefits my code (if not my character!). I imagine you'll hear from others whose sensibilities are offended by heredoc -- in particular those whose careful indentation it spoils -- so I wanted to make sure you knew that it had an (admittedly cheating and lazy yet) ardent supporter as well. I don't know whom, in programming, you can cheat other than yourself; I've been suffering under the misapprehension that laziness is a virtue because it teaches efficiency; but I really hadn't heard that heredoc was going to be deprecated. If it is then it will be my loss and the gain of those who earn royalties from the use of quotation marks and periods and who make their living pulling the tangled and bloody fragments of logic and markup from the wreckage of their collision. Regards, Paul -- 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] problem loading phpinfo
You probably didn't install PHP correctly. On 12/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Please, Could you tell me if this problem has been resolved: I am using php-5.2X and has this problem, I also had this problem when I was using php-5.1.X. My Apache is httpd-2.2.3. Here is the post from someone who is having the same problem. I config PHP4.0.6 for Apache 1.3.12 for Win32 : in apache configuation file: ScriptAlias /php/ C:/PHP/ AddType application/x-httpd-php .php Action application/x-httpd-php /php/php.exe then I test with phpinfo.php file in htdocs directory. : phpinfo.php : ?php phpinfo(); ? when I type: http://localhost/phpinfo.php, Browser should show me some information table but It show me the original code. ?php phpinfo(); ? [16 Nov 2001 5:17am UTC] [EMAIL PROTECTED] Please ask support questions on the php-general@lists.php.net mailinglist. Not a bug closing ### Any help would be highly appriciated. Thank You, IT Consultant (UNIX, Oracle, Sybase, MSSQL,MYSQL,MCSA) Chris Ok'Onkwo [EMAIL PROTECTED] Tel: 0041-79-656-0889 Check Out the new free AIM(R) Mail -- 2 GB of storage and industry-leading spam and email virus protection. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simplest way in php to get our content on another site / included javascript question
If this is about search engine optimization, I'd suggest using Javascript. Something like : script type=text/javascript language=JavaScript src=http://www.yoursite.com/include.php?article=1536f;/scripta href=http://www.yoursite.com; id=yoursiteProvided by YourSite/a And inside the script, Ajax to fetch and display the content, and also add if (var link = document.getElementById('yoursite') link.href=='http://www.yoursite.com'); else window.location.replace(http://www.yoursite.com/youremovedthelinkyouwillpay.php;); On 12/17/06, jonathan [EMAIL PROTECTED] wrote: I'm working on a project where we'd want partner sites to get our content on the other web sites. A key priority is that they won't have much technical sophistication (probably no db experience or php experience). Also, these would be third party sites so there would also be an issue of requirements (differnet xsl processors, no allow_url_fopen, etc...) I tried looking at sites that get their content on other sites to see how they do it: the possible solutions seem to be: 1. rss / xml - this is well known but would have a pretty high technical hurdles on the other sites. We could create every walk through and code sample but I still think it would be too involved. Only way out is either a xsl transformation (not going to happen), custom parsing library in php (maybe) or writing to db with associated libraries (too complex) 2. serialized php with custom library - this seems more feasible than #1 in terms of requirements 3. php proxy and ajax call / json - i think this would be too complex and would require too much manipulation of apache to handle subdomains, etc. 4. included javascript - kinda how digg handles syndication (see http://www.digg.com/add-digg for example). This would seem to be the lowest barrier to entry. The main concern is preventing unauthorized bots from crawling. It would seem our only option would be using the referer property but this could be forged relatively easily. 5. SOAP - no way 6. REST - if meant to just mean xml, i see this as an extension of #1. any thoughts or opinions would be appreciated. -jt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php redirection..
I believe it's spelled non-sequitur. =) On 12/16/06, Jonesy [EMAIL PROTECTED] wrote: On Fri, 15 Dec 2006 21:07:44 -0800, Casey Chu wrote: Well... They skip all !-- --'s, so they skip script!-- //--/script's. Wow! You get The Prize for the best non sequitor of the day. Jonesy -- Marvin L Jones| jonz | W3DHJ | linux 38.24N 104.55W | @ config.com | Jonesy | OS/2 *** Killfiling google posts: http//jonz.net/ng.htm -- 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] php redirection..
Actually... Search engines don't have a JavaScript interpreter. On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, December 12, 2006 12:51 pm, Stut wrote: bruce wrote: hey stut... Please don't reply to me directly, always include the mailing list. thanks for the reply... i did get some output... i also have a question as to why i couldn't get it to work when i used 'header (foo.php)' 1) The correct way to redirect using the header function is header('Location: http://domain.com/foo.php'); Note the absolute URL. 2) Using header will definitely not display any output from the page. You actually need to put in an exit; if you want to guarantee that PHP won't send more data, and that the browser won't process it and show it before doing the re-direct... *MOST* of the time the Location: header gets processed so fast, you don't see any following data, but if you pound on it enough, you'll see that the browser *can* show the data after the re-direct, if it feels particularly Orange at that moment in time. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] POST in Apache server
Did you add a submit button to the page? On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] php redirection..
Well... They skip all !-- --'s, so they skip script!-- //--/script's. On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, December 15, 2006 10:28 pm, Casey Chu wrote: Actually... Search engines don't have a JavaScript interpreter. Actually... You don't know for sure that Google isn't using Perl's javascript interpreter. Unless you work for Google, have just told us something they would consider double-secret proprietary, and are about to get fired. :-) :-) :-) It would not be Rocket Science for a search engine to execute the javascript on a page in a sandbox, to analyze it for abuses, viruses, and other things they wanted to take away points for. I know I could almost manage that with a ton of work. And I figure the Google engineers are probably a heck of a lot smarter than I am, and for sure they are way more experienced. So I'm going to assume that any dodge in JS I could come up with to game their system, will be detected and defeated as soon as they want to bother doing that. But, hey, feel free to get Google to issue a statement that they do not now nor ever will check the JS on sites as they index them, and point to it as a reference. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] POST in Apache server
On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- 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] POST in Apache server
Hmmm... there's something wrong with the form sending its values. Try echo pre; print_r($GLOBALS); echo /pre; On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: ok, this is what I get: preArray ( ) /pre PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-bin/mail.php on line 18 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-bin/mail.php on line 20 -emiliano On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php redirection..
Search Engines don't like the META tag. Use scriptlocation.href='foobar.php';/scripta href='foobar.php'Foo Bar/a On 12/13/06, tedd [EMAIL PROTECTED] wrote: At 9:02 PM +0100 12/12/06, Tim wrote: Just a quick question regarding this issue. Considering bruce wants to be able to display the data and then change location after a given time, and as stut said you can't do this with a header() as it redirects before output, I would have imagined a dynamic meta tag in the header with a time variable and a location variable. Why not use the standard meta refresh tag? It's worked for me before. tedd PS: I have lots of comments. Thoughts are less common but they do occasionally happen. -Stut LOL -- --- http://sperling.com http://ancientstones.com http://earthstones.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] php redirection..
It's usually OK if it's 8 seconds or more, but that would take too long. See here for info: http://www.netmechanic.com/news/vol4/promo_no15.htm On 12/13/06, Budi Setiawan [EMAIL PROTECTED] wrote: basically: cat.php -echo test contentbr -echo more test contentbr //redirect user echo script location.href='foo.php'; /script ; Hi , im a new too.. but you can try with this to delay your script running for some seconds : echo test contentbr echo more test contentbr // you can add : sleep(2); // this will cause your script delayed for 2 seconds //redirect user echo script location.href='foo.php'; /script ; // hhaha.. // im just trying to help... // -- 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] Distinguishing between a mouse click and a refresh?
Oooh... now that I think about it, it doesn't work. Sorry =( On 12/4/06, Paul Novitski [EMAIL PROTECTED] wrote: Hi Casey, Yes, I can see that your javascript function adds a random number to the href of a clicked link, but how does that help PHP distinguish between a page loaded that way and that same page reloaded with the refresh button in the browser's chrome? That was the OP's problem. Regards, Paul At 12/4/2006 09:30 PM, you wrote: script // NOT TESTED document.onclick = function(e) { var targ; if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; query = Math.floor(Math.random()*1); if (undefined !== targ.href) targ.href=targ.href.indexOf(?)!=-1?targ.href++query:targ.href+?+query; } /script On 12/4/06, Paul Novitski [EMAIL PROTECTED] wrote: At 12/4/2006 01:08 PM, Jay Blanchard wrote: [snip] Is there any way for PHP to know whether it is being called due to a browser refresh versus a mouse click? I think the answer is no but I just want to be sure. Thanks. [/snip] Not unless you specifically capture and send a JavaScript onClick event. A mouse click typically takes you somewhere else, so if you are using for a page refresh you could capture and send a JavaScript variable to the PHP script. The tricky bit would be distinguishing between a page loaded with a mouse-click and a subsequent reload of that same page, as they would share the same querystring. One way would be to use javascript to supply the current absolute time in the querystring at the moment of click (you could do the same sort of thing with submit using a hidden field or a querystring appended to the form action), then PHP could compare that time with its own current time to see if the querystring represented a current or old rendering. That would fail with javascript disabled, of course. A server-side-only solution could pre-populate all the links on the site that point to this page with a special querystring. When the script/page is invoked with that querystring, PHP does the necessary processing and then redirects to itself (the same page) but without the special querystring. Therefore reloading the page that's downloaded to the client won't reinvoke the post-click process. Regards, Paul -- 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