Re: [PHP] PHP Competition - Win a copy of Zend Studio
On 6/15/07, Jiffy Slides Leonard Burton <[EMAIL PROTECTED]> wrote: HI Guys, If I enter my solution, I am sure to win! I have it figured out, but, with some of our new service offerings I don't know that I will have the time to bang out the code. If I don't enter the code I would love to share my outline with a non-contestant just for the fun of talking about it. Take care, Leonard. On 6/15/07, Fernando Cosso <[EMAIL PROTECTED]> wrote: > Hi > The problem is really interesting. > I have to study physics for the university, so you will not see me in the > competition. :( > Best regards > > -- > [EMAIL PROTECTED] > http://www.fernandocosso.com.ar > -- Leonard Burton, N9URK http://www.jiffyslides.com [EMAIL PROTECTED] [EMAIL PROTECTED] "The prolonged evacuation would have dramatically affected the survivability of the occupants." -- Leonard Burton, N9URK http://www.jiffyslides.com [EMAIL PROTECTED] [EMAIL PROTECTED] "The prolonged evacuation would have dramatically affected the survivability of the occupants." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Extract specific div element from page
Oops, I accidentally sent this directly to CK, my apologies. Thank you for your replies. The reason that I didn't explore the JS route is because this will be running in the background, I didn't want to have to visit the page in any way. I went looking for an easy way to accomplish this in PHP but due to malformed HTML in some sites (not wordpress that I am aware of) it wasn't going to be so easy. Someone in ##php on irc.freenode.net pointed me to BeautifulSoup which is a Python module for scraping pages even if they have bad HTML. Within a minute I had a script that grabbed the parts I wanted, and even removed the parts I didn't (such as comments). Now I have a Python script that runs when I am going to update the docs on my Palm, it grabs the page(s), strips out the unimportant stuff, saves to a local directory, and then I have Sunrise parse that into plucker document format. Once again, thank you for the responses. On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Or you could just use Javascript combined with PHP, just use javascript it's something like this document.getElementById('tagId').innerHtml that will give you the html(contents) of the tag you specify. Then just do something like document.form.value = document.getElementById('tagId').innerHtml. Basicly you're setting a hidden form element to have the value of the div, then when you submit the page, you have the content as $_POST['formYouSetTo']. You could have the JS execute on the submit button's onclick. It should be relatively easy if you look up the exact syntax of the javascript. - Daniel ""Anthony Hiscox"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hey folks, > > I need to pull the contents inside of a specific div out of a page, and > write it to a separate file. In this instance I am taking everything > inside > of tags from a wordpress blog, this will give me > only the content and not the menus, or other stuff. I need to do this > because the final document will be converted for viewing on a palm pilot. > > Is anyone aware of a simple solution to this problem, short of parsing the > entire page and starting when I hit that div opening tag, and stopping > when > I hit the closing tag? One problem I can see with this method is that I > would have to count divs inside of that div, otherwise I would end too > early > on. > > Any advice would be greatly appreciated. > > Peace and Love, > distatica. > > -- > - > Anthony Hiscox > > Video Watch Group > Public Site Currently Under Development > Group Members Site Fully Operational > - > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Anthony Hiscox Video Watch Group Public Site Currently Under Development Group Members Site Fully Operational -
Re: [PHP] Extract specific div element from page
Anthony Hiscox wrote: Hey folks, I need to pull the contents inside of a specific div out of a page, and write it to a separate file. In this instance I am taking everything inside of tags from a wordpress blog, this will give me only the content and not the menus, or other stuff. I need to do this because the final document will be converted for viewing on a palm pilot. Is anyone aware of a simple solution to this problem, short of parsing the entire page and starting when I hit that div opening tag, and stopping when I hit the closing tag? One problem I can see with this method is that I would have to count divs inside of that div, otherwise I would end too early on. Any advice would be greatly appreciated. Peace and Love, distatica. What is your relationship to the wordpress blog? If you have control over it, the easiest way to do this is in the browser with Javasacript. You can then send the contents to the server, using Ajax if need be, where it can be written to the file. var content = document.getElementById("content').innerHTML; Or if the page is being sent back to the server through a form, then put the content into a form variable and read that when the page gets back to the server, then write it to the file. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating 'Previous - Next Buttons' Logic - Novice Question
""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 6/15/07, revDAVE <[EMAIL PROTECTED]> wrote: Novice Question: I would like to create a set of pages that could use some kind of logic to have "previous - next buttons "so that when the button was clicked it would automatically go to the next page - or the previous page. I know very little about PHP ... however, I am hoping that there is some kind of preset " open source" php code that I might be able to use. I can envision something like this: - An 'include page' that might store an array of the list of pages such as: start array... pos1 = page1.htm pos2 = page17.htm pos3 = page5.htm etc. stop array... - then a variable could be set for the current page such as: thispage = 2 - Place on the array equals position 2 (page17.htm) then the next button would add 1 to the current place on the array- (pos3) - and the previous button would be minus 1 place on the array - (pos1) ... that type of thing Q: Is there any "open source" code template that I can check out like this? -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php There are several ways to do this, but here's one way: << Previous\n"; } if($i != (count($page) - 1)) { echo "Next >>\n"; } include('page'.$i.'.htm'); ?> -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Totally would work for his purposes but let's clean it up a bit for a beginner. $page = array('page1.htm','page17.htm','page5.htm'); // array of the pages you have if(isset($_GET['page_num'])) // a current page number has been set in the url { $i = $_GET['page_num']; // set variable i to the current page number if($i != (count($i)-1)) // if the current page number isnt the last entry in the array display next echo "Next >>\n"; if($i != 0) // if the current page isn't the first page display previous echo "<< Previous\n"; } include('page'.$i.'.htm'); // show the current page you're at ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extract specific div element from page
Or you could just use Javascript combined with PHP, just use javascript it's something like this document.getElementById('tagId').innerHtml that will give you the html(contents) of the tag you specify. Then just do something like document.form.value = document.getElementById('tagId').innerHtml. Basicly you're setting a hidden form element to have the value of the div, then when you submit the page, you have the content as $_POST['formYouSetTo']. You could have the JS execute on the submit button's onclick. It should be relatively easy if you look up the exact syntax of the javascript. - Daniel ""Anthony Hiscox"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hey folks, I need to pull the contents inside of a specific div out of a page, and write it to a separate file. In this instance I am taking everything inside of tags from a wordpress blog, this will give me only the content and not the menus, or other stuff. I need to do this because the final document will be converted for viewing on a palm pilot. Is anyone aware of a simple solution to this problem, short of parsing the entire page and starting when I hit that div opening tag, and stopping when I hit the closing tag? One problem I can see with this method is that I would have to count divs inside of that div, otherwise I would end too early on. Any advice would be greatly appreciated. Peace and Love, distatica. -- - Anthony Hiscox Video Watch Group Public Site Currently Under Development Group Members Site Fully Operational - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Competition - Win a copy of Zend Studio
tedd wrote: At 12:45 PM +0100 6/14/07, Stut wrote: Hi All, I've been asked to be a judge in a PHP competition, and I thought I'd let you all know about it. Zend have donated some prizes, including a copy of Zend Studio Professional with 1 year of support, so it's definitely worth entering. It's also quite a fun challenge IMHO. http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-studio/ -Stut No offense meant to zend, but I consider it a challenge to get the zend-studio professional to work on a virtual host. I bought it a few years back and could never use it. That would be where the year of support would come in handy. Worth mentioning I've never had any issues getting it to work, so I don't know what issues you were having but I'm sure Zend would be able to help. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling Pascal code/functions from PHP
Right now the program isn't a dll it's a desktop application written in Delphi, but when I take the visual components out it will be Pascal, so I could compile it ot a dll. I want to emulate the same functionality the desktop application had, thus when the user uploads a file, the Pascal call would parse then create an object of the data, that I could later access when the user specifies a computation to do on the data. So it sort of needs to run in the background be always on, etc. I need to be able to call individual functions, get repsonses, etc. ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 6/15/07, Tijnema <[EMAIL PROTECTED]> wrote: On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: > I know for some languages there is a way to call code from another > language. > For example you can call C funcitons from Pascal, etc. Is there any > way I > can call Pascal functions/code from PHP? > Compile the pascal code as an executable, and call it with exec/system/... Or, I don't know if it's possible, you might be able to compile the pascal code as an extension, but that's hard stuff :P Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Are you compiling the Pascal binary as a shared object or dynamic link library, or is it a function within an executable that you're trying to create a hook to? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling an executable for processing some data sent from PHP
Thanks for your help. Since it's a Delphi program and Delphi has the ability to build ISAPI applications I'm going to try and see if I can't turn my app into an ISAPI and run that since it has all the functionality I need and it'll run fast. But if that doesn't work out I'll try the solutions suggested. Yes daemonizing it would probably work too. - Daniel ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Wow, thanks for the code and the fast response! :) Although maybe I should clarify my probem a bit more, I'm trying to run a program, but I want it to stay open so that I can call functions later. When the user "opens" a file, it's uploaded to a folder where PHP can access it, then PHP would call the Pascal program which would parse the file, and create a new object for that data, which later functions would access and do computation on. Like a user woud click Compute Subsets and that would somehow trigger the function Compute_Subsets on that object. Any way I could do something like this? My ugly way to do it would be to do an exec() to call an executable to parse the file and make an object of it then run the function that I needed to every time a function was called. The code base for this would be horrible to maintain and incredibly slow. Is there some way I could keep the program open and give it further arguments? ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: >> Will that script also work on Apache in Windows? OS X? Just checking >> because the backend and front end both need to be able to be installed >> on >> any OS. >> >> Also I looked at exec(), system(), and passthru(); they all let you >> execute >> a executable file but I don't see any way of passing parameters in any >> of >> those functions, can you do that? >> >> - Daniel >> >> ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: >> >> Ok, so I have a PHP script, and I also have a program written in >> >> Pascal, >> >> it's compiled in the native executable for whatever OS the server >> >> is >> >> running. >> >> >> >> I want to have the user input info and then send that info to the >> >> Pascal >> >> program to call a function and send the info as parameters. >> >> >> >> Is there any sort of server side call I can do to do this? Or is >> >> my >> >> only >> >> option making some sort of connection such as SOAP between PHP and >> >> the >> >> Program? >> >> >> >> -- >> >> PHP General Mailing List (http://www.php.net/) >> >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >> >> > >> >RTFM for exec(), system(), passthru(), et cetera. >> > >> > > >exec('pascal-file '.$_POST['user_command'],$ret); >> >$ret == 1 ? 'Error detected' ? ''; >> > ?> >> > >> > >> > -- >> > Daniel P. Brown >> > [office] (570-) 587-7080 Ext. 272 >> > [mobile] (570-) 766-8107 >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >Yeah, the first parameter of each function, where you call the > executable directly, just has to include the parameters you want to > pass to the binary. > >For example, if you wanted to do the following: >netstat -pnt >ls -al|grep -i php >mv file1.php backups/file2.php > >You would (respectively) simply do the following: >exec('netstat -pnt',$ret); >exec('ls -al|grep -i php',$ret); >exec('mv file1.php backups/file2.php',$ret); > >Then just eval $ret to see if it was successful (0) or not (1). > >If you wanted to allow a user to specify parameters, it would be > done like so: > > [PHP] >L> File: form.php > if($_POST['parameters']) { >exec('/path/to/pascal-binary > '.escapeshellarg($_POST['parameters']),$ret); >$ret == 0 ? "Success!" : "Failure!"; >exit; > } > ?> > >Parameters: > > > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you can run the executable as a server, you could daemonize it &1',$ret); ?> and then connect to it using sockets but I'm not completely certain that I'm understanding your needs properly. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Competition - Win a copy of Zend Studio
On 6/16/07, tedd <[EMAIL PROTECTED]> wrote: At 12:45 PM +0100 6/14/07, Stut wrote: >Hi All, > >I've been asked to be a judge in a PHP competition, and I thought >I'd let you all know about it. Zend have donated some prizes, >including a copy of Zend Studio Professional with 1 year of support, >so it's definitely worth entering. It's also quite a fun challenge >IMHO. > >http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-studio/ > >-Stut No offense meant to zend, but I consider it a challenge to get the zend-studio professional to work on a virtual host. I bought it a few years back and could never use it. Cheers, tedd Join the competition for the fun, not for the prices ;) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Competition - Win a copy of Zend Studio
At 12:45 PM +0100 6/14/07, Stut wrote: Hi All, I've been asked to be a judge in a PHP competition, and I thought I'd let you all know about it. Zend have donated some prizes, including a copy of Zend Studio Professional with 1 year of support, so it's definitely worth entering. It's also quite a fun challenge IMHO. http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-studio/ -Stut No offense meant to zend, but I consider it a challenge to get the zend-studio professional to work on a virtual host. I bought it a few years back and could never use it. 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] create file permission problem (solved)
At 6:56 PM -0400 6/15/07, Daniel Brown wrote: I don't think it's PAM-compliant to use a single-quote character in your passwords, Tedd. ;-P -- Daniel P. Brown Daniel: Bzzzet, thanks for trying. Let me explain again, maybe I did explain myself well. In the show-code folder (link below) is a php file entitled "a.php". Inside that file are password and user ID variables. They don't mean anything, nor do they do anything, but they are there. Now, I did say that you have all the tools you need at the site to discover what these values are. Can you do it? Again, here's the link: http://sperling.com/a/show-code/ Is this trivial or not? 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] generating an html intro text ...
At 11:39 AM +0200 6/14/07, Jochem Maas wrote: original string: "HELLO, my name is charlie brown! & I'm a little odd."; shorten text (32 'letters' required): "My name is charlie brown! & I'm "; the 32 'letter' length should therefore ignore the B and I tags and treat the & as a single letter ... additionally when truncation occurs with a set of html tags the resulting string should have all the open html tags properly closed. this is not as simple as it may first seem, I could probably do it but I foresee it taking quite some time (which I don't have ... let's all sing 'deadline' together shall we ;-)), in the past I have attempted such a routine but always ended up doing something much simpler (using strip_tags(), etc) due to time constraints. The problem as I see it is covering all the possibilities that may occur even if the text is well formed. Like what if someone introduces a span that sets a color for a paragraph, such as: Dolore magna aliquam erat volutpat ut wisi enim ad minim veniam quis nostrud. Consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt ut laoreet exerci tation ullamcorper suscipit lobortis! Decima eodem modo typi qui nunc nobis videntur parum clari fiant sollemnes in. And the tag as well as the tag is outside the 256 limit? You would have to search out and pull in all closing tags. So, I guess an algorithm could be: First, grab 256 characters -- The string. If The string is shorter, then quit. Second, determine what tags are not closed. Third, create closing tags and add them to the end of The string (in proper order). Fourth, then remove the same number of non-html characters from the end of The string. OR, just strip out the html tags (strip_tags) and go with straight text -- a lot easier. 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] GD Library and outputing image
At 9:17 PM +0100 6/13/07, Ross wrote: Never really used the GD much before very straightforward but how do I output the image on a page. This is fine on a php page on its own but what about one where the headers are already sent? Ross: That's not a problem. See this: http://xn--nvg.com/rotated_text <-- if your browser chokes, get a better browser The image code (text.php) is: and it's called from html like this: If you put this into your site, you'll need arial.tff to make it work, but you can find it in lot's of places. 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] create file permission problem (solved)
On 6/15/07, tedd <[EMAIL PROTECTED]> wrote: At 5:31 PM -0400 6/15/07, Daniel Brown wrote: > >Sounds like it was the decimal (three-bit, incorrect) versus octal >(four bit, correct) chmod(); value after all. Boo-yaa and stuff. Nope, that was one of the things I had right from the "get-go". The biggest problems I had were: a) getting the file paths right. b) understanding that if a file is not there, then you must to change the permissions of the parent folder/directory to be able to create a file. c) understanding that working with files on a virtual host is quite different than what's normally posted as a read/write solution. d) understanding that I must use the ftp_connect() to connect with my virtual host for these types of operations and that's different than what's normally posted as a read/write solution. Oh, to see it run -- see here: http://sperling.com/a/readwrite/ I had made it one of my show-code examples, like this: http://sperling.com/a/show-code/ But, in doing so, I found that I had written code that would expose other php code in the folder if used cleverly. So I removed the offending code. But, it was an interesting experience. If you want to try being clever, there is a file in the show-code folder entitled "a.php" -- tell me what it says. You have all the tools you need to review the php file.. 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 I don't think it's PAM-compliant to use a single-quote character in your passwords, Tedd. ;-P -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file permission problem (solved)
At 5:31 PM -0400 6/15/07, Daniel Brown wrote: Sounds like it was the decimal (three-bit, incorrect) versus octal (four bit, correct) chmod(); value after all. Boo-yaa and stuff. Nope, that was one of the things I had right from the "get-go". The biggest problems I had were: a) getting the file paths right. b) understanding that if a file is not there, then you must to change the permissions of the parent folder/directory to be able to create a file. c) understanding that working with files on a virtual host is quite different than what's normally posted as a read/write solution. d) understanding that I must use the ftp_connect() to connect with my virtual host for these types of operations and that's different than what's normally posted as a read/write solution. Oh, to see it run -- see here: http://sperling.com/a/readwrite/ I had made it one of my show-code examples, like this: http://sperling.com/a/show-code/ But, in doing so, I found that I had written code that would expose other php code in the folder if used cleverly. So I removed the offending code. But, it was an interesting experience. If you want to try being clever, there is a file in the show-code folder entitled "a.php" -- tell me what it says. You have all the tools you need to review the php file.. 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[2]: [PHP] Re: outputing image part 2
Hi Ross, Friday, June 15, 2007, 10:40:37 PM, you wrote: > Any ideas how to save the imagecopyresampled() to the folder? Call imagepng (or imagejpeg or whatever) and pass it a filename to save the image instead of output it. Check the help files for examples. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Competition - Win a copy of Zend Studio
Tijnema wrote: On 6/15/07, Stut <[EMAIL PROTECTED]> wrote: WeberSites LTD wrote: > Did someone say PHP competition ? Zend Studio? > > Here is one that has been around since April 2004 giving out prizes on a > monthly basis : > http://contest.weberdev.com/ Yeah, but this one has quality judges ;) -Stut Yes, Douglas and Cal are very good judges ;) Cheers Tij, knew I could count on you. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: outputing image part 2
I am taking your advice. I am going to rezize any image greater than 400px wide prior to upload. I have to combine my upload script for ($i=0; $i <$total; $i++) { $fileName = $_FILES['userfile']['name'][$i]; $tmpName = $_FILES['userfile']['tmp_name'][$i]; $fileSize = $_FILES['userfile']['size'][$i]; $fileType = $_FILES['userfile']['type'][$i]; $position=$i+1; $img_url = "images/$customer_id/". basename( $_FILES['userfile']['name'][$i]); if(move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $img_url)) { chmod('images/'.$customer_id, 0777); chmod($img_url, 0777); } with my resize script $image = imagecreatefromjpeg($img_url); if ($image === false) { exit; } // Get original width and height $width = imagesx($image); $height = imagesy($image); // New width and height $new_width = 200; $new_height = 150; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); Any ideas how to save the imagecopyresampled() to the folder? T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extract specific div element from page
Hey folks, I need to pull the contents inside of a specific div out of a page, and write it to a separate file. In this instance I am taking everything inside of tags from a wordpress blog, this will give me only the content and not the menus, or other stuff. I need to do this because the final document will be converted for viewing on a palm pilot. Is anyone aware of a simple solution to this problem, short of parsing the entire page and starting when I hit that div opening tag, and stopping when I hit the closing tag? One problem I can see with this method is that I would have to count divs inside of that div, otherwise I would end too early on. Any advice would be greatly appreciated. Peace and Love, distatica. -- - Anthony Hiscox Video Watch Group Public Site Currently Under Development Group Members Site Fully Operational -
Re: [PHP] Calling Pascal code/functions from PHP
On 6/15/07, Tijnema <[EMAIL PROTECTED]> wrote: On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: > I know for some languages there is a way to call code from another language. > For example you can call C funcitons from Pascal, etc. Is there any way I > can call Pascal functions/code from PHP? > Compile the pascal code as an executable, and call it with exec/system/... Or, I don't know if it's possible, you might be able to compile the pascal code as an extension, but that's hard stuff :P Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Are you compiling the Pascal binary as a shared object or dynamic link library, or is it a function within an executable that you're trying to create a hook to? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file permission problem (solved)
On 6/15/07, tedd <[EMAIL PROTECTED]> wrote: At 1:06 PM -0400 6/14/07, Daniel Brown wrote: >For the sake of people reading the archives now (and in years to >come), what was the cause of the problem, Tedd? Daniel: Ok, good point -- I would have liked to have this example to review. I'm not sure of the problems I had, because they were a comedy of errors, but the following is my solution. If anyone finds anything wrong, or if I have misstated something, please feel free to comment or correct me. Remember, this works for me, but perhaps not for others. Cheers, tedd --- here's the code, please watch for line breaks --- ERROR'); } else { //--- echo("Open connection"); echo("Change parent directory permission to 0777 for writing"); $str="CHMOD 0777 ". $path; // change permission for directory to 0777 ftp_site($connection, $str); echo("Checking to see if file exist"); if (is_file($folder . $filename)) { echo("File found "); } else { echo("File not found"); echo("Creating file -- $filename"); } //--- echo("Opening and Writing file -- $filename"); $file = fopen( $folder . $filename, "w" ); // open file fwrite( $file, $contents); // write file fclose( $file ); // close file echo("Change permission of file to 0644"); chmod($folder . $filename, 0644); echo("Change permission for parent directory back to 0755"); $str="CHMOD 0755 ". $path; // change permission for directory back to 755 ftp_site($connection, $str); echo("Close connection"); ftp_close($connection); // close connection //--- echo("Reading file:"); $filesize = filesize($folder . $filename); $file = fopen($folder . $filename, "r" ); $text = fread( $file, $filesize ); fclose( $file ); echo( "File name: $filename "); echo( "File size: $filesize bytes" ); echo( "File contents:$text" ); } ?> -- --- http://sperling.com http://ancientstones.com http://earthstones.com Sounds like it was the decimal (three-bit, incorrect) versus octal (four bit, correct) chmod(); value after all. Boo-yaa and stuff. Thanks for posting it. I don't know about ya'all, but I hate when I search the web, find people with the exact problem I'm having, and there's no solutions posted. It seems to happen any time I search for the resolution to a problem I just can't figure out. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: outputing image part 2
On 6/15/07, Stut <[EMAIL PROTECTED]> wrote: OK, your problem here is the single quotes in the img src around $img_url. Stut's right. You should change: echo ""; to: echo ""; He's also right about the dynamic resizing of images causing a serious strain on the server. Each time it has to do that, it uses up a significant amount of resources for a seemingly quick and small operation. Multiply that by n number of simultaneous accesses and you can see the exponential - and potentially devastating - "pitfallic" results. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling Pascal code/functions from PHP
On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: I know for some languages there is a way to call code from another language. For example you can call C funcitons from Pascal, etc. Is there any way I can call Pascal functions/code from PHP? Compile the pascal code as an executable, and call it with exec/system/... Or, I don't know if it's possible, you might be able to compile the pascal code as an extension, but that's hard stuff :P Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Competition - Win a copy of Zend Studio
On 6/15/07, Stut <[EMAIL PROTECTED]> wrote: WeberSites LTD wrote: > Did someone say PHP competition ? Zend Studio? > > Here is one that has been around since April 2004 giving out prizes on a > monthly basis : > http://contest.weberdev.com/ Yeah, but this one has quality judges ;) -Stut Yes, Douglas and Cal are very good judges ;) Tijnema > -Original Message- > From: Stut [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 14, 2007 1:46 PM > To: php-general@lists.php.net > Subject: [PHP] PHP Competition - Win a copy of Zend Studio > > Hi All, > > I've been asked to be a judge in a PHP competition, and I thought I'd let > you all know about it. Zend have donated some prizes, including a copy of > Zend Studio Professional with 1 year of support, so it's definitely worth > entering. It's also quite a fun challenge IMHO. > > http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-stud > io/ > > -Stut > > -- > PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file permission problem (solved)
At 1:06 PM -0400 6/14/07, Daniel Brown wrote: For the sake of people reading the archives now (and in years to come), what was the cause of the problem, Tedd? Daniel: Ok, good point -- I would have liked to have this example to review. I'm not sure of the problems I had, because they were a comedy of errors, but the following is my solution. If anyone finds anything wrong, or if I have misstated something, please feel free to comment or correct me. Remember, this works for me, but perhaps not for others. Cheers, tedd --- here's the code, please watch for line breaks --- If the file is not there, then to create one requires that you change its parent directory to 0777 and then create the file. The following code works for me. */ include('config.php'); // get your FTP password and user id $server= 'ftp.yourdomain.com'; // your domain name $path = 'httpdocs/read-write/test/'; // path to the folder "test" $folder = 'test/'; // folder name $filename = 'my.txt'; // file name $tpath = $path . $filename; // total path for file $contents = "This is my text"; // give the file some text $connection = ftp_connect($server); // connection $result = ftp_login($connection, $user, $pass); // login to ftp server if ((!$connection) || (!$result)) { echo ('ERROR'); } else { //--- echo("Open connection"); echo("Change parent directory permission to 0777 for writing"); $str="CHMOD 0777 ". $path; // change permission for directory to 0777 ftp_site($connection, $str); echo("Checking to see if file exist"); if (is_file($folder . $filename)) { echo("File found "); } else { echo("File not found"); echo("Creating file -- $filename"); } //--- echo("Opening and Writing file -- $filename"); $file = fopen( $folder . $filename, "w" ); // open file fwrite( $file, $contents); // write file fclose( $file ); // close file echo("Change permission of file to 0644"); chmod($folder . $filename, 0644); echo("Change permission for parent directory back to 0755"); $str="CHMOD 0755 ". $path; // change permission for directory back to 755 ftp_site($connection, $str); echo("Close connection"); ftp_close($connection); // close connection //--- echo("Reading file:"); $filesize = filesize($folder . $filename); $file = fopen($folder . $filename, "r" ); $text = fread( $file, $filesize ); fclose( $file ); echo( "File name: $filename "); echo( "File size: $filesize bytes" ); echo( "File contents:$text" ); } ?> -- --- 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] Calling an executable for processing some data sent from PHP
On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Wow, thanks for the code and the fast response! :) Although maybe I should clarify my probem a bit more, I'm trying to run a program, but I want it to stay open so that I can call functions later. When the user "opens" a file, it's uploaded to a folder where PHP can access it, then PHP would call the Pascal program which would parse the file, and create a new object for that data, which later functions would access and do computation on. Like a user woud click Compute Subsets and that would somehow trigger the function Compute_Subsets on that object. Any way I could do something like this? My ugly way to do it would be to do an exec() to call an executable to parse the file and make an object of it then run the function that I needed to every time a function was called. The code base for this would be horrible to maintain and incredibly slow. Is there some way I could keep the program open and give it further arguments? ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: >> Will that script also work on Apache in Windows? OS X? Just checking >> because the backend and front end both need to be able to be installed on >> any OS. >> >> Also I looked at exec(), system(), and passthru(); they all let you >> execute >> a executable file but I don't see any way of passing parameters in any of >> those functions, can you do that? >> >> - Daniel >> >> ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: >> >> Ok, so I have a PHP script, and I also have a program written in >> >> Pascal, >> >> it's compiled in the native executable for whatever OS the server is >> >> running. >> >> >> >> I want to have the user input info and then send that info to the >> >> Pascal >> >> program to call a function and send the info as parameters. >> >> >> >> Is there any sort of server side call I can do to do this? Or is my >> >> only >> >> option making some sort of connection such as SOAP between PHP and the >> >> Program? >> >> >> >> -- >> >> PHP General Mailing List (http://www.php.net/) >> >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >> >> > >> >RTFM for exec(), system(), passthru(), et cetera. >> > >> > > >exec('pascal-file '.$_POST['user_command'],$ret); >> >$ret == 1 ? 'Error detected' ? ''; >> > ?> >> > >> > >> > -- >> > Daniel P. Brown >> > [office] (570-) 587-7080 Ext. 272 >> > [mobile] (570-) 766-8107 >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >Yeah, the first parameter of each function, where you call the > executable directly, just has to include the parameters you want to > pass to the binary. > >For example, if you wanted to do the following: >netstat -pnt >ls -al|grep -i php >mv file1.php backups/file2.php > >You would (respectively) simply do the following: >exec('netstat -pnt',$ret); >exec('ls -al|grep -i php',$ret); >exec('mv file1.php backups/file2.php',$ret); > >Then just eval $ret to see if it was successful (0) or not (1). > >If you wanted to allow a user to specify parameters, it would be > done like so: > > [PHP] >L> File: form.php > if($_POST['parameters']) { >exec('/path/to/pascal-binary > '.escapeshellarg($_POST['parameters']),$ret); >$ret == 0 ? "Success!" : "Failure!"; >exit; > } > ?> > >Parameters: > > > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you can run the executable as a server, you could daemonize it &1',$ret); ?> and then connect to it using sockets but I'm not completely certain that I'm understanding your needs properly. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling Pascal code/functions from PHP
I know for some languages there is a way to call code from another language. For example you can call C funcitons from Pascal, etc. Is there any way I can call Pascal functions/code from PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating 'Previous - Next Buttons' Logic - Novice Question
revDAVE wrote: Novice Question: I would like to create a set of pages that could use some kind of logic to have "previous - next buttons "so that when the button was clicked it would automatically go to the next page - or the previous page. I know very little about PHP ... however, I am hoping that there is some kind of preset " open source" php code that I might be able to use. I can envision something like this: - An 'include page' that might store an array of the list of pages such as: start array... pos1 = page1.htm pos2 = page17.htm pos3 = page5.htm etc. stop array... - then a variable could be set for the current page such as: thispage = 2 - Place on the array equals position 2 (page17.htm) then the next button would add 1 to the current place on the array- (pos3) - and the previous button would be minus 1 place on the array - (pos1) ... that type of thing Q: Is there any "open source" code template that I can check out like this? -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] Why don't you google for 'php pagination' ?? http://www.google.com/search?&q=php%20pagination only 1.2 millions results to look through. I'm sure that you can add words to that search phrase to narrow the search also, try searching the archives, I just wrote a posted a link to a nice example on how to do pagination. here is the link to the source. for highlighting purpose only. http://www.cmsws.com/examples/php/pagination/example1.php source is available here. http://www.cmsws.com/examples/php/pagination/example1.phps It mainly deals with pagination based off information retrieved from a DB. But, it could be adopted to work with arrays also. -- 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] Creating 'Previous - Next Buttons' Logic - Novice Question
On 6/15/07, revDAVE <[EMAIL PROTECTED]> wrote: Novice Question: I would like to create a set of pages that could use some kind of logic to have "previous - next buttons "so that when the button was clicked it would automatically go to the next page - or the previous page. I know very little about PHP ... however, I am hoping that there is some kind of preset " open source" php code that I might be able to use. I can envision something like this: - An 'include page' that might store an array of the list of pages such as: start array... pos1 = page1.htm pos2 = page17.htm pos3 = page5.htm etc. stop array... - then a variable could be set for the current page such as: thispage = 2 - Place on the array equals position 2 (page17.htm) then the next button would add 1 to the current place on the array- (pos3) - and the previous button would be minus 1 place on the array - (pos1) ... that type of thing Q: Is there any "open source" code template that I can check out like this? -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php There are several ways to do this, but here's one way: << Previous\n"; } if($i != (count($page) - 1)) { echo "Next >>\n"; } include('page'.$i.'.htm'); ?> -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: outputing image part 2
Ross wrote: Thanks Stut we are getting somewhere. Removing the header gives the full binary output of the file in IE and FF. I also removes the echos and have the resized image showing in the browser. So far so good. I know it works. Now back to sending the URL. I have this $img_url="http://www.xxx.co.uk/images/ENbb24469/room1.JPG";; echo "height=\"100\" />"; and on the display image page I have: $img_url= $_GET['img_url']; $image = imagecreatefromjpeg($img_url); if ($image === false) { exit; } /// rest of the resize code goes here. This still does not work but if I plug the url in manually at the top of display_image.php it works, this suggests it is not being sent properly. OK, your problem here is the single quotes in the img src around $img_url. However, I question what you are actually doing. Is the image on the same machine as this script? If so you should be using a filename not the URL. Also, are you sure you're really saving anything by resizing the image on your server like this? You should consider generating the smaller version using a cron job and linking to it directly. Resizing images on the fly is one of the quickest ways to destroy the scalability of a website. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: outputing image part 2
Hi Ross, Friday, June 15, 2007, 10:00:53 PM, you wrote: > I have this > $img_url="http://www.xxx.co.uk/images/ENbb24469/room1.JPG";; > echo ">"; > and on the display image page I have: > $img_url= $_GET['img_url']; > $image = imagecreatefromjpeg($img_url); > if ($image === false) { exit; } > /// rest of the resize code goes here. > This still does not work but if I plug the url in manually at the top of > display_image.php it works, this suggests it is not being sent properly. You are sending a complete URL to your image, not a path. This means that if your installation of PHP does NOT have the ability to open files from URLs (allow_url_fopen) then it won't be able to open the image from the location you gave it. If you want to load in images from other web sites then make sure allow_url_fopen is enabled in PHP. If you don't want to do this, then don't pass in a URL, pass in the *path* to the image instead. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling an executable for processing some data sent from PHP
Wow, thanks for the code and the fast response! :) Although maybe I should clarify my probem a bit more, I'm trying to run a program, but I want it to stay open so that I can call functions later. When the user "opens" a file, it's uploaded to a folder where PHP can access it, then PHP would call the Pascal program which would parse the file, and create a new object for that data, which later functions would access and do computation on. Like a user woud click Compute Subsets and that would somehow trigger the function Compute_Subsets on that object. Any way I could do something like this? My ugly way to do it would be to do an exec() to call an executable to parse the file and make an object of it then run the function that I needed to every time a function was called. The code base for this would be horrible to maintain and incredibly slow. Is there some way I could keep the program open and give it further arguments? ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Will that script also work on Apache in Windows? OS X? Just checking because the backend and front end both need to be able to be installed on any OS. Also I looked at exec(), system(), and passthru(); they all let you execute a executable file but I don't see any way of passing parameters in any of those functions, can you do that? - Daniel ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: >> Ok, so I have a PHP script, and I also have a program written in >> Pascal, >> it's compiled in the native executable for whatever OS the server is >> running. >> >> I want to have the user input info and then send that info to the >> Pascal >> program to call a function and send the info as parameters. >> >> Is there any sort of server side call I can do to do this? Or is my >> only >> option making some sort of connection such as SOAP between PHP and the >> Program? >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >RTFM for exec(), system(), passthru(), et cetera. > > exec('pascal-file '.$_POST['user_command'],$ret); >$ret == 1 ? 'Error detected' ? ''; > ?> > > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yeah, the first parameter of each function, where you call the executable directly, just has to include the parameters you want to pass to the binary. For example, if you wanted to do the following: netstat -pnt ls -al|grep -i php mv file1.php backups/file2.php You would (respectively) simply do the following: exec('netstat -pnt',$ret); exec('ls -al|grep -i php',$ret); exec('mv file1.php backups/file2.php',$ret); Then just eval $ret to see if it was successful (0) or not (1). If you wanted to allow a user to specify parameters, it would be done like so: [PHP] L> File: form.php exec('/path/to/pascal-binary '.escapeshellarg($_POST['parameters']),$ret); $ret == 0 ? "Success!" : "Failure!"; exit; } ?> Parameters: -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating 'Previous - Next Buttons' Logic - Novice Question
Hi, Friday, June 15, 2007, 9:53:24 PM, you wrote: > I know very little about PHP ... however, I am hoping that there is some > kind of preset " open source" php code that I might be able to use. There is the Pear pagination package which can do this, although not quite in the way you want it done in your example. Search pear.php.net for it if you want. > - An 'include page' that might store an array of the list of pages such as: > start array... > pos1 = page1.htm > pos2 = page17.htm > pos3 = page5.htm > etc. > stop array... > - then a variable could be set for the current page such as: > thispage = 2 - Place on the array equals position 2 (page17.htm) Can I take it from this example that your pages should not be in sequence then? I.e. instead of going page1, page2, page3, instead they should go page1, page17, page5, etc? If so, why? :) Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: outputing image part 2
Thanks Stut we are getting somewhere. Removing the header gives the full binary output of the file in IE and FF. I also removes the echos and have the resized image showing in the browser. So far so good. I know it works. Now back to sending the URL. I have this $img_url="http://www.xxx.co.uk/images/ENbb24469/room1.JPG";; echo ""; and on the display image page I have: $img_url= $_GET['img_url']; $image = imagecreatefromjpeg($img_url); if ($image === false) { exit; } /// rest of the resize code goes here. This still does not work but if I plug the url in manually at the top of display_image.php it works, this suggests it is not being sent properly. Many thanks, R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating 'Previous - Next Buttons' Logic - Novice Question
Novice Question: I would like to create a set of pages that could use some kind of logic to have "previous - next buttons "so that when the button was clicked it would automatically go to the next page - or the previous page. I know very little about PHP ... however, I am hoping that there is some kind of preset " open source" php code that I might be able to use. I can envision something like this: - An 'include page' that might store an array of the list of pages such as: start array... pos1 = page1.htm pos2 = page17.htm pos3 = page5.htm etc. stop array... - then a variable could be set for the current page such as: thispage = 2 - Place on the array equals position 2 (page17.htm) then the next button would add 1 to the current place on the array- (pos3) - and the previous button would be minus 1 place on the array - (pos1) ... that type of thing Q: Is there any "open source" code template that I can check out like this? -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling an executable for processing some data sent from PHP
On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Will that script also work on Apache in Windows? OS X? Just checking because the backend and front end both need to be able to be installed on any OS. Also I looked at exec(), system(), and passthru(); they all let you execute a executable file but I don't see any way of passing parameters in any of those functions, can you do that? - Daniel ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: >> Ok, so I have a PHP script, and I also have a program written in Pascal, >> it's compiled in the native executable for whatever OS the server is >> running. >> >> I want to have the user input info and then send that info to the Pascal >> program to call a function and send the info as parameters. >> >> Is there any sort of server side call I can do to do this? Or is my only >> option making some sort of connection such as SOAP between PHP and the >> Program? >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >RTFM for exec(), system(), passthru(), et cetera. > > exec('pascal-file '.$_POST['user_command'],$ret); >$ret == 1 ? 'Error detected' ? ''; > ?> > > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yeah, the first parameter of each function, where you call the executable directly, just has to include the parameters you want to pass to the binary. For example, if you wanted to do the following: netstat -pnt ls -al|grep -i php mv file1.php backups/file2.php You would (respectively) simply do the following: exec('netstat -pnt',$ret); exec('ls -al|grep -i php',$ret); exec('mv file1.php backups/file2.php',$ret); Then just eval $ret to see if it was successful (0) or not (1). If you wanted to allow a user to specify parameters, it would be done like so: [PHP] L> File: form.php Parameters: -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reoccurring task manager
On 6/15/07, Jason Pruim <[EMAIL PROTECTED]> wrote: > [PHP] >L> File: viewall.php > // Include files, connection routines, configuration, blah, > blah, blah > $dow = (date("N") - 1); > > $sql = "SELECT task_name FROM tasks WHERE completed='0'"; > $sql .= " AND (day_of_week BETWEEN '0' AND '".$dow."')"; > $result = mysql_query($sql); > while($row = mysql_fetch_array($result)) { >// Your routine for HTML-izing the output from the > database > } > ?> I need to learn more about arrays so I don't have to type out all of my data! :P But first, I'll get it working and then I'll redo it. It's a good exercise for me. Actually, this is output as $row['column_name'] from mysql_fetch_array();, so if the row is `task_id`, the variable for each row from the while() condition would be $row['task_id'];. Otherwise, try this: >L> File: update.php > // More include stuff, blah, blah, blah > $task_id = $_POST['task_id']; // Passed from the "HTML-ized" area > of cron.php > $sql = "UPDATE tasks SET completed='1' WHERE id='".$task_id."' > LIMIT 1;"; > mysql_query($sql) or die(mysql_error()); > ?> Currently when I try and pass the variable from viewall.php to update.php by doing a Click here! I'm getting this error: "[Fri Jun 15 16:10:10 2007] [error] PHP Notice: Undefined index: taskid in update.php on line 4" and line 4 from the script looks like this: $task_id = $_POST['taskid']; //Passed from the HTML-ized area of cron.php Am I just totally missing something and making a very stupid newbie mistake? Or have I stumbled onto something that is at least mildly hard? It looks as though you're trying to use a variable as a query string. Change the link from: Click here to: Click here and then changing: $task_id = $_POST['taskid']; //Passed from the HTML-ized area of cron.php to: $task_id = $_REQUEST['taskid']; // This now accepts POST and GET > NOTE: This was entirely typed directly into the mail client, and NONE > of it was tested, so it probably has tons of bugs. > Actually, if I am reading it right, it doesn't have too many! :) Glad to hear it worked for you. Jason "Waiting for his Top Shelf liquor" Pruim Just remember, if you come to the wedding reception in the spring, you have to pay for your own flight (unless you're in driving distance of Scranton, Pennsylvania). Other than that, the liquor shall certainly flow it's going to have to in order to get me up to the altar. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reoccurring task manager
Jason Pruim wrote: On Jun 13, 2007, at 4:03 PM, Daniel Brown wrote: [PHP] L> File: viewall.php // Include files, connection routines, configuration, blah, blah, blah $dow = (date("N") - 1); $sql = "SELECT task_name FROM tasks WHERE completed='0'"; $sql .= " AND (day_of_week BETWEEN '0' AND '".$dow."')"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { // Your routine for HTML-izing the output from the database } ?> I need to learn more about arrays so I don't have to type out all of my data! :P But first, I'll get it working and then I'll redo it. It's a good exercise for me. L> File: update.php $task_id = $_POST['task_id']; // Passed from the "HTML-ized" area of cron.php $sql = "UPDATE tasks SET completed='1' WHERE id='".$task_id."' LIMIT 1;"; mysql_query($sql) or die(mysql_error()); ?> Currently when I try and pass the variable from viewall.php to update.php by doing a Click here! I'm getting this error: "[Fri Jun 15 16:10:10 2007] [error] PHP Notice: Undefined index: taskid in update.php on line 4" and line 4 from the script looks like this: $task_id = $_POST['taskid']; //Passed from the HTML-ized area of cron.php Am I just totally missing something and making a very stupid newbie mistake? Or have I stumbled onto something that is at least mildly hard? The latter Your line should look like this Click here! and you grabbing line should look like this $task_id = (int)$_GET['taskid']; //Passed from the HTML-ized area of cron.php L> File: cronjob.php [cron] 40 03 * * * /path/to/cronjob.php >> /dev/null 2>&1 NOTE: This was entirely typed directly into the mail client, and NONE of it was tested, so it probably has tons of bugs. Actually, if I am reading it right, it doesn't have too many! :) --Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Jason "Waiting for his Top Shelf liquor" Pruim --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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] Calling an executable for processing some data sent from PHP
Will that script also work on Apache in Windows? OS X? Just checking because the backend and front end both need to be able to be installed on any OS. Also I looked at exec(), system(), and passthru(); they all let you execute a executable file but I don't see any way of passing parameters in any of those functions, can you do that? - Daniel ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Ok, so I have a PHP script, and I also have a program written in Pascal, it's compiled in the native executable for whatever OS the server is running. I want to have the user input info and then send that info to the Pascal program to call a function and send the info as parameters. Is there any sort of server side call I can do to do this? Or is my only option making some sort of connection such as SOAP between PHP and the Program? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php RTFM for exec(), system(), passthru(), et cetera. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] outputing image part 2
Ross wrote: I have manually put in the url my display_image.php page to debug as sugested and all I get is the URL of the display_image.php page output on the screen. This is what I see http://xxx.co.uk/common/display_image.php this is the display_image.php file: $img_url="http://www.x.co.uk/images/ENapt63377/4.jpg";; This should almost certainly be a filename not a URL. $image = imagecreatefromjpeg($img_url); if ($image === false) { exit; } // Get original width and height echo $width = imagesx($image); echo $height = imagesy($image); // New width and height $new_width = 200; $new_height = 150; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Display resized image header('Content-type: image/jpeg'); Comment out this header line. Chances are you're getting an error message, but because you're telling the browser it's an image the browser is trying to display it as an image. Because it can't, it's displaying the default alt tag which is the URL (assuming you're using Firefox which is the only browser I know of to do this). imagejpeg($image_resized); exit(); -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Competition - Win a copy of Zend Studio
WeberSites LTD wrote: Did someone say PHP competition ? Zend Studio? Here is one that has been around since April 2004 giving out prizes on a monthly basis : http://contest.weberdev.com/ Yeah, but this one has quality judges ;) -Stut -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Thursday, June 14, 2007 1:46 PM To: php-general@lists.php.net Subject: [PHP] PHP Competition - Win a copy of Zend Studio Hi All, I've been asked to be a judge in a PHP competition, and I thought I'd let you all know about it. Zend have donated some prizes, including a copy of Zend Studio Professional with 1 year of support, so it's definitely worth entering. It's also quite a fun challenge IMHO. http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-stud io/ -Stut -- 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] outputing image part 2
I have manually put in the url my display_image.php page to debug as sugested and all I get is the URL of the display_image.php page output on the screen. This is what I see http://xxx.co.uk/common/display_image.php this is the display_image.php file: $img_url="http://www.x.co.uk/images/ENapt63377/4.jpg";; $image = imagecreatefromjpeg($img_url); if ($image === false) { exit; } // Get original width and height echo $width = imagesx($image); echo $height = imagesy($image); // New width and height $new_width = 200; $new_height = 150; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Display resized image header('Content-type: image/jpeg'); imagejpeg($image_resized); exit(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reoccurring task manager
On Jun 13, 2007, at 4:03 PM, Daniel Brown wrote: [PHP] L> File: viewall.php // Include files, connection routines, configuration, blah, blah, blah $dow = (date("N") - 1); $sql = "SELECT task_name FROM tasks WHERE completed='0'"; $sql .= " AND (day_of_week BETWEEN '0' AND '".$dow."')"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { // Your routine for HTML-izing the output from the database } ?> I need to learn more about arrays so I don't have to type out all of my data! :P But first, I'll get it working and then I'll redo it. It's a good exercise for me. L> File: update.php $task_id = $_POST['task_id']; // Passed from the "HTML-ized" area of cron.php $sql = "UPDATE tasks SET completed='1' WHERE id='".$task_id."' LIMIT 1;"; mysql_query($sql) or die(mysql_error()); ?> Currently when I try and pass the variable from viewall.php to update.php by doing a Click here! I'm getting this error: "[Fri Jun 15 16:10:10 2007] [error] PHP Notice: Undefined index: taskid in update.php on line 4" and line 4 from the script looks like this: $task_id = $_POST['taskid']; //Passed from the HTML-ized area of cron.php Am I just totally missing something and making a very stupid newbie mistake? Or have I stumbled onto something that is at least mildly hard? L> File: cronjob.php [cron] 40 03 * * * /path/to/cronjob.php >> /dev/null 2>&1 NOTE: This was entirely typed directly into the mail client, and NONE of it was tested, so it probably has tons of bugs. Actually, if I am reading it right, it doesn't have too many! :) -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Jason "Waiting for his Top Shelf liquor" Pruim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OK to have many files in one folder?
[snip] > Two words. Beware the inode. ^^ ^^^ ^ 1 23 Here endeth the lesson. [/snip] Can I get an Admin brotha'!? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Competition - Win a copy of Zend Studio
Did someone say PHP competition ? Zend Studio? Here is one that has been around since April 2004 giving out prizes on a monthly basis : http://contest.weberdev.com/ berber -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Thursday, June 14, 2007 1:46 PM To: php-general@lists.php.net Subject: [PHP] PHP Competition - Win a copy of Zend Studio Hi All, I've been asked to be a judge in a PHP competition, and I thought I'd let you all know about it. Zend have donated some prizes, including a copy of Zend Studio Professional with 1 year of support, so it's definitely worth entering. It's also quite a fun challenge IMHO. http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-stud io/ -Stut -- 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] OK to have many files in one folder?
Jay Blanchard wrote: [snip] Server is running Linux, and PHP is constantly creating and modifying images in a directory. Apache is constantly serving these same images. There are about 250,000 of them in the same directory. Seems to be running OK, no problematic CPU load, but I'm wondering if anyone knows whether I'm living dangerously having that many docs in one directory with that much activity. It is an extremely busy server. Sorry is this seems like more of a linux sysad question than a PHP question. Thanks... :) [/snip] Two words. Beware the inode. ^^ ^^^ ^ 1 23 Here endeth the lesson. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
On Saturday 16 June 2007 03:47, Daniel Brown wrote: > Once again, this doesn't matter so much for per-directory (though > listing will take longer, as I think I mentioned) as it does the > filesystem mount. Several years ago, having say 3000+ files in single directory on ext2 would mean that a simple 'ls -al' takes several orders of magnitude longer to perform than on a directory with just several hundred files. As I haven't used ext2/3 for ages I don't know whether the same is still true today. > The ext2/ext3 filesystems were made for these > reasons, especially with journaling like ReiserFS, XFS, et cetera > (which is a completely different bag of nuts). Not sure what point you're trying to make here, but, of the common filesystems for linux, ext2/3 is the absolute slowest (by far) when you have a large number of files in a directory. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling an executable for processing some data sent from PHP
On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Ok, so I have a PHP script, and I also have a program written in Pascal, it's compiled in the native executable for whatever OS the server is running. I want to have the user input info and then send that info to the Pascal program to call a function and send the info as parameters. Is there any sort of server side call I can do to do this? Or is my only option making some sort of connection such as SOAP between PHP and the Program? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php RTFM for exec(), system(), passthru(), et cetera. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
Since it depends on many factors, some out of your control, some others that might vary over the lifetime of the application, one thing you might do, to be on the safe side is try to put files in different directories, for example, by breaking up their filenames every three characters and making each segment a folder but no more than three levels deep so that the file ./abcdefghijkl.jpg would be located at ./abc/def/ghijkl.jpg. This breakup would allow even to mount extra disk volumes for some of the folders, should they exceed certain capacity or to split the risk. Whether to break filenames every two, three or more characters might be a matter of optimization, but I would guess that around three (or four) for the first two segments and whatever is left for the filename would be a reasonable number. I wouldn't go more than three levels deep either, because jumping from one directory level to the next also takes some time, thus it is a compromise in between searching sequentially in a directory for a filename (for those filesystems that do so) and going deep into the directory tree. Satyam - Original Message - From: "Brian Dunning" <[EMAIL PROTECTED]> To: Sent: Friday, June 15, 2007 9:38 PM Subject: Re: [PHP] OK to have many files in one folder? Thanks for the replies but I'm not sure I know what to do with them. Is the problem with the number of files, or is the problem with the activity? Can you dumb down your answers at all for me? :) On Jun 15, 2007, at 11:51 AM, Daniel Brown wrote: 6/15/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: [snip] Server is running Linux, and PHP is constantly creating and modifying images in a directory. Apache is constantly serving these same images. There are about 250,000 of them in the same directory. Seems to be running OK, no problematic CPU load, but I'm wondering if anyone knows whether I'm living dangerously having that many docs in one directory with that much activity. It is an extremely busy server. Sorry is this seems like more of a linux sysad question than a PHP question. Thanks... :) [/snip] Two words. Beware the inode. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If that directory is all on one single partition, God help you if there's any corruption. Check into RAID 0+1/RAID 5 disk striping if you've got that many images. And remember, the fact that they're all in one directory doesn't matter at all to the system, as directories, folders, et cetera, are just representations for human readability and organization. In fact, those files reside on several sectors throughout the drive, and each file itself is probably fragmented many times. Just for fun, though, if you want to crash your server, you could always do: `while [ 1 = 1 ]; do ls -l;done` -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- 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 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.16/849 - Release Date: 14/06/2007 12:44 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling an executable for processing some data sent from PHP
Dan wrote: Ok, so I have a PHP script, and I also have a program written in Pascal, it's compiled in the native executable for whatever OS the server is running. I want to have the user input info and then send that info to the Pascal program to call a function and send the info as parameters. Is there any sort of server side call I can do to do this? Or is my only option making some sort of connection such as SOAP between PHP and the Program? You could try shell_exec(). Eg: $output = shell_exec('.usr/bin/foo ' . escapeshellarg($_POST['foo'])); -- Richard Heyes 0844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
On 6/15/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: [snip] I can easily break it up into 100 subdirectories, 2500 files in each, would that be good insurance against problems? [/snip] As someone mentioned, directories are just a human convenience. Each file will have an inode and is identified by an inode number in the file system where it resides. Inodes store information on files such as user and group ownership, access mode (read, write, execute permissions) and type of file. There is a fixed number of inodes, which indicates the maximum number of files each filesystem can hold. Hence, beware the inode. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Perfect, Jay. That's something I forgot to mention. Also, keep in mind that, while there are file byte size limits (4GB, 8GB, etc.), directories are NOT limited in byte size. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling an executable for processing some data sent from PHP
On 6/15/07, Dan <[EMAIL PROTECTED]> wrote: Ok, so I have a PHP script, and I also have a program written in Pascal, it's compiled in the native executable for whatever OS the server is running. I want to have the user input info and then send that info to the Pascal program to call a function and send the info as parameters. Is there any sort of server side call I can do to do this? Or is my only option making some sort of connection such as SOAP between PHP and the Program? Yes, you will end up with AJAX code I think, or if you don't care to load new page, you can simply click on a link and let PHP handle an exec/system call. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
On 6/15/07, Brian Dunning <[EMAIL PROTECTED]> wrote: Thanks for the replies but I'm not sure I know what to do with them. Is the problem with the number of files, or is the problem with the activity? Can you dumb down your answers at all for me? :) On Jun 15, 2007, at 11:51 AM, Daniel Brown wrote: > 6/15/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: >> [snip] >> Server is running Linux, and PHP is constantly creating and modifying >> images in a directory. Apache is constantly serving these same >> images. There are about 250,000 of them in the same directory. Seems >> to be running OK, no problematic CPU load, but I'm wondering if >> anyone knows whether I'm living dangerously having that many docs in >> one directory with that much activity. It is an extremely busy >> server. >> >> Sorry is this seems like more of a linux sysad question than a PHP >> question. Thanks... :) >> [/snip] >> >> Two words. Beware the inode. >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >If that directory is all on one single partition, God help you if > there's any corruption. Check into RAID 0+1/RAID 5 disk striping if > you've got that many images. And remember, the fact that they're all > in one directory doesn't matter at all to the system, as directories, > folders, et cetera, are just representations for human readability and > organization. In fact, those files reside on several sectors > throughout the drive, and each file itself is probably fragmented many > times. > >Just for fun, though, if you want to crash your server, you > could always do: >`while [ 1 = 1 ]; do ls -l;done` > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 > > -- > 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 Brian, I stand behind my suggestion, though I also suggest you take whatever everyone else says into consideration just as much as me. I have well over a decade of experience, but I'll be the first to admit that sometimes a teenage computer geek is more correct than I am. Yes, list, believe it or not, I'm not always correct. I'm just going to let that sink in a little bit. Okay, now that everyone is done laughing at me (well, mostly everyone), let's get on with it. I still think it's best to split the files across a RAID. Ask your datacenter to discuss the pros and cons of both RAID 0+1 and RAID 5 with you, and research it on the web. It would be better to split the files into different directories, as well, but *probably* is not necessary. Take that as you will. That said, one way of doing it that is very common is to create a minimum of 36 directories, from 0 - 9 and a - z. Each directory should contain only files where the first character is the same as the directory within which it resides. However, if you have a specific character that comes up much more frequently than others, or even all the time, this won't work, of course. The point is, in my experience, holding even a terabyte of data in smaller files within one directory is not a Bad Thing [tm], per se. I've administered MySQL databases on servers that were in the two-to-three terabyte range, and one of which had well over 3,000 separate tables. Each of those tables is three separate files (minimum) on disk, mind you: table.frm, table.MYD, table.MYI. Also, keep in mind that I didn't create the database structure, but was instead hired to ensure that it ran smoothly. In the four months and n-million queries that were run on it while it was in use, the server responded as if it were a standard 50MB database in under a dozen files (if memory serves, it was a Dual Xeon 2.6GHz with 4GB RAM) and only used for MySQL). After the project was completed, however, we did upgrade the systems to a distributed network for further expansion, but I think you get the point there. Bottom line, however, is that just because you're not experiencing problems now doesn't mean you won't soon in the future. Seriously consider, with that many separate files and that much data, how much it's worth to you in the long run, and if a RAID setup and directory-splitting is a Good Thing [tm] for your situation. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
On 6/15/07, Brian Dunning <[EMAIL PROTECTED]> wrote: I can easily break it up into 100 subdirectories, 2500 files in each, would that be good insurance against problems? I have no clue how big the files are, but you might want to store them in a database. That can speed up things, but don't ask me how much ;) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling an executable for processing some data sent from PHP
Ok, so I have a PHP script, and I also have a program written in Pascal, it's compiled in the native executable for whatever OS the server is running. I want to have the user input info and then send that info to the Pascal program to call a function and send the info as parameters. Is there any sort of server side call I can do to do this? Or is my only option making some sort of connection such as SOAP between PHP and the Program? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OK to have many files in one folder?
[snip] I can easily break it up into 100 subdirectories, 2500 files in each, would that be good insurance against problems? [/snip] As someone mentioned, directories are just a human convenience. Each file will have an inode and is identified by an inode number in the file system where it resides. Inodes store information on files such as user and group ownership, access mode (read, write, execute permissions) and type of file. There is a fixed number of inodes, which indicates the maximum number of files each filesystem can hold. Hence, beware the inode. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
I can easily break it up into 100 subdirectories, 2500 files in each, would that be good insurance against problems? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
On 6/15/07, Crayon Shin Chan <[EMAIL PROTECTED]> wrote: On Saturday 16 June 2007 02:51, Daniel Brown wrote: > And remember, the fact that they're all > in one directory doesn't matter at all to the system, as directories, > folders, et cetera, are just representations for human readability and > organization. In fact, those files reside on several sectors > throughout the drive, and each file itself is probably fragmented many > times. Actually it does matter depending on the filesystem you use. If you're using ext2/ext3 then having several thousand files in a directory seriously slows things down. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Once again, this doesn't matter so much for per-directory (though listing will take longer, as I think I mentioned) as it does the filesystem mount. The ext2/ext3 filesystems were made for these reasons, especially with journaling like ReiserFS, XFS, et cetera (which is a completely different bag of nuts). -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
Thanks for the replies but I'm not sure I know what to do with them. Is the problem with the number of files, or is the problem with the activity? Can you dumb down your answers at all for me? :) On Jun 15, 2007, at 11:51 AM, Daniel Brown wrote: 6/15/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: [snip] Server is running Linux, and PHP is constantly creating and modifying images in a directory. Apache is constantly serving these same images. There are about 250,000 of them in the same directory. Seems to be running OK, no problematic CPU load, but I'm wondering if anyone knows whether I'm living dangerously having that many docs in one directory with that much activity. It is an extremely busy server. Sorry is this seems like more of a linux sysad question than a PHP question. Thanks... :) [/snip] Two words. Beware the inode. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If that directory is all on one single partition, God help you if there's any corruption. Check into RAID 0+1/RAID 5 disk striping if you've got that many images. And remember, the fact that they're all in one directory doesn't matter at all to the system, as directories, folders, et cetera, are just representations for human readability and organization. In fact, those files reside on several sectors throughout the drive, and each file itself is probably fragmented many times. Just for fun, though, if you want to crash your server, you could always do: `while [ 1 = 1 ]; do ls -l;done` -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- 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] OK to have many files in one folder?
On Saturday 16 June 2007 02:51, Daniel Brown wrote: > And remember, the fact that they're all > in one directory doesn't matter at all to the system, as directories, > folders, et cetera, are just representations for human readability and > organization. In fact, those files reside on several sectors > throughout the drive, and each file itself is probably fragmented many > times. Actually it does matter depending on the filesystem you use. If you're using ext2/ext3 then having several thousand files in a directory seriously slows things down. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing a url to a page
I have manually put in the url my display_image.php page to debug as sugested and all I get is the URL of the display_image.php page output on the screen. This is what I see http://xxx.co.uk/common/display_image.php this is the display_image.php file: $img_url="http://www.x.co.uk/images/ENapt63377/4.jpg";; $image = imagecreatefromjpeg($img_url); if ($image === false) { exit; } // Get original width and height echo $width = imagesx($image); echo $height = imagesy($image); // New width and height $new_width = 200; $new_height = 150; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Display resized image header('Content-type: image/jpeg'); imagejpeg($image_resized); exit(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot un-subscribe from list
On 6/15/07, Jason Pruim <[EMAIL PROTECTED]> wrote: On Jun 15, 2007, at 2:47 PM, Daniel Brown wrote: > On 6/15/07, Brian Dunning <[EMAIL PROTECTED]> wrote: >> > On 6/15/07, Mark Smith <[EMAIL PROTECTED]> wrote: >> >> I am currently trying to unsubscribe from this mailing list, >> >> however I >> >> am nor very successful in doing this. The mailer program will >> >> refuse to >> >> accept my address for removal, it will simply continue to send >> >> mail to >> >> my address. Why is this happening and how can I stop it? >> >> That can happen when a virus detects that your computer's components >> are settling. To loosen them, you need to give your computer at least >> three or four sharp blows. If it's a laptop, take it outside and >> strike its edge against the sidewalk or a cement patio. If it's a >> desktop, open the case and tap the top of the CPU with a ball peen >> hammer. >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >Brian, > >As of CPU >= 2.4GHz, this method is deprecated. They must now be > dropped from a height of 3 stories or greater to achieve the desired > result. I believe Symantec makes a product called "Geronimo" that > does this. I am actually working on a freeware version of this right now... I've heard that Symantec has had issues with Geronimo figured I would give it a shot, can't be worse right? :) Yes, but Symantec also has agreements with several anti-FLOSS corporations, including Microsoft, to allow immediate deployment and scalability with a variety of physical structures in major metropolitan areas. Unless you can create a network of open-source architectural firms and materials plants, not to mention the CVS construction company and GNU real estate agency, then I don't see how you can compete with their ability to charge users $149.95 per license to drop a system off the top of a building onto the pavement. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK to have many files in one folder?
6/15/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: [snip] Server is running Linux, and PHP is constantly creating and modifying images in a directory. Apache is constantly serving these same images. There are about 250,000 of them in the same directory. Seems to be running OK, no problematic CPU load, but I'm wondering if anyone knows whether I'm living dangerously having that many docs in one directory with that much activity. It is an extremely busy server. Sorry is this seems like more of a linux sysad question than a PHP question. Thanks... :) [/snip] Two words. Beware the inode. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If that directory is all on one single partition, God help you if there's any corruption. Check into RAID 0+1/RAID 5 disk striping if you've got that many images. And remember, the fact that they're all in one directory doesn't matter at all to the system, as directories, folders, et cetera, are just representations for human readability and organization. In fact, those files reside on several sectors throughout the drive, and each file itself is probably fragmented many times. Just for fun, though, if you want to crash your server, you could always do: `while [ 1 = 1 ]; do ls -l;done` -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot un-subscribe from list
On Jun 15, 2007, at 2:47 PM, Daniel Brown wrote: On 6/15/07, Brian Dunning <[EMAIL PROTECTED]> wrote: > On 6/15/07, Mark Smith <[EMAIL PROTECTED]> wrote: >> I am currently trying to unsubscribe from this mailing list, >> however I >> am nor very successful in doing this. The mailer program will >> refuse to >> accept my address for removal, it will simply continue to send >> mail to >> my address. Why is this happening and how can I stop it? That can happen when a virus detects that your computer's components are settling. To loosen them, you need to give your computer at least three or four sharp blows. If it's a laptop, take it outside and strike its edge against the sidewalk or a cement patio. If it's a desktop, open the case and tap the top of the CPU with a ball peen hammer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Brian, As of CPU >= 2.4GHz, this method is deprecated. They must now be dropped from a height of 3 stories or greater to achieve the desired result. I believe Symantec makes a product called "Geronimo" that does this. I am actually working on a freeware version of this right now... I've heard that Symantec has had issues with Geronimo figured I would give it a shot, can't be worse right? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot un-subscribe from list
On 6/15/07, Brian Dunning <[EMAIL PROTECTED]> wrote: > On 6/15/07, Mark Smith <[EMAIL PROTECTED]> wrote: >> I am currently trying to unsubscribe from this mailing list, >> however I >> am nor very successful in doing this. The mailer program will >> refuse to >> accept my address for removal, it will simply continue to send >> mail to >> my address. Why is this happening and how can I stop it? That can happen when a virus detects that your computer's components are settling. To loosen them, you need to give your computer at least three or four sharp blows. If it's a laptop, take it outside and strike its edge against the sidewalk or a cement patio. If it's a desktop, open the case and tap the top of the CPU with a ball peen hammer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Brian, As of CPU >= 2.4GHz, this method is deprecated. They must now be dropped from a height of 3 stories or greater to achieve the desired result. I believe Symantec makes a product called "Geronimo" that does this. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OK to have many files in one folder?
[snip] Server is running Linux, and PHP is constantly creating and modifying images in a directory. Apache is constantly serving these same images. There are about 250,000 of them in the same directory. Seems to be running OK, no problematic CPU load, but I'm wondering if anyone knows whether I'm living dangerously having that many docs in one directory with that much activity. It is an extremely busy server. Sorry is this seems like more of a linux sysad question than a PHP question. Thanks... :) [/snip] Two words. Beware the inode. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot un-subscribe from list
On 6/15/07, Mark Smith <[EMAIL PROTECTED]> wrote: I am currently trying to unsubscribe from this mailing list, however I am nor very successful in doing this. The mailer program will refuse to accept my address for removal, it will simply continue to send mail to my address. Why is this happening and how can I stop it? That can happen when a virus detects that your computer's components are settling. To loosen them, you need to give your computer at least three or four sharp blows. If it's a laptop, take it outside and strike its edge against the sidewalk or a cement patio. If it's a desktop, open the case and tap the top of the CPU with a ball peen hammer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OK to have many files in one folder?
Server is running Linux, and PHP is constantly creating and modifying images in a directory. Apache is constantly serving these same images. There are about 250,000 of them in the same directory. Seems to be running OK, no problematic CPU load, but I'm wondering if anyone knows whether I'm living dangerously having that many docs in one directory with that much activity. It is an extremely busy server. Sorry is this seems like more of a linux sysad question than a PHP question. Thanks... :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Data Filtering
On 6/15/07, Tijnema <[EMAIL PROTECTED]> wrote: On 6/15/07, Stut <[EMAIL PROTECTED]> wrote: > Tijnema wrote: > > -slut > > Actually it's -Stut. I hate it when people spell my name wrong! > > -Stut > Oh, didn't knew you were on the list of inappropriate words too ;) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yeah, Tijnema, you Dan Stut! -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Data Filtering
On 6/15/07, Stut <[EMAIL PROTECTED]> wrote: Tijnema wrote: > -slut Actually it's -Stut. I hate it when people spell my name wrong! -Stut Oh, didn't knew you were on the list of inappropriate words too ;) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Data Filtering
Tijnema wrote: -slut Actually it's -Stut. I hate it when people spell my name wrong! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Data Filtering
On 6/15/07, kvigor <[EMAIL PROTECTED]> wrote: Hello, I 'm checking form data for profanity but it only works if the $_POST['var'] is lowercase I was wondering if anyone knew how I could catch the profanity no matter what case it was. No matter if it was BAD or bad or mixed like BaD? Instead of the long way: if ($value == "fuck" || $value == "shit" || $value == "whore" || $value == "shit" || $value == "bullshit" || $value == "ass" || $value == "asshole" || $value == "piss" || $value == "bitch" || $value == "bastard" || $value == "motherfucker" || $value == "pussy" || $value == "cunt" || $value == "slut" || $value == "hell" || $value == "goddamn" || $value == "skank" || $value == "Tit" || $value == "dick" || $value == "hoe") { $profanity[$field] = "bad"; } Any suggestions welcome. Nice list, but what about this: sh!t d!ck mtherfucker sl ut and I can continue for hours..., and what if your $_POST['var'] contains more than only the work, like: .fuck -slut `asshole The code Daniel provided seems the only that can handle the last things, and for the first you should get a real list of inappropriate words... Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Install question
Paul K wrote: I have just started with a clean install on a Windows XP Pro system, Apache 2.24 and PHP 5.2.3 Apache Monitor reports Apache/2.24(Win32)PHP/5.2.3. I can access html files just fine but I can't even run a test program Nothing displays. Where do I look to see whats wrong? Paul Look at the source returned to you in your browser. If you see the actual php code, then you need the AddHandler and AddType settings in your Apache conf file. First, make sure that the php module is being loaded. -- 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] passing a url to a page
Zoltán Németh wrote: > 2007. 06. 15, péntek keltezéssel 14.45-kor Ross ezt írta: >> I have a display_image.php page >> >> > >> >> >> $image = imagecreatefromjpeg($img_url); > > where do you get $img_url from? GET request? > then do something like > > $img_url = $_GET['img_url']; > if (!file_exists($img_url)) die "bad hacker"; I have /etc/passwd on my system - I'd rather not have the potential for some hacker to abuse a bug in GDlib that allows extraction/output of abitrary files ... SO ... although Zoltan (I can't f-ing remember which is your first name, because first came last, and then it might have been switched for the benefit of american who can't grasp that some people somewhere actually do things differently, but then again it might not have been - oh and you can forget the diacritics - I'm just to lazy ;-)) is right in that you should check the requested $img_url I would add that the checks/constraints should be much more rigid, e.g.: $file = '/path/to/my/image/store/'.basename($_GET['img_url']); if (file_exists($file)) die "ya momma."; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Install question
On 6/15/07, Paul K <[EMAIL PROTECTED]> wrote: I have just started with a clean install on a Windows XP Pro system, Apache 2.24 and PHP 5.2.3 Apache Monitor reports Apache/2.24(Win32)PHP/5.2.3. I can access html files just fine but I can't even run a test program Nothing displays. Where do I look to see whats wrong? Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The server logs, your php.ini, your httpd.conf just to name a few. Make sure you have your AddHandler and AddType lines done correctly in httpd.conf, make sure that PHP is turned on in your php.ini file, make sure you restart Apache after any changes are made, and make sure you consult your logs for any issues that may not display to the screen. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form Data Filtering
Man you have some issues... :p Dave Goodchild wrote: > No, because extra processing is done on the other side - now > > fuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuck > > > off > > . > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form Data Filtering
No, because extra processing is done on the other side - now fuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuck off
[PHP] Install question
I have just started with a clean install on a Windows XP Pro system, Apache 2.24 and PHP 5.2.3 Apache Monitor reports Apache/2.24(Win32)PHP/5.2.3. I can access html files just fine but I can't even run a test program Nothing displays. Where do I look to see whats wrong? Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form Data Filtering
2007. 06. 15, péntek keltezéssel 15.48-kor Dave Goodchild ezt írta: > I use something like this: > > $_SESSION['profane'] = false; > > foreach ($_POST as $value) { > foreach ($swearbox as $profanity) { > if (preg_match("/$profanity/i", $value)) { > $errors = true; > $_SESSION['profane'] = true; > mail(TECHEMAIL, 'profane content attack attempt on DJST', "Word: > $value From: {$_SERVER['REMOTE_ADDRESS']} Time: " . date('d F Y G:i:s', > time()-TIMEDIFF), '[EMAIL PROTECTED]'); > } > } > } > > // second pass - words that are offensive in isolation but could be part of > acceptable words above > > foreach ($_POST as $value) { > foreach ($refined_swearbox as $profanity) { > if (preg_match("/\b$profanity\b/i", $value)) { > $errors = true; > $_SESSION['profane'] = true; > mail(TECHEMAIL, 'profane content attack attempt on DJST', "Word: > $value From: {$_SERVER['REMOTE_ADDRESS']} Time: " . date('d F Y G:i:s', > time()-TIMEDIFF), '[EMAIL PROTECTED]'); > } > } > } and you get 1000 emails if I paste 'fuck' 1000 times into your comment box? ;) greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing a url to a page
Daniel Brown wrote: $image_url = 'http://www.pr0nsite.com/gallery/big-boobs.jpg'; Well that was just too disappointing for a Friday afternoon. Ya tease! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing a url to a page
2007. 06. 15, péntek keltezéssel 15.28-kor [EMAIL PROTECTED] ezt írta: > Nothing happens no errors or anything I tried to debug using > include('display_image.php?img_url=$image_url') I got a parse error. of course. include is totally different stuff, you can not give GET parameters when including what happens if you try to view display.image.php?img_url=something in your browser? try it with a valid img_url value and an invalid one and see if it throws any errors or anything greets Zoltán Németh > > I would rather use buffers if this is possible? > - Original Message - > From: "Zoltán Németh" <[EMAIL PROTECTED]> > To: "Ross" <[EMAIL PROTECTED]> > Cc: > Sent: Friday, June 15, 2007 3:03 PM > Subject: Re: [PHP] passing a url to a page > > > 2007. 06. 15, péntek keltezéssel 14.45-kor Ross ezt írta: > > I have a display_image.php page > > > > > > > > > > > $image = imagecreatefromjpeg($img_url); > > where do you get $img_url from? GET request? > then do something like > > $img_url = $_GET['img_url']; > if (!file_exists($img_url)) die "bad hacker"; > > before the above line. this will let you get rid of register_globals, > and does a basic check of input, which is always very important > > > if ($image === false) { exit; } > > > > // Get original width and height > > echo $width = imagesx($image); > > echo $height = imagesy($image); > > > > // New width and height > > $new_width = 200; > > $new_height = 150; > > > > // Resample > > $image_resized = imagecreatetruecolor($new_width, $new_height); > > imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, > > $new_height, $width, $height); > > > > // Display resized image > > ; > > header('Content-type: image/jpeg'); > > imagejpeg($image_resized); > > exit(); > > > > ?> > > > > > > I want to output this as an image but cannot get it working. I need to > > pass > > the image url something like this I thought would work > > > > echo ""; > > this should work. what do you mean by not working? do you get any error > message? anything? without information no one can tell you what's > wrong... > > greets > Zoltán Németh > > > > > > > any ideas? > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot un-subscribe from list
On 6/15/07, Mark Smith <[EMAIL PROTECTED]> wrote: I am currently trying to unsubscribe from this mailing list, however I am nor very successful in doing this. The mailer program will refuse to accept my address for removal, it will simply continue to send mail to my address. Why is this happening and how can I stop it? Mark Just send an empty mail to [EMAIL PROTECTED] (or [EMAIL PROTECTED] if you are subscribed to digest). Mailing list software sends something back, just hit the reply and send empty reply and you're off the list. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form Data Filtering
I use something like this: $_SESSION['profane'] = false; foreach ($_POST as $value) { foreach ($swearbox as $profanity) { if (preg_match("/$profanity/i", $value)) { $errors = true; $_SESSION['profane'] = true; mail(TECHEMAIL, 'profane content attack attempt on DJST', "Word: $value From: {$_SERVER['REMOTE_ADDRESS']} Time: " . date('d F Y G:i:s', time()-TIMEDIFF), '[EMAIL PROTECTED]'); } } } // second pass - words that are offensive in isolation but could be part of acceptable words above foreach ($_POST as $value) { foreach ($refined_swearbox as $profanity) { if (preg_match("/\b$profanity\b/i", $value)) { $errors = true; $_SESSION['profane'] = true; mail(TECHEMAIL, 'profane content attack attempt on DJST', "Word: $value From: {$_SERVER['REMOTE_ADDRESS']} Time: " . date('d F Y G:i:s', time()-TIMEDIFF), '[EMAIL PROTECTED]'); } } }
Re: [PHP] passing a url to a page
On 6/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Nothing happens no errors or anything I tried to debug using include('display_image.php?img_url=$image_url') I got a parse error. You can't include a file with a query string attached. However, you /can/ do: http://www.pr0nsite.com/gallery/big-boobs.jpg'; // Your favorite! include('display_image.php'); ?> However, it won't work if display_image.php expects $image_url to specifically be passed as a $_GET[] variable --- which, on a production site, it sure should, rather than accepting globals. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing a url to a page
[EMAIL PROTECTED] wrote: Nothing happens no errors or anything I tried to debug using include('display_image.php?img_url=$image_url') I got a parse error. I would rather use buffers if this is possible? You can't parse GET parameters with include. Try this... $_GET['img_url'] = $image_url; include 'display_image.php'; Or better yet, make a simple HTML file with just an image tag. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form Data Filtering
On 6/15/07, Chris <[EMAIL PROTECTED]> wrote: ""kvigor"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Hello, > > I 'm checking form data for profanity but it only works if the > $_POST['var'] is lowercase I was wondering if anyone knew how I could > catch the profanity no matter what case it was. No matter if it was BAD or > bad or mixed like BaD? > > Instead of the long way: > > if ($value == "fuck" || $value == "shit" || $value == "whore" || $value == > "shit" || $value == "bullshit" || $value == "ass" || $value == "asshole" > || $value == "piss" || $value == "bitch" || $value == "bastard" || $value > == "motherfucker" || $value == "pussy" || $value == "cunt" || $value == > "slut" || $value == "hell" || $value == "goddamn" || $value == "skank" || > $value == "Tit" || $value == "dick" || $value == "hoe") > { > $profanity[$field] = "bad"; > } > > Any suggestions welcome. Hi Have you tried eregi()? That might work for you. Cheers Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this. It uses str_ireplace();, which - as of PHP 4.3.3 - can accept arrays. It will also replace parts of words, so if you have shit, ShIt, BULLShIT, ShitFuckCocksuckerPissbag, et cetera (this is fun!), it will replace the offending part of the words with asterisks. HOWEVER, keep in mind that legitimate words such as pass, cockroach, peacock, or saltwater will also be filtered, so you may want to make some adjustments or concessions. As Richard always says, "your mileage may vary." -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GD Library and outputing image
Ross escreveu: $image = imagecreatefromjpeg($img_url); $image in this case, is the Image Identifier, and returns something like , Resource id #NUMBER ( Resourse id allocation process, for the generic imagecreate... ). if ($image === false) { die ('Unable to open image'); } // Get original width and height echo $width = imagesx($image); echo $height = imagesy($image); // New width and height $new_width = 200; $new_height = 150; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); $image_resized is another Image Identifier imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); The imagecopyressampled() returns a boolean value [ TRUE(1) or FALSE(0)]. This value can be used to test the function success. A) If you haven't no problem with readers, you must use: > // Display resized image > header('Content-type: image/jpeg'); > imagejpeg($image_resized); imagedestroy($image); imagedestroy($image_resized); So, in this case you have 2 Image Identifiers, to be destroyd at the end, to freely the processes. imagedestroy($image); imagedestroy($image_resized); B) However, if you have problems with header, you must use: imagejpeg ($image_resized, "image.jpg"); echo ''; imagedestroy($image); imagedestroy($image_resized); instead of > > // Display resized image > header('Content-type: image/jpeg'); > imagejpeg($image_resized); imagedestroy($image); imagedestroy($image_resized); die(); This is not allowed here. --- Please see an example of imagecopyressampled() here: http://www.educar.pro.br/en/a/gdlib/index.php?pn=20&tr=97 -- zerof http://www.educar.pro.br/ Apache - PHP - MySQL - Boolean Logics - Project Management -- Você deve, sempre, consultar uma segunda opinião! -- Deixe todos saberem se esta informação foi-lhe útil. -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form Data Filtering
Have you tried eregi()? You don't need the regex functions, they're slow and you should be using PCRE instead (IMO). -- Richard Heyes 0844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing a url to a page
Nothing happens no errors or anything I tried to debug using include('display_image.php?img_url=$image_url') I got a parse error. I would rather use buffers if this is possible? - Original Message - From: "Zoltán Németh" <[EMAIL PROTECTED]> To: "Ross" <[EMAIL PROTECTED]> Cc: Sent: Friday, June 15, 2007 3:03 PM Subject: Re: [PHP] passing a url to a page 2007. 06. 15, péntek keltezéssel 14.45-kor Ross ezt írta: I have a display_image.php page where do you get $img_url from? GET request? then do something like $img_url = $_GET['img_url']; if (!file_exists($img_url)) die "bad hacker"; before the above line. this will let you get rid of register_globals, and does a basic check of input, which is always very important if ($image === false) { exit; } // Get original width and height echo $width = imagesx($image); echo $height = imagesy($image); // New width and height $new_width = 200; $new_height = 150; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Display resized image ; header('Content-type: image/jpeg'); imagejpeg($image_resized); exit(); ?> I want to output this as an image but cannot get it working. I need to pass the image url something like this I thought would work echo ""; this should work. what do you mean by not working? do you get any error message? anything? without information no one can tell you what's wrong... greets Zoltán Németh any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Form Data Filtering
kvigor wrote: Hello, I 'm checking form data for profanity but it only works if the $_POST['var'] is lowercase I was wondering if anyone knew how I could catch the profanity no matter what case it was. No matter if it was BAD or bad or mixed like BaD? Instead of the long way: if ($value == "fuck" || $value == "shit" || $value == "whore" || $value == "shit" || $value == "bullshit" || $value == "ass" || $value == "asshole" || $value == "piss" || $value == "bitch" || $value == "bastard" || $value == "motherfucker" || $value == "pussy" || $value == "cunt" || $value == "slut" || $value == "hell" || $value == "goddamn" || $value == "skank" || $value == "Tit" || $value == "dick" || $value == "hoe") { $profanity[$field] = "bad"; } Any suggestions welcome. I find it hilarious how you've just posted as many dodgy words as you could to the list :) But try... $bad_words = array("word1", "word2", "word3"); if(in_array(strtolower($_POST['val']), $bad_words)){ $_POST['val'] = "bad"; } Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Form Data Filtering
""kvigor"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Hello, > > I 'm checking form data for profanity but it only works if the > $_POST['var'] is lowercase I was wondering if anyone knew how I could > catch the profanity no matter what case it was. No matter if it was BAD or > bad or mixed like BaD? > > Instead of the long way: > > if ($value == "fuck" || $value == "shit" || $value == "whore" || $value == > "shit" || $value == "bullshit" || $value == "ass" || $value == "asshole" > || $value == "piss" || $value == "bitch" || $value == "bastard" || $value > == "motherfucker" || $value == "pussy" || $value == "cunt" || $value == > "slut" || $value == "hell" || $value == "goddamn" || $value == "skank" || > $value == "Tit" || $value == "dick" || $value == "hoe") > { > $profanity[$field] = "bad"; > } > > Any suggestions welcome. Hi Have you tried eregi()? That might work for you. Cheers Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Data Filtering
kvigor wrote: Hello, I 'm checking form data for profanity but it only works if the $_POST['var'] is lowercase I was wondering if anyone knew how I could catch the profanity no matter what case it was. No matter if it was BAD or bad or mixed like BaD? Use strcasecmp() or perhaps better, stripos(). -- Richard Heyes 0844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: London PHP salaries
On 6/15/07, Christian Hänsel <[EMAIL PROTECTED]> wrote: On the weekends, I get to maintain my own websites, do research, satisfy the needs of my girl, learn new stuff (like JS right now *yikes*)... damned, I can't wait til September when I get TWO WEEKS OFF :oD -- - I submit my stuff @ weberdev.com "Jason Pruim" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > You get weekends off? THAT'S IT! I'm calling my union rep!!! Oh wait.. I > don't have one... My SMALL 4 person company is joining a union! :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php In response to questions directed at me, the $31,200 is gross, not net. The $2400 - $2700 = $900 thing was because I didn't include what I make with my own companies that are still running. Otherwise, I'd be all about that "bank voodoo" myself! And making a correction to an earlier post by Daevid, the formula was printed backwards. Currently, it's 1GBP ~ 1.9696USD. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot un-subscribe from list
On 6/15/07, Jim Moseby <[EMAIL PROTECTED]> wrote: > I am currently trying to unsubscribe from this mailing list, > however I > am nor very successful in doing this. The mailer program will > refuse to > accept my address for removal, it will simply continue to > send mail to > my address. Why is this happening and how can I stop it? > > Mark If you are receiving mail from one of the mailing lists, there should be absolutely no reason that you would be unable to unsubscribe yourself from the list, except for your ability to follow the directions at http://www.php.net/unsub.php . However, if you find yourself unable to unsubscribe from the mailing list, send an email to [EMAIL PROTECTED] Make sure to include the complete headers from one of the messages you have received from the mailing list. Keep in mind that there's a human being at the other end of that last email address, so you'll have to be patient. (blatantly plagiarized from the unsubscribe page) JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Why the hell would you want to unsubscribe from this list? Are we not good enough for you?!? ;-P In any case, thanks to Gmail telling me never to delete email again - and me ignorantly allowing them to shepherd me into doing as they say - here's the welcome message I received from the list several months back: Welcome to [EMAIL PROTECTED] Please save this message so that you know the address you are subscribed under, in case you later want to unsubscribe or change your subscription address. --- Administrative commands for the php-general list --- I can handle administrative requests automatically. Please do not send them to the list address! Instead, send your message to the correct command address: For help and a description of available commands, send a message to: <[EMAIL PROTECTED]> To subscribe to the list, send a message to: <[EMAIL PROTECTED]> To remove your address from the list, just send a message to the address in the ``List-Unsubscribe'' header of any list message. If you haven't changed addresses since subscribing, you can also send a message to: <[EMAIL PROTECTED]> or for the digest to: <[EMAIL PROTECTED]> For addition or removal of addresses, I'll send a confirmation message to that address. When you receive it, simply reply to it to complete the transaction. If you need to get in touch with the human owner of this list, please send a message to: <[EMAIL PROTECTED]> Please include a FORWARDED list message with ALL HEADERS intact to make it easier to help you. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: php-cli vs python
On 6/15/07, Crayon Shin Chan <[EMAIL PROTECTED]> wrote: On Friday 15 June 2007 21:23, Jochem Maas wrote: [etc] > IT is a joke, this list is joke, I'm a joke. no joke. Someone give this guy his meds :) -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Must be Friday And as far as a South American soap opera goes, how many people are dressed in bumblebee suits? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing a url to a page
I have a display_image.php page I want to output this as an image but cannot get it working. I need to pass the image url something like this I thought would work echo ""; any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generating an html intro text ...
On 6/15/07, Jochem Maas <[EMAIL PROTECTED]> wrote: Daniel Brown wrote: ... Dan, I don't want to put a downer on things, especially considering the ammount of time/energy you spent writing the code you posted. ... but this is not exactly what I was looking for. I guess my feable attempt at explaining myself was rather off the mark. I'm looking for code that will take an HTML string and give me back a truncated string which still contains 'valid' HTML - the idea being to make an intro text from a longer article (that is stored as HTML). I'm a little confused why the html santizing couldn't be done with a simple strip_tags()? are we on the same page? have I missed something? rgds, Jochem Not a downer at all, Jochem. I probably misread what you were asking for. However, in the process of doing it, I found three places just yesterday where I could add that file as an include, call that one function [htmlstr();] and reduce several other lines of code. So I'm sorry that it didn't work for you, but it actually did come in use somewhere, which I may not have even done if it weren't for my misunderstanding of your needs. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing a url to a page
2007. 06. 15, péntek keltezéssel 14.45-kor Ross ezt írta: > I have a display_image.php page > > > > > $image = imagecreatefromjpeg($img_url); where do you get $img_url from? GET request? then do something like $img_url = $_GET['img_url']; if (!file_exists($img_url)) die "bad hacker"; before the above line. this will let you get rid of register_globals, and does a basic check of input, which is always very important > if ($image === false) { exit; } > > // Get original width and height > echo $width = imagesx($image); > echo $height = imagesy($image); > > // New width and height > $new_width = 200; > $new_height = 150; > > // Resample > $image_resized = imagecreatetruecolor($new_width, $new_height); > imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, > $new_height, $width, $height); > > // Display resized image > ; > header('Content-type: image/jpeg'); > imagejpeg($image_resized); > exit(); > > ?> > > > I want to output this as an image but cannot get it working. I need to pass > the image url something like this I thought would work > > echo ""; this should work. what do you mean by not working? do you get any error message? anything? without information no one can tell you what's wrong... greets Zoltán Németh > > > any ideas? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: php-cli vs python
On Friday 15 June 2007 21:23, Jochem Maas wrote: [etc] > IT is a joke, this list is joke, I'm a joke. no joke. Someone give this guy his meds :) -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: php-cli vs python
Crayon Shin Chan wrote: > On Saturday 09 June 2007 01:22, Daniel Brown wrote: > >> I actually haven't found a platform yet that I couldn't port PHP >> to, if it wasn't already native. We're talking Windows, Linux, BSD, >> true *nix, MacOS, SunOS, Amiga, et cetera. I doubt it would run on my >> old Commodore 64 with the 1541 5.25" floppy drive (LOAD "*",8,1), but >> you can emulate a C64 in PHP (http://phpc64.extra.hu). ;-P > > Perhaps it would've been better to say "it is _available_ on more > platforms". No doubt given enough dedication you can probably get both > Python and PHP to _run_ on most platforms. However as an example, Python > (albeit an older version) is running happily on Nokia S60 phones, whereas > AFAIK there are no PHP running on said phones. An f'ing big rant deserves to go here about f***wits that can't communicate who spend all day staring the display of a multimedia commuication device that and the number of people without access to clean water. ... but I can't be bothered, too busy watching a South American soap on my mobile. :-/ > > Also Python supports all the major GUI bindings whereas PHP only supports > GTK (AFAIK). which reminds of the guy from LotusNotes fame - whose still try to build the perfect PIM ... using Python, all good and well but slow as congealed dogshit through a seive doesn't even begin to describe it. IT is a joke, this list is joke, I'm a joke. no joke. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php