Re: [PHP] Removing UTF-8 from text
On 05/01/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, January 3, 2007 2:41 pm, Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Instead of trying to strip the UTF stuff out, try to capture the part you want: preg_match_all('|[^]|ms', $emails, $output); var_dump($output); Richard, I do have a working script now, but I'm intrigued by your regex. Why do you surround the needle with pipes, and what is the ms for? The start/end character can be almost anything you want, and which is convenient. If the pattern you are looking for has a '|' in it, then '|' would be very inconvenient, as you'd have to escape it. But if it has no '|' in the pattern, '|' is convenient. It's traditional to use '/' but because / is already used in pathnames and HTML tags, I find myself using '|' more often, as I seldom have patterns with '|' in them as a meaningful character that I need to type. You can also (in some versions) use matching start/end delimiters, like with or { and } and so on. In this particular case, almost anything except and would be convenient, so I could have chosen any of these: |([^]*)| /([^]*)/ {([^]*)} [aside] Notice how I subtly corrected my obvious mistakes this time around... :-) [/aside] The 'm' tacked on at the end allow for newline within the pattern and content, so that if your emails are separated by newlines, it should still work. Actually, I think the 'm' might not be needed, as there should be any newlines WITHIN the pattern. The 's' allows the '.' (if I had one, which I don't) to match newlines within the string as well as other characters. It is totally pointless to have included 's' in this case, since I have no '.' in the pattern in the first place. Just habit, I guess. I generally find that if I have a big ol' chunk of text, and I want to do PCRE on it, and it might have newlines, I want 'ms' on the end, and I don't want that if it's just a single line of text. I'm still definitely more in the Cargo Cult, perhaps graduating to Voodoo Programming style, of PCRE pattern composing. Maybe someday I'll *really* understand regex, and graduate to Competent. I doubt it though. Thanks. This is getting filed under my regex-emergencies label. I'll definetly be referencing this again. As usual, I do prefer to be taught to capture fish rather than be handed a fish. Dotan Cohen http://lyricslist.com/lyrics/artist_albums/517/yaz.html http://what-is-what.com/what_is/sitepoint.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.4.5RC1
Hello! I packed PHP 4.4.5RC1 today, which you can find here: http://downloads.php.net/derick/php-4.4.5RC1.tar.bz2 ee9238175c6b6ecec8712954065451c4 http://downloads.php.net/derick/php-4.4.5RC1.tar.gz 5337c72e3d70fb88b932215957e250f8 Windows binaries will follow suit. Please test it carefully, and report any bugs in the bug system, but only if you have a short reproducable test case. If everything goes well, we will probably release PHP 4.4.5 before the end of the month. regards, Derick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
On 05/01/07, Roman Neuhauser [EMAIL PROTECTED] wrote: The syntax is very dense which makes it easy to forget if you don't practise. On the other hand, it's very easy to stay in form: regular expressions are everywhere, even the Perl-compatible ones. I suppose it's rather easy to stay physically fit as well, assuming that you run every day. However, I sit too many hours in the university library and not enough running nor coding regexes. So, my abilities in both are not what they should be. Thanks for bearing with me, though. Dotan Cohen http://what-is-what.com/what_is/protocol.html http://lyricslist.com/lyrics/artist_albums/383/o_connor_sinead.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] High-Level Design Question, Podcast, Playlists, Content-Rich
Richard Lynch wrote: This question is not PHP-specific, really, but is a general high-level sort of programming/design question, and it's being written in PHP, so I guess it's as on-topic as most of what's here... Do feel free to hit delete now if you're a purist. I have an ongoing daily music playlist of 30 songs: http://uncommonground.com/radio_hifi.m3u http://uncommonground.com/radio_lofi.m3u hifi and lofi, obviously [aside] Playlists may differ slightly at the request of the artists to [not] publish hi/lo fi of their material. [/aside] I'm trying to shoe-horn that into an Apple Podcast. You hit the nail on the head. What you have is not a podcast as far as Apple and most of the industry defines it, so shoe-horning is right. If you really want to release it in a podcast-type format, I think your best bet is to roll them up into a single daily MP3. Yes you'll lose the individual tags, but you can associate each feed entry with a webpage (commonly called the shownotes) where you can provide the full ID3 tags for each individual source file and you'll have control over the order. -Stut First, let me say up-front, that technologically-speaking, this is turning out to be not a really good fit, even though I thought it would be a no-brainer... Apple podcasts are designed for longer single-theme MP3s, and, as some of my dilemnas below will show, for far less content than I'm producing. However, from a business / political perspective, I'm (still) wanting to do this, mainly because I've had too many people tell me I should do this. So no matter how wrong they all are, there is a time to cave in to popular opinion :-) :-) :-) Apple podcasts allow up to 100 items, and are sequenced by DATE only, afaict, in iTunes. Apple podcasts only allow a tiny fraction of mime-types in their podcast, and an m3u (mp3 playlist) is not one of them. I could smush all 30 MP3s for a day into one big MP3, but we're talking a HUGE MP3, and I'd lose the ID3 tag info I've got for each individual MP3, which I'm loathe to do. I could, in theory, switch to Apple's AAC format to get playlist-like stop-points or somesuch, but A) it's proprietary, and B) I've got 65,000+ MP3s for ~400 GIG, and duplicated on a second server, all out of my pocket, so converting is not attractive. So, effectively, I'm limited to 3.333 days' worth of programming: 30 episodes per day, 100 episode limit. And I can't even sequence the playlist of 30 episodes in one day so that iTunes will play them in order. They all were selected the same day, and iTunes re-orders them willy-nilly. :-( [aside] I have to see if the resolution is better than day, but worse than seconds, as maybe changing the minute or hour on each song/episode will maintain order. Haven't tested yet. [/aside] What's worse, is that there doesn't seem to be any easy way in the 100-episode limit to indicate the wealth of content available far beyond the 100 songs. It's a long shot, but I'm hoping somebody here has some insight that might engender some kind of attractive solution that I'm missing. Thanks for any thoughts on this, and I sure appreciate you taking the time to read this! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is_writable() not working on PHP 5.1.6
Hi, I am running Fedora Core 6 with PHP 5.1.6 This little snippet will output the file is not writable: if (file_exists($file)) { if(!is_writeable($menu_filename)){ echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file and also put group and user to apaches user. So that is not an issue. I have seen some bug reports on this, but haven't figured out how to solve it. Is this a PHP 5.1.6 related bug? I haven't seen any fix or similar. Best regards, Peter Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_writable() not working on PHP 5.1.6
# [EMAIL PROTECTED] / 2007-01-05 18:01:30 +0700: if (file_exists($file)) { $file if(!is_writeable($menu_filename)){ $menu_filename echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file Which of the two files? Use the var_dump(), Luke! -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
# [EMAIL PROTECTED] / 2007-01-04 16:19:19 -0600: On Thu, January 4, 2007 2:28 am, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-04 08:21:37 +0200: to grasp, so I use the English version. That may not be a problem for you, but it is for me. Your written English is very good. If you can understand what you wrote and can read replies (in English) from the list, you should have no problems understanding the manual. Well that's funny. As a native speaker, I often have trouble understanding the manual, especially the PCRE bits. I understand all the words, and all the sentences make perfect grammatical sense. But how they apply and what the implications are and WHEN they apply... A picture is worth of a thousand words. If you're confused, experiment! -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] is_writable() not working on PHP 5.1.6
Maybe it's because you're testing two different variables, $file and $menu_filename? Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 05 January 2007 11:02 To: php-general@lists.php.net Subject: [PHP] is_writable() not working on PHP 5.1.6 Hi, I am running Fedora Core 6 with PHP 5.1.6 This little snippet will output the file is not writable: if (file_exists($file)) { if(!is_writeable($menu_filename)){ echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file and also put group and user to apaches user. So that is not an issue. I have seen some bug reports on this, but haven't figured out how to solve it. Is this a PHP 5.1.6 related bug? I haven't seen any fix or similar. Best regards, Peter Lauri -- 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] is_writable() not working on PHP 5.1.6
Sorry, it should be $file for both as in the more complex code. So the below code is the code that is generating the file is not writable. if (file_exists($file)) { if(!is_writeable($file)){ echo the file is not writable; } } else echo The file does not exist; This bug http://bugs.php.net/bug.php?id=30931 is similar, and would have been resolved already in v5.1 Best regards, Peter Lauri Quoting Edward Kay [EMAIL PROTECTED]: Maybe it's because you're testing two different variables, $file and $menu_filename? Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 05 January 2007 11:02 To: php-general@lists.php.net Subject: [PHP] is_writable() not working on PHP 5.1.6 Hi, I am running Fedora Core 6 with PHP 5.1.6 This little snippet will output the file is not writable: if (file_exists($file)) { if(!is_writeable($menu_filename)){ echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file and also put group and user to apaches user. So that is not an issue. I have seen some bug reports on this, but haven't figured out how to solve it. Is this a PHP 5.1.6 related bug? I haven't seen any fix or similar. Best regards, Peter Lauri -- 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] Removing UTF-8 from text
# [EMAIL PROTECTED] / 2007-01-05 11:05:48 +0200: On 05/01/07, Roman Neuhauser [EMAIL PROTECTED] wrote: The syntax is very dense which makes it easy to forget if you don't practise. On the other hand, it's very easy to stay in form: regular expressions are everywhere, even the Perl-compatible ones. I suppose it's rather easy to stay physically fit as well, assuming that you run every day. However, I sit too many hours in the university library and not enough running nor coding regexes. So, my abilities in both are not what they should be. Thanks for bearing with me, though. I have seen many recommendations of Mastering Regular Expressions by Jeffrey Friedl (O'Reilly), perhaps it's in your library. I haven't read that book. man perlre has gobs of info, it's a tough text, but points to tutorials and further references. man pcre lists all manpages of that package. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_writable() not working on PHP 5.1.6
Some additional information: On the running server I am getting this dumped: audit(1168010361.652:217): avc: denied { write } for pid=2924 comm=httpd name=hcat.log dev=dm-0 ino=8718108 scontext=root:system_r:httpd_t:s0 tcontext=root:object_r:etc_runtime_t:s0 tclass=file Anyone? /Peter Quoting [EMAIL PROTECTED]: Hi, I am running Fedora Core 6 with PHP 5.1.6 This little snippet will output the file is not writable: if (file_exists($file)) { if(!is_writeable($menu_filename)){ echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file and also put group and user to apaches user. So that is not an issue. I have seen some bug reports on this, but haven't figured out how to solve it. Is this a PHP 5.1.6 related bug? I haven't seen any fix or similar. Best regards, Peter Lauri -- 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] is_writable() not working on PHP 5.1.6
[EMAIL PROTECTED] wrote: Some additional information: On the running server I am getting this dumped: audit(1168010361.652:217): avc: denied { write } for pid=2924 comm=httpd name=hcat.log dev=dm-0 ino=8718108 scontext=root:system_r:httpd_t:s0 tcontext=root:object_r:etc_runtime_t:s0 tclass=file smells like your on a system that's employing selinux (http://www.nsa.gov/selinux/) or something similar. if that is the case then this is not a php issue and you'll have to dig into your server's setup/configuration to figure out what is implementing this extra security wrapper and how you can tell it to allow your webserver to access to the given dir/file. Anyone? /Peter Quoting [EMAIL PROTECTED]: Hi, I am running Fedora Core 6 with PHP 5.1.6 This little snippet will output the file is not writable: if (file_exists($file)) { if(!is_writeable($menu_filename)){ echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file and also put group and user to apaches user. So that is not an issue. I have seen some bug reports on this, but haven't figured out how to solve it. Is this a PHP 5.1.6 related bug? I haven't seen any fix or similar. Best regards, Peter Lauri --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] Re: [PHP-DEV] PHP 4.4.5RC1
Hi, Windows distribution is available at: http://downloads.php.net/edink/php-4.4.5RC1-Win32.zip Edin Derick Rethans wrote: Hello! I packed PHP 4.4.5RC1 today, which you can find here: http://downloads.php.net/derick/php-4.4.5RC1.tar.bz2 ee9238175c6b6ecec8712954065451c4 http://downloads.php.net/derick/php-4.4.5RC1.tar.gz 5337c72e3d70fb88b932215957e250f8 Windows binaries will follow suit. Please test it carefully, and report any bugs in the bug system, but only if you have a short reproducable test case. If everything goes well, we will probably release PHP 4.4.5 before the end of the month. regards, Derick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_writable() not working on PHP 5.1.6
Thanks for your answer, It was a bit late because we already disabled selinux just to try, and it worked :) But hopefully this could help someone that bumps into the same problem. On a live webserver, what security issues would disableing the selinux cause? Any? Best regards, Peter Lauri Quoting Jochem Maas [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Some additional information: On the running server I am getting this dumped: audit(1168010361.652:217): avc: denied { write } for pid=2924 comm=httpd name=hcat.log dev=dm-0 ino=8718108 scontext=root:system_r:httpd_t:s0 tcontext=root:object_r:etc_runtime_t:s0 tclass=file smells like your on a system that's employing selinux (http://www.nsa.gov/selinux/) or something similar. if that is the case then this is not a php issue and you'll have to dig into your server's setup/configuration to figure out what is implementing this extra security wrapper and how you can tell it to allow your webserver to access to the given dir/file. Anyone? /Peter Quoting [EMAIL PROTECTED]: Hi, I am running Fedora Core 6 with PHP 5.1.6 This little snippet will output the file is not writable: if (file_exists($file)) { if(!is_writeable($menu_filename)){ echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file and also put group and user to apaches user. So that is not an issue. I have seen some bug reports on this, but haven't figured out how to solve it. Is this a PHP 5.1.6 related bug? I haven't seen any fix or similar. Best regards, Peter Lauri --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] FastCGI optmized Windows build of 5.2.1RC2
Hello, I have made a second build of 5.2.1RC2 for Windows with no thread safety enabled. This will only work for non threaded SAPIs such as CGI/FastCGI and CLI. The reason for this is that managing per thread state takes some CPU time from the main task of running PHP scripts making non thread safe PHP significantly faster. My initial benchmarks show 20-30% performance increase. This, together with the new fastcgi implementation for IIS from Microsoft should bring PHP performance on Windows to a new level. http://downloads.php.net/edink/php-5.2.1RC2-nts-Win32.zip (76aa90a7fdb0bd2eb62c1172501d6c6e) http://downloads.php.net/edink/pecl-5.2.1RC2-nts-Win32.zip (a493bdf794a5d44d749f6dcd2a55f9da) http://downloads.php.net/edink/php-debug-pack-5.2.1RC2-nts-Win32.zip (cbfd474fcdb61522d4c750b5c02d3df9) Edin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re:[PHP]clases en sesiones
It can be startin a new session on each page. Are you using some header(Location: ???); ? If so, it could be starting a new session. deinet [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Hi, thank you chucre, but this not is the solution, the session.auto_start is On, I don't need use session_start() because it is automatic. This is my script: ? include_once 'usuario.class.php'; include_once 'carrito.class.php'; //session_start(); if (!session_id()) { session_start(); } if (!isset($_SESSION[ocarrito])){ $_SESSION[ocarrito] = new carrito(); } if (!isset($_SESSION[elusuario])){ $_SESSION[elusuario] = new usuario(); } ? for your class work, is necessary verify the session_id, like this: if (!session_id()) session_start(); 2007/1/5, deinet mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]: Hello list, i have a problem with sessions and class. I used to work with a server with session.auto_start=Off, and now I had to move all my sites to another server with session.auto_start=On, and I have this problem with the session: Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition carrito of the object you are trying to operate on was loaded _before_ the session was started in archive on line 43 The problem is the class is charged after the beginning of the session, but I don't know what to do to make it work, please help me. P.D.: To put the session.auto_start in Off is not a solution because the servers administrators don't admit that. I hope you will understand my problem, sorry for my english. Thank you very much, Carlos. -- Fernando Chure PSL/CE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FastCGI optmized Windows build of 5.2.1RC2
hello, thanks for this good news for Win poeple. Do you have any info on what version(s) of IIS/win32 this release soul be used? thank you Vincent Dupont Ausy Belgium -Original Message- From: Edin Kadribasic [mailto:[EMAIL PROTECTED] Sent: Fri 1/5/2007 14:27 To: PHP internals; php-general@lists.php.net Subject: [PHP] FastCGI optmized Windows build of 5.2.1RC2 Hello, I have made a second build of 5.2.1RC2 for Windows with no thread safety enabled. This will only work for non threaded SAPIs such as CGI/FastCGI and CLI. The reason for this is that managing per thread state takes some CPU time from the main task of running PHP scripts making non thread safe PHP significantly faster. My initial benchmarks show 20-30% performance increase. This, together with the new fastcgi implementation for IIS from Microsoft should bring PHP performance on Windows to a new level. http://downloads.php.net/edink/php-5.2.1RC2-nts-Win32.zip (76aa90a7fdb0bd2eb62c1172501d6c6e) http://downloads.php.net/edink/pecl-5.2.1RC2-nts-Win32.zip (a493bdf794a5d44d749f6dcd2a55f9da) http://downloads.php.net/edink/php-debug-pack-5.2.1RC2-nts-Win32.zip (cbfd474fcdb61522d4c750b5c02d3df9) Edin -- 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] FastCGI optmized Windows build of 5.2.1RC2
Well you can already use PHP/fastcgi with Apache and IIS6 on windows using 3rd party fastcgi modules for these servers. What IIS7 (http://www.iis.net/) brings is native fastcgi implementation. Edin Vincent DUPONT wrote: hello, thanks for this good news for Win poeple. Do you have any info on what version(s) of IIS/win32 this release soul be used? thank you Vincent Dupont Ausy Belgium -Original Message- From: Edin Kadribasic [mailto:[EMAIL PROTECTED] Sent: Fri 1/5/2007 14:27 To: PHP internals; php-general@lists.php.net Subject: [PHP] FastCGI optmized Windows build of 5.2.1RC2 Hello, I have made a second build of 5.2.1RC2 for Windows with no thread safety enabled. This will only work for non threaded SAPIs such as CGI/FastCGI and CLI. The reason for this is that managing per thread state takes some CPU time from the main task of running PHP scripts making non thread safe PHP significantly faster. My initial benchmarks show 20-30% performance increase. This, together with the new fastcgi implementation for IIS from Microsoft should bring PHP performance on Windows to a new level. http://downloads.php.net/edink/php-5.2.1RC2-nts-Win32.zip (76aa90a7fdb0bd2eb62c1172501d6c6e) http://downloads.php.net/edink/pecl-5.2.1RC2-nts-Win32.zip (a493bdf794a5d44d749f6dcd2a55f9da) http://downloads.php.net/edink/php-debug-pack-5.2.1RC2-nts-Win32.zip (cbfd474fcdb61522d4c750b5c02d3df9) Edin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] clases en sesiones
deinet wrote: Hello list, i have a problem with sessions and class. I used to work with a server with session.auto_start=Off, and now I had to move all my sites to another server with session.auto_start=On, and I have this problem with the session: Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition carrito of the object you are trying to operate on was loaded _before_ the session was started in archive on line 43 The problem is the class is charged after the beginning of the session, but I don't know what to do to make it work, please help me. P.D.: To put the session.auto_start in Off is not a solution because the servers administrators don't admit that. they are then a$$holes - to put it not so politely, session.auto_start=On is a crazy setting to have as default. find a different webhoster if you can. you might try using a .htaccess to override the default php.ini setting (assuming this is an apache webserver) put an .htaccess file in the webroot and add this to it: php_value session.auto_start Off that might not work because they are even so stupid as to block changing of this setting. if it doesn't work you can try one more thing, namely an 'auto_prepend_file', again you define this in an .htaccess in the root of your site. php_value auto_prepend_file /path/to/your/auto_prepend_file.php then you add the relevant include/require lines (lines that load the files that contain the class definitions of the classes that you use/store in your sessions) to the php file pointed to by auto_prepend_file. the auto_prepend_file file is run before anything else is done - including *HOPEFULLY* the sessiohn being automatically started - I have not tested this and if the session is started before the auto prepend file is loaded then you are shit out of luck with this option. hope that works for you. I hope you will understand my problem, sorry for my english. Thank you very much, Carlos. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FastCGI optmized Windows build of 5.2.1RC2
Well to correct myself, Microsoft has released their FastCGI module for earlier versions of IIS as well. Take a look at http://www.iis.net/default.aspx?tabid=2subtabid=25i=1207 Edin Edin Kadribasic wrote: Well you can already use PHP/fastcgi with Apache and IIS6 on windows using 3rd party fastcgi modules for these servers. What IIS7 (http://www.iis.net/) brings is native fastcgi implementation. Edin Vincent DUPONT wrote: hello, thanks for this good news for Win poeple. Do you have any info on what version(s) of IIS/win32 this release soul be used? thank you Vincent Dupont Ausy Belgium -Original Message- From: Edin Kadribasic [mailto:[EMAIL PROTECTED] Sent: Fri 1/5/2007 14:27 To: PHP internals; php-general@lists.php.net Subject: [PHP] FastCGI optmized Windows build of 5.2.1RC2 Hello, I have made a second build of 5.2.1RC2 for Windows with no thread safety enabled. This will only work for non threaded SAPIs such as CGI/FastCGI and CLI. The reason for this is that managing per thread state takes some CPU time from the main task of running PHP scripts making non thread safe PHP significantly faster. My initial benchmarks show 20-30% performance increase. This, together with the new fastcgi implementation for IIS from Microsoft should bring PHP performance on Windows to a new level. http://downloads.php.net/edink/php-5.2.1RC2-nts-Win32.zip (76aa90a7fdb0bd2eb62c1172501d6c6e) http://downloads.php.net/edink/pecl-5.2.1RC2-nts-Win32.zip (a493bdf794a5d44d749f6dcd2a55f9da) http://downloads.php.net/edink/php-debug-pack-5.2.1RC2-nts-Win32.zip (cbfd474fcdb61522d4c750b5c02d3df9) Edin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with file reading
Hi, I'm a beginner and i'm still learning PHP and I got a problem: $file = http://localhost/test_folder/test1.txt;; //I have also tried test_folder/test1.txt and text1.txt $fh = fopen($file, r) or die(Could not open file!); $data = fread($fh, filesize($file)) or die (Could not read file!); fclose($fh); echo $data; The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder test_folder. Help would be greatly appreaciated Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What's this image tag for?
Hey all, I'm building a site for a client that is using this system called Linkshare to link to web sites for stores and it's one of those deals where they provide the link code so my client gets credit for sending the person to the store's site. Common enough, but there is one thing about their code I'm a bit confused about. Here is one of their links you put in your code to link to a store: a href=http://click.linksynergy.com/fs-bin/click?id=5sJlsTOpnzEofferid=115126.1505type=4subid=0;IMG alt=Sharper Image border=0 src=http://www.sharperimagespecials.com/banners/Promos/11_Nov06/fshproplus_1106_125x125.gif;/aIMG border=0 width=1 height=1 src=http://ad.linksynergy.com/fs-bin/show?id=5sJlsTOpnzEbids=115126.1505type=4subid=0; You'll notice they provide an image for you to display embedded in the a href=... /a tags, simple enough, but I can't figure out what that second IMG tag is for with the little 1 x 1 image. Since it's outside the actual link, I don't really see what it accomplishes. Anyone with experience with these things, or just any idea why it's there would sure help clear the fog from my brain on this one. Much thanks! -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's this image tag for?
On 5 Jan 2007, at 14:38, Skip Evans wrote: a href=http://click.linksynergy.com/fs-bin/click? id=5sJlsTOpnzEofferid=115126.1505type=4subid=0IMG alt=Sharper Image border=0 src=http:// www.sharperimagespecials.com/banners/Promos/11_Nov06/ fshproplus_1106_125x125.gif/aIMG border=0 width=1 height=1 src=http://ad.linksynergy.com/fs-bin/show? id=5sJlsTOpnzEbids=115126.1505type=4subid=0 You'll notice they provide an image for you to display embedded in the a href=... /a tags, simple enough, but I can't figure out what that second IMG tag is for with the little 1 x 1 image. Since it's outside the actual link, I don't really see what it accomplishes. It's simply a counter. Calls an image off a remote server which increments a counter on that remote server. Allows whoever to track how frequently the code block is shown. HTH Simon Forster ___ LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK Tel: +44 (0)20 8133 0528 Fax: +44 (0)70 9230 5247 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's this image tag for?
I thought it would be something like that. So here's another question I'd appreciate thoughts on: If I have ten of these links on a page, linking to ten different stores, should I include one of these IMG links on each link, just as they say to cut and paste? Or should there only be one per page so I don't hit the counter ten times, once for each image. I have examined the ten different IMG URLs for the ones I have pasted onto a page and they are all the same, so they are NOT unique per store image. But rather seem to relate to my client's account itself. Any thoughts, insights would be greatly appreciated. Skip Simon Forster wrote: On 5 Jan 2007, at 14:38, Skip Evans wrote: a href=http://click.linksynergy.com/fs-bin/click? id=5sJlsTOpnzEofferid=115126.1505type=4subid=0IMG alt=Sharper Image border=0 src=http:// www.sharperimagespecials.com/banners/Promos/11_Nov06/ fshproplus_1106_125x125.gif/aIMG border=0 width=1 height=1 src=http://ad.linksynergy.com/fs-bin/show? id=5sJlsTOpnzEbids=115126.1505type=4subid=0 You'll notice they provide an image for you to display embedded in the a href=... /a tags, simple enough, but I can't figure out what that second IMG tag is for with the little 1 x 1 image. Since it's outside the actual link, I don't really see what it accomplishes. It's simply a counter. Calls an image off a remote server which increments a counter on that remote server. Allows whoever to track how frequently the code block is shown. HTH Simon Forster ___ LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK Tel: +44 (0)20 8133 0528 Fax: +44 (0)70 9230 5247 ___ -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Some advice / points / help
Hi guys, Some intelligent minds needed again ... I have the following schematic to work to ... http//steven.macintyre.name/arb/showlineups.jpg I need to fill that with data from a mysql table ... The format of the table is as follows; CREATE TABLE `kayasite_schedule` ( `id` int(11) NOT NULL auto_increment, `tid` int(6) NOT NULL, `showname` mediumtext NOT NULL, `day` varchar(10) NOT NULL, `blurb` longtext NOT NULL, `show_start` time NOT NULL default '00:00:00', `show_end` time NOT NULL default '00:00:00', `who` varchar(25) NOT NULL default '', `uid` int(6) NOT NULL, `pic` varchar(60) NOT NULL default '', UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM Now, as you can see the time slot are the items show_start, show_end (which I can do) the names are from the table (who) - can anyone start me off on the correct route to get this done. The layout does not have to be exactly like that - but - the days across top have to - so if there are gaps in time slots etc we can handle that This is way beyond my level of knowledge and have NO idea where to start. As always - your assistance appreciated!! Kind Regards, Steven Macintyre http://steven.macintyre.name -- http://www.friends4friends.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Some advice / points / help
Steven Macintyre wrote: Hi guys, Some intelligent minds needed again ... I dont think I count - mostly because I don't even understand the question. I have the following schematic to work to ... http//steven.macintyre.name/arb/showlineups.jpg that URL make my browser end up here: http://www.w3.org/Protocols/ is .name even a top level domain? did that happen whilst I was sleeping? I need to fill that with data from a mysql table ... The format of the table is as follows; CREATE TABLE `kayasite_schedule` ( `id` int(11) NOT NULL auto_increment, `tid` int(6) NOT NULL, `showname` mediumtext NOT NULL, `day` varchar(10) NOT NULL, `blurb` longtext NOT NULL, `show_start` time NOT NULL default '00:00:00', `show_end` time NOT NULL default '00:00:00', `who` varchar(25) NOT NULL default '', `uid` int(6) NOT NULL, `pic` varchar(60) NOT NULL default '', UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM Now, as you can see the time slot are the items show_start, show_end (which I can do) the names are from the table (who) - can anyone start me off on the correct route to get this done. The layout does not have to be exactly like that - but - the days across top have to - so if there are gaps in time slots etc we can handle that This is way beyond my level of knowledge and have NO idea where to start. in very broad terms (with out taking any account of error checking): 0. connect to mysql database http://php.net/mysql http://php.net/manual/en/function.mysql-connect.php 1. define an sql query e.g. $sql = SELECT * kayasite_schedule; // lame example query 2. perform the query http://php.net/manual/en/function.mysql-query.php 3. loop the result to output tabular data http://php.net/manual/en/function.mysql-fetch-assoc.php http://php.net/foreach http://php.net/echo As always - your assistance appreciated!! the manual is your best friend, if you don't understand something in the manual (i.e. the links above) come back and ask ... don't forget to tell us where/what you don't understand :-) good luck Kind Regards, Steven Macintyre http://steven.macintyre.name -- http://www.friends4friends.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Some advice / points / help
http//steven.macintyre.name/arb/showlineups.jpg that URL make my browser end up here: http://www.w3.org/Protocols/ is .name even a top level domain? did that happen whilst I was sleeping? Looks like something is wrong with your DNS Jochem :) I can see the image fine. .name has been a valid TLD since Jan 2002 - you haven't been sleeping that long as I've seen posts from you in the meantime :) http://en.wikipedia.org/wiki/.name Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Some advice / points / help
http//steven.macintyre.name/arb/showlineups.jpg that URL make my browser end up here: http://www.w3.org/Protocols/ is .name even a top level domain? did that happen whilst I was sleeping? Looks like something is wrong with your DNS Jochem :) I can see the image fine. Correction: The problem will more likely be the lack of the colon after http. .name is still valid though ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with file reading
===ORIGINAL=== Hi, I'm a beginner and i'm still learning PHP and I got a problem: $file = http://localhost/test_folder/test1.txt;;http://localhost/test_folder/test1.txt//I have also tried test_folder/test1.txt and text1.txt $fh = fopen($file, r) or die(Could not open file!); $data = fread($fh, filesize($file)) or die (Could not read file!); fclose($fh); echo $data; The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder test_folder. Help would be greatly appreaciated Thanks in advance! ===END ORIGINAL=== Try using the complete path in $file... you can get the complete path by using $_SERVER['DOCUMENT_ROOT'] Also be sure that path given in $file variable is relatvie to location of php file that is executing -- Regards Fahad Pervaiz www.ecommerce-xperts.com (Shopping Cart, Web Design, SEO)
Re: [PHP] Some advice / points / help
So the question is... How to grab data from the DB and create a jpg from it, looking pretty like http://steven.macintyre.name/arb/showlineups.jpg (I added the colon ;-) ) ?? David
Re: [PHP] Problem with file reading
Delta Storm wrote: I'm a beginner and i'm still learning PHP and I got a problem: $file = http://localhost/test_folder/test1.txt;; //I have also tried test_folder/test1.txt and text1.txt $fh = fopen($file, r) or die(Could not open file!); $data = fread($fh, filesize($file)) or die (Could not read file!); fclose($fh); echo $data; The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder test_folder. Is there a reason why you're trying to access it through a URL? If not, please don't. The file path needs to be relative to the current file. So if your PHP file is in the root, test_folder/test1.txt should work. If your PHP file is in a folder named code in the root, ../test_folder/text1.txt should work. Also, depending on your PHP version you're probably better off using file_get_contents instead of fopen/fread/fclose. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's this image tag for?
Skip Evans wrote: I thought it would be something like that. So here's another question I'd appreciate thoughts on: If I have ten of these links on a page, linking to ten different stores, should I include one of these IMG links on each link, just as they say to cut and paste? Or should there only be one per page so I don't hit the counter ten times, once for each image. I have examined the ten different IMG URLs for the ones I have pasted onto a page and they are all the same, so they are NOT unique per store image. But rather seem to relate to my client's account itself. Any thoughts, insights would be greatly appreciated. That's really a question for the ad company to answer according to their policy. You'll probably an answer in their instructions somewhere. We can't give you an authoritative answer on a specific company's policy. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Some advice / points / help
Jochem Maas wrote: Steven Macintyre wrote: I have the following schematic to work to ... http//steven.macintyre.name/arb/showlineups.jpg that URL make my browser end up here: http://www.w3.org/Protocols/ is .name even a top level domain? did that happen whilst I was sleeping? It's the missing : from http:// that does it. And yes, .name is a TLD, has been for a while now. the manual is your best friend, if you don't understand something in the manual (i.e. the links above) come back and ask ... don't forget to tell us where/what you don't understand :-) Don't forget Google, your second best friend. Google for php mysql tutorial and you'll find a ton of stuff. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's this image tag for?
Stut wrote: That's really a question for the ad company to answer according to their policy. You'll probably an answer in their instructions somewhere. We can't give you an authoritative answer on a specific company's policy. Good point. I finally was able to track down their contact info and will fire off a message. Thanks. -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Arrays help
Hello, I'm making a menu script that uses mysql, php and javascript to build a on mouse over dropdown menu to a page. I ran into some problems and would need help to get this working. (This is just the top level of the menusystem) 1. Get the toplevel links from DB, create array and put values there. $sql =SELECT * FROM x_menu WHERE menulevel = '1' ORDER BY 'id' ASC; $result=mysql_query($sql); $num = mysql_num_rows($result); $cur = 1; while ($num = $cur) { $row = mysql_fetch_array($result); $id = $row[id]; $menulevel = $row[menulevel]; $linktext = $row[linktext]; $linkurl = $row[linkurl]; $toplevel =array($id, $menulevel, $linktext, $linkurl); $cur ++; } The first problem comes here. How can I create a different array at every iteration of the loop? Or how this should be done if the toplevel objects are echoed with foreach to the browser like this: $TopLevelCounter = 1; foreach ($toplevel as $value){ print menuSyS.addItem('labelItem', '$toplevel[2]', $TopLevelCounter, $width, '$colour1', '#aa', '$colour2');\n; $TopLevelCounter ++; } Now, because I just fill the same array again and again in the DB query all top level items finally contain the same text. So my question is how to query the DB and create the arrays so that it would be easy to refer to the data in the arrays when printing to screen. Do I have to make multidimensional arrays? If so how to implement them here and how they should be referred to when printing to browser? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with file reading
# [EMAIL PROTECTED] / 2007-01-05 16:34:41 +: Delta Storm wrote: I'm a beginner and i'm still learning PHP and I got a problem: $file = http://localhost/test_folder/test1.txt;; //I have also tried test_folder/test1.txt and text1.txt $fh = fopen($file, r) or die(Could not open file!); $data = fread($fh, filesize($file)) or die (Could not read file!); fclose($fh); echo $data; The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder test_folder. Is there a reason why you're trying to access it through a URL? If not, please don't. The file path needs to be relative to the current file. So if your PHP file is in the root, test_folder/test1.txt should work. If your PHP file is in a folder named code in the root, ../test_folder/text1.txt should work. Arent' you confusing this with something else? fopen() is affected by the current working directory of the process calling it. What kind of root are you talking about? The filesystem root, /? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with file reading
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-05 16:34:41 +: Delta Storm wrote: I'm a beginner and i'm still learning PHP and I got a problem: $file = http://localhost/test_folder/test1.txt;; //I have also tried test_folder/test1.txt and text1.txt $fh = fopen($file, r) or die(Could not open file!); $data = fread($fh, filesize($file)) or die (Could not read file!); fclose($fh); echo $data; The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder test_folder. Is there a reason why you're trying to access it through a URL? If not, please don't. The file path needs to be relative to the current file. So if your PHP file is in the root, test_folder/test1.txt should work. If your PHP file is in a folder named code in the root, ../test_folder/text1.txt should work. Arent' you confusing this with something else? fopen() is affected by the current working directory of the process calling it. What kind of root are you talking about? The filesystem root, /? The OP referred to the servers root folder. Now stop nit-picking and go back to quoting standards. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with file reading
# [EMAIL PROTECTED] / 2007-01-05 17:17:46 +: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-05 16:34:41 +: Delta Storm wrote: I'm a beginner and i'm still learning PHP and I got a problem: $file = http://localhost/test_folder/test1.txt;; //I have also tried test_folder/test1.txt and text1.txt $fh = fopen($file, r) or die(Could not open file!); The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder test_folder. Is there a reason why you're trying to access it through a URL? If not, please don't. The file path needs to be relative to the current file. So if your PHP file is in the root, test_folder/test1.txt should work. If your PHP file is in a folder named code in the root, ../test_folder/text1.txt should work. Arent' you confusing this with something else? fopen() is affected by the current working directory of the process calling it. What kind of root are you talking about? The filesystem root, /? The OP referred to the servers root folder. Now stop nit-picking and go back to quoting standards. I'm not nitpicking. If the webserver process (assuming mod_php) runs in a different directory, fopen(relative/to/documentroot/path.txt) won't help him at all, and as far as I can tell, it's quite common for web servers to run with pretty much any cwd, often / or /var/empty (these are local filesystem paths). -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Some advice / points / help
# [EMAIL PROTECTED] / 2007-01-05 16:37:27 +0100: Steven Macintyre wrote: http//steven.macintyre.name/arb/showlineups.jpg that URL make my browser end up here: http://www.w3.org/Protocols/ is .name even a top level domain? did that happen whilst I was sleeping? That's because of the http// (notice the missing colon). name. is a valid TLD, just like museum. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with file reading
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-05 17:17:46 +: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-05 16:34:41 +: Delta Storm wrote: I'm a beginner and i'm still learning PHP and I got a problem: $file = http://localhost/test_folder/test1.txt;; //I have also tried test_folder/test1.txt and text1.txt $fh = fopen($file, r) or die(Could not open file!); The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder test_folder. Is there a reason why you're trying to access it through a URL? If not, please don't. The file path needs to be relative to the current file. So if your PHP file is in the root, test_folder/test1.txt should work. If your PHP file is in a folder named code in the root, ../test_folder/text1.txt should work. Arent' you confusing this with something else? fopen() is affected by the current working directory of the process calling it. What kind of root are you talking about? The filesystem root, /? The OP referred to the servers root folder. Now stop nit-picking and go back to quoting standards. I'm not nitpicking. If the webserver process (assuming mod_php) runs in a different directory, fopen(relative/to/documentroot/path.txt) won't help him at all, and as far as I can tell, it's quite common for web servers to run with pretty much any cwd, often / or /var/empty (these are local filesystem paths). Ok, let me clarify... Using mod_php with Apache will make the current directory the directory that contains the script being requested. I am assuming that the OP is trying to access the file from the script that is being requested and not an included file in a different directory - I should have been clearer on that. I never said anything about being relative to the document root - you pulled that out of somewhere yourself. Happy now? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Port Block
You could do a hackish work around and write a small server program that is hosted off your computer, maybe on a friend's host/server. Then, you could have your application on your local machine open some other port to connect to the off-site server, and have it send the email data to that server, and have the off site server send the emails. It's a mean, hackish work around, but if your host wont unblock port 25, you don't have many options short of finding a new ISP. - Craige -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with file reading
# [EMAIL PROTECTED] / 2007-01-05 17:40:49 +: Using mod_php with Apache will make the current directory the directory that contains the script being requested. I am assuming that the OP is trying to access the file from the script that is being requested and not an included file in a different directory - I should have been clearer on that. I never said anything about being relative to the document root - you pulled that out of somewhere yourself. You're right, sorry for the noise! -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to suppress error messages when using 'new mysqli(...)'
Hi, I am having this problem that I hope can be worked around. I make a connection to our MySQL database using the object version of mysqli. If access is denied because of an incorrect username or password, mysqli displays an error. Is there any way to suppress the error message? Here is the code I am using as a test case: ?php $db = null; $db = new mysqli('localhost', 'user', 'badpass', 'test'); if (mysqli_connect_errno()) { echo Database connection error.\n\n; exit(); } echo Connection successful.\n\n; ? This is the output I get: PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'user'@'localhost' (using password: YES) in /home/richard/dbtest.php on line 4 Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'user'@'localhost' (using password: YES) in /home/richard/dbtest.php on line 4 An error occurred while trying to connect to the database. I was expecting this: An error occurred while trying to connect to the database. Is there a way to prevent the error messages from being display so that the error can be handled in a nicer manner? Thank you. -- Richard Morris HDD Broker, Inc. Toll-Free: +1 866 960-3331 International: +1 250 474-6022 Fax: +1 250 474-6099 E-Mail: [EMAIL PROTECTED] Web Site: www.hddbroker.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Still problem with file reading
Hi, I wrote a while back saying of my problem... I tried to read a file I tried in a couple of ways and i posted a question on this newsgroup and a couple of people helped me (btw, thank you for help) and they suggested a few other ways I tried all possible ways and i could read a file it says: Failed to open stream! No such file or directory exists while im 100% sure the file exists path of the file: C:\Program Files\XAMPP\xampp\htdocs\test_folder\test1.txt htdocs is apache's root directory I tried setting the file there C:\Program Files\XAMPP\xampp\htdocs but still the same I have tried the URL approach the above aproach the plain test1.txt aproach as to relative to the DOCUMENT_ROOT i have tried everything but still it doesn't work I tried to use echo is_readable and file_exists and it returned negative, that the file does not exists but i say again the file does exist I didn't spelled it wrong I have checked a hundred times but always the same answer! PLEASE HELP, I'm learning PHP by a book and I have a whole section about file reading,writing... And I dont want to skip any part of the book! :) If you need more info, I'll be happy to answer any question. THANK YOU in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Still problem with file reading
You probably have a owner and/or permissions problem. Try setting the dir to 777. Read fopen() in the php manual. There are dozens of user notes on the subject. Delta Storm wrote: Hi, I wrote a while back saying of my problem... I tried to read a file I tried in a couple of ways and i posted a question on this newsgroup and a couple of people helped me (btw, thank you for help) and they suggested a few other ways I tried all possible ways and i could read a file it says: Failed to open stream! No such file or directory exists while im 100% sure the file exists path of the file: C:\Program Files\XAMPP\xampp\htdocs\test_folder\test1.txt htdocs is apache's root directory I tried setting the file there C:\Program Files\XAMPP\xampp\htdocs but still the same I have tried the URL approach the above aproach the plain test1.txt aproach as to relative to the DOCUMENT_ROOT i have tried everything but still it doesn't work I tried to use echo is_readable and file_exists and it returned negative, that the file does not exists but i say again the file does exist I didn't spelled it wrong I have checked a hundred times but always the same answer! PLEASE HELP, I'm learning PHP by a book and I have a whole section about file reading,writing... And I dont want to skip any part of the book! :) If you need more info, I'll be happy to answer any question. THANK YOU in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Still problem with file reading
Why don't you start by running file_exists() on another file in the same directory: if (file_exists(./findMe.php)) echo It's here; then, directory by directory, move towards where you want the real file to be read. If a move fails, check permissions as already suggested ( and capitalization, also, if on a *nix system ). Once you can accomplish this, fopen() should work just fine. David
[PHP] Question regarding include() and symlinks to directories
Hi let's say we have the follwing directory structure: directory test, with to subdirectories: a and b; both have ssi subdirectory; a has also a subdirectory c with an index.php file in it and in b we habe a symbolic link to a/c. On the shell it looks like this: , | /htdocs/testls -gG * | a: | total 8 | drwxr-xr-x 2 4096 Jan 4 20:55 c | drwxr-xr-x 2 4096 Jan 4 20:51 ssi | | b: | total 4 | lrwxrwxrwx 16 Jan 4 20:53 c - ../a/c | drwxr-xr-x 2 4096 Jan 4 20:53 ssi | ~/htdocs/testcat a/ssi/a.inc | In directory a | | ~/htdocs/testcat b/ssi/a.inc | In directory b ` As you see whe have an a.inc in each ssi. If we call now the index.php which does nothing more than to: include('../ssi/a.inc') what would you expect to read if you called b/c/index.php? I expected to read 'In directory b' but I read 'In directory a'. , | ~/htdocs/test(cd a/c php -f index.php ) | In directory a | | | ~/htdocs/test(cd b/c php -f index.php ) | In directory a ` In my opinion include() should respect symlinks to directories and not dereference them before finding the file to include. Or am I wrong here? The PHP version is 5.1.6 (will soon be updated). KP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Arrays help
On Fri, 2007-01-05 at 18:48 +0200, William Stokes wrote: Hello, I'm making a menu script that uses mysql, php and javascript to build a on mouse over dropdown menu to a page. I ran into some problems and would need help to get this working. (This is just the top level of the menusystem) 1. Get the toplevel links from DB, create array and put values there. $sql =SELECT * FROM x_menu WHERE menulevel = '1' ORDER BY 'id' ASC; Yeesh... should be using parent ID references. How does a sub-menu item know to which menu item it belongs? It has a parent right? What determines a root menu entry? No parent (or root node parent)... What is this wierd menulevel field? $result=mysql_query($sql); $num = mysql_num_rows($result); $cur = 1; while ($num = $cur) { $row = mysql_fetch_array($result); $id = $row[id]; $menulevel = $row[menulevel]; $linktext = $row[linktext]; $linkurl = $row[linkurl]; $toplevel =array($id, $menulevel, $linktext, $linkurl); $cur ++; } The first problem comes here. How can I create a different array at every iteration of the loop? Or how this should be done if the toplevel objects are echoed with foreach to the browser like this: Just create the array at each iteration of the loop... $foo = array( /* put some data in it */ ) $TopLevelCounter = 1; foreach ($toplevel as $value){ print menuSyS.addItem('labelItem', '$toplevel[2]', $TopLevelCounter, $width, '$colour1', '#aa', '$colour2');\n; $TopLevelCounter ++; } Now, because I just fill the same array again and again in the DB query all top level items finally contain the same text. So my question is how to query the DB and create the arrays so that it would be easy to refer to the data in the arrays when printing to screen. Do I have to make multidimensional arrays? Yes. If so how to implement them here and how they should be referred to when printing to browser? Use a foreach loop for the menu array. When you come across a menu item with children, use another foreach loop. Alternatively you can use recursion. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question regarding include() and symlinks to directories
reply at the bottom ... (Karl Pflästerer) wrote: Hi let's say we have the follwing directory structure: directory test, with to subdirectories: a and b; both have ssi subdirectory; a has also a subdirectory c with an index.php file in it and in b we habe a symbolic link to a/c. On the shell it looks like this: , | /htdocs/testls -gG * | a: | total 8 | drwxr-xr-x 2 4096 Jan 4 20:55 c | drwxr-xr-x 2 4096 Jan 4 20:51 ssi | | b: | total 4 | lrwxrwxrwx 16 Jan 4 20:53 c - ../a/c | drwxr-xr-x 2 4096 Jan 4 20:53 ssi | ~/htdocs/testcat a/ssi/a.inc | In directory a | | ~/htdocs/testcat b/ssi/a.inc | In directory b ` As you see whe have an a.inc in each ssi. If we call now the index.php which does nothing more than to: include('../ssi/a.inc') what would you expect to read if you called b/c/index.php? I expected to read 'In directory b' but I read 'In directory a'. , | ~/htdocs/test(cd a/c php -f index.php ) | In directory a | | | ~/htdocs/test(cd b/c php -f index.php ) | In directory a ` In my opinion include() should respect symlinks to directories and not dereference them before finding the file to include. Or am I wrong here? I have tested using your exact description and get the result, you can be fairly certain this is not something specific to your server/machine. I would tend to agree with your premise - but the php devs may have decided against this behaviour on purpose. although I must also say it's a rather convoluted setup, then again you may have a very good/neat reason for wanting to setup a directory akin to your example. because I was curious I tried the following, namely creating a subdir 'd' in each of dirs 'a' and 'b' and creating the index.php in 'a/d/' a then symlinking 'a/d/index.php' to 'b/d/index.php' and then running the same tests using the 'd' subdirs and guess what the correct [according to your expectation/opinion] 'ssi/a/inc' file was included I would suggest maybe asking the [EMAIL PROTECTED] mailing list as to whether they consider this a bug - and then file a bug report if asked. I might suggest also adding the following 2 lines to your test index.php - which might provide a little more insight: echo the current working directory is ,getcwd(),\n; echo I am the index file, my name is ,__FILE__,\n; additionally I changed the contents of your 'a.inc' files to the following: ?php echo I'm an included file, my name is ,__FILE__,\n; --- my conclusion: no real answers, one possible way to workaround the problem, possibly requires a little php-dev input. The PHP version is 5.1.6 (will soon be updated). KP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Some advice / points / help
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-05 16:37:27 +0100: Steven Macintyre wrote: http//steven.macintyre.name/arb/showlineups.jpg that URL make my browser end up here: http://www.w3.org/Protocols/ is .name even a top level domain? did that happen whilst I was sleeping? That's because of the http// (notice the missing colon). that'll teach me to actually look and read :-P name. is a valid TLD, just like museum. ... now .museum. I did know about, I've even been to one once ... but that was long ago, keep it to yourself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question regarding include() and symlinks to directories
On Fri, 2007-01-05 at 22:07 +0100, Jochem Maas wrote: reply at the bottom ... (Karl Pflästerer) wrote: Hi let's say we have the follwing directory structure: directory test, with to subdirectories: a and b; both have ssi subdirectory; a has also a subdirectory c with an index.php file in it and in b we habe a symbolic link to a/c. On the shell it looks like this: , | /htdocs/testls -gG * | a: | total 8 | drwxr-xr-x 2 4096 Jan 4 20:55 c | drwxr-xr-x 2 4096 Jan 4 20:51 ssi | | b: | total 4 | lrwxrwxrwx 16 Jan 4 20:53 c - ../a/c | drwxr-xr-x 2 4096 Jan 4 20:53 ssi | ~/htdocs/testcat a/ssi/a.inc | In directory a | | ~/htdocs/testcat b/ssi/a.inc | In directory b ` As you see whe have an a.inc in each ssi. If we call now the index.php which does nothing more than to: include('../ssi/a.inc') what would you expect to read if you called b/c/index.php? I expected to read 'In directory b' but I read 'In directory a'. , | ~/htdocs/test(cd a/c php -f index.php ) | In directory a | | | ~/htdocs/test(cd b/c php -f index.php ) | In directory a ` In my opinion include() should respect symlinks to directories and not dereference them before finding the file to include. Or am I wrong here? I have tested using your exact description and get the result, you can be fairly certain this is not something specific to your server/machine. I would tend to agree with your premise - but the php devs may have decided against this behaviour on purpose. PHP needs to dereference symlinks so it knows exactly where it is in case of security violations. This prevents symlinking into paths for which you don't have access... especially important on shared hosts. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still problem with file reading
On Fri, January 5, 2007 12:45 pm, Delta Storm wrote: I wrote a while back saying of my problem... I tried to read a file I tried in a couple of ways and i posted a question on this newsgroup and a couple of people helped me (btw, thank you for help) and they suggested a few other ways I tried all possible ways and i could read a file it says: Failed to open stream! No such file or directory exists while im 100% sure the file exists path of the file: C:\Program Files\XAMPP\xampp\htdocs\test_folder\test1.txt htdocs is apache's root directory I tried setting the file there C:\Program Files\XAMPP\xampp\htdocs but still the same I have tried the URL approach the above aproach the plain test1.txt aproach as to relative to the DOCUMENT_ROOT i have tried everything but still it doesn't work I tried to use echo is_readable and file_exists and it returned negative, that the file does not exists but i say again the file does exist I didn't spelled it wrong I have checked a hundred times but always the same answer! PLEASE HELP, I'm learning PHP by a book and I have a whole section about file reading,writing... And I dont want to skip any part of the book! :) If you need more info, I'll be happy to answer any question. Two suggestions: 1. Show us your exact code. Either copy/paste it into email, or provide a URL to the source code by copying (or better yet symlinking) to a .phps file (the 's' is not a typo) 2. Sometimes PHP will say the file is not there when what it REALLY means is I do not have permission to read that file or directory If PHP can't read the directory the file lives in, it can't even SEE the file to find out if it's there or not. Unfortunately, the permissions model in Windows changes with every release, so what this boils down to is poking around in endless windows in Properties on all the directories and files until you make things work. -- 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
Re: [PHP] How to suppress error messages when using 'new mysqli(...)'
On Fri, January 5, 2007 12:29 pm, Richard Morris wrote: I am having this problem that I hope can be worked around. I make a connection to our MySQL database using the object version of mysqli. If access is denied because of an incorrect username or password, mysqli displays an error. Is there any way to suppress the error message? To suppress a single error message in a single line you can use the @ operator in PHP: @this_code_errors_but_youll_never_see_the_error(...); To catch errors in a more general manner: http://php.net/set_error_handler Also, since mysqli is new-fangled, it's probably using that fancy try/catch/throw stuff, so you could PROBABLY wrap it in a try/catch block and that will somehow magically suppress the error message, maybe... I really don't know (or want to know) much about this, but you're welcome to research it and find out. -- 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
Re: [PHP] Some advice / points / help
On Fri, January 5, 2007 9:07 am, Steven Macintyre wrote: Hi guys, Some intelligent minds needed again ... I have the following schematic to work to ... http//steven.macintyre.name/arb/showlineups.jpg I need to fill that with data from a mysql table ... The format of the table is as follows; CREATE TABLE `kayasite_schedule` ( `id` int(11) NOT NULL auto_increment, `tid` int(6) NOT NULL, `showname` mediumtext NOT NULL, `day` varchar(10) NOT NULL, `blurb` longtext NOT NULL, `show_start` time NOT NULL default '00:00:00', `show_end` time NOT NULL default '00:00:00', `who` varchar(25) NOT NULL default '', `uid` int(6) NOT NULL, `pic` varchar(60) NOT NULL default '', UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM //I always get date_format directives wrong. Look them up. $query = select id, tid, showname, day, date_format(show_start, '%h%a'), date_format(show_end '%h%a') ; $query .= from kayasite_schedule ; $query .= order by day, show_start ; $shows = mysql_query($query, $connection) or trigger_error(mysql_error($connection) . $query); $last_day = ''; $columns = array(); //The interesting thing to note is that the layout of start-times //is actually very free-form //So don't try to structure it too much! echo tabletr valign=\top\tdbMon-Thu/bbr /; while (list($id, $tid, $showname, $day, $show_start, $show_end) = mysql_fetch_row($shows)){ if ($day !== $last_day){ echo /tdtdb$day/bbr /\n; $last_day = $day; } echo b$show_start-$show_end/bbr /\n; echo $showname, br /\n; echo br /\n; } echo /td/tr/table\n; -- 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] RE : [PHP] Still problem with file reading
You cite a windows path to your txt file.I warn you that you need to write c:\ as c:/, because the \ is the escapechar into a string so, to point to C:\Program Files\XAMPP\xampp\htdocs\test_folder\test1.txt from php you need: $file_path = C:\\Program Files\\XAMPP\\xampp\\htdocs\\test_folder\\test1.txt; (note I use and not ' or $file_path = C:/Program Files/XAMPP/xampp/htdocs/test_folder/test1.txt; and then you should be able to $data = file_get_contents($file_path); Vincent Dupont Ausy Belgium Message d'origine De: Richard Lynch [mailto:[EMAIL PROTECTED] Date: ven. 1/5/2007 22:43 À: Delta Storm Cc: php-general@lists.php.net Objet : Re: [PHP] Still problem with file reading On Fri, January 5, 2007 12:45 pm, Delta Storm wrote: I wrote a while back saying of my problem... I tried to read a file I tried in a couple of ways and i posted a question on this newsgroup and a couple of people helped me (btw, thank you for help) and they suggested a few other ways I tried all possible ways and i could read a file it says: Failed to open stream! No such file or directory exists while im 100% sure the file exists path of the file: C:\Program Files\XAMPP\xampp\htdocs\test_folder\test1.txt htdocs is apache's root directory I tried setting the file there C:\Program Files\XAMPP\xampp\htdocs but still the same I have tried the URL approach the above aproach the plain test1.txt aproach as to relative to the DOCUMENT_ROOT i have tried everything but still it doesn't work I tried to use echo is_readable and file_exists and it returned negative, that the file does not exists but i say again the file does exist I didn't spelled it wrong I have checked a hundred times but always the same answer! PLEASE HELP, I'm learning PHP by a book and I have a whole section about file reading,writing... And I dont want to skip any part of the book! :) If you need more info, I'll be happy to answer any question. Two suggestions: 1. Show us your exact code. Either copy/paste it into email, or provide a URL to the source code by copying (or better yet symlinking) to a .phps file (the 's' is not a typo) 2. Sometimes PHP will say the file is not there when what it REALLY means is I do not have permission to read that file or directory If PHP can't read the directory the file lives in, it can't even SEE the file to find out if it's there or not. Unfortunately, the permissions model in Windows changes with every release, so what this boils down to is poking around in endless windows in Properties on all the directories and files until you make things work. -- 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] What's this image tag for?
It makes it look like you displayed an advertisement, even though you shrunk it down to 1x1, so it's not generally noticeable to the user. Often used for tracking a user across domains for legitimate and illegitimate purposes, and for racking up pennies for showing ads without actually showing ads. Can't say for sure what this particular one does... That's the thing with showing somebody else's images/links/code on your site. You never quite know for sure what they are doing with it... On Fri, January 5, 2007 8:38 am, Skip Evans wrote: Hey all, I'm building a site for a client that is using this system called Linkshare to link to web sites for stores and it's one of those deals where they provide the link code so my client gets credit for sending the person to the store's site. Common enough, but there is one thing about their code I'm a bit confused about. Here is one of their links you put in your code to link to a store: a href=http://click.linksynergy.com/fs-bin/click?id=5sJlsTOpnzEofferid=115126.1505type=4subid=0;IMG alt=Sharper Image border=0 src=http://www.sharperimagespecials.com/banners/Promos/11_Nov06/fshproplus_1106_125x125.gif;/aIMG border=0 width=1 height=1 src=http://ad.linksynergy.com/fs-bin/show?id=5sJlsTOpnzEbids=115126.1505type=4subid=0; You'll notice they provide an image for you to display embedded in the a href=... /a tags, simple enough, but I can't figure out what that second IMG tag is for with the little 1 x 1 image. Since it's outside the actual link, I don't really see what it accomplishes. Anyone with experience with these things, or just any idea why it's there would sure help clear the fog from my brain on this one. Much thanks! -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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
Re: [PHP] Re:[PHP]clases en sesiones
WILD GUESS Search on php.net for __autoload I think that will let you figure out a way to get the auto_start session to automatically load your .class.php files, when it needs them. On Fri, January 5, 2007 7:04 am, deinet wrote: Hi, thank you chucre, but this not is the solution, the session.auto_start is On, I don't need use session_start() because it is automatic. This is my script: ? include_once 'usuario.class.php'; include_once 'carrito.class.php'; //session_start(); if (!session_id()) { session_start(); } if (!isset($_SESSION[ocarrito])){ $_SESSION[ocarrito] = new carrito(); } if (!isset($_SESSION[elusuario])){ $_SESSION[elusuario] = new usuario(); } ? for your class work, is necessary verify the session_id, like this: if (!session_id()) session_start(); 2007/1/5, deinet mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]: Hello list, i have a problem with sessions and class. I used to work with a server with session.auto_start=Off, and now I had to move all my sites to another server with session.auto_start=On, and I have this problem with the session: Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition carrito of the object you are trying to operate on was loaded _before_ the session was started in archive on line 43 The problem is the class is charged after the beginning of the session, but I don't know what to do to make it work, please help me. P.D.: To put the session.auto_start in Off is not a solution because the servers administrators don't admit that. I hope you will understand my problem, sorry for my english. Thank you very much, Carlos. -- Fernando Chure PSL/CE -- 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
Re: [PHP] Question regarding include() and symlinks to directories
Robert Cummings wrote: On Fri, 2007-01-05 at 22:07 +0100, Jochem Maas wrote: ... ` In my opinion include() should respect symlinks to directories and not dereference them before finding the file to include. Or am I wrong here? I have tested using your exact description and get the result, you can be fairly certain this is not something specific to your server/machine. I would tend to agree with your premise - but the php devs may have decided against this behaviour on purpose. PHP needs to dereference symlinks so it knows exactly where it is in case of security violations. This prevents symlinking into paths for which you don't have access... especially important on shared hosts. (what's a shared host? ;-) that explains why - open_base_dir (right?) - but it sounds shoddy, surely php should just be dereferencing within the confines of the security violation check. (and crap out if the check fails) but if the check succeeds the symlink referencing should honoured for the remainder of play? (or maybe that would be a nightmare to implement or just plain slow at runtime?) I realise open_base_dir fills a need left by the lack of ability to run as a webserver module in the context of a specific user on a per client basis - but really this kind of stuff needs to be done at the system level - in a perfect world php would not have to go near any security checks of this ilk. another thing is that I don't have open_base_dir set to anything - there is no restriction defined so there is can be no violation in the context of php's security check - so why do the check at all (and therefore why deference the symlink) and then there is the issue of the fact that I was testing this with the CLI, no freaking webserver in sight, and therefore running purely within the context of the user I was logged in as not the webserver's user. I realise I may be thinking rather simplistically about this so I welcome any insight :-) then again if I've raised some points which *might* be valid then maybe there is still a case for asking a php-dev's opinion? Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_writable() not working on PHP 5.1.6
On Fri, January 5, 2007 5:01 am, [EMAIL PROTECTED] wrote: I am running Fedora Core 6 with PHP 5.1.6 This little snippet will output the file is not writable: if (file_exists($file)) { if(!is_writeable($menu_filename)){ Did you really intend to switch from $file to $menu_filename ??? This *could* be the problem... echo the file is not writable; } } else echo The file does not exist; I have set the permissions to 777 for the file and also put group and user to apaches user. So that is not an issue. Are you using FULL PATHNAME for the file, or are you relying on the sometimes seemingly-random behaviour of current working directory? Use the FULL PATH and then you'll never have a problem. Other than the obvious one of moving files around and needing to change paths to match. :-) I have seen some bug reports on this, but haven't figured out how to solve it. Post references from http://bugs.php.net if you can. Is this a PHP 5.1.6 related bug? I haven't seen any fix or similar. Anything is possible, but something like this usually boils down to operator error with paths/permissions, rather than an actual bug. -- 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
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
On Thu, January 4, 2007 8:26 pm, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-04 18:45:07 -0600: On Thu, January 4, 2007 6:17 pm, Roman Neuhauser wrote: Ok, but what harm has been done? something() presumably did the fopen() for a reason, and couldn't work without the file handle and couldn't succeed anyway. Sure, the program leaves the normal path at this moment unexpectedly, and I can understand your frustration, but it has a bug, right? And although the program contains a bug it hasn't crashed, it just entered whatever orderly cleanup-and-exit path you had prepared. If fopen() didn't throw and the programmer didn't check the return value (catch the exception in your version), you'd be screwed not even knowing it. I think you brought a solid example of superiority of exceptions over returning error codes. over returning error codes and not DOING anything with them? Sure. Over well-written code that does something with the returned error codes? no. Just a stylistic difference really, if all developers consistently did their error-checking, and did it fairly well. Alas, they don't. That's exactly the point. Programmers don't check return values, programs have bugs. Programmers don't write try/catch blocks, programs have bugs. Same thing, different spelling. And, suppose it's NOT an fopen() that was the problem deep in the guts of the other guy's code. Now you are catching an error and you have NO IDEA what the [bleep] to do with it. If you really don't know what to do, then the right thing is probably an orderly exit of the application, no? What I should have said is that you are catching an error assuming that it is caused by X when it is caused by Y, and handling it inappropriately, because you cannot tell the difference between the errors you meant to catch, and the lower-level un-caught errors. At least with error code returns, you are USUALLY dealing with a specific way to get those codes (in PHP, not C-style shell-style pass-the-buck error code bubble-up). With error codes, you are USUALLY dealing with crashes and wrong behavior. Compiled programs segfault, programs in PHP produce unspecified numbers of E_NOTICE, E_WARNING, and quite easily drop dead with an E_FATAL before returning to where you'd be complaining that you don't know what to do with the error! I know exactly what to do with those errors in set_error_handler. :-) And, of course, you just ignored the question of another catch block doing something you wish it didn't do... I don't know what that means. I don't know how else to describe it, but will make one last stab: Pretend you are using some library of software with a lot of code, and you have a lot of your own code. There are try/catch blocks all over the place. The library does something with try/catch, and you don't like the way it handles the error. It's very difficult to change that behaviour. -- 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] Posix Shared Memory Support?
I have an application on Linux 2.6.9 which uses posix shared memory and I need to access the shared memory via a web page using php. Looks like PHP only supports System V shared memory, which isn't an option for me in this case. Thanks, -- David George Hark Technologies http://harktech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to suppress error messages when using 'new mysqli(...)'
Richard Lynch wrote: On Fri, January 5, 2007 12:29 pm, Richard Morris wrote: I am having this problem that I hope can be worked around. I make a connection to our MySQL database using the object version of mysqli. If access is denied because of an incorrect username or password, mysqli displays an error. Is there any way to suppress the error message? To suppress a single error message in a single line you can use the @ operator in PHP: @this_code_errors_but_youll_never_see_the_error(...); To catch errors in a more general manner: http://php.net/set_error_handler Also, since mysqli is new-fangled, it's probably using that fancy try/catch/throw stuff, so you could PROBABLY wrap it in a try/catch if that was the case his error would have mentioned something about an uncaught exception. as it stands I find the WARNING inappropriate - you are forced to use an @ if using this new-fangled object ALWAYS because a failed connection may occur (it's a valid but undesired program state, no?) and you have no way of checking this before the WARNING is spat out. in this case, mainly because the WARNING is being generated inside an object constructor, php/mysqli should be throwing an exception - which can be handled in a programmatically sane way ... e.g.: try { $db = new mysqli('localhost', 'user', 'badpass', 'test'); } catch (DBServerException) { echo I'm sorry our database server seems to be sleeping; exit; } catch (DBNotFoundException) { echo I'm sorry our database seems to have been deleted by a digruntled ex-sysadmin; exit; } catch (DBConnectException) { echo I'm sorry our database doesn't like the look of you - your not coming in; exit; } (and I seen/heard php devs state multiple times that failed object constructors should throw exceptions on failure - actually there not much else you can do given that return values are invalid from within the context of an object constructor) sidenote: where exactly do you put the @ to suppress the error in this line?: $db = new mysqli('localhost', 'user', 'badpass', 'test'); block and that will somehow magically suppress the error message, maybe... I really don't know (or want to know) much about this, but you're welcome to research it and find out. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re:[PHP]clases en sesiones
Richard Lynch wrote: WILD GUESS Search on php.net for __autoload I think that will let you figure out a way to get the auto_start session to automatically load your .class.php files, when it needs them. Nice idea, unfortunately it doesn't work that way. In order to have the __autoload function work properly for session'd objects it needs to be declared before the session is started. AFAIK when auto_start is on the session is started before any PHP is evaluated. I had to shift one of my frameworks around so that the __autoload was declared before session_start was called. I think Jochem may be on to something with the idea of using auto_prepend_file but I can't say for certain whether this is done before or after the auto_start. If it is before then you could declare the __autoload function in the prepended file and it should work. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posix Shared Memory Support?
David George wrote: I have an application on Linux 2.6.9 which uses posix shared memory and I need to access the shared memory via a web page using php. Looks like PHP only supports System V shared memory, which isn't an option for me in this case. is this what your looking for? http://php.net/manual/en/ref.shmop.php Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posix Shared Memory Support?
On 1/5/2007 5:41 PM, Jochem Maas wrote: David George wrote: I have an application on Linux 2.6.9 which uses posix shared memory and I need to access the shared memory via a web page using php. Looks like PHP only supports System V shared memory, which isn't an option for me in this case. is this what your looking for? http://php.net/manual/en/ref.shmop.php I thought shm and shmop were both system V? I may have misunderstood because in PHP they are accessed with a key, whereas POSIX shm is usually accessed via a name. Of course I could be wrong. :-) Thanks, -- David George Hark Technologies http://harktech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with copy() function
Hi, I'm trying to copy a file like this: copy(home/xxx/public_html/yyy/zzz/index.php, home/xxx/public_html/yyy/www/index.php) and have this error: *Warning*: Wrong parameter count for copy() in */home/.* Someone can help me please? Thanks,
Re: [PHP] IE, Word documents and Content Types
On Thu, January 4, 2007 8:09 pm, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-04 23:36:44 +0100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-03 15:48:31 -0600: On Wed, January 3, 2007 2:52 pm, Philip Thompson wrote: I have a form where a user can upload different types of documents. A valid file type they will be able to upload is a Word Document. However, when I view the $_FILES 'type' of a word document in Internet Explorer, it says it's type 'application/octet-stream' instead of 'application/msword' or 'application/vnd.ms-word'. It works fine in Firefox and Safari. Any ideas why IE does this and/or how I might be able to get around this? IE does this because MS is not interested in interoperability. Back this statements with some references, will you? do a quick google on anti-trust or something. there is plenty of evidence that Microsoft has and does continue to hamper and/or ignore interoperability on many fronts. Yes I know. I don't care. I was asking if he could back his statement that IE sends CT: a/o-s to harm interoperability. I don't care what MS did elsewhere. It's a theory, more than fact, obviously, as I wasn't involved in the meetings where MS engineers decided to design/code this specific bit of IE. Consider these facts, however: MS has brain-dead simple .xyz - file-type-handler Operating System. '.doc' extensions could have been trivially mapped to 'application/msword' or 'application/vnd.ms-word' Instead, IE falls back to a generic and content-devoid 'application/octet-stream' I suppose we could attribute this to sheer stupidity, but I'm going with malice as the operating factor. I'm simply fed up with his bashing MS for artificial reasons (like his foaming over the allegedly MS-originated Content-Disposition header). The Content-Disposition header was originated in MIME email. It was then abused by MS IIS for HTTP, for which it was never intended. And it *still* doesn't work across the board, no matter who made it up. *Especially* as the value carries no information since it's under the control of a (potentially) malicious user (he later mentioned that himself)! The net effect is that a naive programmer who would otherwise merrily fall prey to an exploit has to DTRT, which is inspect the file. That makes the whole thing a non-issue, and the opening remark was completely unwarranted, unasked for. I am sorry you find my posts inflammatory and non-issue with unwarranted and unasked for information. Please feel free to use the delete key. Note that application/octet-stream is valid for any kind of document whatsoever for an upload. For output, that would require the browser to download the document rather than attempt to display it. More on that here: http://richardlynch.blogspot.com/ To the OP: read that rant for amusement, but don't use the advice rlynch gives, it's nonsense. If you don't believe me, check the RFCs richard's practical experience in dealing with this things is nonsense? It's advice, not experience. he has been dealing with this kind of stuff [I'm referring just to his experience/work with php for the purpose of this reply] for longer than most of us have even heard of php - and for companies that most of us would give our right arm to work for. his rant is based on lots of experience on how to make things that work, rather than making that should work because they adhere to any/every given standard (but don't work because of any number of real world situations) I already wrote it: If you don't believe me, check the RFCs Really, please do it, I beg you. Read the RFCs I quoted in the last installment of the Content-Disposition discussion. Please take the time to figure out WHY QualComm wrote that RFC. Pay particular attention to the history of MIME EMAIL and HTTP server headers. Also take note: QualComm does not, to the best of my knowledge, have any invested stake in HTTP servers. MS does. MIME Email, QualComm has much invested. As with any documentation, pay attention to the players, and where their money comes from, while you read. Richard Lynch: It *HAS* to prompt you for a filename and do a download, by the original HTTP RFC spec. Please read more RFCs until you find the one about application/octet-stream If the UA opens up application/octet-stream it is in direct violation of one of the few HTTP standards that every other UA on the planet actually honors! The HTTP standard: Nothing, zip, nada. HTTP doesn't generally discuss presentation of entities contained in responses. Er. One of the earliest HTTP RFCs specifically states that the client program MUST treat application/octet-stream as a file to be downloaded. Not MAY, not SHOULD. MUST. Unfortunately, I cannot find it right now, as I keep finding these stupid MIME email crap RFCs instead, which apply to email. All I know is that the RFC number
Re: [PHP] Posix Shared Memory Support?
David George wrote: On 1/5/2007 5:41 PM, Jochem Maas wrote: David George wrote: I have an application on Linux 2.6.9 which uses posix shared memory and I need to access the shared memory via a web page using php. Looks like PHP only supports System V shared memory, which isn't an option for me in this case. is this what your looking for? http://php.net/manual/en/ref.shmop.php I thought shm and shmop were both system V? I may have misunderstood because in PHP they are accessed with a key, whereas POSIX shm is usually accessed via a name. Of course I could be wrong. :-) that goes for both of us, I was going on guess work really, based on the fact that this page mentions System V: http://www.php.net/manual/en/ref.sem.php but this pages mentions only 'Unix Shared Memory': http://php.net/manual/en/ref.shmop.php I was kind of hoping thse 2 extensions were not actually [doing] the exact same thing hiding behind 2 different (which seems silly) maybe a bigger egghead can shed some real light on the matter (including the discrepancy between key/name that you mentioned). Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with copy() function
R B wrote: Hi, I'm trying to copy a file like this: copy(home/xxx/public_html/yyy/zzz/index.php, home/xxx/public_html/yyy/www/index.php) ^ -- your missing a slash (although that shouldn't be the problem) and have this error: *Warning*: Wrong parameter count for copy() in */home/.* is that your actual code you posted?? Someone can help me please? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
On Thu, January 4, 2007 6:30 pm, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-04 16:19:19 -0600: On Thu, January 4, 2007 2:28 am, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-04 08:21:37 +0200: to grasp, so I use the English version. That may not be a problem for you, but it is for me. Your written English is very good. If you can understand what you wrote and can read replies (in English) from the list, you should have no problems understanding the manual. Well that's funny. As a native speaker, I often have trouble understanding the manual, especially the PCRE bits. I understand all the words, and all the sentences make perfect grammatical sense. But how they apply and what the implications are and WHEN they apply... A picture is worth of a thousand words. If you're confused, experiment! A good experimenting tool for Regex is The Regex Coach I can't recommend it highly enough. There's a couple places where it differs from PHP, and you have to escape stuff in PHP once you figure out what PCRE wants, but it's definitely a very good laboratory for PCRE. Sometimes, though, experimenting only leads to more and more frustration, as PCRE can seem quite random, rather than designed... -- 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
Re: [PHP] Question regarding include() and symlinks to directories
On Thu, January 4, 2007 2:47 pm, Karl Pflästerer wrote: In my opinion include() should respect symlinks to directories and not dereference them before finding the file to include. Or am I wrong here? The PHP version is 5.1.6 (will soon be updated). Honestly... My answer would be Don't do that. Use include_path so that you never need to use .. in your includes, and use full pathnames when you go to read -- 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
Re: [PHP] Question regarding include() and symlinks to directories
On Thu, January 4, 2007 2:47 pm, Karl Pflästerer wrote: In my opinion include() should respect symlinks to directories and not dereference them before finding the file to include. Or am I wrong here? The PHP version is 5.1.6 (will soon be updated). WHOOPS! My fingers slipped and I keyboarded to Send button. SORRY! ... and use full pathname when you go to read a file. Anything else is more like playing an Adventure Game than Programming. I can see arguments both ways for when to work out the symlink, so you'd have to take this up with Internals to get a change made... -- 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
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
# [EMAIL PROTECTED] / 2007-01-05 16:29:04 -0600: Pretend you are using some library of software with a lot of code, and you have a lot of your own code. There are try/catch blocks all over the place. The library does something with try/catch, and you don't like the way it handles the error. It's very difficult to change that behaviour. How does that differ from a situation where you're unhappy with a way a procedural library handles error situations? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posix Shared Memory Support?
On Fri, January 5, 2007 5:09 pm, Jochem Maas wrote: David George wrote: On 1/5/2007 5:41 PM, Jochem Maas wrote: David George wrote: I have an application on Linux 2.6.9 which uses posix shared memory and I need to access the shared memory via a web page using php. Looks like PHP only supports System V shared memory, which isn't an option for me in this case. is this what your looking for? http://php.net/manual/en/ref.shmop.php I thought shm and shmop were both system V? I may have misunderstood because in PHP they are accessed with a key, whereas POSIX shm is usually accessed via a name. Of course I could be wrong. :-) that goes for both of us, I was going on guess work really, based on the fact that this page mentions System V: http://www.php.net/manual/en/ref.sem.php but this pages mentions only 'Unix Shared Memory': http://php.net/manual/en/ref.shmop.php I was kind of hoping thse 2 extensions were not actually [doing] the exact same thing hiding behind 2 different (which seems silly) maybe a bigger egghead can shed some real light on the matter (including the discrepancy between key/name that you mentioned). The User Contributed Notes (*always* read those!) make it clear that shmod is NOT Sys V. It looks like it's not POSIX either, but I could be reading too much into it... Seems more similar to POSIX than Sys V, from my limited experience^H^H^H^H^H^H^H^H^H^H reading. :-) It's possible that name was changed to key just to be more consistent with the SysV stuff as a migration. -- 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
Re: [PHP] Re:[PHP]clases en sesiones
On Fri, January 5, 2007 4:36 pm, Stut wrote: Richard Lynch wrote: WILD GUESS Search on php.net for __autoload I think that will let you figure out a way to get the auto_start session to automatically load your .class.php files, when it needs them. Nice idea, unfortunately it doesn't work that way. In order to have the __autoload function work properly for session'd objects it needs to be declared before the session is started. AFAIK when auto_start is on the session is started before any PHP is evaluated. I had to shift one of my frameworks around so that the __autoload was declared before session_start was called. I think Jochem may be on to something with the idea of using auto_prepend_file but I can't say for certain whether this is done before or after the auto_start. If it is before then you could declare the __autoload function in the prepended file and it should work. Another possibility... Do a session_write_close() to kill of the auto_start session. Then, using session_name() and session_id() and session_set_cookie_params() force your OWN session control, completely independent of the auto_start session, which you can do AFTER you have done your include()s This should allow you to do what you want with the fewest conceptual changes, at the price of a bogus auto_start session being wastefully used by your webhost -- which seems pretty brain-dead to me, but there it is. -- 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
Re: [PHP] is_writable() not working on PHP 5.1.6
[EMAIL PROTECTED] wrote: Thanks for your answer, It was a bit late because we already disabled selinux just to try, and it worked :) But hopefully this could help someone that bumps into the same problem. On a live webserver, what security issues would disableing the selinux cause? Any? I have no idea - it's rather out of my league. I guess you'll have to ask the NSA, but be clever what you say - we're foreigners remember and never know when they might drag you to Guantanemo. PS - they hung Saddam for murdering 100,000 iraqi's ... thing is George is not that far off his score (http://www.iraqbodycount.org/) ... they have the death penalty in Texas right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with copy() function
On Fri, January 5, 2007 5:01 pm, R B wrote: I'm trying to copy a file like this: copy(home/xxx/public_html/yyy/zzz/index.php, home/xxx/public_html/yyy/www/index.php) and have this error: *Warning*: Wrong parameter count for copy() in */home/.* Someone can help me please? You are probably missing a quote in your real code... -- 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
Re: [PHP] How to suppress error messages when using 'new mysqli(...)'
On Fri, January 5, 2007 4:35 pm, Jochem Maas wrote: sidenote: where exactly do you put the @ to suppress the error in this line?: $db = new mysqli('localhost', 'user', 'badpass', 'test'); Since it is the 'new' operator which is issuing the WARNING, as far as I can tell, you should put it in like this: $db = @new mysqli(...); It's POSSIBLE to put @ in front like this: @$db = new mysqli(...); when the assignment itself issues the error, such as: @list($x, $y, $z) = each(array(1, 2)); //note the lack of a third element to assign to $z But it seems excessive here to need it in front of $db... -- 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
Re: [PHP] How to suppress error messages when using 'new mysqli(...)'
On Fri, January 5, 2007 4:35 pm, Jochem Maas wrote: Richard Lynch wrote: On Fri, January 5, 2007 12:29 pm, Richard Morris wrote: I am having this problem that I hope can be worked around. I make a connection to our MySQL database using the object version of mysqli. If access is denied because of an incorrect username or password, mysqli displays an error. Is there any way to suppress the error message? To suppress a single error message in a single line you can use the @ operator in PHP: @this_code_errors_but_youll_never_see_the_error(...); To catch errors in a more general manner: http://php.net/set_error_handler Also, since mysqli is new-fangled, it's probably using that fancy try/catch/throw stuff, so you could PROBABLY wrap it in a try/catch if that was the case his error would have mentioned something about an uncaught exception. With all the __toString and SPL array/object mumbo-jumbo going on, I never know what's going on anymore with these things... -- 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
Re: [PHP] Re:[PHP]clases en sesiones
Richard Lynch wrote: On Fri, January 5, 2007 4:36 pm, Stut wrote: Richard Lynch wrote: WILD GUESS Search on php.net for __autoload I think that will let you figure out a way to get the auto_start session to automatically load your .class.php files, when it needs them. Nice idea, unfortunately it doesn't work that way. In order to have the __autoload function work properly for session'd objects it needs to be declared before the session is started. AFAIK when auto_start is on the session is started before any PHP is evaluated. I had to shift one of my frameworks around so that the __autoload was declared before session_start was called. I think Jochem may be on to something with the idea of using auto_prepend_file but I can't say for certain whether this is done before or after the auto_start. If it is before then you could declare the __autoload function in the prepended file and it should work. Another possibility... Do a session_write_close() to kill of the auto_start session. Then, using session_name() and session_id() and session_set_cookie_params() force your OWN session control, completely independent of the auto_start session, which you can do AFTER you have done your include()s you sneaky oldskool b'std ;-) This should allow you to do what you want with the fewest conceptual changes, at the price of a bogus auto_start session being wastefully used by your webhost -- which seems pretty brain-dead to me, but there it is. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DEV] FastCGI optmized Windows build of 5.2.1RC2
Edin, Thanks for taking care of this! Andi -Original Message- From: Edin Kadribasic [mailto:[EMAIL PROTECTED] Sent: Friday, January 05, 2007 5:28 AM To: PHP internals; php-general@lists.php.net Subject: [PHP-DEV] FastCGI optmized Windows build of 5.2.1RC2 Hello, I have made a second build of 5.2.1RC2 for Windows with no thread safety enabled. This will only work for non threaded SAPIs such as CGI/FastCGI and CLI. The reason for this is that managing per thread state takes some CPU time from the main task of running PHP scripts making non thread safe PHP significantly faster. My initial benchmarks show 20-30% performance increase. This, together with the new fastcgi implementation for IIS from Microsoft should bring PHP performance on Windows to a new level. http://downloads.php.net/edink/php-5.2.1RC2-nts-Win32.zip (76aa90a7fdb0bd2eb62c1172501d6c6e) http://downloads.php.net/edink/pecl-5.2.1RC2-nts-Win32.zip (a493bdf794a5d44d749f6dcd2a55f9da) http://downloads.php.net/edink/php-debug-pack-5.2.1RC2-nts-Win32.zip (cbfd474fcdb61522d4c750b5c02d3df9) Edin -- PHP Internals - PHP Runtime Development Mailing List 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]clases en sesiones
Richard Lynch wrote: On Fri, January 5, 2007 4:36 pm, Stut wrote: Richard Lynch wrote: WILD GUESS Search on php.net for __autoload I think that will let you figure out a way to get the auto_start session to automatically load your .class.php files, when it needs them. Nice idea, unfortunately it doesn't work that way. In order to have the __autoload function work properly for session'd objects it needs to be declared before the session is started. AFAIK when auto_start is on the session is started before any PHP is evaluated. I had to shift one of my frameworks around so that the __autoload was declared before session_start was called. I think Jochem may be on to something with the idea of using auto_prepend_file but I can't say for certain whether this is done before or after the auto_start. If it is before then you could declare the __autoload function in the prepended file and it should work. Another possibility... Do a session_write_close() to kill of the auto_start session. Then, using session_name() and session_id() and session_set_cookie_params() force your OWN session control, completely independent of the auto_start session, which you can do AFTER you have done your include()s This should allow you to do what you want with the fewest conceptual changes, at the price of a bogus auto_start session being wastefully used by your webhost -- which seems pretty brain-dead to me, but there it is. Evil. Pure evil. Personally I'd rather go through the hassle of either mail-bombing my current host until they realise how stupid they're being, or simply switch host. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to suppress error messages when using 'new mysqli(...)'
Richard Lynch wrote: On Fri, January 5, 2007 4:35 pm, Jochem Maas wrote: Richard Lynch wrote: On Fri, January 5, 2007 12:29 pm, Richard Morris wrote: I am having this problem that I hope can be worked around. I make a connection to our MySQL database using the object version of mysqli. If access is denied because of an incorrect username or password, mysqli displays an error. Is there any way to suppress the error message? To suppress a single error message in a single line you can use the @ operator in PHP: @this_code_errors_but_youll_never_see_the_error(...); To catch errors in a more general manner: http://php.net/set_error_handler Also, since mysqli is new-fangled, it's probably using that fancy try/catch/throw stuff, so you could PROBABLY wrap it in a try/catch if that was the case his error would have mentioned something about an uncaught exception. With all the __toString and SPL array/object mumbo-jumbo going on, I never know what's going on anymore with these things... I found out that new mysqli doesn't throw an exception during it's construction. The way I figured out how to deal with it was to do this: $db =@ new mysqli('localhost', 'user', 'badpass', 'test'); With this in place no warning messages are displayed and then I can follow it up with a check for any errors using mysqli_connect_errno(). I was a little surprised to see it not use an exception as I thought that would be a better mechanism to know something is wrong when dealing with objects. Either way, it was a simple fix. I just want to thank Fernando Chure for pointing me in the right direction. -- Richard Morris Toll Free: (866) 960-3331 International: +1 250 474-6022 Fax: +1 250 474-6099 E-Mail: [EMAIL PROTECTED] Web Site: www.hddbroker.com
Re: [PHP] Posix Shared Memory Support?
On 1/5/2007 6:25 PM, Richard Lynch wrote: snip The User Contributed Notes (*always* read those!) make it clear that shmod is NOT Sys V. It looks like it's not POSIX either, but I could be reading too much into it... Seems more similar to POSIX than Sys V, from my limited experience^H^H^H^H^H^H^H^H^H^H reading. :-) It's possible that name was changed to key just to be more consistent with the SysV stuff as a migration. Ok, I just downloaded the source and looked at it. shmop is definitely using the System V Shared Memory interface. The user contributed notes say it differs from sysvshm. I take that to mean PHP's sysvshm module. shmop uses shmget, shmctl, and shmat which are the System V shm functions (need to use ipcs and ipcrm to manage them). Posix shared memory uses shm_open(), mmap(), and shm_unlink(). Guess I'll take the source for shmop and make posixshm and contribute it back to PHP. Unless someone else has already done it. Thanks for checking into this for me. Gotta love open source, when in doubt read the source. :-) -- David George Hark Technologies http://harktech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with displaying image
hi, im Budi, recently i have some problems here with displaying jpeg image in firefox browser. at first, when i tested my web page using IE it jsut works fine, but when i decided to test it using Firefox 2 the problem occurs. some of my images left undisplayed. but the things that i cant still understand is the other images (which is have the same type -- jpeg) are still displayed well. another unusual thing is : 1. when drag on the image it still indicating that there is an image, but with full white color. 2. say that my image file name is tes.jpg 200x200 px, then, when i copy the image location, it is still showing the right name, say fooofoo.com/tes.jpg, but when open that image (typing the name fooofoo.com/tes.jpg in the browsers address bar) my browsers window title displaying tes.jpg (GIF Image, 1x1 pixels) so.. what problem that i really dealt with? // im beginner in everything, including my english, so, i hope you can understand what i just wrote above.. // best, regard
Re: [PHP] Problem with displaying image
Budi Setiawan wrote: hi, im Budi, recently i have some problems here with displaying jpeg image in firefox browser. at first, when i tested my web page using IE it jsut works fine, but when i decided to test it using Firefox 2 the problem occurs. some of my images left undisplayed. but the things that i cant still understand is the other images (which is have the same type -- jpeg) are still displayed well. another unusual thing is : 1. when drag on the image it still indicating that there is an image, but with full white color. 2. say that my image file name is tes.jpg 200x200 px, then, when i copy the image location, it is still showing the right name, say fooofoo.com/tes.jpg, but when open that image (typing the name fooofoo.com/tes.jpg in the browsers address bar) my browsers window title displaying tes.jpg (GIF Image, 1x1 pixels) so.. what problem that i really dealt with? // im beginner in everything, including my english, so, i hope you can understand what i just wrote above.. // best, regard do you have an example/page that we can look at? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posix Shared Memory Support?
David George wrote: On 1/5/2007 6:25 PM, Richard Lynch wrote: snip The User Contributed Notes (*always* read those!) make it clear that shmod is NOT Sys V. It looks like it's not POSIX either, but I could be reading too much into it... Seems more similar to POSIX than Sys V, from my limited experience^H^H^H^H^H^H^H^H^H^H reading. :-) It's possible that name was changed to key just to be more consistent with the SysV stuff as a migration. Ok, I just downloaded the source and looked at it. shmop is definitely using the System V Shared Memory interface. The user contributed notes say it differs from sysvshm. I take that to mean PHP's sysvshm module. shmop uses shmget, shmctl, and shmat which are the System V shm functions (need to use ipcs and ipcrm to manage them). Posix shared memory uses shm_open(), mmap(), and shm_unlink(). Guess I'll take the source for shmop and make posixshm and contribute it back to PHP. Unless someone else has already done it. if you didn't find it and we didn't find it then it's not out there (in the open at least) but to be sure check with the guys at internals@lists.php.net ; and they might have some tips/pointers/gotchas for you. Thanks for checking into this for me. Gotta love open source, when in doubt read the source. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question regarding URL parameters
Hello, I have a newbie question regarding URL parameters. The PHP script I wrote need to read parameters passed in from a URL, so as an example http://my.domain/myscript.php?name=meage=27 and my script would use $name to get the value for name and $age to get the value for age. Everything was working fine until the sysadmin did a upgrade of the PHP server, and $name and $age both give me nothing. I am just wondering if the latest version of PHP has changed the way to access url parameters. If so, what would be the correct way of doing it? Please help. Thanks. - Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question regarding URL parameters
Hello Jim the Standing Bear, register_global try use $name=$_GET['name']; $age=$_GET['age']; Best regards, === At 2007-01-06, 10:05:40 you wrote: === Hello, I have a newbie question regarding URL parameters. The PHP script I wrote need to read parameters passed in from a URL, so as an example http://my.domain/myscript.php?name=meage=27 and my script would use $name to get the value for name and $age to get the value for age. Everything was working fine until the sysadmin did a upgrade of the PHP server, and $name and $age both give me nothing. I am just wondering if the latest version of PHP has changed the way to access url parameters. If so, what would be the correct way of doing it? Please help. Thanks. - Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = Nicholas Yim [EMAIL PROTECTED] 2007-01-06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question regarding URL parameters
You'll probably get 50 answers to this, but here's probably what happened. There's a setting called register globals that will turn your name=me and age=27 into $name = me and $age = 27. It used to be turned ON by default. This was generally considered to be bad security, so it now defaults to OFF. To get these variables, just use the $_GET system variable. $name = $_GET['name']; $age = $_GET['age']; Easy! Best of luck! -TG = = = Original message = = = Hello, I have a newbie question regarding URL parameters. The PHP script I wrote need to read parameters passed in from a URL, so as an example http://my.domain/myscript.php?name=meage=27 and my script would use $name to get the value for name and $age to get the value for age. Everything was working fine until the sysadmin did a upgrade of the PHP server, and $name and $age both give me nothing. I am just wondering if the latest version of PHP has changed the way to access url parameters. If so, what would be the correct way of doing it? Please help. Thanks. - Jim ___ 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
Re: [PHP] newbie question regarding URL parameters
On Fri, 2007-01-05 at 20:57 -0500, Jim the Standing Bear wrote: Hello, I have a newbie question regarding URL parameters. The PHP script I wrote need to read parameters passed in from a URL, so as an example http://my.domain/myscript.php?name=meage=27 and my script would use $name to get the value for name and $age to get the value for age. Everything was working fine until the sysadmin did a upgrade of the PHP server, and $name and $age both give me nothing. I am just wondering if the latest version of PHP has changed the way ^ Ummm, pull your head out of the sand (or whatever other dark recess you have it stuck in). Register globals ini setting was defaulted to off about 3 or more years ago :/ Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question regarding URL parameters
Thanks, everyone. Yeah, I really need to dig myself out of the sand. :D On 1/5/07, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2007-01-05 at 20:57 -0500, Jim the Standing Bear wrote: Hello, I have a newbie question regarding URL parameters. The PHP script I wrote need to read parameters passed in from a URL, so as an example http://my.domain/myscript.php?name=meage=27 and my script would use $name to get the value for name and $age to get the value for age. Everything was working fine until the sysadmin did a upgrade of the PHP server, and $name and $age both give me nothing. I am just wondering if the latest version of PHP has changed the way ^ Ummm, pull your head out of the sand (or whatever other dark recess you have it stuck in). Register globals ini setting was defaulted to off about 3 or more years ago :/ Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- -- Standing Bear Has Spoken -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question regarding URL parameters
Robert Cummings wrote: On Fri, 2007-01-05 at 20:57 -0500, Jim the Standing Bear wrote: Hello, I have a newbie question regarding URL parameters. The PHP script I wrote need to read parameters passed in from a URL, so as an example http://my.domain/myscript.php?name=meage=27 and my script would use $name to get the value for name and $age to get the value for age. Everything was working fine until the sysadmin did a upgrade of the PHP server, and $name and $age both give me nothing. I am just wondering if the latest version of PHP has changed the way ^ Ummm, pull your head out of the sand (or whatever other dark recess you have it stuck in). Register globals ini setting was defaulted to off about 3 or more years ago :/ Cheers, Rob. Mate is this kind of behaviour really neccesary? Some people don't know everything that you do, and he has already stated he isn't responsible for administering the server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with displaying image
do you have an example/page that we can look at? here is one of them : http://10.126.11.246/schematics2007/main_logic.php and the image URL : http://10.126.11.246/schematics2007/image/banner/mainlog.jpg all will be be displayed in an unusual manner in FFox.. thanks
Re: [PHP] Problem with displaying image
Budi Setiawan wrote: do you have an example/page that we can look at? here is one of them : http://10.126.11.246/schematics2007/main_logic.php and the image URL : http://10.126.11.246/schematics2007/image/banner/mainlog.jpg all will be be displayed in an unusual manner in FFox.. thanks OK, how about something that is hosted on a public server??? 10.x.x.x is private :( Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, curl and aol addressbook import problem
Hi, I am desparately looking for a solution for importing address book from aol webmail to my browser. I found some commercial solution (such as, http://svetlozar.net) which was done using cURL. But couldnt find any php classes to implement it. Anyone can help me how to implement this ? As far as i could go is this code which can successfully log in to aol : ?php $login = 'abcd'; $pass = '1234'; $url = https://my.screenname.aol.com/_cqr/login/login.psp;; $user_agent = Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0); $postvars = screenname=.$login.password=.$pass.submitSwitch=1siteId=aolcomprodmcState=initializedauthLev=1; $cookie = cookies/test; @unlink($cookie); $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_CAINFO, E:/aol_grab/curl-ca-bundle.crt); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec ($ch); file_get_contents(http://d02.webmail.aol.com/22250/aol/en-us/Suite.aspx;); //print_r(curl_getinfo($ch)); //echo \n\ncURL error number: .curl_errno($ch); //echo \n\ncURL error: . curl_error($ch); curl_close ($ch); unset($ch); echo PRE.htmlentities($content); ? and I was able to log in to it successfully..the output is as below HTML Code: preHTTP/1.0 200 OK Date: Wed, 20 Dec 2006 09:31:47 GMT Server: Apache Pragma: No-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: RSP_COOKIE=type=23amp;name=SXFiYWxuYXZlZA%3D%3Damp;stype =100; Domain=.aol.com; Expires=Sat, 15-Dec-2007 09:31:47 GMT; Path=/ Set-Cookie: SNS_TT=AAppcWJhbG5hdmVkRYkDAwAAEAABADzZgUOA2md9Z10 eZXKIoglrjoCeCrbwVT0pwLi4eVd8mDKn%2BVKco%2FRRi%2F5 rNTsm5vMgc1UlyzEDQ%2BXxYeQ%3D; Domain=my.screenname.aol.com; Expires=Fri, 19-Jan-2007 09:31:47 GMT; Path=/ Set-Cookie: MC_CMP_ESK=NonSense; Domain=.aol.com; Path=/ Set-Cookie: SNS_SKWAT=diAyLjAga2lkIDEgdDF5SDJxYmROcHhxN0FHbEh6 V1hDMmJLc0djPQ%3D%3D-b0o7Q4xCU%2F39IESbtoTm9mBdSL47fxxUnmD4X1Pn82%2Fol% 2B03%2BtxOLynThOHeQsaL5xdmerZnzZT34sulbmtlrezipaPL kGMHiXQBbDQpCZb53AT7EPRZ2sWEvYfeP0a9rf%2FDn%2F2ER3 2h0rLA5%2B7UMs6NmHharvEJQCFkTVYUHyjUa6btTL8twXF4Jm siXUX0uXBuOHibk6Pl9lKtKJj779U%2BiXUU4oBiSpcg6Q%2FY KJUvGNsk4cjDURDglR9SsQL0iCJ2S1w4YGA%3D; Domain=screenname.aol.com ; Path=/ Set-Cookie: SNS_SC=diAxLjAga2lkIDEgQ2R1RXNSeDJGTDZ3SmNNMXRkMUt hQ25kdEhZPQ%3D%3D-dwYGM2lmn8IsM5qbIMCD4cF876hxn28LVqa2CrLuSNY%2FClN5 8OIf%2Bg1GbhwkQ8c4%2BoZTQgtZjkKb0gS4x9xI2v1HzzyBQU 7%2FUGAuyvgR9SWpqJmjzOpUJldJIJHA43WwgahRfwXBKCp8Ci B%2FPMLCa4bSsNdpgaEVUgc%2FrdXCOOU%3D; Domain=my.screenname.aol.com; Path=/ Set-Cookie: SNS_L0=diAxLjAga2lkIDEgUUpsdVVrUWtzb21SOFhPdGo1SFo 2R2swQzJzPQ%3D%3D-RgHJcTIzyWP%2BQIb7S6lE%2BpdmQv1XVmfP; Domain= screenname.aol.com ; Expires=Tue, 15-Jul-2036 09:31:47 GMT; Path=/ Set-Cookie: SNS_LDC=1 aolcomprod 1 1166607107 0 1166607107 0; Domain= my.screenname.aol.com; Expires=Fri, 19-Jan-2007 09:31:47 GMT; Path=/ Set-Cookie: SNS_AA=asrc=2amp;sst=1166607107; Domain=.aol.com; Path=/ P3P: CP=PHY ONL PRE STA CURi OUR IND Content-length: 1505 Cache-control: no-cache Content-language: en-US Content-type: text/html;charset=utf-8 Connection: close lt;htmlgt;lt;headgt;lt;titlegt;Scr But i dont know how to fetch the email addresses from the contact list. Any one can help me on this ? Thanks in Advance Naved