[PHP] REALLY NEWB QUESTION - include issue
Trying to include() a script from another domain on my server and it won't let me do it. I'm getting this error. open_basedir restriction in effect. Operation not permitted etc... Please help and stop laughing at me. Thanks ahead, T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] REALLY NEWB QUESTION - include issue
Code segment? Exact error message? (Is there more context?) Include (/file); Function.include/a]: open_basedir restriction in effect. File(/var/www/vhosts/domain/httpdocs/file.php) is not within the allowed path(s): (/var/www/vhosts/differentdomain/httpdocs:/tmp) in /var/www/vhosts/samedifferentdomain/httpdocs/custom-template.php on line 151 It's my server and it makes perfect security sense because the package I'm using allows me to resell but, I don't care about that particular security issue since I'm not reselling. I'm assuming it's something in php.ini. It's a linux machine. I'm not sure what else there is to tell. Thanks, T -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 1:08 AM To: TS Subject: RE: [PHP] REALLY NEWB QUESTION - include issue Code segment? Exact error message? (Is there more context?) I probably don't have the answer to answer you, but make like a little easier for those who might by giving them some information to work with. David -- Original Message -- From: TS [EMAIL PROTECTED] To: php-general@lists.php.net Date: Tue, 1 Jul 2008 00:50:50 -0600 Subject: [PHP] REALLY NEWB QUESTION - include issue Trying to include() a script from another domain on my server and it won't let me do it. I'm getting this error. open_basedir restriction in effect. Operation not permitted etc... Please help and stop laughing at me. Thanks ahead, T -- 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] REALLY NEWB QUESTION - include issue
Quoting TS [EMAIL PROTECTED]: Code segment? Exact error message? (Is there more context?) Include (/file); Function.include/a]: open_basedir restriction in effect. File(/var/www/vhosts/domain/httpdocs/file.php) is not within the allowed path(s): (/var/www/vhosts/differentdomain/httpdocs:/tmp) in /var/www/vhosts/samedifferentdomain/httpdocs/custom-template.php on line 151 It's my server and it makes perfect security sense because the package I'm using allows me to resell but, I don't care about that particular security issue since I'm not reselling. I'm assuming it's something in php.ini. It's a linux machine. I'm not sure what else there is to tell. Thanks, T -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 1:08 AM To: TS Subject: RE: [PHP] REALLY NEWB QUESTION - include issue Code segment? Exact error message? (Is there more context?) I probably don't have the answer to answer you, but make like a little easier for those who might by giving them some information to work with. David -- Original Message -- From: TS [EMAIL PROTECTED] To: php-general@lists.php.net Date: Tue, 1 Jul 2008 00:50:50 -0600 Subject: [PHP] REALLY NEWB QUESTION - include issue Trying to include() a script from another domain on my server and it won't let me do it. I'm getting this error. open_basedir restriction in effect. Operation not permitted etc... Please help and stop laughing at me. Thanks ahead, T Looks like your hosting is blocking files included outside of the webroot. If you have root access you could change this. If you wanted to. But security is not a bad thing :) To allow opening of remote url's you can enable 'allow_url_fopen' in php.ini. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
Quoting Brian Dunning [EMAIL PROTECTED]: I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matching array element, so I end up with this: $arr = array( array('blue', 4), array('orange', 7), array('green', 6)); Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. Just loop through the array to update. And use in_array to check if the key to update exists. Then you can do $array[$key][1] = $newValue. Something like this maybe: function updateArray($array, $update) { list($updateKey, $updateValue) = $update; foreach ($array as $key = $subArray) { if (in_array($updateKey, $subArray)) { $array[$key][1] = $updateValue; } } } updateArray($arr, $new_value); var_dump($arr); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
Brian Dunning wrote: I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matching array element, so I end up with this: $arr = array( array('blue', 4), array('orange', 7), array('green', 6)); Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. It's rather easy: for ($i=0; $icount($arr); $i++) { if ($arr[$i][0] == $new_array[0]) { $arr[$i][1] += $new_array[1]; break; // Optional - means the first orange found will be // updated only } } -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] REALLY NEWB QUESTION - include issue
To allow opening of remote url's you can enable 'allow_url_fopen' in php.ini. This isn't a remote url though. It's a local path. Looking for something similar to crossdomain.xml file for Flash if anyone is familiar with that. Thanks, T -Original Message- From: Thijs Lensselink [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 1:58 AM To: php-general@lists.php.net Subject: RE: [PHP] REALLY NEWB QUESTION - include issue Quoting TS [EMAIL PROTECTED]: Code segment? Exact error message? (Is there more context?) Include (/file); Function.include/a]: open_basedir restriction in effect. File(/var/www/vhosts/domain/httpdocs/file.php) is not within the allowed path(s): (/var/www/vhosts/differentdomain/httpdocs:/tmp) in /var/www/vhosts/samedifferentdomain/httpdocs/custom-template.php on line 151 It's my server and it makes perfect security sense because the package I'm using allows me to resell but, I don't care about that particular security issue since I'm not reselling. I'm assuming it's something in php.ini. It's a linux machine. I'm not sure what else there is to tell. Thanks, T -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 1:08 AM To: TS Subject: RE: [PHP] REALLY NEWB QUESTION - include issue Code segment? Exact error message? (Is there more context?) I probably don't have the answer to answer you, but make like a little easier for those who might by giving them some information to work with. David -- Original Message -- From: TS [EMAIL PROTECTED] To: php-general@lists.php.net Date: Tue, 1 Jul 2008 00:50:50 -0600 Subject: [PHP] REALLY NEWB QUESTION - include issue Trying to include() a script from another domain on my server and it won't let me do it. I'm getting this error. open_basedir restriction in effect. Operation not permitted etc... Please help and stop laughing at me. Thanks ahead, T Looks like your hosting is blocking files included outside of the webroot. If you have root access you could change this. If you wanted to. But security is not a bad thing :) To allow opening of remote url's you can enable 'allow_url_fopen' in php.ini. -- 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: FW: [PHP] REALLY NEWB QUESTION - include issue
-Original Message- From: Thijs Lensselink [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 1:58 AM To: php-general@lists.php.net Subject: RE: [PHP] REALLY NEWB QUESTION - include issue Quoting TS [EMAIL PROTECTED]: Code segment? Exact error message? (Is there more context?) Include (/file); Function.include/a]: open_basedir restriction in effect. File(/var/www/vhosts/domain/httpdocs/file.php) is not within the allowed path(s): (/var/www/vhosts/differentdomain/httpdocs:/tmp) in /var/www/vhosts/samedifferentdomain/httpdocs/custom-template.php on line 151 /var/www/vhosts/domain/httpdocs/file.php is not in the paths you allowed: /var/www/vhosts/differentdomain/httpdocs or /tmp So you'll need to adjust it through your apache config or you can disable it just for that domain as well. See http://www.php.net/manual/en/configuration.changes.php#configuration.changes.apache and http://www.php.net/manual/en/features.safe-mode.php#ini.open-basedir -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: FW: [PHP] REALLY NEWB QUESTION - include issue
Quoting TS [EMAIL PROTECTED]: To allow opening of remote url's you can enable 'allow_url_fopen' in php.ini. This isn't a remote url though. It's a local path. Looking for something similar to crossdomain.xml file for Flash if anyone is familiar with that. Thanks, T -Original Message- From: Thijs Lensselink [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 1:58 AM To: php-general@lists.php.net Subject: RE: [PHP] REALLY NEWB QUESTION - include issue Quoting TS [EMAIL PROTECTED]: Code segment? Exact error message? (Is there more context?) Include (/file); Function.include/a]: open_basedir restriction in effect. File(/var/www/vhosts/domain/httpdocs/file.php) is not within the allowed path(s): (/var/www/vhosts/differentdomain/httpdocs:/tmp) in /var/www/vhosts/samedifferentdomain/httpdocs/custom-template.php on line 151 It's my server and it makes perfect security sense because the package I'm using allows me to resell but, I don't care about that particular security issue since I'm not reselling. I'm assuming it's something in php.ini. It's a linux machine. I'm not sure what else there is to tell. Thanks, T -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 1:08 AM To: TS Subject: RE: [PHP] REALLY NEWB QUESTION - include issue Code segment? Exact error message? (Is there more context?) I probably don't have the answer to answer you, but make like a little easier for those who might by giving them some information to work with. David -- Original Message -- From: TS [EMAIL PROTECTED] To: php-general@lists.php.net Date: Tue, 1 Jul 2008 00:50:50 -0600 Subject: [PHP] REALLY NEWB QUESTION - include issue Trying to include() a script from another domain on my server and it won't let me do it. I'm getting this error. open_basedir restriction in effect. Operation not permitted etc... Please help and stop laughing at me. Thanks ahead, T Looks like your hosting is blocking files included outside of the webroot. If you have root access you could change this. If you wanted to. But security is not a bad thing :) To allow opening of remote url's you can enable 'allow_url_fopen' in php.ini. In your first post you mentioned something about a remote domain. So i assumed you were including a remote page. But Chris already answered your question. Just add the paths so they are accessible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encription
On Mon, 30 Jun 2008 14:39:04 -0500 Will Fitch [EMAIL PROTECTED] wrote: Have you considered mcrypt then base64? Thanks, i was completely forgetting mcrypt... that's what i need :) -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: VOGLIA DI VACANZA ? * Prenota la tua vacanza in un Costa Hotels! * Hotels e Agriturismo nella Riviera Romagnola. Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8032d=1-7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: can you give me example of website using postgresql database?
paragasu wrote: I develop a relatively large, in-house application using PostgreSQL that I can't wait to convert to MySQL. well, you should give me a reason why you want to do this. What exactly scares you about Sun/MySQL? personally, it is not about i am scared. i am still continue to use mysql for several project i did few years ago and continue support and upgrade it. for the moment, after making internet survey for few month i found out it might be worth my time trying to explore the concept of trigger etc. don't get me wrong. it is not about mysql vs postgresql. it is just something i believe worth to explore.. opps... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strategy to protect images
On Sun, 15 Jun 2008 13:48:28 +0200 Stefano Esposito [EMAIL PROTECTED] wrote: Hi all, i have to forbid users of my site to view images directly (i.e. writing the image URL in the address bar) but they'd be able viewing them from the pages of the site. What's the best way of doing it, or something similar? Is there a common strategy using PHP? Thank you for any hint :-) Ciao, Stefano Thanks for all of your hints :) Here's my solution: 1) disable contextmenu on the images to protect using javascript (just to discourage less determined people) 2) for other purposes, the page containing images to protect, is brought to users through an ajax request, so they can't so-easily look at the source (not with browser's normal 'view source' anyway... they would need something like firebug). 3) use a script to get image data (as someone on the list suggested), checking for the right $_SERVER['HTTP_REFERER'] (i know... it's not so trustworthy... if anyone has a better idea, i'll be glad to listen to :)) 4) encrypt the relative path of the image on the fly, using mcrypt with a key generated on the login and then pass it encoded whit base64_encode (with a little workaround for '+', '/' and '=' chars) to the image-reading script. So, even if someone can get to the source, they'll end up whit an encrypted id of which they don't know neither the key nor the encryption method nor even what it's supposed to represent (if some database id or a path). I think that's a good way to prevent image theft... well, unless the thief uses the print screen key... What's your point of view? Ciao, Stefano -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Caschi, abbigliamento e accessori per la moto a prezzi convenienti, solo su Motostorm.it Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7850d=1-7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strategy to protect images
Umm have you ever thought about watermark-ing it? (In case its not a part of your website or something..) On 01/07/2008, Stefano Esposito [EMAIL PROTECTED] wrote: On Sun, 15 Jun 2008 13:48:28 +0200 Stefano Esposito [EMAIL PROTECTED] wrote: Hi all, i have to forbid users of my site to view images directly (i.e. writing the image URL in the address bar) but they'd be able viewing them from the pages of the site. What's the best way of doing it, or something similar? Is there a common strategy using PHP? Thank you for any hint :-) Ciao, Stefano Thanks for all of your hints :) Here's my solution: 1) disable contextmenu on the images to protect using javascript (just to discourage less determined people) 2) for other purposes, the page containing images to protect, is brought to users through an ajax request, so they can't so-easily look at the source (not with browser's normal 'view source' anyway... they would need something like firebug). 3) use a script to get image data (as someone on the list suggested), checking for the right $_SERVER['HTTP_REFERER'] (i know... it's not so trustworthy... if anyone has a better idea, i'll be glad to listen to :)) 4) encrypt the relative path of the image on the fly, using mcrypt with a key generated on the login and then pass it encoded whit base64_encode (with a little workaround for '+', '/' and '=' chars) to the image-reading script. So, even if someone can get to the source, they'll end up whit an encrypted id of which they don't know neither the key nor the encryption method nor even what it's supposed to represent (if some database id or a path). I think that's a good way to prevent image theft... well, unless the thief uses the print screen key... What's your point of view? Ciao, Stefano -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Caschi, abbigliamento e accessori per la moto a prezzi convenienti, solo su Motostorm.it Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7850d=1-7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
At 9:35 AM +0100 7/1/08, Richard Heyes wrote: Brian Dunning wrote: Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. It's rather easy: for ($i=0; $icount($arr); $i++) { if ($arr[$i][0] == $new_array[0]) { $arr[$i][1] += $new_array[1]; break; // Optional - means the first orange found will be // updated only } } -- Richard Heyes Small correction: for ($i=0; $icount($arr); $i++) { if ($arr[$i][0] == $new_value [0]) { $arr[$i][1] += $new_value [1]; break; // Optional - means the first orange found will be // updated only } } See here: http://www.webbytedd.com/b1/array/ But, I'm not sure as to why you (Brian) would want to do that anyway. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
Small correction: Which is...? -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
On Tue, Jul 1, 2008 at 8:50 AM, Richard Heyes [EMAIL PROTECTED] wrote: Small correction: Which is...? -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Look at the link he sent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
Brian Dunning wrote: I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matching array element, so I end up with this: $arr = array( array('blue', 4), array('orange', 7), array('green', 6)); Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. What have you tried so far? Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
I think the problem is easier... and also the solutions doing a for instead of foreach are not good solutions because if the array is not index-consecutive the loop fails. So, if you has an array with the colors as indexes and the integer value X as the value for that position of the array, updating is very easy. You have an array such as: $array = array( ); $array['blue'] = 4; $array['orange'] = 5; $array['green'] = 6; So if you want to update the key 'orange' with a new value $new_value is as easy as: $array['orange'] += $new_value; As the new value is being passed as an array so as to update it, it should be like: $new_value = array('orange',2); So you have to do a foreach in the $new_value array like: foreach ($new_value as $key = $value){ if(in_array($key,$array)){ $array[$key] += $value; } } I think that solution works and is the easiest way to do it. Cheers, Roberto On 01/07/2008, tedd [EMAIL PROTECTED] wrote: At 9:35 AM +0100 7/1/08, Richard Heyes wrote: Brian Dunning wrote: Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. It's rather easy: for ($i=0; $icount($arr); $i++) { if ($arr[$i][0] == $new_array[0]) { $arr[$i][1] += $new_array[1]; break; // Optional - means the first orange found will be // updated only } } -- Richard Heyes Small correction: for ($i=0; $icount($arr); $i++) { if ($arr[$i][0] == $new_value [0]) { $arr[$i][1] += $new_value [1]; break; // Optional - means the first orange found will be // updated only } } See here: http://www.webbytedd.com/b1/array/ But, I'm not sure as to why you (Brian) would want to do that anyway. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset in foreach breaks recrusion
That's true. My fault. I forgot the recrusion call ;-) I think that is the better solution so far, and it is far far away (better) that the one you posted at first On 01/07/2008, David Sky [EMAIL PROTECTED] wrote: Hey, Can't use your example, as you check weather $sorted is empty, if it is - run the foreach and return, but on next recursion when it's not empty - do nothing :) Though I found how to cut a few seconds (on very big array), removing the first if, and adding a $return=true to functions' parameters, and in future calls set it to false: function recur($array, $sorted=array(), $pid=0, $level=0, $return=true) { foreach($array as $id=$parent) { if($pid===$parent) { $sorted[$id]= $level; unset($array[$id]); if(in_array($id,$array)){ recur($array, $sorted, $id, $level+1, false); } } } if($return){return $sorted;} } Well, I guess that's it, I'm sure I can think of another way to cut execution time, but, well, I don't have much time for it :) Thanks all! David. On Mon, Jun 30, 2008 at 8:24 AM, Roberto Costumero Moreno [EMAIL PROTECTED] wrote: Hi David, That's good work ;-) You are right that my example would only return one entry for each parent. Didn't realized of that. I know the local copies you create in the recursive calls is not the best solution in efficiency, but lots of times it is better to have local copies of the array (in time of execution of the foreach) that the reference to it, and the loss is not so big. I think i would not be able to improve that function a lot, but if I come up a solution I will tell you. One little advice, you can get the same functionality saving a little bit of code, and having one variable less, so the function should look like this (avoiding the use of $return variable and makes the code clearer for later revisions): /** * Recursion * @array as ( id = parent ) * return array as ( id = level ) maintaining arrays' initial order */ function recur($array, $sorted=array(), $pid=0, $level=0) { if(empty($sorted)){ foreach($array as $id=$parent) { if($pid===$parent) { $sorted[$id]= $level; unset($array[$id]); if(in_array($id,$array)){ recur($array, $sorted, $id, $level+1); } } } return $sorted; } } Note that return $sorted is inside the if so as to avoid returning an empty array. If you don't mind returning an empty array put it down the bracket. And thanks to you. I signed up to the mailing list only two days ago (although I've been working with PHP for at least 3 years), and you are the first person I help successfully (or almost). Don't ever regret of asking problems in the mailing list and always wait about 24 hours for someone to answer ;-) There are lots of people from all over the world so if the one helping your case is in the opposite part of the world and is asleep... it takes time ;-) Cheers, Roberto On Mon, Jun 30, 2008 at 17:38, David Sky [EMAIL PROTECTED] wrote: Hey Robero, Thanks for the answer, the none recursion function is a good idea, although as provided in your example if would only return one entry from each parent it can get to and it only can get to few, depends on how the array is sorted. Basically you can make it work if you would sort the array from small to high by parent value, but in my case I will get this array pre-sorted by date, so I can't change the order. Now, about your other suggestion, yes, it will work without the reference. I used the reference to avoid creating local copies of the array. I solved the problem by removing the reference just as you said, but then there would be to many recursions, so I ended up with this function: /** * Recursion * @array as ( id = parent ) * return array as ( id = level ) maintaining arrays' initial order */ function recur($array, $sorted=array(), $pid=0, $level=0) { if(empty($sorted)){$return=true;}else{$return=false;} foreach($array as $id=$parent) { if($pid===$parent) { $sorted[$id]= $level; unset($array[$id]); if(in_array($id,$array)){ recur($array, $sorted, $id, $level+1); } } } if($return){return $sorted;} }
RE: [PHP] Re: can you give me example of website using postgresql database?
Then in that case I agree. I develop an inherited, large-scale, in-house system that utilizes PostgreSQL. It does the job, but I can't wait until I get the time to convert it to MySQL. As with any RDMS, Postgres has its advantages: controlling sequences, aggregates, custom operators, custom types, etc. MySQL has focused on performance while PostgreSQL primarily focused on features. Now it seems both are going in each other's starting direction. -Original Message- From: paragasu [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 4:51 AM To: php-general@lists.php.net Subject: [PHP] Re: can you give me example of website using postgresql database? paragasu wrote: I develop a relatively large, in-house application using PostgreSQL that I can't wait to convert to MySQL. well, you should give me a reason why you want to do this. What exactly scares you about Sun/MySQL? personally, it is not about i am scared. i am still continue to use mysql for several project i did few years ago and continue support and upgrade it. for the moment, after making internet survey for few month i found out it might be worth my time trying to explore the concept of trigger etc. don't get me wrong. it is not about mysql vs postgresql. it is just something i believe worth to explore.. opps... -- 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] can you give me example of website using postgresql database?
Will Fitch wrote: The purchase of MySQL by Sun should actually give you more comfort. They will be able to attach more money and developers to the project. Remember, the advantage of open-source is not just that it's free, but that you may freely modify it for your purpose (keeping in mind the restrictions of individual licenses). I'm not sure what you're looking for in a RDMS, but the simple fact that you are having a hard time finding a robust, live site that uses PostgreSQL should scare you more than Sun's purchase of MySQL. I develop a relatively large, in-house application using PostgreSQL that I can't wait to convert to MySQL. WHY? What a waste of time. More big MySQL sites have had problems in the past that Postgres, but the only reason to change TO MySQL is if it is going to give something in return. What do you think it will give you? Personally I'll stick with Firebird even though switching between engines is very simple in my case, using ADOdb ;) paragasu - http://www.bitweaver.org/wiki/bitweaver_sites see if you can spot which engine is being used for which site :) MySQL is somewhat low on the list when it comes to testing :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
At 1:50 PM +0100 7/1/08, Richard Heyes wrote: Small correction: Which is...? -- Richard Heyes You missed it a second time? :-) It's not, new_array[], but new_value[]. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] can you give me example of website using postgresql database?
Assuming that a system should switch RDBMSs is a waste of time without knowing the reason is asinine. Using NDB clustering is a primary reason for switching. PostgreSQL is only currently PLANNING built-in replication, much less clustering. Not to mention that the existing system is not taking advantage of ANY PostgreSQL functionality that is not already present in MySQL. So gaining performance and clustering is reason enough for me. -Original Message- From: Lester Caine [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 8:53 AM To: php-general@lists.php.net Subject: Re: [PHP] can you give me example of website using postgresql database? Will Fitch wrote: The purchase of MySQL by Sun should actually give you more comfort. They will be able to attach more money and developers to the project. Remember, the advantage of open-source is not just that it's free, but that you may freely modify it for your purpose (keeping in mind the restrictions of individual licenses). I'm not sure what you're looking for in a RDMS, but the simple fact that you are having a hard time finding a robust, live site that uses PostgreSQL should scare you more than Sun's purchase of MySQL. I develop a relatively large, in-house application using PostgreSQL that I can't wait to convert to MySQL. WHY? What a waste of time. More big MySQL sites have had problems in the past that Postgres, but the only reason to change TO MySQL is if it is going to give something in return. What do you think it will give you? Personally I'll stick with Firebird even though switching between engines is very simple in my case, using ADOdb ;) paragasu - http://www.bitweaver.org/wiki/bitweaver_sites see if you can spot which engine is being used for which site :) MySQL is somewhat low on the list when it comes to testing :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset in foreach breaks recrusion
David Sky wrote: Hey, Can't use your example, as you check weather $sorted is empty, if it is - run the foreach and return, but on next recursion when it's not empty - do nothing :) Though I found how to cut a few seconds (on very big array), removing the first if, and adding a $return=true to functions' parameters, and in future calls set it to false: function recur($array, $sorted=array(), $pid=0, $level=0, $return=true) { foreach($array as $id=$parent) { if($pid===$parent) { $sorted[$id]= $level; unset($array[$id]); if(in_array($id,$array)){ recur($array, $sorted, $id, $level+1, false); } } } if($return){return $sorted;} } Well, I guess that's it, I'm sure I can think of another way to cut execution time, but, well, I don't have much time for it :) Why are you returning anything at all? I mean, you are making your function call like this right? $dataOut = recur($dataIn, array(), 3); You are passing the second argument as a reference already, why not keep it that way at the top level. Do this instead. recur($dataIn, $dataOut, 3); Now, from what you function looks like, it would return $sorted through the reference $dataOut. Then you can get rid of the extra if($return){return $sorted;} thing. Remove the last argument from the function definition and you should now be a little faster also. Thanks all! David. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
Roberto Costumero Moreno wrote: I think the problem is easier... and also the solutions doing a for instead of foreach are not good solutions because if the array is not index-consecutive the loop fails. So, if you has an array with the colors as indexes and the integer value X as the value for that position of the array, updating is very easy. You have an array such as: $array = array( ); $array['blue'] = 4; $array['orange'] = 5; $array['green'] = 6; So if you want to update the key 'orange' with a new value $new_value is as easy as: $array['orange'] += $new_value; As the new value is being passed as an array so as to update it, it should be like: $new_value = array('orange',2); So you have to do a foreach in the $new_value array like: foreach ($new_value as $key = $value){ if(in_array($key,$array)){ $array[$key] += $value; } } I think that solution works and is the easiest way to do it. Cheers, Roberto On 01/07/2008, tedd [EMAIL PROTECTED] wrote: At 9:35 AM +0100 7/1/08, Richard Heyes wrote: Brian Dunning wrote: Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. It's rather easy: for ($i=0; $icount($arr); $i++) { if ($arr[$i][0] == $new_array[0]) { $arr[$i][1] += $new_array[1]; break; // Optional - means the first orange found will be // updated only } } -- Richard Heyes Small correction: for ($i=0; $icount($arr); $i++) { if ($arr[$i][0] == $new_value [0]) { $arr[$i][1] += $new_value [1]; break; // Optional - means the first orange found will be // updated only } } See here: http://www.webbytedd.com/b1/array/ But, I'm not sure as to why you (Brian) would want to do that anyway. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php All of that is fine and dandy, but what if he can't change the structure of the array? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array problem
You missed it a second time? :-) My sight is awful - if you don't point it out, chances are I won't see it. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset in foreach breaks recrusion
Jim, Read the first emails, your idea was my initial design, eg. $sorted= array(); recrusion($array, $sorted); var_dump( $sorted ); It's not a nice solution due to a need to create variable before the call. Using my final function it will return sorted array into new variable eg $sorted = recur($array); It's easier to use and understand :) Thanks for your reply! On Tue, Jul 1, 2008 at 6:34 AM, Jim Lucas [EMAIL PROTECTED] wrote: David Sky wrote: Hey, Can't use your example, as you check weather $sorted is empty, if it is - run the foreach and return, but on next recursion when it's not empty - do nothing :) Though I found how to cut a few seconds (on very big array), removing the first if, and adding a $return=true to functions' parameters, and in future calls set it to false: function recur($array, $sorted=array(), $pid=0, $level=0, $return=true) { foreach($array as $id=$parent) { if($pid===$parent) { $sorted[$id]= $level; unset($array[$id]); if(in_array($id,$array)){ recur($array, $sorted, $id, $level+1, false); } } } if($return){return $sorted;} } Well, I guess that's it, I'm sure I can think of another way to cut execution time, but, well, I don't have much time for it :) Why are you returning anything at all? I mean, you are making your function call like this right? $dataOut = recur($dataIn, array(), 3); You are passing the second argument as a reference already, why not keep it that way at the top level. Do this instead. recur($dataIn, $dataOut, 3); Now, from what you function looks like, it would return $sorted through the reference $dataOut. Then you can get rid of the extra if($return){return $sorted;} thing. Remove the last argument from the function definition and you should now be a little faster also. Thanks all! David. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can you give me example of website using postgresql database?
Will Fitch wrote: Assuming that a system should switch RDBMSs is a waste of time without knowing the reason is asinine. Using NDB clustering is a primary reason for switching. PostgreSQL is only currently PLANNING built-in replication, much less clustering. Not to mention that the existing system is not taking advantage of ANY PostgreSQL functionality that is not already present in MySQL. So gaining performance and clustering is reason enough for me. You gave no reasons initially ... and with facilities being added all the time, the reason to change may evaporate before a change is made? Have you looked at the alternatives as well since you seem to have some work to do rather than simply changing the data source? I'm being told I have to switch to MSSQL or Oracle but the customers can't provide justification to do that as yet and since we are only up to a couple of gigabytes of data replicated across machines I am always looking for informed explanations of why a switch is necessary ;) i.e. why one database may be more appropriate than another. The lack of proper comparison information does make it difficult at times :( -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] V4 Vs V5 Issue
Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways -- Have a bit of code that looks like this . . body leftmargin=2 marginwidth=2 topmargin=2 marginheight=2 onResize=blockDefault(); content; include($settings['app_dir'].'/js/core_js.php'); echo content script LANGUAGE=Javascript window.onload=initEditor /script table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=framed . . . -- Under My V4 Sever it works fine .the Java script loads and an all is fine. On my V5 Sever I get the following Errors Line: 68 Char: 21 Error: Syntax error Code: 0 URL: .. and then Line: 600 Char: 11 Error 'initEditor' is undefined Code 0 URL Now the thing is, when I view source code in IE off both servers the the core_js.php is being read and is visible, the initEditor function is there for all the world to see. If I rename the initEditor function on the V5 version and add a new empty function I still get the same error messages. I dont have much hair and I am tearing out the rest as we speak :).I have no idea where to look so I am just hoping someone can point me in the right direction. Like I said in the beginning I think it must be a configuration issue but I just dont know what or where. Anyways TIA Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] can you give me example of website using postgresql database?
Touché, salesman. -Original Message- From: Lester Caine [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 10:21 AM To: php-general@lists.php.net Subject: Re: [PHP] can you give me example of website using postgresql database? Will Fitch wrote: Assuming that a system should switch RDBMSs is a waste of time without knowing the reason is asinine. Using NDB clustering is a primary reason for switching. PostgreSQL is only currently PLANNING built-in replication, much less clustering. Not to mention that the existing system is not taking advantage of ANY PostgreSQL functionality that is not already present in MySQL. So gaining performance and clustering is reason enough for me. You gave no reasons initially ... and with facilities being added all the time, the reason to change may evaporate before a change is made? Have you looked at the alternatives as well since you seem to have some work to do rather than simply changing the data source? I'm being told I have to switch to MSSQL or Oracle but the customers can't provide justification to do that as yet and since we are only up to a couple of gigabytes of data replicated across machines I am always looking for informed explanations of why a switch is necessary ;) i.e. why one database may be more appropriate than another. The lack of proper comparison information does make it difficult at times :( -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] V4 Vs V5 Issue
Neil [EMAIL PROTECTED] wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look Configuration issue of what? I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways !-- SNIP -- Line: 68 Char: 21 Error: Syntax error Code: 0 It's probably all JS, but if this is a PHP page that you've actually cut/pasted from, look at lines 67 and 68 and check to make sure you have a ; at the end of line 67. Or a ) or a } or some other closing brace that you could be using previously. Otherwise, check with a javascript list to see what the javascript errors are. HTH, Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] V4 Vs V5 Issue
On Tue, Jul 1, 2008 at 11:27 AM, Neil [EMAIL PROTECTED] wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways -- Have a bit of code that looks like this . . body leftmargin=2 marginwidth=2 topmargin=2 marginheight=2 onResize=blockDefault(); content; include($settings['app_dir'].'/js/core_js.php'); echo content script LANGUAGE=Javascript window.onload=initEditor /script table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=framed . . . -- Under My V4 Sever it works fine .the Java script loads and an all is fine. On my V5 Sever I get the following Errors Line: 68 Char: 21 Error: Syntax error Code: 0 URL: .. and then Line: 600 Char: 11 Error 'initEditor' is undefined Code 0 URL Now the thing is, when I view source code in IE off both servers the the core_js.php is being read and is visible, the initEditor function is there for all the world to see. If I rename the initEditor function on the V5 version and add a new empty function I still get the same error messages. I dont have much hair and I am tearing out the rest as we speak :).I have no idea where to look so I am just hoping someone can point me in the right direction. Like I said in the beginning I think it must be a configuration issue but I just dont know what or where. Anyways TIA Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Compare your rendered output from the v4 and the v5. You might see something in the php5 version that has some sort of error displaying to screen that causes a parse error inside your JS block that wasn't there before. Something might have changed about the way your settings variable works too. Do a var_dump($settings['app_dir'].'/js/core_js.php') and see if it actually prints out a real path to a file that exists. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] V4 Vs V5 Issue
Thanks Wolf I have replied to all, I hope that is the correct way here. A configuration issue on the PHP V5 Server . thats my problem, I dont know where I should be looking. The source code, php and JS is absolutely identical on both machines. Cheers Neil At 01:36 AM 2/07/2008, Wolf wrote: Neil [EMAIL PROTECTED] wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look Configuration issue of what? I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways !-- SNIP -- Line: 68 Char: 21 Error: Syntax error Code: 0 It's probably all JS, but if this is a PHP page that you've actually cut/pasted from, look at lines 67 and 68 and check to make sure you have a ; at the end of line 67. Or a ) or a } or some other closing brace that you could be using previously. Otherwise, check with a javascript list to see what the javascript errors are. HTH, Wolf -- 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] V4 Vs V5 Issue
Hi Thanks I have tested the path, that works fine. I set up a dummy file on the same path just to check that, it found that and printed out some echo'd text from that file. I can see the content of core_js.php file in the the IE view source view. At 01:43 AM 2/07/2008, Eric Butera wrote: On Tue, Jul 1, 2008 at 11:27 AM, Neil [EMAIL PROTECTED] wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways -- Have a bit of code that looks like this . . body leftmargin=2 marginwidth=2 topmargin=2 marginheight=2 onResize=blockDefault(); content; include($settings['app_dir'].'/js/core_js.php'); echo content script LANGUAGE=Javascript window.onload=initEditor /script table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=framed . . . -- Under My V4 Sever it works fine .the Java script loads and an all is fine. On my V5 Sever I get the following Errors Line: 68 Char: 21 Error: Syntax error Code: 0 URL: .. and then Line: 600 Char: 11 Error 'initEditor' is undefined Code 0 URL Now the thing is, when I view source code in IE off both servers the the core_js.php is being read and is visible, the initEditor function is there for all the world to see. If I rename the initEditor function on the V5 version and add a new empty function I still get the same error messages. I dont have much hair and I am tearing out the rest as we speak :).I have no idea where to look so I am just hoping someone can point me in the right direction. Like I said in the beginning I think it must be a configuration issue but I just dont know what or where. Anyways TIA Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Compare your rendered output from the v4 and the v5. You might see something in the php5 version that has some sort of error displaying to screen that causes a parse error inside your JS block that wasn't there before. Something might have changed about the way your settings variable works too. Do a var_dump($settings['app_dir'].'/js/core_js.php') and see if it actually prints out a real path to a file that exists. -- 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] Simple array problem
At 3:44 PM +0100 7/1/08, Richard Heyes wrote: You missed it a second time? :-) My sight is awful - if you don't point it out, chances are I won't see it. -- Richard Heyes I'm just as bad, I only saw the error after I tried to get your code to run. I thought I had another way, but your's was better. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute command line as a different user
My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute command line as a different user
On Tue, Jul 1, 2008 at 1:17 PM, Matt palermo [EMAIL PROTECTED] wrote: My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I did a quick check on php.net, there is a post on there that talks about using sudo: @exec(echo 'apache' | /usr/bin/sudo -u mail -S /var/www/html/mailset.sh $name); You may want to read thru it, php.net/exec, go to the user notes. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
[PHP] Re: Execute command line as a different user
Matt palermo wrote: My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt There are several ways on *nix systems. I would probably write a shell script to do the deletions and setuid of the script to root or a user with rights to delete the files. Then just exec() the shell script. On winbloze you can use the runas command. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Execute command line as a different user
Okay, I'll have to look into that. I have very limited knowledge with shell scripts. You wouldn't have an example of one that can do what I need do you? Thanks, Matt Shawn McKenzie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt palermo wrote: My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt There are several ways on *nix systems. I would probably write a shell script to do the deletions and setuid of the script to root or a user with rights to delete the files. Then just exec() the shell script. On winbloze you can use the runas command. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strategy to protect images
On Tuesday 01 July 2008 13:34:28 Nitsan Bin-Nun wrote: Umm have you ever thought about watermark-ing it? (In case its not a part of your website or something..) heh, this dude got way to much time on his hands... ;D On 01/07/2008, Stefano Esposito [EMAIL PROTECTED] wrote: On Sun, 15 Jun 2008 13:48:28 +0200 Stefano Esposito [EMAIL PROTECTED] wrote: Hi all, i have to forbid users of my site to view images directly (i.e. writing the image URL in the address bar) but they'd be able viewing them from the pages of the site. What's the best way of doing it, or something similar? Is there a common strategy using PHP? Thank you for any hint :-) Ciao, Stefano Thanks for all of your hints :) Here's my solution: 1) disable contextmenu on the images to protect using javascript (just to discourage less determined people) 2) for other purposes, the page containing images to protect, is brought to users through an ajax request, so they can't so-easily look at the source (not with browser's normal 'view source' anyway... they would need something like firebug). 3) use a script to get image data (as someone on the list suggested), checking for the right $_SERVER['HTTP_REFERER'] (i know... it's not so trustworthy... if anyone has a better idea, i'll be glad to listen to :)) 4) encrypt the relative path of the image on the fly, using mcrypt with a key generated on the login and then pass it encoded whit base64_encode (with a little workaround for '+', '/' and '=' chars) to the image-reading script. So, even if someone can get to the source, they'll end up whit an encrypted id of which they don't know neither the key nor the encryption method nor even what it's supposed to represent (if some database id or a path). I think that's a good way to prevent image theft... well, unless the thief uses the print screen key... What's your point of view? Ciao, Stefano -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Caschi, abbigliamento e accessori per la moto a prezzi convenienti, solo su Motostorm.it Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7850d=1-7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Execute command line as a different user
Shawn McKenzie wrote: Matt palermo wrote: My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt There are several ways on *nix systems. I would probably write a shell script to do the deletions and setuid of the script to root or a user with rights to delete the files. Then just exec() the shell script. On winbloze you can use the runas command. -Shawn Actually, a quick search shows that many *nix may not let you setuid on a executable script, so sudo would be an approach. You should be able to setup the apache user in the sudoers file so that it can only run a very specif command, such as 'rm /path/to/file/to/delete'. Then just use that: exec('sudo rm /path/to/file/to/delete'); -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strategy to protect images
On Tue, 01 Jul 2008 19:59:20 +0200 Børge Holen [EMAIL PROTECTED] wrote: On Tuesday 01 July 2008 13:34:28 Nitsan Bin-Nun wrote: Umm have you ever thought about watermark-ing it? (In case its not a part of your website or something..) heh, this dude got way to much time on his hands... ;D This dude has commitments, and watermark is not an option. -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Vasco � tornato! Sul tuo cellulare Il mondo che vorrei Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?midw49d=1-7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Splitting up long URLs
I have a web page that lists most recent comments in a left margin. Sometimes people post long URLs, or even just really really long words, that force that margin to display way too wide, screwing up the page layout. Is there a way to make sure URLs or other text in a string gets split up so this doesn't happen? If there's a CSS solution that's better than a PHP solution I'll take that too. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Splitting up long URLs
On Tue, 2008-07-01 at 13:26 -0700, Brian Dunning wrote: I have a web page that lists most recent comments in a left margin. Sometimes people post long URLs, or even just really really long words, that force that margin to display way too wide, screwing up the page layout. Is there a way to make sure URLs or other text in a string gets split up so this doesn't happen? If there's a CSS solution that's better than a PHP solution I'll take that too. :-) You need to manually chop them. The wordwrap() function should be able to do it for you. Although, you'll have issues with HTML if I recall correctly. CSS will not do it for you unless you want to have overflow and either hide the overflow or have scrollbars appear. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Splitting up long URLs
-Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 3:27 PM To: php-general@lists.php.net Subject: [PHP] Splitting up long URLs I have a web page that lists most recent comments in a left margin. Sometimes people post long URLs, or even just really really long words, that force that margin to display way too wide, screwing up the page layout. Is there a way to make sure URLs or other text in a string gets split up so this doesn't happen? If there's a CSS solution that's better than a PHP solution I'll take that too. :-) STFW: http://www.w3.org/TR/css3-text/#white-space ...doesn't say much in the article about whether or not it will break up words rather than lines, but it's worth a shot. Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Execute command line as a different user
I'm using the following command and I'm not getting any feedback: exec(echo 'adminPass' | sudo -u adminAccount -S whoami, $f, $r); Both $f and $r don't contain any data. This leads me to believe that the command is not being run for whatever reason. Is there something wrong with this command? Is there a different way to do it? Thanks, Matt Matt palermo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Execute command line as a different user
Matt Palermo wrote: I'm using the following command and I'm not getting any feedback: exec(echo 'adminPass' | sudo -u adminAccount -S whoami, $f, $r); Both $f and $r don't contain any data. This leads me to believe that the command is not being run for whatever reason. Is there something wrong with this command? Is there a different way to do it? set up sudo to run that particular command for that particular user with no password. adminAccountALL = NOPASSWD: /usr/bin/whoami -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: V4 Vs V5 Issue
Neil wrote: Hi Thanks I have tested the path, that works fine. I set up a dummy file on the same path just to check that, it found that and printed out some echo'd text from that file. I can see the content of core_js.php file in the the IE view source view. debugging javascript in IE is about as much fun as slamming your head in a car door. try it in firefox with firebug installed, it should give you much better feedback about what is going on. -jsd- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CURL de-bugging: So why am I not getting the results page on the target site?
I didn't get any brave response on this, but given the other thread on 'encription' I was wondering could anyone decrypt the __VIEWSTATE string at the end of this message. It is part of the input page whose results page I am trying to retrieve back onto my server for further php work. I replicated the source from that input page onto a page on my server, and when I click the submit button it correctly goes to the target results page, on the other site though, however it did not work without the whole of the string below. The experiment proved though that without the __VIEWSTATE the results page will not return. So I am just wondering, as I have not been able to repeat this using curl, what the is included in that string. There's a challenge for anyone with whatever resources it takes. John ioannes wrote: For those that like CURL and calendars. ... VIEWSTATE curl_setopt($ch,
Re: [PHP] Splitting up long URLs
If you want to do it on the php side, I would do something like this: a href=$fullURLsubstr($fullURL, 0, 9)/a It would provide a valid link using the full url, but chop off everything after the 10th character and replace with a Nate On Tue, Jul 1, 2008 at 3:45 PM, Boyd, Todd M. [EMAIL PROTECTED] wrote: -Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 3:27 PM To: php-general@lists.php.net Subject: [PHP] Splitting up long URLs I have a web page that lists most recent comments in a left margin. Sometimes people post long URLs, or even just really really long words, that force that margin to display way too wide, screwing up the page layout. Is there a way to make sure URLs or other text in a string gets split up so this doesn't happen? If there's a CSS solution that's better than a PHP solution I'll take that too. :-) STFW: http://www.w3.org/TR/css3-text/#white-space ...doesn't say much in the article about whether or not it will break up words rather than lines, but it's worth a shot. Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FIFO files on PHP?
I'm trying to build a queue out using FIFO files (someone on the MySQL list suggested checking them out instead of using the database), but I'm running into a problem because of the synchronous fwrite call. Here's the code: $fifoFile = '/tmp/fifo'; if (!file_exists($fifoFile)) { posix_mkfifo($fifoFile, 0600); } $fp = fopen($fifoFile, w); fwrite($fp, content); fclose($fp); But this will block until something actually reads the pipe. Is there any way to write to the pipe, then go away as opposed to waiting until something consumes it? Otherwise, I may just go back to a database table. Thanks, Waynn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: V4 Vs V5 Issue
Hi Unfortunately this editor does not run in any other browsers. however I do not believe that it is the java script that is the problem because it runs and works and has done so for years on the current and earlier V4 servers. Cheers Neil At 07:10 AM 2/07/2008, Jon Drukman wrote: Neil wrote: Hi Thanks I have tested the path, that works fine. I set up a dummy file on the same path just to check that, it found that and printed out some echo'd text from that file. I can see the content of core_js.php file in the the IE view source view. debugging javascript in IE is about as much fun as slamming your head in a car door. try it in firefox with firebug installed, it should give you much better feedback about what is going on. -jsd- -- 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] V4 Vs V5 Issue
Neil wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways -- Have a bit of code that looks like this . . body leftmargin=2 marginwidth=2 topmargin=2 marginheight=2 onResize=blockDefault(); content; include($settings['app_dir'].'/js/core_js.php'); echo content script LANGUAGE=Javascript window.onload=initEditor /script table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=framed . . . -- Under My V4 Sever it works fine .the Java script loads and an all is fine. On my V5 Sever I get the following Errors Line: 68 Char: 21 Error: Syntax error Code: 0 URL: .. and then Line: 600 Char: 11 Error 'initEditor' is undefined Code 0 URL Now the thing is, when I view source code in IE off both servers the the core_js.php is being read and is visible, the initEditor function is there for all the world to see. If I rename the initEditor function on the V5 version and add a new empty function I still get the same error messages. I dont have much hair and I am tearing out the rest as we speak :).I have no idea where to look so I am just hoping someone can point me in the right direction. Like I said in the beginning I think it must be a configuration issue but I just dont know what or where. Anyways TIA Cheers Neil Two things come to mind. 1) Is their any PHP inside you javascript file that needs to be parsed? And if so, is the new V5 install configured in such a way that it parses/processes javascript files? where the old install was processing javascript files. This would be a configuration issue from the actual web server POV. i.e. Apache, lighttpd, etc... Once reconfigured, make sure you restart your web server. 2) Is your code using short tags in php? This allows the programmer to use ? instead of ?php . In this case you might want to enable short tags in the new version of PHP. I think php 5 comes with short tags disabled and version 4 had it enabled by default. This setting would be found in your php.ini file on the server. If you need to change the setting, make sure you restart your httpd server before testing. Just a couple of thoughts -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: V4 Vs V5 Issue
Neil wrote: Hi Unfortunately this editor does not run in any other browsers. however I do not believe that it is the java script that is the problem because it runs and works and has done so for years on the current and earlier V4 servers. http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038displaylang=en Not as powerful as firebug but it gives you a lot more help than the IE script debugger. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can you give me example of website using postgresql database?
i agree, salesman can make a lot of difference influence costumer. sometimes they are really a headache because salesman not really a technical person and know nothing about technical info. always suggesting something complicated and irrelevant feature to costumer. wtf On 7/1/08, Will Fitch [EMAIL PROTECTED] wrote: Touché, salesman. -Original Message- From: Lester Caine [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 10:21 AM To: php-general@lists.php.net Subject: Re: [PHP] can you give me example of website using postgresql database? Will Fitch wrote: Assuming that a system should switch RDBMSs is a waste of time without knowing the reason is asinine. Using NDB clustering is a primary reason for switching. PostgreSQL is only currently PLANNING built-in replication, much less clustering. Not to mention that the existing system is not taking advantage of ANY PostgreSQL functionality that is not already present in MySQL. So gaining performance and clustering is reason enough for me. You gave no reasons initially ... and with facilities being added all the time, the reason to change may evaporate before a change is made? Have you looked at the alternatives as well since you seem to have some work to do rather than simply changing the data source? I'm being told I have to switch to MSSQL or Oracle but the customers can't provide justification to do that as yet and since we are only up to a couple of gigabytes of data replicated across machines I am always looking for informed explanations of why a switch is necessary ;) i.e. why one database may be more appropriate than another. The lack of proper comparison information does make it difficult at times :( -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: FIFO files on PHP?
Why not simply maintain an array as a file. $fifoArray= unserialize(file_get_contents($fifoFile)); $oldValue= array_pop($fifoArray);//To pop off old value array_unshift($fifoArray, $newValue);//To push in new value $fifoStr= serialize($fifoArray); file_put_contents($fifoArray, $fifoStr, LOCK_EX); You can do the same thing by just using: $fifoArray= file($fifoFile); ..same array_pop() and array_unshift() stuff file_put_contents($fifoFile, $fifoArray, LOCK_EX); You'll need to check for an empty array, etc. Waynn Lue wrote: I'm trying to build a queue out using FIFO files (someone on the MySQL list suggested checking them out instead of using the database), but I'm running into a problem because of the synchronous fwrite call. Here's the code: $fifoFile = '/tmp/fifo'; if (!file_exists($fifoFile)) { posix_mkfifo($fifoFile, 0600); } $fp = fopen($fifoFile, w); fwrite($fp, content); fclose($fp); But this will block until something actually reads the pipe. Is there any way to write to the pipe, then go away as opposed to waiting until something consumes it? Otherwise, I may just go back to a database table. Thanks, Waynn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] V4 Vs V5 Issue
Thanks Jim Two things come to mind. 1) Is their any PHP inside you javascript file that needs to be parsed? And if so, is the new V5 install configured in such a way that it parses/processes javascript files? where the old install was processing javascript files. This would be a configuration issue from the actual web server POV. i.e. Apache, lighttpd, etc... Once reconfigured, make sure you restart your web server. Yes there is PHP inside the javascript that is being passed. As an exorcise I was just looking at deleting it all out of the code and seeing what happens, however it is everywhere. The Webserver with the V5 PHP is Apache 2.2.4, but I can not really see where I would make the changes you are suggesting. The older server with V4 is Apache 1.34.4 2) Is your code using short tags in php? This allows the programmer to use ? instead of ?php . In this case you might want to enable short tags in the new version of PHP. I think php 5 comes with short tags disabled and version 4 had it enabled by default. This setting would be found in your php.ini file on the server. If you need to change the setting, make sure you restart your httpd server before testing. Short tags is enabled and working most of the application is short tagged. Cheers Neil Just a couple of thoughts -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-CLI and the less command (kubuntu)
Hi everyone, I have a CLI application that produces lots of output to the terminal, so I like to send the output along to the less command. This has always worked very nicely. Moving to the top or bottom of the output used to require just hitting the home or end key, and the up and down arrows as well as page up and page down worked nicely. After upgrading to Hardy on Kubuntu, the behavior changed. Now, it seems to preempt the navigation and instead print ugly codes for each press on a navigational key (one of those mentioned above), such as ^[OF. When I press enter, the desired scroll is executed. Scrolling up and down is one thing, but it's particularly a pain when trying to search through the output, as it would no longer look up previous search arguments. I thought at first it's a problem with Konsole, my terminal program, or with less itself. But I've now tried in different terminal programs, and reading output other than output from PHP, and the ONLY time it happens is when I pipe output from PHP to less. I have added a small test script that exhibits the problem on my system. It may work well the first time, but when repeating the same command a second time, the weird behavior starts. It could very well be some kind of problem with less, but since I can only reproduce the problem with output from PHP CLI, I thought it's worth asking here. Did something about PHP CLI output change lately? My test script: ?php $count = 0; while ($count 100){ echo This is line number $count\n; $count++; } ? Execute like so: $ php test.php | less First time might work without problem, but subsequent times not. Thanks for any feedback and observations. Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strategy to protect images
On Tue, Jul 1, 2008 at 2:16 PM, Stefano Esposito [EMAIL PROTECTED] wrote: On Tue, 01 Jul 2008 19:59:20 +0200 Børge Holen [EMAIL PROTECTED] wrote: On Tuesday 01 July 2008 13:34:28 Nitsan Bin-Nun wrote: Umm have you ever thought about watermark-ing it? (In case its not a part of your website or something..) heh, this dude got way to much time on his hands... ;D This dude has commitments, and watermark is not an option. -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Vasco è tornato! Sul tuo cellulare Il mondo che vorrei Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?midw49d1-7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php since the image is sent to the client browser, anyone with enough brains to look in the cache will be able to access the image. What about setting the image to show only inside a flash viewer with ming? -- Bastien Cat, the other other white meat
Re: [PHP] CURL de-bugging: So why am I not getting the results page on the target site?
ioannes wrote: I didn't get any brave response on this, but given the other thread on 'encription' I was wondering could anyone decrypt the __VIEWSTATE string at the end of this message. It is part of the input page whose results page I am trying to retrieve back onto my server for further php work. I replicated the source from that input page onto a page on my server, and when I click the submit button it correctly goes to the target results page, on the other site though, however it did not work without the whole of the string below. The experiment proved though that without the __VIEWSTATE the results page will not return. So I am just wondering, as I have not been able to repeat this using curl, what the is included in that string. There's a challenge for anyone with whatever resources it takes. echo base64_decode($view_state_string); viewstate in asp.net is like sessions in php (I believe, I could be completely wrong :P). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CURL de-bugging: So why am I not getting the results page on the target site?
Chris wrote: ioannes wrote: I didn't get any brave response on this, but given the other thread on 'encription' I was wondering could anyone decrypt the __VIEWSTATE string at the end of this message. It is part of the input page whose results page I am trying to retrieve back onto my server for further php work. I replicated the source from that input page onto a page on my server, and when I click the submit button it correctly goes to the target results page, on the other site though, however it did not work without the whole of the string below. The experiment proved though that without the __VIEWSTATE the results page will not return. So I am just wondering, as I have not been able to repeat this using curl, what the is included in that string. There's a challenge for anyone with whatever resources it takes. echo base64_decode($view_state_string); or maybe print_r(base64_decode($view_state_string)); I don't know if it will return a string or an array or something else. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CURL de-bugging: So why am I not getting the results page on the target site?
On Tue, Jul 1, 2008 at 5:23 PM, ioannes [EMAIL PROTECTED] wrote: I didn't get any brave response on this, but given the other thread on 'encription' I was wondering could anyone decrypt the __VIEWSTATE string at the end of this message. It is part of the input page whose results page I am trying to retrieve back onto my server for further php work. I replicated the source from that input page onto a page on my server, and when I click the submit button it correctly goes to the target results page, on the other site though, however it did not work without the whole of the string below. The experiment proved though that without the __VIEWSTATE the results page will not return. So I am just wondering, as I have not been able to repeat this using curl, what the is included in that string. There's a challenge for anyone with whatever resources it takes. John ioannes wrote: For those that like CURL and calendars. ... VIEWSTATE curl_setopt($ch,
Re: [PHP] V4 Vs V5 Issue
Thanks Jim Will add some more to this. The PHP that is parsed inside this file and the JS is I think working correctly because the values are populated in the JavaScript output that is being displayed in the IE source viewer. For instance there is a stack of variable that are defined up front, these get information from PHP, these have the same information as the V4 server and I can therefore only presume the correct information. Cheers N Two things come to mind. 1) Is their any PHP inside you javascript file that needs to be parsed? And if so, is the new V5 install configured in such a way that it parses/processes javascript files? where the old install was processing javascript files. This would be a configuration issue from the actual web server POV. i.e. Apache, lighttpd, etc... Once reconfigured, make sure you restart your web server. Yes there is PHP inside the javascript that is being passed. As an exorcise I was just looking at deleting it all out of the code and seeing what happens, however it is everywhere. The Webserver with the V5 PHP is Apache 2.2.4, but I can not really see where I would make the changes you are suggesting. The older server with V4 is Apache 1.34.4 2) Is your code using short tags in php? This allows the programmer to use ? instead of ?php . In this case you might want to enable short tags in the new version of PHP. I think php 5 comes with short tags disabled and version 4 had it enabled by default. This setting would be found in your php.ini file on the server. If you need to change the setting, make sure you restart your httpd server before testing. Short tags is enabled and working most of the application is short tagged. Cheers Neil Just a couple of thoughts -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- 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