RE: [PHP] Kindla 0T, but here goes...
On Fri, 2008-06-13 at 16:32 -0500, Boyd, Todd M. wrote: -Original Message- From: Daniel Brown [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2008 4:13 PM To: Ryan S Cc: php php Subject: Re: [PHP] Kindla 0T, but here goes... On Fri, Jun 13, 2008 at 4:49 PM, Ryan S [EMAIL PROTECTED] wrote: when the user clicks on any of those links i do a quick trip to the DB via ajax and update the div with all the artists that his choice merits... same thing when he clicks the bands name... this time i display all of their songs... and here's where i am stumped... when he clicks any of those songs... it should start playing in the background WITHOUT reloading the whole page... is this possible or am i just barking up the wrong tree? Most sites, such as Project Playlist (now just Playlist.com) use Flash for this. Check it out: http://www.playlist.com/ I agree with Daniel. Your most likely solution is to use a Flash player (or similar implementation) and populate a portion of your page with the object via AJAX (which you are already apparently comfortable with). Or make your own Flash player with Ming and PHP. Working on that myself at the moment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how can convert phonetic symbols and chinese pinyin to NCR(Numeric character reference)
hello all, i want convert the phonetic symbols and chinese pinyin to NCR. i use the function mb_encode_numericentity do it, but i can't got the true convmap table, so i can't convert the phonetic symbols and chinese pinyin to NCR correctly. how can i get the true convmap table? thanks for any help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how can convert phonetic symbols and chinese pinyin to NCR(Numeric character reference)
php 5.2.6+debian linux gege wan [EMAIL PROTECTED] дÈëÏûÏ¢ÐÂÎÅ:[EMAIL PROTECTED] hello all, i want convert the phonetic symbols and chinese pinyin to NCR. i use the function mb_encode_numericentity do it, but i can't got the true convmap table, so i can't convert the phonetic symbols and chinese pinyin to NCR correctly. how can i get the true convmap table? thanks for any help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] conversion of unicode characters into utf-8
On Mon, Jun 16, 2008 at 11:26 PM, valsaraj [EMAIL PROTECTED] wrote: Hi, I am using code $val = htmlentities($val, ENT_QUOTES, UTF-8); but it's not working in version 5.2.0. Is there any additional configuration needed for this. it's working well in 5.2.2. Could you please help me??? have you compared ini settings between the 5.2.0 environment and the 5.2.2 environment for differences, esp. in the multibyte settings ? -nathan
RE: [PHP] looping through a database
On 16 June 2008 21:58, Richard Kurth advised: I am looping through a database of files that are numbers 1 through 10 if number 1 is in the database I what to print out the first table below if it is not then print the else section below. Then loop through the database to see if 2 through 10 are there and do the same thing. Of course what I am doing does not work. Should I move it all to an array and then loop through it. Or use a foreach loop. Could you please give me an idea where to start looking while($row=mysql_fetch_array($sql_result)){ if ($row[number]==1) { tr td File 1/td tdThis is the file/td tdDelete/td /tr }else{ tr tdFile1/td td/td tdAdd/td /tr } } Well, first of you need a few ?php ? tags to make this legal: if ($row[number]==1) { ? tr td File 1/td tdThis is the file/td tdDelete/td /tr ?php }else{ ? tr tdFile1/td td/td tdAdd/td /tr ?php } } Of course, some people frown on this and prefer other techniques such as echo-ing the HTML, or assembling it into a variable which gets echoed at the end -- but whatever floats your boat...!! Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqliconnect issue
On Jun 16, 2008, at 10:49 PM, Chris wrote: Jason Pruim wrote: Okay, So I'm going to just assume that my issue is the fact that I'm tired... and my mind won't work properly. [Mon Jun 16 22:27:58 2008] [error] PHP Warning: mysqli_connect() expects parameter 5 to be long, string given Now parameter 5 is the database name, I echoed out each of the parameters and everything looks right... here's the line that's causing the problem: mysqli_connect($link, $server, $username, $password, $database) or die('Connection failed in dbmysqliconnect.php'); No, #5 is the port number (http://www.php.net/mysqli_connect). You want: $link = mysqli_connect($server, $user, $pass, $dbname); $link can't be passed to mysqli_connect because it doesn't exist yet ;) Hey Chris, Thanks for helping me through my brain shut down! Once I moved that it connects just fine. Now I just need to get the query to work. But that I am going to have to work on later as the day job doesn't pay me to work on side programming jobs ;) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A somewhaat better example of CANVAS
Again, FF only. This is a somewhat better example of what can be done with CANVAS. Not quite on par with what some have shown, but hey I only started yesterday... :-) http://www.phpguru.org/graph/graph.html The bars maybe a few pixels off, but really, who cares? -- Richard Heyes Employ me: http://www.phpguru.org/cv ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A somewhaat better example of CANVAS
On Jun 17, 2008, at 8:05 AM, Richard Heyes wrote: Again, FF only. This is a somewhat better example of what can be done with CANVAS. Not quite on par with what some have shown, but hey I only started yesterday... :-) http://www.phpguru.org/graph/graph.html The bars maybe a few pixels off, but really, who cares? The perfectionists like me who want to create everything in a self contained file so no matter wether they view it on the web, or on their cell phone it's pixel perfectly the same :P -- Richard Heyes Employ me: http://www.phpguru.org/cv ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] substr?
Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they get HUGE files to print from. The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. When it fails, it says the file type is not allowed even though it is listed in the file type array. Hopefully I have given you enough to go on to at least ask me some questions :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED]
Re: [PHP] substr?
On 17 Jun 2008, at 13:39, Jason Pruim wrote: I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they get HUGE files to print from. The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. When it fails, it says the file type is not allowed even though it is listed in the file type array. Hopefully I have given you enough to go on to at least ask me some questions :) Sounds like you haven't increased upload_max_filesize in php.ini. If you actually look at what's in $_FILES['userfile'] you'll see most of it's empty. I suggest you add some more error checking rather than assuming everything worked ok. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr?
The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. I'm not an expert on pulling in and reading files, but if all you want is the last three characters of a file name, couldn't you just do something like: $extension = substr($filename, -3); if ($extension = pdf || $extension = zip) { echo The file is a PDF or ZIP.; } else { echo Incorrect file type.; } ?? Or maybe you are saying you want it to perform this check while the user is attempting to upload the file and not after it has been uploaded?
Re: [PHP] substr?
On Jun 17, 2008, at 9:01 AM, Dan Shirah wrote: The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. I'm not an expert on pulling in and reading files, but if all you want is the last three characters of a file name, couldn't you just do something like: $extension = substr($filename, -3); if ($extension = pdf || $extension = zip) { echo The file is a PDF or ZIP.; } else { echo Incorrect file type.; } ?? Or maybe you are saying you want it to perform this check while the user is attempting to upload the file and not after it has been uploaded? I am looking to use this as a simple test prior to the upload beginning... IE, if it's not a .zip file, don't try and upload 250MB files :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr?
On Jun 17, 2008, at 8:46 AM, Stut wrote: On 17 Jun 2008, at 13:39, Jason Pruim wrote: I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they get HUGE files to print from. The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. When it fails, it says the file type is not allowed even though it is listed in the file type array. Hopefully I have given you enough to go on to at least ask me some questions :) Sounds like you haven't increased upload_max_filesize in php.ini. If you actually look at what's in $_FILES['userfile'] you'll see most of it's empty. I suggest you add some more error checking rather than assuming everything worked ok. Hey Stut, I'm looking into that now, i just increased the php.ini upload_max_filesize to 250M and tried uploading a 44MB file and it failed... I'll try and add some more error checking, but I'm really leaning towards the problem being in the code I posted... But please, prove me wrong! :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr?
Jason, If you don't expressly need it to run server side, you could always use a simple little javascript check if you want. *script type=text/javascript function checkFileType() { // for mac/linux, else assume windows if (navigator.appVersion.indexOf('Mac') != -1 || navigator.appVersion.indexOf('Linux') != -1) var fileSplit = '/'; else var fileSplit = '\\'; var fileTypes = new Array('.zip', '.ZIP', '.jpg', '.JPG'); // valid filetypes var fileName = document.getElementById('UploadFile').value; // current value in your file upload box var extension = fileName.substr(fileName.lastIndexOf('.'), fileName.length); var valid = 0; for(var i in fileTypes) { if(fileTypes[i] == extension) { valid = 1; break; } } if(valid == 1) alert(The file to be uploaded is a PDF or ZIP file!); else alert(Invalid file type!); * *}* */script*
Re: [PHP] substr?
On 17 Jun 2008, at 14:05, Jason Pruim wrote: On Jun 17, 2008, at 8:46 AM, Stut wrote: On 17 Jun 2008, at 13:39, Jason Pruim wrote: I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they get HUGE files to print from. The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. When it fails, it says the file type is not allowed even though it is listed in the file type array. Hopefully I have given you enough to go on to at least ask me some questions :) Sounds like you haven't increased upload_max_filesize in php.ini. If you actually look at what's in $_FILES['userfile'] you'll see most of it's empty. I suggest you add some more error checking rather than assuming everything worked ok. Hey Stut, I'm looking into that now, i just increased the php.ini upload_max_filesize to 250M and tried uploading a 44MB file and it failed... I'll try and add some more error checking, but I'm really leaning towards the problem being in the code I posted... But please, prove me wrong! :) Did you restart the web server after changing it? Are you sure you're editing the right php.ini? There's nothing wrong with our code that I can see. On an efficiency note you don't need the last parameter to substr - if it's omitted it defaults to the remaining test. I would suggest doing a var_dump on $_FILES['userfile'] before the code you've posted to check it contains the right stuff. If not then it's the upload that's failing and nothing in your code. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr?
On 17 Jun 2008, at 14:04, Jason Pruim wrote: On Jun 17, 2008, at 9:01 AM, Dan Shirah wrote: The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. I'm not an expert on pulling in and reading files, but if all you want is the last three characters of a file name, couldn't you just do something like: $extension = substr($filename, -3); if ($extension = pdf || $extension = zip) { echo The file is a PDF or ZIP.; } else { echo Incorrect file type.; } ?? Or maybe you are saying you want it to perform this check while the user is attempting to upload the file and not after it has been uploaded? I am looking to use this as a simple test prior to the upload beginning... IE, if it's not a .zip file, don't try and upload 250MB files :) That code will not be executed until the file has been uploaded. Such is the nature of the beast. If you really need to do this your best bet is to use a client-side uploader. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] conversion of unicode characters into utf-8
Thanks. But in php 5.2.2 it's not compiled with mbstring. But in version 5.2.0 it's compiled with mbstring support, but I don't get information aboout what settings is required by htmlentities() to work properly. Could you help to find out this? valsaraj wrote: Hi, I am using code $val = htmlentities($val, ENT_QUOTES, UTF-8); but it's not working in version 5.2.0. Is there any additional configuration needed for this. it's working well in 5.2.2. Could you please help me??? -- View this message in context: http://www.nabble.com/conversion-of-unicode-characters-into-utf-8-tp17878398p17908695.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] conversion of unicode characters into utf-8
valsaraj wrote: valsaraj wrote: Hi, I am using code $val = htmlentities($val, ENT_QUOTES, UTF-8); but it's not working in version 5.2.0. Is there any additional configuration needed for this. it's working well in 5.2.2. Could you please help me??? Thanks. But in php 5.2.2 it's not compiled with mbstring. But in version 5.2.0 it's compiled with mbstring support, but I don't get information aboout what settings is required by htmlentities() to work properly. Could you help to find out this? -- View this message in context: http://www.nabble.com/conversion-of-unicode-characters-into-utf-8-tp17878398p17908959.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] conversion of unicode characters into utf-8
valsaraj [EMAIL PROTECTED] wrote: Thanks. But in php 5.2.2 it's not compiled with mbstring. But in version 5.2.0 it's compiled with mbstring support, but I don't get information aboout what settings is required by htmlentities() to work properly. Could you help to find out this? valsaraj wrote: Hi, I am using code $val = htmlentities($val, ENT_QUOTES, UTF-8); but it's not working in version 5.2.0. Is there any additional configuration needed for this. it's working well in 5.2.2. Could you please help me??? Load your php.ini from both versions Look at the configuration string side-by-side Reconfigure your 5.2.2 with the 5.2.0 settings. Reload apache You could also STFW: http://www.google.com/search?hl=enclient=firefox-arls=com.ubuntu%3Aen-US%3Aunofficialhs=Z0xq=php%3A+convert+of+unicode+characters+into+utf-8+btnG=Search And depending on your OS, you could look for a php-mbstring package that you just need to install and then reload apache. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to prevent DoS on PHP script?
Am 2008-06-16 12:02:27, schrieb Per Jessen: Check client IP-addresses? And then? I am DoS'ed from several 1000 IPs and since legitim uploaders are mostly on dynamic IPs I can not block by IP. OK, last Saturday I have installed a COOKIE which worked for the weekend but today morning the DoS'er have solved this problem too. This mean, there are one or more crackers targeting my system directly. OK, even if I use heavyly PHP, my system was never hacked since it is up (Juni 2000) but now I am ongoing to be militant if I catch one of those pigs... Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Re: How to prevent DoS on PHP script?
On Tue, Jun 17, 2008 at 8:22 AM, Michelle Konzack [EMAIL PROTECTED] wrote: Am 2008-06-16 12:02:27, schrieb Per Jessen: Check client IP-addresses? And then? I am DoS'ed from several 1000 IPs and since legitim uploaders are mostly on dynamic IPs I can not block by IP. OK, last Saturday I have installed a COOKIE which worked for the weekend but today morning the DoS'er have solved this problem too. This mean, there are one or more crackers targeting my system directly. OK, even if I use heavyly PHP, my system was never hacked since it is up (Juni 2000) but now I am ongoing to be militant if I catch one of those pigs... did you see my suggestion to try apache authentication ? i suspect you can protect access to the upload with that, and create a simple script to use yourself to submit the credentials and then perform uploads. -nathan
Re: [PHP] Re: Strategy to protect images
On Tuesday 17 June 2008 00:08:48 Daniel Brown wrote: On Mon, Jun 16, 2008 at 5:23 PM, Jonesy [EMAIL PROTECTED] wrote: On Sun, 15 Jun 2008 14:07:14 -0400, tedd wrote: At 4:11 PM +0100 6/15/08, Richard Heyes wrote: But, a sophisticated user will find a way around that. A less sophisticated one will use the PrintScr key... :-) Must be a windozes thing. :-) Nope. Works a treat in KDE in linux. Status: Myth. This is only if you have KDE configured to bind the key to an external application such as KSnapshot, which is not the default. Unless, of course, your distro does it by default, which is always possible but in general, it's not the case. ;-P Oh, how many distros have you tried? Just wondering, cus as I see it; you just took a chance and called it a fact -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Strategy to protect images
On Tue, Jun 17, 2008 at 1:02 PM, Børge Holen [EMAIL PROTECTED] wrote: Oh, how many distros have you tried? Just wondering, cus as I see it; you just took a chance and called it a fact Who, me? I didn't call it a fact, I called it a myth. ;-P -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr?
At 9:01 AM -0400 6/17/08, Dan Shirah wrote: The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. I'm not an expert on pulling in and reading files, but if all you want is the last three characters of a file name, couldn't you just do something like: $extension = substr($filename, -3); if ($extension = pdf || $extension = zip) { echo The file is a PDF or ZIP.; } else { echo Incorrect file type.; } ?? Or maybe you are saying you want it to perform this check while the user is attempting to upload the file and not after it has been uploaded? if ($extension == pdf || $extension == zip) 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] substr?
On Tue, Jun 17, 2008 at 8:39 AM, Jason Pruim [EMAIL PROTECTED] wrote: Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they get HUGE files to print from. [snip!] Tweak this to meet your needs. All .htaccess settings are PHP_INI_ALL or PHP_INI_PERDIR in modern PHP's. # In your .htaccess php_flag max_execution_time 300 php_flag max_input_time 300 php_flag memory_limit 64M php_flag post_max_size 256M php_flag upload_max_filesize 256M ?php // In your script: ignore_user_abort(1); ? -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mkdir() Cannot Create Directories
Hi, I have a code here that I am intending to create new directories by creating a parent and then proceed on to create the children one by one. I am trying to create directories in the server I am running my script from as shown in the snippet below. My problem is that although the code seems to be accurate, it keeps telling me that I cannot create the directories with the following error message: Cannot create directory C:/Inetpub/wwwroot/TPU/test/2 This is my PHP code: mkdir(C:/Inetpub/wwwroot/TPU/test/$id, 0755) or die (pCannot create directory C:/Inetpub/wwwroot/TPU/test/$id/p); What is strange is that I don't get permission denied errors, but I still cannot create the directories. Can anyone provide me some tips on why I am getting these errors? Thanks in advance. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir() Cannot Create Directories
On Tue, Jun 17, 2008 at 2:43 PM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, [snip!] This is my PHP code: mkdir(C:/Inetpub/wwwroot/TPU/test/$id, 0755) or die (pCannot create directory C:/Inetpub/wwwroot/TPU/test/$id/p); What is strange is that I don't get permission denied errors, but I still cannot create the directories. Can anyone provide me some tips on why I am getting these errors? Does 'C:\Inetpub\wwwroot\TPU\test\' exist on the server, and is it writable? Maybe you're just missing a directory up to that point (such as 'test'), or maybe it's not on your C:\ drive. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir() Cannot Create Directories
On 6/17/08, Daniel Brown [EMAIL PROTECTED] wrote: On Tue, Jun 17, 2008 at 2:43 PM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, [snip!] This is my PHP code: mkdir(C:/Inetpub/wwwroot/TPU/test/$id, 0755) or die (pCannot create directory C:/Inetpub/wwwroot/TPU/test/$id/p); What is strange is that I don't get permission denied errors, but I still cannot create the directories. Can anyone provide me some tips on why I am getting these errors? Does 'C:\Inetpub\wwwroot\TPU\test\' exist on the server, and is it writable? Maybe you're just missing a directory up to that point (such as 'test'), or maybe it's not on your C:\ drive. Alice, that's a default IIS path to the web root, so I assume you _might_ be using IIS. Maybe the IIS manager is locking you out somehow. --David.
RE: [PHP] mkdir() Cannot Create Directories
Hi, Daniel: Thanks, I didn't realize that is the only problem. It sure is working pretty good now. One question, why didn't I get Permission Denied when I tried to do it before the execution permissions were set properly? Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Daniel Brown [EMAIL PROTECTED] Sent: Tuesday, June 17, 2008 2:54 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: Re: [PHP] mkdir() Cannot Create Directories On Tue, Jun 17, 2008 at 2:43 PM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, [snip!] This is my PHP code: mkdir(C:/Inetpub/wwwroot/TPU/test/$id, 0755) or die (pCannot create directory C:/Inetpub/wwwroot/TPU/test/$id/p); What is strange is that I don't get permission denied errors, but I still cannot create the directories. Can anyone provide me some tips on why I am getting these errors? Does 'C:\Inetpub\wwwroot\TPU\test\' exist on the server, and is it writable? Maybe you're just missing a directory up to that point (such as 'test'), or maybe it's not on your C:\ drive. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir() Cannot Create Directories
As far as I remember, when I was on shared windows I had something similar (no access to upload/create folders), the tech guy at the company i was hosting at changed something in my privileges and it solved it. You may have no creating privileges. On 17/06/2008, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, I have a code here that I am intending to create new directories by creating a parent and then proceed on to create the children one by one. I am trying to create directories in the server I am running my script from as shown in the snippet below. My problem is that although the code seems to be accurate, it keeps telling me that I cannot create the directories with the following error message: Cannot create directory C:/Inetpub/wwwroot/TPU/test/2 This is my PHP code: mkdir(C:/Inetpub/wwwroot/TPU/test/$id, 0755) or die (pCannot create directory C:/Inetpub/wwwroot/TPU/test/$id/p); What is strange is that I don't get permission denied errors, but I still cannot create the directories. Can anyone provide me some tips on why I am getting these errors? Thanks in advance. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CAD file decoding
Has anybody seen any software that could be used with PHP to extract the preview pictures from CAD files such as DXF and the like. I'm looking to keep thumbnails of the drawings in much the same was as we generate thumbnails of images. So I can display a list of previews before downloading the whole file. -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How to prevent DoS on PHP script?
On 17 Jun 2008, at 15:22, Michelle Konzack wrote: Am 2008-06-16 12:02:27, schrieb Per Jessen: Check client IP-addresses? And then? I am DoS'ed from several 1000 IPs and since legitim uploaders are mostly on dynamic IPs I can not block by IP. OK, last Saturday I have installed a COOKIE which worked for the weekend but today morning the DoS'er have solved this problem too. This mean, there are one or more crackers targeting my system directly. OK, even if I use heavyly PHP, my system was never hacked since it is up (Juni 2000) but now I am ongoing to be militant if I catch one of those pigs... Maybe it's just me but if you don't want it to be used by unauthorised users, erm, authorise your users. What's wrong with a simple HTTP basic authentication solution? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr?
Jason Pruim wrote: Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they get HUGE files to print from. The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. All I want to do is grab the file extension and verify that it is a .zip or a .pdf etc. file. This is working for small files (under a few megs) but for some reason it fails when I get bigger. I have increased the allowed memory size to 50 MB's I'm testing with a 44 MB file right now. When it fails, it says the file type is not allowed even though it is listed in the file type array. Hopefully I have given you enough to go on to at least ask me some questions :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] Looking at what I think you are trying to do, how about this? ?php if ( isset( $_FILES ) ) { foreach ( $_FILES AS $file ) $filename = $file['name']; list($ext) = array_reverse(explode('.', $filename)); $allowed_ext = array('zip', 'pdf'); if ( in_array($ext, $allowed_ext) ) { // Correct extension; do what ever } else { // Incorrect extension; do nothing } } } ? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Search like php.net's URL thingy
Ryan S wrote: Hey! Thanks for replying. Digging a bit more i found IfModule mod_rewrite.c RewriteEngine On RewriteRule ^([a-z][0-9][A-Z][aA0-zZ0])$ jj.php?show=$1 /IfModule But it does not work :( do you see any fault with the above? this is an apache issue, not a php issue, so you'll probably have better luck on an apache mailing list. however i will tell you that apache handles URLs in .htaccess differently from in the normal httpd.conf files. in the .htaccess file, the URL presented to RewriteRule does NOT have a leading /. in the conf file, it will. so your rule might work if you do this: RewriteRule ^/([a-z][0-9][A-Z][aA0-zZ0])$ jj.php?show=$1 i'm guessing that you are using .htaccess though, in which case the problem becomes the rule itself. your regex is not going to do what you think. it's saying lower case letter followed by number followed by uppercase letter followed by i don't know what the heck that is. try: RewriteRule ^(\w+)$ jj.php?show=$1 [L] \w is equivalent to [A-Za-z0-9_] note that this is NOT the same as [A-Z][a-z][0-9] you almost always want [L] in a situation like this to prevent later rules from messing with your rewritten string. also i will tell you that if you ever plan to launch this feature on a site that gets significant traffic, turning off .htaccess file checking is a HUGE performance win. unfortunately you will have to restart apache every time you want to modify your rewrite rules, but them's the breaks. -jsd- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Search like php.net's URL thingy
Nate Tallman wrote: Why is an ErrorDocument insufficient or not the elegant way? It accomplishes the goal in a clean way, no? It's *WRONG*. ErrorDocument still preserves the 404 error code, it just gives it a prettier face. If the page really is there, returning a 404 for it is not correct. Search engines will not index it. You probably don't want that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Search like php.net's URL thingy
It's *WRONG*. So are vegetables. Long live the waffle! BTW, anyone seen this: http://code.google.com/apis/chart/ ...? More to the point, is anyone using it commercially? -- Richard Heyes Employ me: http://www.phpguru.org/cv ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Kindla 0T, but here goes...
Hey, clip I agree with Daniel. Your most likely solution is to use a Flash player (or similar implementation) and populate a portion of your page with the object via AJAX (which you are already apparently comfortable with). Or make your own Flash player with Ming and PHP. Working on that myself at the moment. /clip Would love to see what you come up with, gimme a shout when you finish it. Cheers! R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Search like php.net's URL thingy
Thanks for replying m8, but if you check the rest of the thread you will see this has alraedy been solved and the result is http://ezee.se/ezeeurl.php?do=1 Cheers! Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Password Protecting a page and email notification
I'm going to ask you PHP gurus if someone can give me a hand in trying to get this resolved. I'm fairly new to PHP and learning as I go. I've got two page login.php and video.php. Video.php is supposed to be protected i.e. if someone clicks on the direct link or brings up the page in a browser, it comes back with an error message and a request to link to login.php... they type in their username/pasword and it opens up the video.php so they can download videos. I actually managed to accomplish that with the following code which sits at the top of video.php. I also created a form on login.php for user input. So far so good. However, we also need an email to be sent to the site owner when someone logs in plus their name. For the hell of me, I can't figure out how to combine the two elements. I tried a lot of things sofar, but nothing works. It's either the page gets protected OR the email gets sent, depending on what I leave in the script. I tried using part of Jenny's script which is great for email forms but I can't combine this whole thing. Hlp!! /*this is the code that sits at the top of the protected page* which works actually fine for the protection*/ ?php session_start(); $_SESSION ['username'] = $_POST ['user']; $_SESSION ['userpass'] = $_POST ['pass']; $_Session ['authuser'] = 0; if (($_SESSION['username'] == 'logon') and ($_SESSION['userpass'] == 'password')) { $_SESSION['authuser'] = 1; } else { echo I'm sorry, access is denied br /; echo Please log in at a href='login.php' HERE/a to enter your Username and Password; exit(); } Can this be done on one form i.e. login.php? I have 4 textfields set up: username, password, email, name (for the person sending the email...).. some if clause somewhere? Best R.C. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Password Protecting a page and email notification
R.C. wrote: I'm going to ask you PHP gurus if someone can give me a hand in trying to get this resolved. I'm fairly new to PHP and learning as I go. I've got two page login.php and video.php. Video.php is supposed to be protected i.e. if someone clicks on the direct link or brings up the page in a browser, it comes back with an error message and a request to link to login.php... they type in their username/pasword and it opens up the video.php so they can download videos. I actually managed to accomplish that with the following code which sits at the top of video.php. I also created a form on login.php for user input. So far so good. However, we also need an email to be sent to the site owner when someone logs in plus their name. For the hell of me, I can't figure out how to combine the two elements. I tried a lot of things sofar, but nothing works. It's either the page gets protected OR the email gets sent, depending on what I leave in the script. I tried using part of Jenny's script which is great for email forms but I can't combine this whole thing. Hlp!! /*this is the code that sits at the top of the protected page* which works actually fine for the protection*/ ?php session_start(); $_SESSION ['username'] = $_POST ['user']; $_SESSION ['userpass'] = $_POST ['pass']; $_Session ['authuser'] = 0; if (($_SESSION['username'] == 'logon') and ($_SESSION['userpass'] == 'password')) { $_SESSION['authuser'] = 1; } else { echo I'm sorry, access is denied br /; echo Please log in at a href='login.php' HERE/a to enter your Username and Password; exit(); } Can this be done on one form i.e. login.php? I have 4 textfields set up: username, password, email, name (for the person sending the email...).. some if clause somewhere? Best R.C. what you have here looks fine. just put the mail() command in the first part of the if... if (($_SESSION['username'] == 'logon') and ($_SESSION['userpass'] == 'password')) { ... SEND MAIL HERE ... $_SESSION['authuser'] = 1; } else { echo I'm sorry, access is denied br /; echo Please log in at a href='login.php' HERE/a to enter your Username and Password; exit(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Password Protecting a page and email notification
On Jun 17, 2008, at 5:33 PM, R.C. wrote: I'm going to ask you PHP gurus if someone can give me a hand in trying to get this resolved. I'm fairly new to PHP and learning as I go. I've got two page login.php and video.php. Video.php is supposed to be protected i.e. if someone clicks on the direct link or brings up the page in a browser, it comes back with an error message and a request to link to login.php... they type in their username/pasword and it opens up the video.php so they can download videos. I actually managed to accomplish that with the following code which sits at the top of video.php. I also created a form on login.php for user input. So far so good. However, we also need an email to be sent to the site owner when someone logs in plus their name. For the hell of me, I can't figure out how to combine the two elements. I tried a lot of things sofar, but nothing works. It's either the page gets protected OR the email gets sent, depending on what I leave in the script. I tried using part of Jenny's script which is great for email forms but I can't combine this whole thing. Hlp!! /*this is the code that sits at the top of the protected page* which works actually fine for the protection*/ ?php session_start(); $_SESSION ['username'] = $_POST ['user']; $_SESSION ['userpass'] = $_POST ['pass']; $_Session ['authuser'] = 0; if (($_SESSION['username'] == 'logon') and ($_SESSION['userpass'] == 'password')) { $_SESSION['authuser'] = 1; } else { echo I'm sorry, access is denied br /; echo Please log in at a href='login.php' HERE/a to enter your Username and Password; exit(); } Can this be done on one form i.e. login.php? I have 4 textfields set up: username, password, email, name (for the person sending the email...).. some if clause somewhere? Best R.C. I think you're heading the right direction. I'd do something like this... ?php // login.php session_start(); if (isset ($_POST['confirm'])) { if ($_POST['user'] != 'logon' || $_POST['pass'] != 'password') { header (location: login.php?code=i); exit; } $_SESSION['username'] = $_POST['user']; $_SESSION['userpass'] = $_POST['pass']; $_SESSION['authuser'] = true; header (location: video.php); exit; } else { unset ($_SESSION['authuser']); } ? html ?php if ($_GET['code'] == 'i') { ? pInvalid login. Please try again./p ?php } ? form action=login.php method=post !-- Other fields here -- input type=hidden name=confirm value=1 / /form /html That's how you can start it. At the top of the login.php page, check to see if the form has been submitted/post'ed. If it has, check for the correct username and password. If fail, send back to the login page with an error code - don't make the user click to go back to the login. If success, THEN assign the session variables and redirect to the video page. Just a side note. Maybe this is just an example that you sent us, but I would strongly recommend NOT using 'password' as the password. =D If each user is going to have his/her own username/password, then I'd use a database to store that info - that can be another thread or a search of the archives. ;) Hope that helps. ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] Password Protecting a page and email notification
I forgot about the mail thing... Begin forwarded message: From: Philip Thompson [EMAIL PROTECTED] Date: June 17, 2008 6:52:15 PM CDT To: PHP-General List php-general@lists.php.net Subject: Re: [PHP] Password Protecting a page and email notification On Jun 17, 2008, at 5:33 PM, R.C. wrote: I'm going to ask you PHP gurus if someone can give me a hand in trying to get this resolved. I'm fairly new to PHP and learning as I go. I've got two page login.php and video.php. Video.php is supposed to be protected i.e. if someone clicks on the direct link or brings up the page in a browser, it comes back with an error message and a request to link to login.php... they type in their username/pasword and it opens up the video.php so they can download videos. I actually managed to accomplish that with the following code which sits at the top of video.php. I also created a form on login.php for user input. So far so good. However, we also need an email to be sent to the site owner when someone logs in plus their name. For the hell of me, I can't figure out how to combine the two elements. I tried a lot of things sofar, but nothing works. It's either the page gets protected OR the email gets sent, depending on what I leave in the script. I tried using part of Jenny's script which is great for email forms but I can't combine this whole thing. Hlp!! /*this is the code that sits at the top of the protected page* which works actually fine for the protection*/ ?php session_start(); $_SESSION ['username'] = $_POST ['user']; $_SESSION ['userpass'] = $_POST ['pass']; $_Session ['authuser'] = 0; if (($_SESSION['username'] == 'logon') and ($_SESSION['userpass'] == 'password')) { $_SESSION['authuser'] = 1; } else { echo I'm sorry, access is denied br /; echo Please log in at a href='login.php' HERE/a to enter your Username and Password; exit(); } Can this be done on one form i.e. login.php? I have 4 textfields set up: username, password, email, name (for the person sending the email...).. some if clause somewhere? Best R.C. I think you're heading the right direction. I'd do something like this... ?php // login.php session_start(); if (isset ($_POST['confirm'])) { if ($_POST['user'] != 'logon' || $_POST['pass'] != 'password') { header (location: login.php?code=i); exit; } $_SESSION['username'] = $_POST['user']; $_SESSION['userpass'] = $_POST['pass']; $_SESSION['authuser'] = true; $to = $_POST['user'] . .$_POST['email'].; $subject = $_POST['user'] . logged in; $message = Whatever you want in here...; $headers = From: MyCoolSite [EMAIL PROTECTED]\r\n; $headers .= Cc: Bob the Boss [EMAIL PROTECTED]\r\n; mail ($to, $subject, $message, $headers); header (location: video.php); exit; } else { unset ($_SESSION['authuser']); } ? html ?php if ($_GET['code'] == 'i') { ? pInvalid login. Please try again./p ?php } ? form action=login.php method=post !-- Other fields here -- input type=hidden name=confirm value=1 / /form /html That's how you can start it. At the top of the login.php page, check to see if the form has been submitted/post'ed. If it has, check for the correct username and password. If fail, send back to the login page with an error code - don't make the user click to go back to the login. If success, THEN assign the session variables and redirect to the video page. Just a side note. Maybe this is just an example that you sent us, but I would strongly recommend NOT using 'password' as the password. =D If each user is going to have his/her own username/password, then I'd use a database to store that info - that can be another thread or a search of the archives. ;) Hope that helps. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php