Re: [PHP] need a little help all
- Original Message - From: Richard Davey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 29, 2003 4:52 AM Subject: Re: [PHP] need a little help all Hello, Wednesday, December 17, 2003, 11:50:52 AM, you wrote: wmc Here is what i have i call 2 cookies in the top of my script, now i need to wmc call another when another script is called but it keeps givin me the error wmc headers already sent, wmc now ive seen this done in other scripts but wont work for me so please help wmc me is it in my php.ini or is it just not possible and imagened seeing it wmc somwhere else. Thanks all. You can access the value of cookies anywhere in your script, regardless if the headers have been sent or not. However you cannot SET a cookie once the headers have gone for use in the same page session. This isn't a PHP setting, it's just not possible. - Output buffering might be hlepful. read the php documentation abt output buffering. - -- Best regards, Richardmailto:[EMAIL PROTECTED] -- 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] Read/Write ID3v1.0 and ID3v1.1 Tags. ( PHP )
Hi, This class that represents ID3v1.0 and ID3v1.1 tags. It can read, write, and remove tags in MP3 files. Download : http://www.phpbuilder.com/snippet/detail.php?type=snippetid=1107 may the FORCE be with us! may the PHP be with us! .) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 29 Dec 2003 10:32:57 -0000 Issue 2500
php-general Digest 29 Dec 2003 10:32:57 - Issue 2500 Topics (messages 173403 through 173417): Re: Simple question 173403 by: Andy Higgins Re: Can't upload file greater than 11kb 173404 by: Chris need a little help all 173405 by: webmaster.multiwebmastertools.com 173406 by: Richard Davey 173416 by: Binay mcrypt and PHP to encrypt values to be passed to differend server 173407 by: Mark Wouters 173409 by: Tom Rogers [Newbie Guide] For the benefit of new members 173408 by: Ma Siva Kumar 173411 by: Raditha Dissanayake 173414 by: Ma Siva Kumar fopen 173410 by: Cesar Aracena 173413 by: Gerard Samuel multiple select option alternative to field_name[] 173412 by: Terence 173415 by: Binay Read/Write ID3v1.0 and ID3v1.1 Tags. ( PHP ) 173417 by: Fatih Hood Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hi Lab, I normally use code of the following format, which I think is quite neat: //Note that you do not need curely brackets in an if statement is there is only one line if ($_SERVER['REQUEST_METHOD'] == 'POST') $add = $HTTP_POST_VARS['textbox']; if ($add == 'Hello') do something //It is however recommended that you do the following in order to ensure that a user does not try to use malicious code in their input if ($_SERVER['REQUEST_METHOD'] == 'POST') $add = clean($HTTP_POST_VARS['textbox'], 20);; if ($add == 'Hello') do something where clean() is a function defined in an include as follows: function clean($input, $maxlength) { $input = substr($input, 0, $maxlength); $input = EscapeShellCmd($input); return ($input); } Hope that helps. Regards, Andy Labunski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I have only one simple question.. I'm using this method to get the values from the text box: if(isset($_POST[Submit]) $_POST[Submit]==Submit) { $add = $_POST['textbox'] ; } But I don't know how to write the source for this: If the value from the textbox ($add) is Hello then.. do something. I think it could be nicely done with IF, but I dont know how to write this.. Can someone help me, please? Regards, Lab. ---End Message--- ---BeginMessage--- Unfortunately, creating/editing .htaccess is not an operational requirement. Thanks anyway. Chris Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, if you are lucky LimitRequestBody could go into a .htaccess file (not sure though been a couple of months since i last read the manual) Chris wrote: It has been my experience that max_file_size does terminate the upload process if you include it in the form. But you are right, if it gets to the upload, your stuck. LimitRequestBody is beyond my control as the site is hosted by a third party. Thanks Chris Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, It's often said in many newsgroups and articles that the max_file_size is next to useless. It's also said that once IE starts uploading it will not stop even if you keep you foot on the stop button! If i remembers the earlier messages you have said the php.ini settings are correct. If so it could well be that you might be having misconfigured proxy server or firewall in the way. Apache also has a setting (LimitRequestBody) that could effect your upload. all the best Chris wrote: I don't believe that the MAX_FILE_SIZE needs to be there. It will only terminate the upload process at the client, rather than wait for the upload to complete. Anyway with or without MAX_FILE_SIZE the upload process is being terminated after the file is uploaded. When the form is submitted, the selected file is uploaded to the server's temp directory then copied to the maps dir. For some reason, when the file size exceeds 11kb (very small) the process gets aborted (with or without MAX_FILE_SIZE). I've put in diagnostic messages and the POST script throws an error message if it can't find the file in the temp directory. I've uploaded several file sizes up to the max of 2MB and it appears the file is being uploaded. I base this assumption on the fact the upload time is proportional to the file size. When the file size is greater than 11kb it appears that the file is deleted from the temp dir. Still no idea what is going on. Chris Larry Brown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The input type=hidden ... is more than a convenience for the client. It must be before the ...type=file... tag and after form.. (at least with
Re: [PHP] Can't upload file greater than 11kb
post_max_size should be greater than upload_max_filesize. What is the setting for max_input_time? Chris wrote: post_max_size: 8M upload_max_filesize: 10M what quota and disk space affect the web server process and temp dir This site is hosted by a third party: Disk space is 400MB only a fraction is used. temp dir -- unknown Chris -- ...and then Chris said... % % script on many php servers. However I am on one now which is not allowing me % to upload a file greater than 12kb. What does phpinfo() say for post_max_size upload_max_filesize and what quota and disk space affect the web server process and temp dir? HTH HAND David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multiple select option alternative to field_name[]
Use this.form.elements['select1[]'] Terence wrote: Dear All, The only way I know to retrieve all the values from a multiple select field is to use the square brackets after the field name ie. user_id[] The problem however is that when I use a javascript function to transfer the items from multiple_select_list1 to multiple_select_list2, I cannot use the square brackets in a field name, as this obviously conflicts with something in the script. So I am wondering if there's any other way in PHP to get the items, or do I have to find an alternative way in javascript? If anyone has ideas it would be great. Thanks Terence my code: (This works) echo select name='select1' multiple size='7' class='inputstyle'/select\n; input type='button' class='buttonstyle' value=' ' onClick=\if (document.images) copySelected(this.form.select1,this.form.select2)\ input type='button' class='buttonstyle' value=' ' onClick=\if (document.images) copySelected(this.form.select2,this.form.select1)\ input type='button' class='buttonstyle' value='' onClick=\if (document.images) copyAll(this.form.select1,this.form.select2)\ input type='button' class='buttonstyle' value='' onClick=\if (document.images) copyAll(this.form.select2,this.form.select1)\ select name='select2' multiple size='7' class='inputstyle'/select (This is the problem - notice the square brackets behind select2) echo select name='select1' multiple size='7' class='inputstyle'/select\n; input type='button' class='buttonstyle' value=' ' onClick=\if (document.images) copySelected(this.form.select1,this.form.select2[])\ input type='button' class='buttonstyle' value=' ' onClick=\if (document.images) copySelected(this.form.select2[],this.form.select1)\ input type='button' class='buttonstyle' value='' onClick=\if (document.images) copyAll(this.form.select1,this.form.select2[])\ input type='button' class='buttonstyle' value='' onClick=\if (document.images) copyAll(this.form.select2[],this.form.select1)\ select name='select2[]' multiple size='7' class='inputstyle'/select Javascript: echo script language='JavaScript'!--\n; echo function deleteOption(object,index) {\n; echo object.options[index] = null;\n; echo }\n; echo function addOption(object,text,value) {\n; echo var defaultSelected = true;\n; echo var selected = true;\n; echo var optionName = new Option(text, value, defaultSelected, selected)\n; echo object.options[object.length] = optionName;\n; echo }\n; echo function copySelected(fromObject,toObject) {\n; echo for (var i=0, l=fromObject.options.length;il;i++) {\n; echo if (fromObject.options[i].selected)\n; echo addOption(toObject,fromObject.options[i].text,fromObject.options[i].value); \n; echo }\n; echo for (var i=fromObject.options.length-1;i-1;i--) {\n; echo if (fromObject.options[i].selected)\n; echo deleteOption(fromObject,i);\n; echo }\n; echo }\n; echo function copyAll(fromObject,toObject) {\n; echo for (var i=0, l=fromObject.options.length;il;i++) {\n; echo addOption(toObject,fromObject.options[i].text,fromObject.options[i].value); \n; echo }\n; echo for (var i=fromObject.options.length-1;i-1;i--) {\n; echo deleteOption(fromObject,i);\n; echo }\n; echo }\n; echo //--/script\n; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is It Just a Matter of Getting the Pathname Righr?
Okay, I'm sorry for the length of this post, but I've worked my way thru a number of exercises--acoupla chapters' worth, in fact, since that last question was solved--before being stumped again. I'm not just turning pages and running to you folks without doing any work of my own. I'm trying to cut out excess code, but I again apologize that this is longish nonetheless. Again, I am on a Macintosh PowerBook, where my hard drive is, in fact, named a variation of My Hard Drive (with cap letters and spaces, as the Macintosh allows). So this brings me to my first questions: Do I change the line $dirName = c:/csci/mm to something like $dirName = My Hard Drive:/ followed by the exact name of every last folder until I come to the folder containing the GIFs and JPEGs I want to index and follow that with the .html extension? Or do I use something like $dirName = http://localhost/[my username]/ followed by the exact name of every last folder until I come to the folder containing the GIFs and JPEGs I want to index and follow that with the .html extension? The error message refers to unexpected $ ... on line 33. Line 33 of the code below is: /a. Then, of course, the unexpected $ of the error message does refer to the variable names to use in the $_POST--or is it better to use $_REQUEST instead?--lines right after ?php. Which of these belongs and why? Or, actually, which doesn't, and how come? $imageIndex = $_POST['imageIndex']? $dirName = $_POST['dirName']; $currentFile = $_POST['currentFile']; $theFiles = $_POST['theFiles']; $imageFiles = $_POST['imageFiles']; $output = $_POST['output']; Am I on the right track, at least? Thank you very much. Steve Tiano - The code: ?php // image index // generates an index file containing all images in a particular directory //point to whatever directory you wish to index. //index will be written to this directory as imageIndex.html $dirName = c:/csci/mm; $dp = opendir($dirName); chdir($dirName); //add all files in directory to $theFiles array while ($currentFile !== false){ $currentFile = readDir($dp); $theFiles[] = $currentFile; } // end while //extract gif and jpg images $imageFiles = preg_grep(/jpg$|gif$/, $theFiles); $output = ; foreach ($imageFiles as $currentFile){ $output .= HERE a href = $currentFile img src = $currentFile height = 50 width = 50 /a HERE; } // end foreach //save the index to the local file system $fp = fopen(imageIndex.html, w); fputs ($fp, $output); fclose($fp); //readFile(imageIndex.html); print a href = $dirName/imageIndex.htmlimage index/a\n; ? mail2web - Check your email from the web at http://mail2web.com/ . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is It Just a Matter of Getting the Pathname Righr?
[EMAIL PROTECTED] wrote: Again, I am on a Macintosh PowerBook, where my hard drive is, in fact, named a variation of My Hard Drive (with cap letters and spaces, as the Macintosh allows). So this brings me to my first questions: Do I change the line $dirName = c:/csci/mm to something like $dirName = My Hard Drive:/ followed by the exact name of every last folder until I come to the folder containing the GIFs and JPEGs I want to index and follow that with the .html extension? What version of MacOS are you running? Version X is based on BSD, so internaly there should not be any Hard Drives, but everything is mounted under some directory. In either case, phpinfo() will tell you what path you should use, search for SCRIPT_FILENAME. Or do I use something like $dirName = http://localhost/[my username]/ followed by the exact name of every last folder until I come to the folder containing the GIFs and JPEGs I want to index and follow that with the .html extension? This would not work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Replication Rollback
Hi, I posted this question in MySQL mailing list and go no reply. Since PHP is so close to MySQL. I am posting this question here. The basic problem is that I have committed the transaction and then replicated to another DB. Now I want to rollback the committed transaction. Is there a way to rollback to a particular point. This requirement is very similar to rolling back using save points. I guess an option would be to backup database before changes and restore it if the user is not satisfied with the changes he has made. One transaction in my application would affect 6-8 tables with at least 50 - 100 records getting inserted/updated or deleted. Please advice Karthikeyan B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't upload file greater than 11kb
Since this install of PHP is a CGI module, the server limits any execution to 30 seconds. Why should upload_max_filesize be greater than post_max_size? Why would this have any effect on a file size of 11kb? Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] post_max_size should be greater than upload_max_filesize. What is the setting for max_input_time? Chris wrote: post_max_size: 8M upload_max_filesize: 10M what quota and disk space affect the web server process and temp dir This site is hosted by a third party: Disk space is 400MB only a fraction is used. temp dir -- unknown Chris -- ...and then Chris said... % % script on many php servers. However I am on one now which is not allowing me % to upload a file greater than 12kb. What does phpinfo() say for post_max_size upload_max_filesize and what quota and disk space affect the web server process and temp dir? HTH HAND David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't upload file greater than 11kb
your file is sent through post. If your post upload max size is smaller then your upload max size, then the file wouldn't all fit within the post data that PHP will accept. Your upload would then get blocked. Therefore, post_max_size should be set to a larger value then upload_max_filesize to allow the upload to work in the first place. Andrew. Since this install of PHP is a CGI module, the server limits any execution to 30 seconds. Why should upload_max_filesize be greater than post_max_size? Why would this have any effect on a file size of 11kb? Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] post_max_size should be greater than upload_max_filesize. What is the setting for max_input_time? Chris wrote: post_max_size: 8M upload_max_filesize: 10M what quota and disk space affect the web server process and temp dir This site is hosted by a third party: Disk space is 400MB only a fraction is used. temp dir -- unknown Chris -- ...and then Chris said... % % script on many php servers. However I am on one now which is not allowing me % to upload a file greater than 12kb. What does phpinfo() say for post_max_size upload_max_filesize and what quota and disk space affect the web server process and temp dir? HTH HAND David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- 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] php.ini opened but not readed
Hi.. I write because I did not found a solution to this problem anywhere else. I compiled php-4.3.4 and httpd-2.0.48 (Apache) on Solaris 8. I run it in a chrooted environment (/usr/local/chroot/www/) The problem I see is that the php.ini file is never readed. It is found, it is opened and closed, but never readed. Running strace (actually truss since the OS is Solaris 8) I get this: open(/apache2/conf/php-apache2handler.ini, O_RDONLY) Err#2 ENOENT open(./php.ini, O_RDONLY) Err#2 ENOENT open(/apache2/conf/php.ini, O_RDONLY) = 473 close(473) = 0 open(/etc/services, O_RDONLY) Err#2 ENOENT stat(/apache2/lib/nss_nis.so.1, 0xFFBEEECC) Err#2 ENOENT As far as I see that means the file /apache2/conf/php.ini if found, opened and inmidiatly close. Never read... what do you think could be the problem? File permission looks OK. Some other info: that happens using the libphp4, but not the command line php. truss using the command line php shows this: open(/apache2/conf/php.ini, O_RDONLY) = 3 pathconf(., _PC_PATH_MAX) = 1024 stat64(./, 0xFFBEEBA8)= 0 stat64(/, 0xFFBEEB10) = 0 open64(./../, O_RDONLY|O_NDELAY) = 4 fcntl(4, F_SETFD, 0x0001) = 0 fstat64(4, 0xFFBEE130) = 0 fstat64(4, 0xFFBEEBA8) = 0 close(4)= 0 resolvepath(/apache2/conf/php.ini, /apache2/conf/php.ini, 1024) = 21 brk(0x0029B7F8) = 0 brk(0x0029F7F8) = 0 fstat64(3, 0xFFBEE4D0) = 0 brk(0x0029F7F8) = 0 brk(0x002A17F8) = 0 ioctl(3, TCGETA, 0xFFBEE45C)Err#25 ENOTTY read(3, [ P H P ]\n\n ; ; ; ; ;.., 8192) = 8192 read(3, Y\n ; e n v i r o n m.., 8192) = 8192 read(3, e t i t t o b e .., 8192) = 8192 read(3, n d o f c o u r s e.., 8192) = 8192 brk(0x002A17F8) = 0 brk(0x002A37F8) = 0 read(3, s e r ' s h i s t o r.., 8192) = 5918 read(3, 0x0029E5EC, 8192) = 0 llseek(3, 0, SEEK_CUR) = 38686 close(3) and the directives are readed. Any help would be very welcome since I am really lost :-| Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen
Now it gives me the following error message: Warning: fopen(websitename/esp/files/welcome.txt): failed to open stream: No such file or directory in d:\wwwroot\websitename\esp\lib\functions.php on line 6 But the file exists and so does the folder it is into. What can be wrong? I also uploaded the file to my Unix web server for testing purposes, CHMOD the folder to 777 and linked to the file but then other error appeared. When I tried with rb for fopen it gave me the same error saying that the file was missing... ??? Thanks, Gerard Samuel [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] On Sunday 28 December 2003 11:17 pm, Cesar Aracena wrote: $fp = fopen(../files/welcome.txt, a+); Change to $fp = fopen(../files/welcome.txt, r); Use r to read, when you use a it appends (or adds) to the file Its also suggested to use the b option to so it would look like $fp = fopen(../files/welcome.txt, rb); That is done for portability between *nix and windows. More info is at the manual http://us2.php.net/manual/en/function.fopen.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen
On Monday 29 December 2003 09:50 am, Cesar Aracena wrote: Now it gives me the following error message: Warning: fopen(websitename/esp/files/welcome.txt): failed to open stream: No such file or directory in d:\wwwroot\websitename\esp\lib\functions.php on line 6 But the file exists and so does the folder it is into. What can be wrong? I also uploaded the file to my Unix web server for testing purposes, CHMOD the folder to 777 and linked to the file but then other error appeared. When I tried with rb for fopen it gave me the same error saying that the file was missing... ??? Thanks, I cant say why you may be experiencing this error. The only thing wrong with your original code was you were trying to read a file, with fopen in append mode which is wrong. Maybe start with reading files that live in the same directory as the calling script, and work your way out from there... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't upload file greater than 11kb
Hi, Both Marek and Asegu have raised a very valid point about upload_max_filesize post_max_size hower Chris seems to have set this in megabytes but the limit kicks in to place at 11 KILO bytes. That's why i am convinced it's either an apache setting or a proxy getting in the way. Chris, in an earlier message you have said using .htaccess is not part of the requirement!? can you explain what you mean by that? To answer your other question on timing the max execution time is not considered important for handling file uploads but max input time is very important. Asegu wrote: your file is sent through post. If your post upload max size is smaller then your upload max size, then the file wouldn't all fit within the post data that PHP will accept. Your upload would then get blocked. Therefore, post_max_size should be set to a larger value then upload_max_filesize to allow the upload to work in the first place. Andrew. Since this install of PHP is a CGI module, the server limits any execution to 30 seconds. Why should upload_max_filesize be greater than post_max_size? Why would this have any effect on a file size of 11kb? Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] post_max_size should be greater than upload_max_filesize. What is the setting for max_input_time? Chris wrote: post_max_size: 8M upload_max_filesize: 10M what quota and disk space affect the web server process and temp dir This site is hosted by a third party: Disk space is 400MB only a fraction is used. temp dir -- unknown Chris -- ...and then Chris said... % % script on many php servers. However I am on one now which is not allowing me % to upload a file greater than 12kb. What does phpinfo() say for post_max_size upload_max_filesize and what quota and disk space affect the web server process and temp dir? HTH HAND David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Replication Rollback
How can you possibly expect us to know more about mysql than the experts in the mysql list ? :-) karthikeyan.balasubramanian wrote: Hi, I posted this question in MySQL mailing list and go no reply. Since PHP is so close to MySQL. I am posting this question here. The basic problem is that I have committed the transaction and then replicated to another DB. Now I want to rollback the committed transaction. Is there a way to rollback to a particular point. This requirement is very similar to rolling back using save points. I guess an option would be to backup database before changes and restore it if the user is not satisfied with the changes he has made. One transaction in my application would affect 6-8 tables with at least 50 - 100 records getting inserted/updated or deleted. Please advice Karthikeyan B -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Newbie Guide] For the benefit of new members
Hi, Hopefully an administrator could append this to the welcome message that's sent to new subscribers. Ma Siva Kumar wrote: On Monday 29 Dec 2003 10:24 am, you wrote: Hi, This compilation of your is really excellent. Over the last few months i have noticed that many posters are cleary sending messages without having read your newby guide. IMHO whenever that happens all of us on this list should suggest that the user should read this message in the archive first before responding to his query. Thanks. The idea is to send it once a week to catch the new subscribers with a message into their inbox before they commit any of the sins (!). Guess, some new users slip in the gap in between. Best regards, Ma SivaKumar -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp_connect error w/ 4.3.4RC1
I get the following error when running a script from CRON using PHP 4.3.4RC1 on FreeBSD (CRON statement) /usr/local/bin/php -q /usr/local/www/data.default/crm/parsecdr.php PHP Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /usr/local/www/data.default/crm/parsecdr.php on line 36 // ftp variables $ftp_server = rc.server.name; $ftp_user = user; $ftp_pass = pass; // connect to ftp server $ftpc = ftp_connect($ftp_server); LINE 36 I have searched everywhere, inlcuding bug reports that lead nowhere. Can anyone point me in the right direction? (I had no problems with this on previous versions of PHP and this has cropped up since the upgrade.) TIA and Happy Holidays! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Variables Disappear and Reappear
New to PHP and I've checked previous posts and haven't seen similar problem. Any ideas would be appreciated. Have encounted an odd problem. Using session variables to allow users to log in and out of my site. I've created a test system on my laptop. Apache 2.0.48, PHP 4.3.4, MySQL and Windows 2000. On my test system everything works perfectly. Sessions are created and maintained as long as the browser is open. I can also destroy sessions. However when I load everything up to my site via FTP the results are very sporadic. Sessions seem to drop and reappear. While a user is logged in I display a Logged in as: X message at the top of the page. I can continually refresh the page and occassionally the Logged in as X message will disappear showing the Please Login Form. If I refresh again (without logging in) the page shows the user is again Logged in. Here's the script that I use to log users in: ?php error_reporting (E_ALL ^ E_NOTICE); //check for required fields from the form if ((!$_POST[userid]) || (!$_POST[password])) { header(Location: Salkehatchie_Home.php); exit; } session_start(); //connect to server and select database $conn = mysql_connect(x.x.x.x, xx, x) or die(mysql_error()); //echo Connection is $conn br; mysql_select_db(xx_salkehatchie,$conn) or die(mysql_error()); //create and issue the query $sql = select userid, password, privs from userlist where userid = '$_POST[userid]' AND password = '$_POST[password]'; //echo USERID is $_POST[userid]br; //echo PASSWORD is $_POST[password]br; //echo SQL is $sqlbr; $result = mysql_query($sql,$conn) or die(mysql_error()); //echo Result is $resultbr; $rows = mysql_num_rows($result); //echo Number of Rows are $rowsbr; //get the number of rows in the result set; should be 1 if a match if (mysql_num_rows($result) == 1) { //if authorized, get the values set the $_SESSION Variables -- userid, password and privs $_SESSION[userid] = $_POST[userid]; $_SESSION[password] = $_POST[password]; $_SESSION[privs] = mysql_result($result, 0, 'privs'); //Direct user to members page header(Location: Salkehatchie_Members_Home.php); exit; } else { //redirect back to login form if not authorized header(Location: Salkehatchie_Home.php); exit; } ? I start off each webpage with the following script: ?php //Check for existence of Valid Login ID error_reporting (E_ALL ^ E_NOTICE); header(Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); header(Expires: . gmdate(D, d M Y H:i:s) . GMT); header(Cache-Control: no-store, no-cache, must-revalidate ); header(Cache-Control: post-check=0, pre-check=0, false); header(Pragma: no-cache); session_start(); if (isset($_SESSION[userid])) { $validlogon = YES; } else { $validlogon = NO; } echo $validlogon //test to see if user has previously logged on This all works perfectly on my test system but creates problems at my site. If anyone would like to see this for themselves go to the following site: http://www.salkehatchiehuntersville.com/Salkehatchie_Home.php and log in using test/test as userid/password. When logged in go back to the home page and then continually refresh that page. You will see that that the user moves in and out of a logged in status. This will also show up on other pages but since this site is under construction it's safest to stick to the HOME page. Other possibly helpful information. Web Hosting site is BlueDomino. Thanks for your help. Jerry Kita -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Replication Rollback
karthikeyan.balasubramanian wrote: I posted this question in MySQL mailing list and go no reply. Since PHP is so close to MySQL. I am posting this question here. That's no excuse. Just wait for an answer and don't bother other lists because they're kinda sorta related... The basic problem is that I have committed the transaction and then replicated to another DB. Now I want to rollback the committed transaction. Is there a way to rollback to a particular point. No. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp_connect error w/ 4.3.4RC1
Hi, Sounds like a DNS problem more than anything else. Have you tried to dig that hostname? best regards raditha Jay Blanchard wrote: I get the following error when running a script from CRON using PHP 4.3.4RC1 on FreeBSD (CRON statement) /usr/local/bin/php -q /usr/local/www/data.default/crm/parsecdr.php PHP Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /usr/local/www/data.default/crm/parsecdr.php on line 36 // ftp variables $ftp_server = rc.server.name; $ftp_user = user; $ftp_pass = pass; // connect to ftp server $ftpc = ftp_connect($ftp_server); LINE 36 I have searched everywhere, inlcuding bug reports that lead nowhere. Can anyone point me in the right direction? (I had no problems with this on previous versions of PHP and this has cropped up since the upgrade.) TIA and Happy Holidays! -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extending strip_tags() for allowing certain html tags
I found some code at http://marc.theaimsgroup.com/?l=php-generalm=106942414231212w=2 that was meant to extend strip_tags() where it wouldn't be blindly prone to XSS attacks via tag attributes. Unfortunately, that code works too good. If one were to pass a legal img tags like img src=http://us2.php.net/images/php_snow.gif; / It gets reduced to img Does anyone have any suggestions on how to modify that code (or any code), where one is bypassing certain tags, while keeping those certain tags safe (as safe as one can be) Thanks for you suggestions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can somebody convert this short Perl Script to PHP?
Hi, I am trying to make a log rotator and found a great perl script to do it but, would really like it in PHP (one less langauge to maintain). I know the system has things in place to do this but, I don't have access to the system /etc/log/ folder or the system log rotation scripts. I figured a simple php command line script would be a good alternative to maintain my own logs. Here's the perl script: #!/usr/bin/perl $LOGPATH='/Users/cv_admin/mylogs'; @LOGNAMES=('housekeeper_log_deleter.log','mysqlbackups_deleter.log','webbac kups_deleter.log'); $MAXCYCLE = 4; chdir $LOGPATH; # Change to the log directory foreach $filename (@LOGNAMES) { for (my $s=$MAXCYCLE; $s = 0; $s-- ) { $oldname = $s ? $filename.$s : $filename; $newname = join(.,$filename,$s+1); rename $oldname,$newname if -e $oldname; } } Don Myers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is It Just a Matter of Getting the Pathname Righr?
On 29/12/03 11:57 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: instead?--lines right after ?php. Which of these belongs and why? Or, actually, which doesn't, and how come? $imageIndex = $_POST['imageIndex']? $dirName = $_POST['dirName']; $currentFile = $_POST['currentFile']; $theFiles = $_POST['theFiles']; $imageFiles = $_POST['imageFiles']; $output = $_POST['output']; Am I on the right track, at least? The first line ends with a ? Not a ; If your on os X then the url is: http://localhost/~username/whatever.html The path is: /Users/username/sites/whatever.html Ryan Gibson --- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't Access PHP Includes Above Current Directory if using SSL
I hope all have had a great holiday season! My configuration is: RH Linux Kernel 2.4.20-8, Apache 2.0.48, OpenSSL -0.9.6l, PHP 4.3.4, Apache was compiled with SSL and SSL appears to work OK. My document root is http - /www/sd/htdocs, https - /www/sd/htdocs/jobs I don't want anyone accessing the jobs directory so I have a redirect in httpd.conf to send requests for http://www/sd/htdocs/jobs to https://www/sd/htdocs/jobs instead. All seems to work fine with http and https access with one blaring exception. My PHP scripts have include directives which pull include files from /www/sd/htdocs/include and that all works fine if run from one of the http subdirectories i.e. When running /www/sd/htdocs/test/index.php with this line: ?php include(../include/prepend.php); ? All works fine (note running from http area). But if I try the above code from an https directory, say https://www/sd/hddocs/jobs the it will fail with: PHP Warning: main(../include/prepend.php): failed to open stream: No such file or directory in /www/sd/htdocs/jobs/index.php on line 4 There is no problem if I change the include location to /www/sd/htdocs/jobs/include, I can run the scripts fine. So it seems I can include at the same level or below but not up any level in the directory tree if using https. I've also tried SSI to include a file (for testing purposes) with a similar result: !--#include file=../include/middle.html -- unable to include file ../include/middle.html in parsed file /www/sdfair.com/htdocs/jobs/index.shtml Fails as you can see from the https side but works fine if run from http://www/sd/htdocs/test (an area where SSL is not enabled). This is the case with all other parts of the web site without SSL, all scripts with include directives work fine. I've searched the web and SSL documentation but I seem to be missing something here and am just banging my head against a wall. I've modified both httpd.conf and ssl.conf 'til I'm blue with no change in function. Has anyone with PHP run into similar problems? I imagine this is some SSL configuration oversight on my part but so far I've been unable to find it and would ask for anyone who may be able to help to please give suggestions on what directive(s) are causing this. I'd really appreciate a point in the right direction on a resolution. Thanks for your help, .. Steve
RE: [PHP] ftp_connect error w/ 4.3.4RC1
[snip] Sounds like a DNS problem more than anything else. Have you tried to dig that hostname? [/snip] Well, I forgot to include that the script works from the command line. I have added an nsswitch.conf to the server and I am testing to see if that resolves the problem. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [Newbie Guide] For the benefit of new members
Raditha Dissanayake mailto:[EMAIL PROTECTED] on Sunday, December 28, 2003 8:55 PM said: This compilation of your is really excellent. Over the last few months i have noticed that many posters are cleary sending messages without having read your newby guide. IMHO whenever that happens all of us on this list should suggest that the user should read this message in the archive first before responding to his query. This sounds like an excellent idea. I hope to see you do it. :) Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't upload file greater than 11kb
The application is going to being supplied to a number of customers who may not know how to or don't have the ability to create/modify a .htaccess file. I tend to agree with Raditha about this being an Apache issue. Upon complaint to the hosting provider about this issue the did something that increased the upload file size to several hundred kilobytes. They claimed it has something to do with the temp dir where the file is being uploaded to. My suspect now is this issue has nothing to do with php. I'll bet I could write a cgi script as an action to the form and would encounter the same problem. Chris Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Both Marek and Asegu have raised a very valid point about upload_max_filesize post_max_size hower Chris seems to have set this in megabytes but the limit kicks in to place at 11 KILO bytes. That's why i am convinced it's either an apache setting or a proxy getting in the way. Chris, in an earlier message you have said using .htaccess is not part of the requirement!? can you explain what you mean by that? To answer your other question on timing the max execution time is not considered important for handling file uploads but max input time is very important. Asegu wrote: your file is sent through post. If your post upload max size is smaller then your upload max size, then the file wouldn't all fit within the post data that PHP will accept. Your upload would then get blocked. Therefore, post_max_size should be set to a larger value then upload_max_filesize to allow the upload to work in the first place. Andrew. Since this install of PHP is a CGI module, the server limits any execution to 30 seconds. Why should upload_max_filesize be greater than post_max_size? Why would this have any effect on a file size of 11kb? Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] post_max_size should be greater than upload_max_filesize. What is the setting for max_input_time? Chris wrote: post_max_size: 8M upload_max_filesize: 10M what quota and disk space affect the web server process and temp dir This site is hosted by a third party: Disk space is 400MB only a fraction is used. temp dir -- unknown Chris -- ...and then Chris said... % % script on many php servers. However I am on one now which is not allowing me % to upload a file greater than 12kb. What does phpinfo() say for post_max_size upload_max_filesize and what quota and disk space affect the web server process and temp dir? HTH HAND David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Small HTTP Server and PHP
Hi, I have downloaded and am fooling around with small http server...while reading the documentation I see that you can intergrate it with PHP/PERL etc but the details are a little high funda for me, just too scarce or not written properly (the authors first language is not english - but he wrote a great piece of software) My question is: Anybody here using that software? and if yes, have you been able to plug php and mySql into it? again, if yes...how? Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small HTTP Server and PHP
Http? Apache? or what server software? Alan Fullmer Owner / Administrator [EMAIL PROTECTED] Xnote Communications www.xnote.com - Original Message - From: Ryan A [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 29, 2003 12:15 PM Subject: [PHP] Small HTTP Server and PHP Hi, I have downloaded and am fooling around with small http server...while reading the documentation I see that you can intergrate it with PHP/PERL etc but the details are a little high funda for me, just too scarce or not written properly (the authors first language is not english - but he wrote a great piece of software) My question is: Anybody here using that software? and if yes, have you been able to plug php and mySql into it? again, if yes...how? Thanks, -Ryan -- 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] Small HTTP Server and PHP
Oops sorry for the confusion...the name of the server is small http server and you can download it off download.cnet.com thats where i found it anyway... -Ryan Http? Apache? or what server software? Hi, I have downloaded and am fooling around with small http server...while reading the documentation I see that you can intergrate it with PHP/PERL etc but the details are a little high funda for me, just too scarce or not written properly (the authors first language is not english - but he wrote a great piece of software) My question is: Anybody here using that software? and if yes, have you been able to plug php and mySql into it? again, if yes...how? Thanks, -Ryan -- 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] FDF Toolkit 6
I am having trouble getting FDF Took Kit for Adobe 6 and php 4.3.4 to correctly merge the fdf data into the pdf form. I am using the file below, which merges fine on our server running FDF Tool Kit for Adobe 4 and php 4.3.4 but won't merge using FDF 6. Are there changes in the FDF Tool Kit 6 that php doesn't handle currently? ?php $status = hello; $fdfhandle = fdf_create(); fdf_set_value($fdfhandle,status,$status, 0); $pdffile = http://172.16.84.213/simple1.pdf;; $fdffile = simple.fdf; fdf_set_file($fdfhandle, $pdffile); fdf_save($fdfhandle, $fdffile); fdf_close($fdfhandle); header(Content-type: application/vnd.fdf); $fp = fopen($fdffile, r); fpassthru($fp); unlink($fdffile); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and SSL Path Reference
PROBLEM 1 I am trying to implement SSL with PHP. When trying to use the include() function to insert an external PHP file, I am only able to make it work in the local directory and without SSL. I believe the following calls to external files should be correct; however, the include function is not successfull with the complete URL. Example include ('test.php'); works fine include ('http://www.myURL.com/mySubdirectory/test.php'); does not work. RELATED PROBLEM 2 When emplementing the SSL I am using my IP's certificate. Using their certificate, I can establish an SSL connection directly...ie. https://www.myIPDomain.com/myLoginID/mySubdirectories/test.php inserted into my browser establishes an SSL connection and the php test script works fine. When I reference this test script from another PHP script using the include() or require() function, the script does display the contents of the reference. The code is as follows: File 1 with external reference: https://www.myIPDomain.com/myLoginID/mySubdirectories/testinclude.php File 1 Contents: ?PHP echo Following should be the display of the Test File; include 'https://wwwmyIPDomain.com/myLoginID/mySubdirectories/testinclude.php;; ? File2 (file I am trying to include): https://www.myIPDomain.com/myLoginID/mySubdirectories/test.php Contents: ?PHP echo bbrbrThis is the contents of the Test PHP Fileb; ? When I call File 1, I can only get the following output: Following should be the display of the Test File I think it is a matter of relative vs absolute references...but not sure. Using the following setup Hardware -- SunOS www1 5.7 Generic_106541-12 sun4u Apache ver 1.3.26 PHP ver 4.3.1 Any suggestions are appreciated... Regards, D.H. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expression
Thank you!! It worked!! The wrong sample was 'dot'11'dot'abcd, but the first dot was not shown properly... And, now I have another problem: In fact, the input strings are lines from a webpage, and they sometimes have line-feed as in: $string = 11.abcd.32.efgh.54.ij --here kh.41.lmno. --here 63.pqrs; And, with ereg_replace((\.)([0-9]),\\1brbr\\2,$string), the result I expect is: 11.abcd. 32.efgh. 54.ijkh. 41.lmno. 63.pqrs. But, the actual result is: 11.abcd. 32.efgh. 54.ij -- problem kh. 41.lmno. 63.pqrs. -- problem I tried some more regular expressions to solve this, but they don work yet. So, please help me~~ Thank you in advance. Joshua - Original Message - Wrom: WIGYOKSTTZRCLBDXRQBGJSNBOHMKHJYFMYXOEAIJJ To: Joshua [EMAIL PROTECTED] Cc: PHP General list [EMAIL PROTECTED] Sent: Saturday, December 27, 2003 1:27 PM Subject: Re: [PHP] Regular Expression On Sat, 27 Dec 2003, Joshua wrote: I'm trying to change the string, for example, $string = 11.abcd.32.efgh.53.ijk; to 11.abcd. 32.efgh. 53.ijk. with ereg_replace. Like ereg_replace(\.[0-9],BR,$string); How can I recover the original characters after replacing them with BR in ereg_replace? ereg_replace(\.[0-9],BR\\0,$string) gives me the wrong result like: 11.abcd. 32.efgh. 53.ijk. Since the output you want and the output you didn't want are identical in your post, it was hard to tell what you were trying to do, but... I think this is what you want.. ereg_replace((\.)([0-9]),\\1br\\2,$string); (minus the last decimal point, missing from your original string) -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Original Message - Wrom: PHSCRTNHGSWZIDREXCAXZOWCONEUQZAAFXISHJEXX To: Joshua [EMAIL PROTECTED] Cc: PHP General list [EMAIL PROTECTED] Sent: Saturday, December 27, 2003 1:27 PM Subject: Re: [PHP] Regular Expression On Sat, 27 Dec 2003, Joshua wrote: I'm trying to change the string, for example, $string = 11.abcd.32.efgh.53.ijk; to 11.abcd. 32.efgh. 53.ijk. with ereg_replace. Like ereg_replace(\.[0-9],BR,$string); How can I recover the original characters after replacing them with BR in ereg_replace? ereg_replace(\.[0-9],BR\\0,$string) gives me the wrong result like: 11.abcd. 32.efgh. 53.ijk. Since the output you want and the output you didn't want are identical in your post, it was hard to tell what you were trying to do, but... I think this is what you want.. ereg_replace((\.)([0-9]),\\1br\\2,$string); (minus the last decimal point, missing from your original string) -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and SSL Path Reference
In response to your first problem: As long as allow_url_fopen is enabled in php.ini, you can use HTTP and FTP URLs with most of the functions that take a filename as a parameter. In addition, URLs can be used with the include(), include_once(), require() and require_once() statements. http://us3.php.net/manual/en/features.remote-files.php -- Matt Grimm Web Developer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Parkway Anchorage, AK 99508 907.770.6200 ext. 686 907.336.6205 (fax) E-mail: [EMAIL PROTECTED] Web: www.healthtvchannel.org D.H. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] PROBLEM 1 I am trying to implement SSL with PHP. When trying to use the include() function to insert an external PHP file, I am only able to make it work in the local directory and without SSL. I believe the following calls to external files should be correct; however, the include function is not successfull with the complete URL. Example include ('test.php'); works fine include ('http://www.myURL.com/mySubdirectory/test.php'); does not work. RELATED PROBLEM 2 When emplementing the SSL I am using my IP's certificate. Using their certificate, I can establish an SSL connection directly...ie. https://www.myIPDomain.com/myLoginID/mySubdirectories/test.php inserted into my browser establishes an SSL connection and the php test script works fine. When I reference this test script from another PHP script using the include() or require() function, the script does display the contents of the reference. The code is as follows: File 1 with external reference: https://www.myIPDomain.com/myLoginID/mySubdirectories/testinclude.php File 1 Contents: ?PHP echo Following should be the display of the Test File; include 'https://wwwmyIPDomain.com/myLoginID/mySubdirectories/testinclude.php;; ? File2 (file I am trying to include): https://www.myIPDomain.com/myLoginID/mySubdirectories/test.php Contents: ?PHP echo bbrbrThis is the contents of the Test PHP Fileb; ? When I call File 1, I can only get the following output: Following should be the display of the Test File I think it is a matter of relative vs absolute references...but not sure. Using the following setup Hardware -- SunOS www1 5.7 Generic_106541-12 sun4u Apache ver 1.3.26 PHP ver 4.3.1 Any suggestions are appreciated... Regards, D.H. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can't upload files then 400K to MySQL
Have you taken a look at the post below: Can't upload files Greater than 11KB? We may have the same problem. Ahmetax [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have the following PHP code to upload files to a MySQL table. It works fine, but, I can't upload any files greater then 400K. What might be the problem? TIA ahmet ? if (isset($_POST[submit])) { $fname= $_FILES[user_file][name]; $tmp= addslashes($_FILES[user_file][tmp_name]); $size= $_FILES[user_file][size]; $type=$_FILES[user_file][type]; $tanim=$_FILES[user_file][file_desc]; $fd=fopen($tmp,r) or die(Can't open file!); $fdata=urlencode(fread($fd,filesize($tmp))); $size=filesize($tmp); $tanim=$descript; include(baglan.inc); mysql_select_db(dosyalar); $sql=INSERT INTO files (name,file_type,file_desc,file_data,file_size). VALUES('$fname','$type','$descr','$fdata','$size'); mysql_query($sql); } ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleAxTelSoft-Uploading a file /title meta http-equiv=Content-Type content=text/html; charset=windows-1254 meta http-equiv=Content-Type content=text/html; charset=iso-8859-9 meta http-equiv=Content-Language content=tr meta http-equiv=description content=axtelsoft, indir, download, delphi, source code, kaynak kod meta http-equiv=Pragma content=no-cache meta name=Generator content=Ahmet Aksoy /head body form enctype=multipart/form-data action=?php echo $SERVER[PHP_SELF];? method=post input type=hidden name=MAX_FILE_SIZE value=16777215 Send this file: input name=user_file type=file Explanations : TEXTAREA NAME=descript ROWS=10 COLS=45 WRAP?php echo($descr); ?/TEXTAREA Pinput type=submit value=Send File name=submit /form /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Selecting between using letters
How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. $sql = SELECT * FROM table WHERE LastName REGEXP '^[A-E]'; HTH -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Selecting between using letters
If the database is really large, some databases will attempt to use an index if you use between as in select * from table where lastname between A and F or and compares. not sure about MySQL, and notice I had to use the letter F to get all names beginning with E I seem to recall Sybase would use a table scan (read every row in the table) if an imbedded function was used in the where clause, and it would use an index with between. Haven't done any internals work with MySQL so not sure if this would speed things up or not. Warren Vail -Original Message- From: Lowell Allen [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 2:25 PM To: PHP Subject: Re: [PHP] Selecting between using letters How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. $sql = SELECT * FROM table WHERE LastName REGEXP '^[A-E]'; HTH -- Lowell Allen -- 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] HTML via echo or not
Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML via echo or not
I agree. I think embedding the ?php ? tags is messy and harder to follow. I do however, treat echo like print. ie echo The thought would \have\ to be clear.; I've not use CR,. I'll have to look at that. Thanks -Original Message- From: Robin Kopetzky [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 8:02 PM To: PHP General Subject: [PHP] HTML via echo or not Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- 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] Selecting between using letters
How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Selecting between using letters
How about the following; SELECT DISTINCT left( name, 1 ) AS idx, count( * ) FROM users GROUP BY idx produces a count of the names found for each letter, then you can make decisions about your range of letters, like a max of 250 between letters, or some such number. Warren Vail -Original Message- From: Doug Parker [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 2:18 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Selecting between using letters How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Selecting between using letters
Doug Parker wrote: How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com SELECT * FROM `user` WHERE lastname 'A' AND lastname 'E' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
Why make PHP work harder than it needs to? Jordan Robin Kopetzky wrote: Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jones -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML via echo or not
I use a templating framework in which I put all of my HTML. However, when I create components that need to output HTML to render themselves then I use the echo and single quote style also. I find heredoc and breaking in and out of PHP to be extremely messy looking, not to mention horribly maintainable. Double quotes versus single quotes is more a matter of preference, for instance when doing SQL queries I like to use double quotes instead since I quote my SQL strings in single quotes. Cheers, Rob. On Mon, 2003-12-29 at 20:03, Larry Brown wrote: I agree. I think embedding the ?php ? tags is messy and harder to follow. I do however, treat echo like print. ie echo The thought would \have\ to be clear.; I've not use CR,. I'll have to look at that. Thanks -Original Message- From: Robin Kopetzky [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 8:02 PM To: PHP General Subject: [PHP] HTML via echo or not Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
On Mon, 2003-12-29 at 20:34, Jordan S. Jones wrote: Why make PHP work harder than it needs to? A decent compile cache will optimize literal concatenation so that only variables are concatenated at run time. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and SSL Path Reference
Hello, On 12/29/2003 06:37 PM, D.H. wrote: PROBLEM 1 I am trying to implement SSL with PHP. When trying to use the include() function to insert an external PHP file, I am only able to make it work in the local directory and without SSL. I believe the following calls to external files should be correct; however, the include function is not successfull with the complete URL. Example include ('test.php'); works fine include ('http://www.myURL.com/mySubdirectory/test.php'); does not work. I am not sure why you want to do this because it is very slow. Anyway, if you do not allow to open remote URL files in your configuration file php.ini, that may be the reason. You may also want to this HTTP client class that can work if you have configuration restrictons. It lets you retrieve pages with either http or https URLs. http://www.phpclasses.org/httpclient RELATED PROBLEM 2 When emplementing the SSL I am using my IP's certificate. Using their certificate, I can establish an SSL connection directly...ie. https://www.myIPDomain.com/myLoginID/mySubdirectories/test.php inserted into my browser establishes an SSL connection and the php test script works fine. When I reference this test script from another PHP script using the include() or require() function, the script does display the contents of the reference. The code is as follows: File 1 with external reference: https://www.myIPDomain.com/myLoginID/mySubdirectories/testinclude.php File 1 Contents: ?PHP echo Following should be the display of the Test File; include 'https://wwwmyIPDomain.com/myLoginID/mySubdirectories/testinclude.php;; ? File2 (file I am trying to include): https://www.myIPDomain.com/myLoginID/mySubdirectories/test.php Contents: ?PHP echo bbrbrThis is the contents of the Test PHP Fileb; ? When I call File 1, I can only get the following output: Following should be the display of the Test File I think it is a matter of relative vs absolute references...but not sure. I think you are confused. When you ask for remote data that way, you will get the contents of the page that is generated by that script, not the script itself. If you could do what you want that way, anybody could steal the PHP source code of all sites. OTOH, if you have PHP script source code retrieval support enabled, you can try what you want asking for this url (notice phps extension), but you have to enable support in your server. https://www.myIPDomain.com/myLoginID/mySubdirectories/test.phps -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can't upload files then 400K to MySQL
Might want to check the MySQL configuration. The max allowed packet size might be set extremely low. -Jeremy On Mon, 2003-12-29 at 15:25, Chris wrote: Have you taken a look at the post below: Can't upload files Greater than 11KB? We may have the same problem. Ahmetax [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have the following PHP code to upload files to a MySQL table. It works fine, but, I can't upload any files greater then 400K. What might be the problem? TIA ahmet ? if (isset($_POST[submit])) { $fname= $_FILES[user_file][name]; $tmp= addslashes($_FILES[user_file][tmp_name]); $size= $_FILES[user_file][size]; $type=$_FILES[user_file][type]; $tanim=$_FILES[user_file][file_desc]; $fd=fopen($tmp,r) or die(Can't open file!); $fdata=urlencode(fread($fd,filesize($tmp))); $size=filesize($tmp); $tanim=$descript; include(baglan.inc); mysql_select_db(dosyalar); $sql=INSERT INTO files (name,file_type,file_desc,file_data,file_size). VALUES('$fname','$type','$descr','$fdata','$size'); mysql_query($sql); } ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleAxTelSoft-Uploading a file /title meta http-equiv=Content-Type content=text/html; charset=windows-1254 meta http-equiv=Content-Type content=text/html; charset=iso-8859-9 meta http-equiv=Content-Language content=tr meta http-equiv=description content=axtelsoft, indir, download, delphi, source code, kaynak kod meta http-equiv=Pragma content=no-cache meta name=Generator content=Ahmet Aksoy /head body form enctype=multipart/form-data action=?php echo $SERVER[PHP_SELF];? method=post input type=hidden name=MAX_FILE_SIZE value=16777215 Send this file: input name=user_file type=file Explanations : TEXTAREA NAME=descript ROWS=10 COLS=45 WRAP?php echo($descr); ?/TEXTAREA Pinput type=submit value=Send File name=submit /form /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Migrating from SSI and Perl
Right, I used $output = shell_exec(perl browser.pl); echo output; as Radek suggested. To call my browser-sniffing perl script and read back what the script prints. My trouble now is that the perl script, being called by the php script rather than by SSI, no longer seems to have the cgi environment variables to call on. I can get the variable using $BRPHP = $_SERVER['HTTP_USER_AGENT']; How do I pass this to the perl script? I've followed all the avenues suggested in the newbie guide. The best I can seem to manage is to use exec() like so: $BRPHP = $_SERVER['HTTP_USER_AGENT']; $arr = array (1 = $BRPHP ); exec (' ../cgi-bin/browser.pl', $arr ); echo $arr[2]; echo $arr[3]; echo $arr[4]; echo $arr[5]; echo $arr[6]; The echo commands get me back the script's output, but am I passing $BRPHP to the perl script this way? (If the answer is yes then I can ask the folks at perl.org how to pick it up in the perl script). Thanks, Philip Pawley At 26/12/03 12:29 -0500, you wrote: Check out shell_exec() and its siblings. I'd likely use it like so $output = shell_exec(perl myscript.pl); and then do something with the $output variable R -Original Message- From: Philip Pawley [mailto:[EMAIL PROTECTED] Sent: December 26, 2003 12:07 PM To: php-general Subject: [PHP] Migrating from SSI and Perl I am new to php. My site, at the moment, uses SSI to call a Perl browser-sniffing script. I would like to: 1. use php to call the Perl script. 2. then save the values the Perl script outputs as php variables. Can this be done? If so, how? Thanks, Philip Pawley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can somebody convert this short Perl Script to PHP?
Hi, Tuesday, December 30, 2003, 2:50:17 AM, you wrote: DM Hi, I am trying to make a log rotator and found a great perl script to do it DM but, would really like it in PHP (one less langauge to maintain). DM I know the system has things in place to do this but, I don't have access DM to the system /etc/log/ folder or the system log rotation scripts. I figured DM a simple php command line script would be a good alternative to maintain my DM own logs. DM Here's the perl script: DM #!/usr/bin/perl DM $LOGPATH='/Users/cv_admin/mylogs'; DM DM @LOGNAMES=('housekeeper_log_deleter.log','mysqlbackups_deleter.log','webbac DM kups_deleter.log'); DM $MAXCYCLE = 4; DM chdir $LOGPATH; # Change to the log directory DM foreach $filename (@LOGNAMES) { DM for (my $s=$MAXCYCLE; $s = 0; $s-- ) { DM $oldname = $s ? $filename.$s : $filename; DM $newname = join(.,$filename,$s+1); DM rename $oldname,$newname if -e $oldname; DM } DM } DM Don Myers Here is an untested version you can start with #!/usr/bin/php ? $LOGPATH='/Users/cv_admin/mylogs'; $LOGNAMES= array('housekeeper_log_deleter.log','mysqlbackups_deleter.log','webbackups_deleter.log'); $MAXCYCLE = 4; chdir($LOGPATH); # Change to the log directory foreach ($LOGNAMES as $filename ) { for ($s=$MAXCYCLE; $s = 0; $s-- ) { $oldname = ($s 0)? $filename.$s : $filename; $newname = $filename.($s+1); if(file_exists($oldname)){ rename($oldname,$newname); } } } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP cart Credit Card processing
Hi all, I am building a cart of my own for a site I'm making and would like to know if doing it like this (instead of using a known cart script), I will be able to use any of the Credit Card processing systems there are. If so, which Credit Card processing company has given you the best experience? Thanks all, Cesar Aracena -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
Robin -- ...and then Robin Kopetzky said... % % Good evening. Hiya! % % I'm probably going to stir up a hornet's nest but have a question. Probably so :_0 % % Does using echo for ALL html pages mean I have a sick mind? Example: I don't think so. % % echo CR, 'HTML', %CR, ' BODY', %CR, ' etc...'; OK, that does look a bit sick :-) If nothing else, you end up with a blank line before your first tag, which is technically a no-no. I personally terribly dislike the jump-in-and-out bit, so only when I have to use javascript and have to quote it do I even think about that. I should also get around to using templates, but I haven't yet, so my answer might be different later. I have a vague grasp of the nirvana of separating the presentation formatting from the actual work and would like to get there someday. In my copious time between midnight and 4am, I suppose. Oh, wait; I'm in that now. I may have to sleep in 'til 4:30 to make up for it *yawn* I also use print for everything rather than echo; I use '' on my HTML attributes within my print s and so I don't look like a B movie (that's B for backslasher :-) When printing large chunks I don't bother with HEREDOCs but have been known to print table tr tdcell/td tdcell/td /tr /table There was a table. ; or so. It's easier to write than all of the quoting on and off that you describe (plus I use \n rather than CR, not having seen it before and thus not knowing if it's a predefined constant or one you did). I tend to get a bit lazy with my HTML and often don't sweat the formatting for the sake of the browser, though I do use newlines for at least a token consideration of anyone reading the output :-) The php is much more important to me than the resultant HTML. Good luck coming to a sane final decision :-) HTH HAND Happy Holidays :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] Can't upload file greater than 11kb
Chris, et al -- ...and then Chris said... % % complaint to the hosting provider about this issue the did something that % increased the upload file size to several hundred kilobytes. They claimed it % has something to do with the temp dir where the file is being uploaded to. Hah! I called it six days ago :-) Glad to see you're up and running, and good luck beating this problem with your customers. HTH HAND Happy Holidays :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP] Has anyone installed AWF 1.10?? I need some help
Has anyone installed AWF 1.10?? I need some help... -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] curl tutorial
Hi everybody , can any body point me the direction where i can find curl tutorials. I was going through the curl concept from php manual but couldn't quench my thirst as this section is not very clear. I also searched in the archive but couldn't find any. if any of u know the resource point(curl tutorial) plz let me know. Thanks Binay
[PHP] Re: curl tutorial
Hello, On 12/30/2003 04:39 AM, Binay wrote: can any body point me the direction where i can find curl tutorials. I was going through the curl concept from php manual but couldn't quench my thirst as this section is not very clear. I also searched in the archive but couldn't find any. if any of u know the resource point(curl tutorial) plz let me know. You are right, curl API is a bit messy. I think that if you ask Google, you may find some curl tutorials. You may also want to take a look at this HTTP client class that provides a simpler interface and uses CURL mostly for accessing SSL pages (https): http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php