Re: [PHP] send email sample
John Taylor-Johnston wrote: Burhan Khalid wrote: Can you give me a send email sample? RTFM : http://www.php.net/manual/en/function.mail.php Burhan, That's awfully polite. "RTFM". How are people supposed to get started? Take that attitude back over to the Perl newsgroup. One of the joys of PHP has been a non-techhead, non-stressful, Open Source spirit of teaching and helping others, which in turn helps PHP grow and flourish. I'm polite, but seems that the original poster took no effort on their part to try and solve the problem first. I'm polite to people that try and solve the problem first, before coming to others for help. The original poster could have done any of the following things: 1. Simply type "mail" in the search box on the php.net website, which would have taken them to the section titled "Mail Functions", where the first line reads " The mail() function allows you to send mail." When they would have clicked on mail(), the would have seen examples on how to send an email. 2. Simply typing "sending email php" in Google would have gotten them a lot better results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session IDs - How are they generated?
Im Pretty sure it's using Uniqid , its the simplest solution possible , about the second question, php doesnot mind if he is being run from apahce,iis or command line. Dont count on my answers coz im not really sure. "Yannick Warnier" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi there, > > I'm looking for a good document that describes session ID generation in > PHP 4.3.6. Does somebody have that at hand? > > I couldn't find anything googling it, and nothing in the PHP doc. I > would like to know what kind of parameters it uses during the > generation. And also how it is generated in the case of a script > executed in command line. > > Thanks, > > Yannick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Ensure only one instance of a script is running
a more reliable solution: Write a lock file and update timestamp each minute or so ,(at varous places around the script) then in order to check if the script is already runninh, check the timestamp. "Jeremiah Fisher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Test for a lock file when the script starts, and remove it when the script > ends. This isn't 100% reliable, but it's the typical solution to this > problem. If the script fails, the lock file may not be removed (ever have > a Mozilla browser crash and tell you the default profile is locked?), so > be careful with your error handling! > > > // test for lock file > if ( !$f = fopen( 'lock', 'r')) { > // touch the lock file > $f = fopen( 'lock', 'w'); > fwrite( $f, 'lock'); > fclose( $f); > > } else { > // lock file exists; another instance must be running (we hope) > echo 'Error: An instance of this script is already running!'; > exit( 1); > > } > > > /* script stuff */ > > > // remove the lock file for the next instance > unlink( 'lock'); > > > ?> > > Shaun wrote: >> Hi, >> >> I have a script that inserts data from files uploaded to our server. I >> need to make sure that only one instance of this script runs at anyone >> time, can anyone tell me how I can do this? >> >> Many thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class and global
Ok, I've tried with a dummy class : class dummy { var $yank; Function dummy() { $this->yank = "test dummy"; } } and the problem is exactly the same. i've done print_r($dummy); is works ok outside the function, but inside print_r($dummy) doesn't return anything, like $dummy wasn't existing, even tough I declared it to be global... So the class n itself doesn't have anything to do with it. I'm really stuck with this. Is there any incompatibiliy with class and global declaration ? btw, I'm using PHP 4.3.10-8 thanks for your help, On Sat, 19 Mar 2005 20:45:55 +, Mister Jack <[EMAIL PROTECTED]> wrote: > there is no database connection involved here. if I displace the > $freedb =& new freedbaxs(); > inside the function it's works. > > I should give a try with a dummy object. (but the constructor, only > initialize empty array) > > On Sat, 19 Mar 2005 21:17:02 +0200, BAO RuiXian <[EMAIL PROTECTED]> wrote: > > > > > > Evert - Rooftop Solutions wrote: > > > > > pooly wrote: > > > > > >> I'm trying to use a global object (declared at a upper level), but > > >> all I got is : > > >> Call to a member function on a non-object in > > >> /home/pooly/public_html/templeet/modules/freedb.php on line 16 > > >> > > Hmm, perhaps your problem is the failed connection to your database. Can > > you verify this? > > > > Best > > > > Bao > > > > >> part of the code is : > > >> $freedb =& new freedbaxs(); > > >> Function return_freedb_search($array) > > >> { > > >> global $freedb; > > >> [snip] > > >> $freedb->freedb_search($txt); > > >> > > >> > > > I don't see an error in this code, perhaps you should give us a bit > > > more information. > > > > > > grt, > > > Evert > > > > > > > > > > -- > > 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: Session IDs - How are they generated?
Le dimanche 20 mars 2005 Ã 13:02 +0200, zini10 a Ãcrit : > Im Pretty sure it's using Uniqid , its the simplest solution possible , > about the second question, php doesnot mind if he is being run from > apahce,iis or command line. > Dont count on my answers coz im not really sure. Thank you. The ID generator is here: php_session_create_id (http://cvs.php.net/co.php/php-src/ext/session/session.c) Thanks to Eric Colinet for his answer on this topic. Yannick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] http authentication with safe mode enabled?!
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi to you all. I've been pulling my hair out over this issue and I really hope YOU can help me. A part of the website that I'm having the problems with should be password protected (nothing much, just to have a slight notion of it not being publicly available, so no SSL or other Stuff) so I wrote this function based on an example from the php manual which does just that. Problem is that on my ISPs server safe_mode is enabled and so as it says in the manual: | As of PHP 4.3.0, in order to prevent someone from writing a script | which reveals the password for a page that was authenticated through | a traditional external mechanism, the PHP_AUTH variables will not be | set if external authentication is enabled for that particular page | and safe mode is enabled. Regardless, REMOTE_USER can be used to | identify the externally-authenticated user. So, you can use | $_SERVER['REMOTE_USER']. My code looks like this: function auth($file) { $username = $_SERVER['PHP_AUTH_USER']; $password = $_SERVER['PHP_AUTH_PW']; $http_401 = './auth/unauthorized.html'; $realm = 'Intern'; if (!isset($username) || !isset($password)) { header("WWW-Authenticate: Basic realm=\"$realm\""); header('HTTP/1.0 401 Unauthorized'); include $http_401; } else { if (($username != 'XXX') && (crypt($password, 'XX') != 'X')) { include $http_401; } else { include $file; } ~ } } Now as you can see I'm also checking wether there was no password entered in contrast to the example from the manual. Of course I could leave that part out and set $username = $_SERVER['REMOTE_USER']; But how the hell am I supposed to check for a correct password if $_SERVER['PHP_AUTH_PW'] is not set? If safe mode is disabled everything works just fine (checked on my on box with apache 1.3), so in theory it's working. Please help me guys I'd be grateful for any help provided. -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCPXCen0kyIx7rF68RAmq5AJsHC5HIm4lvnHp3gbOVVR0NcArTkwCgj7y5 8cU2qnxDeeWaDDIeFElroQk= =F0Wq -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] detecting a leading hyphen from post data
I know this is pretty petty, but it is a sunday and I'm missing this for some reason... I'm trying to detect a leading hyphen in an element of an array. I've been using strpos to find strings and if getting 1 as the result, I know it was at the beginning of the string. However, "-", "\-", nor "/^-/" give me a hit? Could someone throw me a bone here? Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pache_request_headers() does not return HTTP Authorization headers
if safe_mode=on so there is no possibilty to validate HTTP Digest Authorization ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [suspicious - maybe spam] detecting a leading hyphen from post data
try use : if (strpos($string,"-")==0) //first char is index 0 not 1 ! or if (strpos($string,"-")!==false) //find anywhere in string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: detecting a leading hyphen from post data
sorry correct is : if (strpos($string,"-")===0) //3*= exact match, first char is index 0 not 1 ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache_request_headers() does not return HTTP Authorization headers
if safe_mode=on so there is no possibilty to validate HTTP Digest Authorization ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: http authentication with safe mode enabled?!
Hello Roman, yes if safe_mode=on then Authorization header is hidden from phpinfo() and apache_request_headers(), but variables $_SERVER["PHP_AUTH_USER"] and "PHP_AUTH_PW" are set , when Basic authorization is used ! (it works in my configuration of Apache and PHP) Problem may be in Apache . When directory (where requested file is) is protected by Apache authentication, then $_SERVER variables are not set. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory exhausted message wrong
Only try -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: execute methods dynamically
Sorry my fault. It's working of course. Am Sun, 20 Mar 2005 18:47:20 +0100 schrieb Rainer Hahnekamp: > Hello everybody, > > I want to write a method in version 4 that executes a method of an object. > As parameter the classname and the methodname is passed: > > function executeMethod($classname, $methodname) { > $object = new $classname(); > $object->$methodname(); > } > > This does not work. What am I doing wrong? > > Greetings, > -Rainer Hahnekamp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute methods dynamically
Hello everybody, I want to write a method in version 4 that executes a method of an object. As parameter the classname and the methodname is passed: function executeMethod($classname, $methodname) { $object = new $classname(); $object->$methodname(); } This does not work. What am I doing wrong? Greetings, -Rainer Hahnekamp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mod_ssl + php4-curl interaction problem ... ?
Just upgraded curl on our FreeBSD servers to curl-7.13.1_1, and now whenever I try and enable both curl.so in extensions.php *and* mod_ssl, the apache server crashes ... disable one or the other fixes the issue ... I've rebuilt php4-curl itself, as well as the apache, and nothing seems to correct for it ... Does anyone know of a problem with php4-curl + curl 7.1.3.1, and/or a fix? Thanks ... Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] carriage returns using error_log?
Is there any way to tell error_log to keep the newline characters? I am outputting error messages to the error log so I can look at detailed status information at the time of the error. However, if I put \n in the error message, it is treated literally by error_log and I see "\n" in the log message. -- Kurt Yoder http://yoderhome.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Authorization header is missing from apache_request_headers() array
Hello, When I try to use "HTTP Digest Authorization" using code like : Header( "HTTP/1.0 401 Unauthorized"); Header( "WWW-Authenticate: Digest realm=\"www.myrealm.com\", opaque=\"opaque\", nonce=\"nonce\", stale=\"false\", qop=\"auth\""); browser returns in HTTP request Authorization header like this one : Digest username="lacak", realm="www.myrealm.com", qop="auth", algorithm="MD5", uri="/devel/phpinfo.php", nonce="5e8ac9b033001458fc5380d8a88325a2", nc=0004, cnonce="c9495e4af19fa6b08eb045f32e6ced79", response="fbd8f86b45334202b2cac380f29d9706" When PHP runs as apache module with safe_mode=off I can read this header using apache_request_headers() function But when safe_mode=On, then apache_request_headers() returns no Authorization (this is documented behavior) Is this bug or exists other way how access Authorization header ? Can anyone help ? How to report this to php developers, to fix this problem ? Thank you LacaK. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: http authentication with safe mode enabled?!
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 LacaK wrote on 20.03.2005 19:13: | Hello Roman, | yes if safe_mode=on then | Authorization header is hidden from phpinfo() and apache_request_headers(), | | but variables $_SERVER["PHP_AUTH_USER"] and "PHP_AUTH_PW" | are set , when Basic authorization is used ! (it works in my configuration | of Apache and PHP) | | Problem may be in Apache . When directory (where requested file is) is | protected by Apache authentication, then $_SERVER variables are not set. I have no idea what to do to deal with this. There is only one .htaccess file, which is in the top-level directory of my account with my ISP. And I've even put AuthType None in there, but it doesn't change anything. The fact that the uid of the script is appended to the realm specified shouldn't require any changes in the code, or should it? I really don't have any more ideas of what to do. What is probably important is that apparently my ISP upgraded his version of PHP to 4.3.10 which is now CGI instead of a module. -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCPd3bn0kyIx7rF68RAn5/AKCQp3rI6EckIfs+XPj4/afpNQ80uwCeNqc8 mQBLBwxXqnrHfNKKktQep9E= =wqmo -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: is_a() against instanceof
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jason Barnett schrieb: > Nice suggestion! But I wonder... would it perhaps be better to use the > && operator instead of the AND operator? That way in case you are > trying to do an assignment PHP won't bother to check instanceof if the > class_exists() fails. > > if (class_exists($class) && $cls instanceof $class) > { > > } mmh ... instanceof isn't listed at http://www.php.net/manual/en/language.operators.php#language.operators.precedence so I'm not 100% sure. But neither php -r "var_dump(class_exists('foobar') AND $a instanceof foobar);" nor php -r "var_dump(class_exists('foobar') AND ($a instanceof foobar));" triggered an error on the commandline. So I guess, both && and AND should work. Regards, Christian Stadler -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCPeVQ9250Hcbf/3IRAg6rAJ96A/iBzkDU1X3cCOFWo/waV1y3ywCfSbIF S4JU3lo66WnPw5y8q3qMVSU= =bRQK -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] carriage returns using error_log?
Kurt Yoder wrote: Is there any way to tell error_log to keep the newline characters? I am outputting error messages to the error log so I can look at detailed status information at the time of the error. However, if I put \n in the error message, it is treated literally by error_log and I see "\n" in the log message. Try using double quotes instead of single quotes. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_ssl + php4-curl interaction problem ... ?
As a follow up to this, I just installed curl 7.12.3_2, to see if going back a version would fix the problem, and it does ... apache with curl enabled now works again beside SSL ... Not sure where the bug is, but the newer version of curl appears to have a problem with php4-curl ... On Sun, 20 Mar 2005, Marc G. Fournier wrote: Just upgraded curl on our FreeBSD servers to curl-7.13.1_1, and now whenever I try and enable both curl.so in extensions.php *and* mod_ssl, the apache server crashes ... disable one or the other fixes the issue ... I've rebuilt php4-curl itself, as well as the apache, and nothing seems to correct for it ... Does anyone know of a problem with php4-curl + curl 7.1.3.1, and/or a fix? Thanks ... Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] see anything wrong (xhtml validator)
it seems the xhtml validator is throwing an error with: -- Line 530, column 12: value of attribute "id" invalid: "1" cannot start a name -- Here is the code: $outnews = " continues » " . stripslashes($news['morelink']) . " (" . $count . " more words) " . $news['moretext'] . ""; for some odd reason the validator is showing a space before the $news['id'] in the id tag, even though the actual news ID is fine and there are no spaces in the raw xhtml code above.. maybe im blind .. i'd really like to get rid of the \" escapes and just use single quotes, but i would guess i have to escape the javascript single quotes? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-not-executing-in-html-file-help
hi friends i am struggling to solve this problem for the past one week...kindly help me.. my apache runs perfectly... this code gives a perfect output in the browser... file name: hi.html hihihi but this code doesnot give any output in the browser... file name: hi.html but, the same file with the php code in it...could be executed in the command line, using php... where i am getting the expected output... i tested to c if my apache doesnt recognise php ... this code runs perfectly...in the browser... if saved as hi.php file... the same code saved as .html, is not giving any output in the browser... kindly help me to figure out this problem... thanks vijayaraj nagarajan graduate student the university of southern mississippi MS - USA __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-not-executing-in-html-file-help
You need to tell apache to run html files through the php interpreter: ie. AddType application/x-httpd-php .php .php3 .html then restart apache Ian On Sun, 2005-03-20 at 14:12 -0800, vijayaraj nagarajan wrote: > hi friends > i am struggling to solve this problem for the past one > week...kindly help me.. > > my apache runs perfectly... > this code gives a perfect output in the browser... > > file name: hi.html > > > hihihi > > > but this code doesnot give any output in the > browser... > > file name: hi.html > > > > > > but, the same file with the php code in it...could be > executed in the command line, using php... where i am > getting the expected output... > > i tested to c if my apache doesnt recognise php ... > > this code runs perfectly...in the browser... > > > > if saved as hi.php file... > the same code saved as .html, is not giving any output > in the browser... > > kindly help me to figure out this problem... > > thanks > > vijayaraj nagarajan > graduate student > the university of southern mississippi > MS - USA > > > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > -- Ian Firla Consulting http://ianfirla.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-not-executing-in-html-file-help
You need to setup your apache server to accept and parse .html files as PHP. Add this line or modify it to look like this in your httpd.conf file. AddType application/x-httpd-php .php .html .shtml HTH http://www.thelonecoder.com [EMAIL PROTECTED] 562.924.4454 (office) 562.924.4075 (fax) continuing the struggle against bad code */ ?> > From: vijayaraj nagarajan <[EMAIL PROTECTED]> > Date: Sun, 20 Mar 2005 14:12:38 -0800 (PST) > To: php-general@lists.php.net > Subject: [PHP] php-not-executing-in-html-file-help > > hi friends > i am struggling to solve this problem for the past one > week...kindly help me.. > > my apache runs perfectly... > this code gives a perfect output in the browser... > > file name: hi.html > > > hihihi > > > but this code doesnot give any output in the > browser... > > file name: hi.html > > > > > > but, the same file with the php code in it...could be > executed in the command line, using php... where i am > getting the expected output... > > i tested to c if my apache doesnt recognise php ... > > this code runs perfectly...in the browser... > > > > if saved as hi.php file... > the same code saved as .html, is not giving any output > in the browser... > > kindly help me to figure out this problem... > > thanks > > vijayaraj nagarajan > graduate student > the university of southern mississippi > MS - USA > > > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regex
I'm trying to compress down a php-powered javascript file. In the file i have php run a bunch of loops and foreaches to build huge nested arrays for use in the javascript. Since this will be an often loaded page with ALOT of backend processing, I've decided to compress the file as much as I can and cache the resulting 'js' file. Trimming whitespace, etc have been easy in the buffer i have, but I'm having trouble trying to remove empty javascript satements that do nothing but add to the page weight. code: /* remove useless statements like " case '15': { break;} " */ $buffer = preg_replace('/case(\s)?\'(\d)\'(\s)?:(\s)?[{](\s)?(break;)?(\s)?[}]/', '', $buffer); I have a bad feeling that its something in my regex, but can't quite tell... I want it to allow for spaces (only), 'break;' should be optional. and any number. I usually tend to understand regexs, not sure why this one isn't working out... Colin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] see anything wrong (xhtml validator)
Sebastian wrote: it seems the xhtml validator is throwing an error with: -- Line 530, column 12: value of attribute "id" invalid: "1" cannot start a name -- Do you not trust the description? It seems to me that "1" cannot start a name. I bet $news['id'] starts with a "1" in this case. I'm not really sure what you're asking... Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-not-executing-in-html-file-help
vijayaraj nagarajan wrote: but this code doesnot give any output in the browser... file name: hi.html but, the same file with the php code in it...could be executed in the command line, using php... where i am getting the expected output... i tested to c if my apache doesnt recognise php ... this code runs perfectly...in the browser... if saved as hi.php file... the same code saved as .html, is not giving any output in the browser... kindly help me to figure out this problem... I see no problem. It seems that hi.html is being treates as HTML, and hi.php is being treated as PHP. No surprise there. You can modify this behavior and make Apache treat .html files as PHP by adding .html to your AddType directive in httpd.conf. Are you really sure this is what you need? Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: is_a() against instanceof
Jason Barnett wrote: Christian Stadler wrote: Eli schrieb: - ($cls instanceof ClassName) *requires* from ClassName to be declared, and generates a fatal error when ClassName is not declared. How about if (class_exists('ClassName') AND $cls instanceof ClassName) { ... } Regards, Christian Stadler Nice suggestion! But I wonder... would it perhaps be better to use the && operator instead of the AND operator? That way in case you are trying to do an assignment PHP won't bother to check instanceof if the class_exists() fails. if (class_exists($class) && $cls instanceof $class) { } The only difference between && and AND is precedence, so the second statement won't be executed with either one. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with dates
Dear Jochem and all the others who have offered help, Thank you all for your assistance! Thanks to all of you I have been able to reach the next step in the design process! Thanks ever so much! Most sincerely, Kevin "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kevin wrote: > > Dear mr. Maas, > > no need for 'mr' :-) > > > > > First of all my appologies for taking so long to respond. I had a family > > death to attend to. > > my condolences. > there is no need to apologise in any case. > > ... > > >> > >>why is OBC relevant, I read later on that you take the start of egyptian > >>civilization as zero. is that not much earlier. > > > > > > Well it's relevant to make a baseline so that I can calculate the difference > > from then until now. That's the only reason thusfar. > > > > > >>whats the structure of the egyptian|rpg calendar? > > > > > > A year consists of 769 days, 13 months of 63 days a month, except for month > > 13 which has 14 days. Every month has 7 weeks of 9 days, of course month 13 > > is the exception. A day is 24 hours. > > > > a few thoughts: > > 1. you have a date in both calendars which represent the same day? > and/or rather what is day zero in the egyptian calendar in the gregorian > calendar? > > 2. maybe you should store the date internally as number of days since zero, > where zero is the first day on the egyptian calendar .. > > er, checking this thread again, Richard Lynch puts it better than I can so > I'll just let you read his answer (again?) and hope it helps! > > > oh one last thing: I notice that in the function you posted you did this: > > > # Calculating the year in Egypt. > $yr_Egypt = floor($EgyptianDays / 769); > # Calculating the Month in Egypt. > $mnt_Egypt = round( ($EgyptianDays-($yr_Egypt*769)) / 63 ); > # Calculating the Day in Egypt. > $dy_Egypt = round( $EgyptianDays - (($yr_Egypt * 769) + ($mnt_Egypt * 63)) ); > # Filling the date array variable with the day, month and year of the > Egyptian calendar. > $ec_date["Day"] = $dy_Egypt; > $ec_date["Month"] = $mnt_Egypt; > $ec_date["Year"] = $yr_Egypt; > # Returning the Calculated date. > return $ec_date; > > which could be written more succinctly as: > > > /* Calculating the year,month,day in Egypt and returning. */ > return array ( > "Year" => ($y = floor( $EgyptianDays / 769 )), > "Month" => ($m = round( ($EgyptianDays - ($y * 769)) / 63 )), > "Day" => round( $EgyptianDays - (($y * 769) + ($m * 63)) ), > ); > > that might inspire you to use less variables in your code, which is a good thing - but in this > case completely beside the point. whats less beside the point is that you use floor() for the year > and round() for the day and month, I wonder if it helps if you use floor() for all 3? > > beware of floating point rounding errors, compare: > > > $EgyptianDays = 10345; > > var_dump( > > array( > "Year" => ($y = floor( $EgyptianDays / 769 )), > "Month" => ($m = floor( ($EgyptianDays - ($y * 769)) / 63 )), > "Day" => floor( $EgyptianDays - (($y * 769) + ($m * 63)) ), > ), > > array( > "Year" => ($y = floor( $EgyptianDays / 769 )), > "Month" => ($m = round( ($EgyptianDays - ($y * 769)) / 63 )), > "Day" => round( $EgyptianDays - (($y * 769) + ($m * 63)) ), > ) > > ); > > ?> > > kind regards, > Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-not-executing-in-html-file-help-----its working----thanks
hi ian, chris , stephan and others its working..now... i dont know how come...but its working... thank you somuch... vijay --- Ian Firla <[EMAIL PROTECTED]> wrote: > > You need to tell apache to run html files through > the php interpreter: > > ie. AddType application/x-httpd-php .php .php3 .html > > then restart apache > > Ian > > On Sun, 2005-03-20 at 14:12 -0800, vijayaraj > nagarajan wrote: > > hi friends > > i am struggling to solve this problem for the past > one > > week...kindly help me.. > > > > my apache runs perfectly... > > this code gives a perfect output in the browser... > > > > file name: hi.html > > > > > > hihihi > > > > > > but this code doesnot give any output in the > > browser... > > > > file name: hi.html > > > > > > > > > > > > but, the same file with the php code in it...could > be > > executed in the command line, using php... where i > am > > getting the expected output... > > > > i tested to c if my apache doesnt recognise php > ... > > > > this code runs perfectly...in the browser... > > > > > > > > if saved as hi.php file... > > the same code saved as .html, is not giving any > output > > in the browser... > > > > kindly help me to figure out this problem... > > > > thanks > > > > vijayaraj nagarajan > > graduate student > > the university of southern mississippi > > MS - USA > > > > > > > > __ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > > -- > Ian Firla Consulting > http://ianfirla.com > > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-not-executing-in-html-file-help-----its working----thanks
Two ways to resolve it: 1,simplest, rename your file as xxx.php, in order to let php interpreter to process the script. 2, as just now others saying, add file type 'html' to the list which interpreter would process. On Sun, 20 Mar 2005 17:43:52 -0800 (PST), vijayaraj nagarajan <[EMAIL PROTECTED]> wrote: > hi > ian, chris , stephan and others > > its working..now... > i dont know how come...but its working... > thank you somuch... > > vijay > > --- Ian Firla <[EMAIL PROTECTED]> wrote: > > > > You need to tell apache to run html files through > > the php interpreter: > > > > ie. AddType application/x-httpd-php .php .php3 .html > > > > then restart apache > > > > Ian > > > > On Sun, 2005-03-20 at 14:12 -0800, vijayaraj > > nagarajan wrote: > > > hi friends > > > i am struggling to solve this problem for the past > > one > > > week...kindly help me.. > > > > > > my apache runs perfectly... > > > this code gives a perfect output in the browser... > > > > > > file name: hi.html > > > > > > > > > hihihi > > > > > > > > > but this code doesnot give any output in the > > > browser... > > > > > > file name: hi.html > > > > > > > > > > > > > > > > > > but, the same file with the php code in it...could > > be > > > executed in the command line, using php... where i > > am > > > getting the expected output... > > > > > > i tested to c if my apache doesnt recognise php > > ... > > > > > > this code runs perfectly...in the browser... > > > > > > > > > > > > if saved as hi.php file... > > > the same code saved as .html, is not giving any > > output > > > in the browser... > > > > > > kindly help me to figure out this problem... > > > > > > thanks > > > > > > vijayaraj nagarajan > > > graduate student > > > the university of southern mississippi > > > MS - USA > > > > > > > > > > > > __ > > > Do You Yahoo!? > > > Tired of spam? Yahoo! Mail has the best spam > > protection around > > > http://mail.yahoo.com > > > > > -- > > Ian Firla Consulting > > http://ianfirla.com > > > > > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Sincerely, Forest Liu(åäè) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple words search query advise
Hi, We have an a auction like site, now we have to add a search feature to the site, the searching will be done for 2 fields: subject and description (ad_sub, ad_text). Since i have never done this before, I would appreciate some advise on how to do it. I was thinking of getting the search string, running an explode() on it and then doing a LIKE sql query to get the results on each word...but then that would add up to quite a bit if even 5 words were written (5 queries each for the subject and 5 for the text) Any help in the form of advise, links, code, examples etc would be appreciated. After googleing a bit I have gotten a bit of help from some of the pages but not much, one very helpful bit of advise i got was to ignore works like: the, a, in as they are too common...if you have anymore to add, please feel free to write it. Thanks in advance, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] carriage returns using error_log?
On Mar 20, 2005, at 4:15 PM, Chris Shiflett wrote: Kurt Yoder wrote: Is there any way to tell error_log to keep the newline characters? I am outputting error messages to the error log so I can look at detailed status information at the time of the error. However, if I put \n in the error message, it is treated literally by error_log and I see "\n" in the log message. Try using double quotes instead of single quotes. Hope that helps. Chris Heh... no, I was already using double quotes. I also tried using actual carriage returns in the string, that didn't work either. Is error_log simply incapable of obeying carriage returns within the error string? -- Kurt Yoder http://yoderhome.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] carriage returns using error_log?
I prefer purpose it's the design concept in PHP error log. If I would design a system containing error msg displaying. I would also just simplly ignore the carriage returns character which the programer passes to my system, in order to keep graceful in sight. On Sun, 20 Mar 2005 21:50:09 -0500, Kurt Yoder <[EMAIL PROTECTED]> wrote: > > On Mar 20, 2005, at 4:15 PM, Chris Shiflett wrote: > > > Kurt Yoder wrote: > >> Is there any way to tell error_log to keep the newline characters? I > >> am > >> outputting error messages to the error log so I can look at detailed > >> status information at the time of the error. However, if I put \n in > >> the > >> error message, it is treated literally by error_log and I see "\n" in > >> the log message. > > > > Try using double quotes instead of single quotes. > > > > Hope that helps. > > > > Chris > > Heh... no, I was already using double quotes. I also tried using actual > carriage returns in the string, that didn't work either. > > Is error_log simply incapable of obeying carriage returns within the > error string? > > -- > > Kurt Yoder > http://yoderhome.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Sincerely, Forest Liu(åäè) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] carriage returns using error_log?
Kurt Yoder wrote: Heh... no, I was already using double quotes. I also tried using actual carriage returns in the string, that didn't work either. Is error_log simply incapable of obeying carriage returns within the error string? No, I've used error_log() plenty, and I've never had a problem. Can you show us a specific example that would let us reproduce the problem locally? Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: http authentication with safe mode enabled?!
Yes, documentation says : "If safe mode is enabled, the uid of the script is added to the realm part of the WWW-Authenticate header. " and second : "The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version" and also : "Also note that until PHP 4.3.3, HTTP Authentication did not work using Microsoft's IIS server with the CGI version of PHP due to a limitation of IIS ..." This seems to be a minor bug in PHP concept... PHP Authentication (Basic) works when : 1. PHP is running as apache module 2. safe_mode=off or safe_mode=on, but external authentication in Apache is disabled ("PHP uses the presence of an AuthType directive to determine whether external authentication is in effect") At this time I do not now, how to help you ? Try report it to bugs ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.ini file
hi, i'm experimenting with php on mandrake 10 and i'm not sure about a few things. first, where should the php.ini file go? i mean in which folder. next, i need to upload files to a database and i dont know what folder to specify as the temp folder under the file uploads section in the php.ini nor what permissions to give such a folder. hope someone ca help ASAP! thanx in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php.ini file
-Original Message- From: Ruel Cima [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 9:12 AM > i'm experimenting with php on mandrake 10 and i'm not sure about a few > things. first, where should the php.ini file go? If You compile PHP there´s a parameter to use: --with-config-file-path=/usr/local/php.ini -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] detecting a leading hyphen from post data
Larry Brown wrote: I know this is pretty petty, but it is a sunday and I'm missing this for some reason... I'm trying to detect a leading hyphen in an element of an array. I've been using strpos to find strings and if getting 1 as the result, I know it was at the beginning of the string. However, "-", "\-", nor "/^-/" give me a hit? Could someone throw me a bone here? if ($string{0} === "-") { echo "Woof"; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fopen
-Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] Sent: Saturday, March 19, 2005 7:03 AM To: php-general@lists.php.net Subject: [PHP] fopen > What can I add to get more info from the die? Do I to specify a > pathname in $defaultfile? Start by _removing_ @ to get warnings? $defaultfile = "ffmail.txt"; #default file to write to @ $results = fopen($datafilename, "a"); #open file and supress errors You set $defaultfile, but tries to open $datafilename? -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] see anything wrong (xhtml validator)
Sebastian wrote: it seems the xhtml validator is throwing an error with: -- Line 530, column 12: value of attribute "id" invalid: "1" cannot start a name -- From : http://www.w3.org/TR/CSS21/syndata.html#q6 "In CSS 2.1, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [A-Za-z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit." I can't see how this is related to PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini file
Ruel Cima wrote: hi, i'm experimenting with php on mandrake 10 and i'm not sure about a few things. first, where should the php.ini file go? Check the output of phpinfo(); to see where it is expecting the file to be. i mean in which folder. next, i need to upload files to a database and i dont know what folder to specify as the temp folder under the file uploads section in the php.ini nor what permissions to give such a folder. Use your system wide /tmp folder. I believe this is the default setting in PHP, so it should Just Work (tm) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php