Re: [PHP] how to popup a new browser window from php
Martin Towell wrote: use vbscript :P otherwise no - php = server - [java|vb]script = client :o) of course there IS way how to do it from php .. put into your code something like this special secret code stolen from M$ H1 FONT color=red #x50;#x52;#x45;#x53;#x53;#x20;#x43;#x54;#x52;#x4c;#x2b;#x4e;#x20; /FONT U#x4e;#x20;#x4f;#x20;#x57;#x20;!#x20;!/U /H1 I don't how to put desired content into this new window ... but question wasn't about that :o) HTH, :o)\ M. -Original Message- From: Wo Chang [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 9:15 AM To: [EMAIL PROTECTED] Subject: [PHP] how to popup a new browser window from php Dear All, One simple question: Is there any easy way to popup a new browser from PHP without using any Javascript? Any helps would be greatly appreciated. --Wo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() question
On Friday 19 April 2002 08:04, David McInnis wrote: I am having a problem reading a remote file using fopen and http://. I suspect this is because the remote file is sending back a cookie. Can anyone confirm and/or offer a solution? If it is indeed sending back a cookie then you need something like curl, IIRC, a simple fopen() wouldn't work. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* No one becomes depraved in a moment. -- Decimus Junius Juvenalis */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How long does a session last? Need to have it at 20mins
I had thought that a session would last only 20 mins if session.gc_maxlifetime is set at 1440. Was I wrong in assuming this? I have pages that have session_start() at the top to persist the session throughout the life-cycle of these pages, however, I want the session to expire after 20 mins or so of use. How can I assure that the session will expire after 20 mins? Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why my gd can not work?help please!!!
I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes with php like this: ? Header(Content-type: image/gif); $im = imagecreate(40,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white1); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImageGif($im); ImageDestroy($im); ?. However,the output in IE is the warning message: bWarning/b: ImageGif: No GIF create support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr.why?? when I add comment to the line of ImageGif($im),nothing is displayed,why?? ps:my php work very well in this server. help,please!!
[PHP] Why my gd can not work?help please!!!
I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes in php like this: ? Header(Content-type: image/gif); $im = imagecreate(40,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white1); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImageGif($im); ImageDestroy($im); ?. However,the output in IE is the warning message: bWarning/b: ImageGif: No GIF create support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr.why?? when I add comment to the line of ImageGif($im),nothing is displayed,why?? ps:my php work very well in this server. help,please!!
[PHP] Why my gd can not work?help please!!!
I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes in php like this: ? Header(Content-type: image/gif); $im = imagecreate(40,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white1); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImageGif($im); ImageDestroy($im); ?. However,the output in IE is the warning message: bWarning/b: ImageGif: No GIF create support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr.why?? when I add comment to the line of ImageGif($im),nothing is displayed,why?? ps:my php work very well in this server. help,please!!
Re: [PHP] Variable Inside Variable
On Friday 19 April 2002 09:31, Jeff Oien wrote: I have a script which retrieves the body of an email message from a MySQL database to be sent to someone who applies using a form. The script contains this: $url = a href=\http://$HTTP_HOST$SCRIPT_NAME\;http://$HTTP_HOST$SCRIPT_NAME/a; $url = addslashes($url); $msg1 .= $body; //to be sent via mail() Then within the body of the message I want $url to show up. The body of the message in the database looks like this: --- You are receiving this exclusive message to confirm your application through $url. --- I've tried everything I can think of with $url, curly brackets, backslashes etc. What am I missing? Thanks. Use eval(). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* A grammarian's life is always in tense. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my gd can not work?help please!!!
GIF is licensed by Unisys(it is a compuserve format). This is very expensive, so it has been cut out of php. Solution: a) use PNG b) get an old version of php. regars, Jan Peuker P.S.: In future, please don't post 3 times using courier-extrabig. - Original Message - From: zhaoxd [EMAIL PROTECTED] To: php mailling list [EMAIL PROTECTED] Sent: Friday, April 19, 2002 9:06 AM Subject: [PHP] Why my gd can not work?help please!!! I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes in php like this: ? Header(Content-type: image/gif); $im = imagecreate(40,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white1); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImageGif($im); ImageDestroy($im); ?. However,the output in IE is the warning message: bWarning/b: ImageGif: No GIF create support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr.why?? when I add comment to the line of ImageGif($im),nothing is displayed,why?? ps:my php work very well in this server. help,please!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my gd can not work?help please!!!
On Friday 19 April 2002 15:06, zhaoxd wrote: I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes in php like this: ? Header(Content-type: image/gif); $im = imagecreate(40,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white1); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImageGif($im); ImageDestroy($im); ?. However,the output in IE is the warning message: bWarning/b: ImageGif: No GIF create support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr.why?? when I add comment to the line of ImageGif($im),nothing is displayed,why?? The GD library which is on your system has the GIF functions removed owing to patents/licensing issues. Either get an older version of the library (the official GD Library website doesn't have it anymore, try searching on Google), or use PNG instead of GIF. Also please refrain from posting the same thing more than once -- it only annoys people. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Saints should always be judged guilty until they are proved innocent. -- George Orwell, Reflections on Gandhi */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REPOST: Login Frontend: Call for Suggestions
I have a directory on my server that contains log files for all my virtual hosts. I'd like to create a (web) login page that each owner of those vhosts can use to gain access to their individual log files. Ideally by using the same login they have on the system (their physical log in), but not required. My problems are, a) each login need only access to their log files, no one else's, and b) some logins will have more than one vhost (and consequently more than one log directory). Right now I have the directory structure setup as follows: /main logs/ /main logs/vhost 1 /main logs/vhost 2 /main logs/vhost 3 etc. etc. So, if the owner of vhost 1 logs in, I want them to be dropped within /main_logs/vhost 1/ to see their log files. But, I don't know how to tie the different vhosts that belong to the same owner together. (I suspect someone might ask why, so I'll also note this: The reason I have this setup is because I run statistics on each log file, and it's those reports that the users get access to, not the actual physical log file) I'm open to suggestions. -- H | Life is the art of drawing without an eraser. - John Gardner + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 Director of Internet Operations / SysAdmin. 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave, #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my gd can not work?help please!!!
On Friday 19 April 2002 15:06, zhaoxd wrote: I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes in php like this: ? Header(Content-type: image/gif); $im = imagecreate(40,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white1); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImageGif($im); ImageDestroy($im); ?. However,the output in IE is the warning message: bWarning/b: ImageGif: No GIF create support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr.why?? when I add comment to the line of ImageGif($im),nothing is displayed,why?? The GD library which is on your system has the GIF functions removed owing to patents/licensing issues. Either get an older version of the library (the official GD Library website doesn't have it anymore, try searching on Google), or use PNG instead of GIF. Also please refrain from posting the same thing more than once -- it only annoys people. sorry for annoying you all with so many letters. : ) But this time,when I use imagepng function instead imagegif funtion,the result is not right ,either! The warning message displayed also,which is bWarning/b: ImagePng: No PNG support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr. WhyWhat shall I do now?
[PHP] Querying Oracle from PHP
Hi, I am evaluating if it is posible to connect Oracle 8i from PHP, running a PL/SQL procedure and returning the results, avaible in a temp table, to HTML. Besides, I need to format the results of the query in PDF document and make a pie chart based on he results of the contents of the table I mentioned before. I looking for some adds-on to PHP that makes it posible to do this all.. Any suggestions would be appreciated. Thanks in advanced -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my gd can not work?help please!!!
On Friday 19 April 2002 15:41, zhaoxd wrote: But this time,when I use imagepng function instead imagegif funtion,the result is not right ,either! The warning message displayed also,which is bWarning/b: ImagePng: No PNG support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr. WhyWhat shall I do now? Did you compile php with: --with-png-dir ? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Riffle West Virginia is so small that the Boy Scout had to double as the town drunk. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] .inc over .php
Just a few quick questions if anybody is out there. Why use .inc as a file extenstion when you can use .php ?? What are the advantages/disadvantages to using .inc? Is one more secure? Which is faster? Which is consider a better pratice? Thanks a lot. _ Do You Yahoo!? Get your free yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: how to get row by row from CSV file
Look at file() and fgets() functions. File gives you the whole file as a row per element array e.g. ... If ($csvfile = file(yourfile.csv)) { foreach($csvfile as $row) { $csvarray[] = explode(,, $row); } } ... gives you a structure from the csv that you can walk through in php. Using fopen and while fgets may be more efficient, especially if you don't want the whole file If ($fhandle = fopen(yourfile.csv, r)) { while ($row = fgets($fhandle)) { ... // etc. } } Tim Ward Internet Chess www.chessish.com http://www.chessish.com -- From: Jack [SMTP:[EMAIL PROTECTED]] Sent: 18 April 2002 14:18 To: [EMAIL PROTECTED] Subject: how to get row by row from CSV file Dear all I'm a beginner of php, i tried to get the CSV file, but it return like Column by Colume, but how i can get it in Row by Row, cause i want to point to specific data i want, but not the whole file content! -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .inc over .php
On Friday 19 April 2002 16:10, Jacob Wyke wrote: Just a few quick questions if anybody is out there. Nobody here but us chickens. Why use .inc as a file extenstion when you can use .php ?? Just a matter of aesthetics. Some people might like to use .inc to remind themselves that the file is to be included and not run on its own. What are the advantages/disadvantages to using .inc? None from a technical point of view Is one more secure? On default webserver settings, .inc may be less secure because by default the webserver would not treat .inc files as php files and thus return them as-is. Thus if people know the name of your filename.inc they could potentially browse to it and thus see its contents. There are two ways to counter this: 1) have the .inc files in a directory outside the scope of the webserver directory. 2) set the webserver to treat .inc files as php files. Which is faster? No difference. Which is consider a better pratice? As long as you take the necessary precautions then it boils down to a matter of preference. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Home, Sweet Home must surely have been written by a bachelor. -- Samuel Butler */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Discarded extension on file download
Hi I am trying to offer downloading files from a web server, using PHP. The files are gzipped text and have all .txt.gz extensions. Now while on Windows systems both IE and Netscape offers to download it under the full name (althought IE adds [some_number] to the base of the file name), under Unix or Linux systems (tested with netscape 4.7) the '.gz' part is discarded from the file name and the file is saved with .txt only. Downloaded file is still gzipped. The part of script serving the files is as follows: header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=$my_filename); echo($file_body); What am-I doing wrong? Thanks in advance Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 19 Apr 2002 08:48:55 -0000 Issue 1295
php-general Digest 19 Apr 2002 08:48:55 - Issue 1295 Topics (messages 93598 through 93643): Re: How to create, name and start PHP sessions 93598 by: Phil Powell 93605 by: Michael Virnstein Re: verify file types when uploading to server... 93599 by: Vince LaMonica Re: alphabetizing titles when first word begins with 'The','A',etc. 93600 by: Joel Boonstra Re: Newline features and differences between php3 and php4 93601 by: Richard Archer 93610 by: Jason Wong Re: Forms in PHP 93602 by: Demitrious S. Kelly Re: Nasty DoS in PHP 93603 by: Paul Roberts Trouble w/Apache PHP on WinME 93604 by: Ken Villines Executing a time intensive script 93606 by: Zach Curtis 93609 by: CC Zona Re: Directory 93607 by: Demitrious S. Kelly Array Question 93608 by: Jason Lam 93611 by: Steve Cayford Reading Session File from /tmp directory 93612 by: Devin Atencio Re: Number checker 93613 by: Philip Olson how to popup a new browser window from php 93614 by: Wo Chang 93621 by: Martin Towell 93622 by: Jason Wong 93627 by: Mirek Novak fopen() question 93615 by: David McInnis 93628 by: Jason Wong Tagi It! 93616 by: Jason Whitaker Variable Inside Variable 93617 by: Jeff Oien 93633 by: Jason Wong storing session variables in a database 93618 by: Randy Johnson Sorry Testing Please DELETE ... No PHP mail for awhile now 93619 by: Daniel Negron/KBE Sorry Testing Please DELETE ... Sorry It was my server 93620 by: Daniel Negron/KBE Why not success?Need your help,please!!! 93623 by: zhaoxd Re: php printer functions... 93624 by: Yasuo Ohgaki Thank 93625 by: zhaoxd Help With postgresql 93626 by: Jr How long does a session last? Need to have it at 20mins 93629 by: Phil Powell Why my gd can not work?help please!!! 93630 by: zhaoxd 93631 by: zhaoxd 93632 by: zhaoxd 93634 by: Jan Peuker 93635 by: Jason Wong 93637 by: zhaoxd 93639 by: Jason Wong REPOST: Login Frontend: Call for Suggestions 93636 by: Ashley M. Kirchner Querying Oracle from PHP 93638 by: Jon .inc over .php 93640 by: Jacob Wyke 93642 by: Jason Wong Re: how to get row by row from CSV file 93641 by: Tim Ward Discarded extension on file download 93643 by: Tomas Mikulecky 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--- OK thanx figured out a workaround in the meantime, I am setting and retaining part of the session, but not all session variables, am I doing this wrong??? $ip = $REMOTE_ADDR; // Check for session - if session is set user has already logged in session_start(); $login_state = $_SESSION[login_state]; if ($login_state[hasLoggedIn] === 1) $hasLoggedIn = 1; if ($login_state[ip] != $REMOTE_ADDR) $hasLoggedIn = 0; // Prevents session stealing $temp .= Your new session id is: . $login_state[ip] . br; $login_state[ip] never exists, though it's supposed to when the session is created upon successful login: // Set up session variable with username and redirect to pic upload lib session_start(); $login_state[hasLoggedIn] = 1; $login_state[ip] = $ip; session_register(login_state); header(Location: http://; . $HTTP_HOST . $PHP_SELF); You can see I am going to be a big problem :( Phil Uchendu Nwachukwu [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Make sure you aren't sending any HTML to the browser for any reason before the session_start(); call. Surefire way to prevent this error: place the following line as the first line of PHP script you execute on every page: ob_start(); Check out http://www.php.net/ob_start for details on what that does. -- Uchendu Nwachukwu newsreply AT unndunn DOT com - www.unndunn.com Phil Powell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am now getting the following errors on every page: Warning: Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php:25) in c:\program files\apache group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 81 This is when I use the following block of code to first SET the session for the very first time: if (mysql_num_rows($results) == 0) { // Could not find info in db redirect to login library with error msg $errorHTML .= font color=ccWe could not find your information ; $errorHTML .= in our
[PHP] Re: Querying Oracle from PHP
Jon wrote: Hi, I am evaluating if it is posible to connect Oracle 8i from PHP, running a PL/SQL procedure and returning the results, avaible in a temp table, to HTML. Besides, I need to format the results of the query in PDF document and make a pie chart based on he results of the contents of the table I mentioned before. I looking for some adds-on to PHP that makes it posible to do this all.. Any suggestions would be appreciated. Thanks in advanced If you want some charts try http://www.aditus.nu/jpgraph/ it is very powerfull library. Jarek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Executing a time intensive script
you 'd need process forking, which is has to be compiled into php and which should/could not be used within a webserver environement. i don't know your scripts will work, if you call process_function after including auth_user.php. if it works, i'd do it this way: ?php require(function.php); ... ... do some authentication stuff ... set_time_limit(300); ignore_user_abort(1); include(auth_user.php); // takes user to authenticated area process_function(); ? Regards Michael Zach Curtis [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have three scripts login.php, auth_user.php, and function.php. The login.php script does user authentication and routes the user to auth_user.php. The function.php script, which contains process_function(), does some very intensive data processing and may take from 30 seconds to 3 minutes to run. Here's what I have tried to do: // login.php script require(function.php); ... ... do some authentication stuff ... process_function(); // makes user wait too long to get to the authenticated area include(auth_user.php); // takes user to authenticated area If I try to run the process_function() from the login.php script, the script takes too long to run. How can I get this function to run so it does not interfere with user logging in? Is there a way to get the function to execute and let it run on its own within login.php and let the user continue on to the authenticated area without that delay? Another thought I had was to get the function.php script that contains the function to execute on its own based on time (e.g., run every hour on the hour). Is there a way to do that? Thank you. _ Zach Curtis Programmer Analyst POPULUS www.populus.com _ Confidentiality Statement: This e-mail message and any attachment(s) are confidential and may contain proprietary information that may not be disclosed without express permission. If you have received this message in error or are not the intended recipient, please immediately notify the sender by replying to this message and then please delete this message and any attachment(s). Any use, dissemination, distribution, or reproduction by unintended recipients is not authorized. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date function
Hello I have the following SQL and I wanna insert the current date in one of the table fields but it's not working. Can u tell me whats the problem? (I'm using mysql and php) Thx a lot $SQL = INSERT INTO orders (Customer_Id, Order_Date). VALUES($CustID,date()); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Tagi It!
Have a look here... http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=8txtCodeId =585 Craig Jason Whitaker [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am looking for a pre-wrote script thats does the same thing as what this company offers: http://www.tagit-board.com any one know where i can get one? to give ya an idea i want a script that will take a visitors name and message(maybe another field for a website) and write it to a page heres an example: http://www.geocities.com/babied0ll/tagit.html -- Jason Whitaker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date function
[EMAIL PROTECTED] (Alia Mikati) wrote: Hello I have the following SQL and I wanna insert the current date in one of the table fields but it's not working. Can u tell me whats the problem? (I'm using mysql and php) Thx a lot $SQL = INSERT INTO orders (Customer_Id, Order_Date). VALUES($CustID,date()); try this: $SQL = INSERT INTO orders (Customer_Id, Order_Date). VALUES($CustID,' . date(m-d-Y) . '); -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Discarded extension on file download
Hi, I recently had this problem and, after hours of hair pulling, found that it seems to work best if you send the words Content-Type and Content-Disposition in **lower case**. Not sure why it has to be like that but it was the only way I found. HTH, Danny. - Original Message - From: Tomas Mikulecky [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 9:40 AM Subject: [PHP] Discarded extension on file download Hi I am trying to offer downloading files from a web server, using PHP. The files are gzipped text and have all .txt.gz extensions. Now while on Windows systems both IE and Netscape offers to download it under the full name (althought IE adds [some_number] to the base of the file name), under Unix or Linux systems (tested with netscape 4.7) the '.gz' part is discarded from the file name and the file is saved with .txt only. Downloaded file is still gzipped. The part of script serving the files is as follows: header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=$my_filename); echo($file_body); What am-I doing wrong? Thanks in advance Tom -- 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] Date function
MySQL (I assume that's the database you're inserting into) requires dates to be sent in -MM-DD format. You appear to be sending a unix timestamp. Try: date(Y-m-d,time()) // Sends a MySQL style date. or even: $SQL = INSERT INTO orders (Customer_Id, Order_Date) VALUES($CustID,NOW()); // uses MySQL's builtin date function to store the current date. HTH, Danny. - Original Message - From: Alia Mikati [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 10:28 AM Subject: [PHP] Date function Hello I have the following SQL and I wanna insert the current date in one of the table fields but it's not working. Can u tell me whats the problem? (I'm using mysql and php) Thx a lot $SQL = INSERT INTO orders (Customer_Id, Order_Date). VALUES($CustID,date()); -- 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] .inc over .php
A third way could be to append .php onto those files too, giving .inc.php, .class.php etc. Danny. There are two ways to counter this: 1) have the .inc files in a directory outside the scope of the webserver directory. 2) set the webserver to treat .inc files as php files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my gd can not work?help please!!!
Yeah,I have already compiled --with-png-dir=../libpng --with-zlib-dir=../zlib. The command is : ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.24 --enable-track-vars --with-gd=../gd-1.8.4 --with-png-dir=../libpng --with-zlib-dir=../zlib Has something wrong or something I forgotten? But it is still unworked.. ps:the test code is: ? Header(Content-type: image/png); $im = imagecreate(400,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImagePNG($im); ImageDestroy($im); ? - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 3:46 PM Subject: Re: [PHP] Why my gd can not work?help please!!! On Friday 19 April 2002 15:41, zhaoxd wrote: But this time,when I use imagepng function instead imagegif funtion,the result is not right ,either! The warning message displayed also,which is bWarning/b: ImagePng: No PNG support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr. WhyWhat shall I do now? Did you compile php with: --with-png-dir ? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Riffle West Virginia is so small that the Boy Scout had to double as the town drunk. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cross db
And what about pearDB ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem when my php forum tries to send a mail
Dear All! I try to have run a php-forum. It works fine, but it is unable to send mail automatically (f.e.: if somebody registers or in case of forgotten password). If sombody tries to register he will succeed, but without sending an email. If sombody forgots his password, and tries to get his lost password, there is the following warning: Warning: Failed to Connect in c:\program files\apache group\apache\htdocs\forum03\phpbb\sendpassword.php on line 87 The forum works at the moment on an Intranet, so it is not connected to the web. Parameters operating system: windows98 server: apache 1.3.23 (win32) php module: PHP 4.1.3 database server: MySql 3.23.47-max-debug I am not familiar with php, but I would like to solve this problem. What do I need if I want a correctly-workin mail-sending system on my forum? Please help! Thanks so much! Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] some problems about gd in php
I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes in php like this: ? Header(Content-type: image/png); $im = imagecreate(400,30); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); imageline($im, 1, 1, 350, 25, $black); imagearc($im, 200, 15, 20, 20, 35, 190, $white); imagestring($im, 5, 4, 10, Graph TEST!!, $white); ImagePNG($im); ImageDestroy($im); ? But the result is warning message in IE:bWarning/b: ImagePng: No PNG support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr. Is this a compiling problem?The compiling command of php is: ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.24 --enable-track-vars --with-gd=../gd-1.8.4 --with-png-dir=../libpng --with-zlib-dir=../zlib Has something wrong or something I forgot? Thank you. zhaoxd
RE: [PHP] some problems about gd in php
But the result is warning message in IE:bWarning/b: ImagePng: No PNG support in this PHP build in b/usr/local/apache/htdocs/index.php/b on line b9/bbr. Is this a compiling problem?The compiling command of php is: ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.24 --enable-track-vars --with-gd=../gd-1.8.4 --with-png-dir=../libpng --with-zlib-dir=../zlib What version of PHP are you using? Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem when my php forum tries to send a mail
an email. If sombody forgots his password, and tries to get his lost password, there is the following warning: Warning: Failed to Connect in c:\program files\apache group\apache\htdocs\forum03\phpbb\sendpassword.php on line 87 http://www.phpbb.com/phpBB/ There are support forums here for phpBB. You may want to search here to see if there have been others with a similar problem. My guess would be that you don't have an smtp setup on win 98. Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parse error= doc contains no data
*This message was transferred with a trial version of CommuniGate(tm) Pro* Hi, I set my own error handler as described in the documentation. It seems to work, as I can catch NOTICE errors. The problem is that PARSE errors do not display anywhere, nor are catched by my error handler. The browser just says document contains no data. I know parse errors are not supposed to be catched by my error handler, but ... why are not them processed anywhere ? (display_errors is On in php.ini) Thanks in advance. Pedro. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error= doc contains no data
On Saturday 20 April 2002 01:24, Pedro Garre wrote: *This message was transferred with a trial version of CommuniGate(tm) Pro* Hi, I set my own error handler as described in the documentation. It seems to work, as I can catch NOTICE errors. The problem is that PARSE errors do not display anywhere, nor are catched by my error handler. The browser just says document contains no data. I know parse errors are not supposed to be catched by my error handler, but ... why are not them processed anywhere ? (display_errors is On in php.ini) Parse errors cannot be trapped. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* He hath eaten me out of house and home. -- William Shakespeare, Henry IV */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .inc over .php
On Friday 19 April 2002 17:31, Danny Shepherd wrote: A third way could be to append .php onto those files too, giving .inc.php, .class.php etc. SARCASTIC IOW make them into .php files? /SARCASTIC -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* So, is the glass half empty, half full, or just twice as large as it needs to be? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Images don't save
If you do not want your site visitors to make good copies of your pictures, you can present low-resolution JPG images. I use this when I make images for galleries. But you cannot prevent them from obtaining an image that you display on their screen - even if they cannot right-click, they can just capture the screen image. Some technology lawyers have recommended putting a copyright watermark into any high-resolution images that we display. Nothing to do with PHP, sorry. Ray Paseur - www.non-aol.com -Original Message- From: Fifield, Mike [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 2:21 PM To: 'Gunther E. Biernat'; [EMAIL PROTECTED]; 'Php-General (E-mail) Subject: RE: [PHP] Images don't save Actually you can do this if all you are trying to do is disable right clicking. If you are thinking this will stop people from getting your pictures this is not the case. When a picture is viewed by someone it is downloaded to there comp first. No way to disable this. To disable right clicking you would have to do it with java. -Original Message- From: Gunther E. Biernat [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:17 PM To: [EMAIL PROTECTED]; 'Php-General (E-mail) Subject: Re: [PHP] Images don't save You can't. Period. Simple as that. Oh, and BTW, it's not even a PHP question... On Thu, 18 Apr 2002 20:10:13 +0200, Manu Verhaegen wrote: Hi, You can right click on a image on your browser and choose save. I want to disable this option, how can i do this Greetings, Manu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards, Gunther E. Biernat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] some problems about gd in php
On Friday 19 April 2002 18:57, zhaoxd wrote: The version of php is php-4.1.2,the latest version,apache-1.3.24,also latest. I have installed gd-1.8.4 in apache server without any problems.To check if the gd can work,I write some codes in php like this: ? [snip] Is this a compiling problem?The compiling command of php is: ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.24 --enable-track-vars --with-gd=../gd-1.8.4 --with-png-dir=../libpng --with-zlib-dir=../zlib 1) If this was a recompile: a) Presumably there were no errors during configure/make/install? b) Did you restart the webserver? 2) What do you get using phpinfo()? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Nice guys finish last. -- Leo Durocher */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] .inc over .php
i'm not sure if the same rules apply to PHP but with ASP I make all my includes contain only functions and constants, no free mark-up, and then save them as .inc.asp so if requested directly they return an empty script. .b -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: 19 April 2002 11:38 To: [EMAIL PROTECTED] Subject: Re: [PHP] .inc over .php On Friday 19 April 2002 17:31, Danny Shepherd wrote: A third way could be to append .php onto those files too, giving .inc.php, .class.php etc. SARCASTIC IOW make them into .php files? /SARCASTIC -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* So, is the glass half empty, half full, or just twice as large as it needs to be? */ -- 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] official statement about PHP file extensions?
Hi, Is there any official statement (by php.net) about which file extension you should use when using PHP (1, 2, 3 or 4)? I know that's server related, but isn't there a standard? http://www.fatcow.com/help/php.shtml states when using PHP4, you should use .php4. But I have the feeling that's not true. I can remember the windows installation of PHP4 which said .phtml and .php3 were deprecated and .php was the only alternative. Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: .inc over .php
Yup, and I also think it is the best way to do. Though, could be smarter to have any kind of include files OUTSIDE the web root - makes life so easy, not always possible for many development enviroments. Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] Jason Wong writes: On Friday 19 April 2002 17:31, Danny Shepherd wrote: A third way could be to append .php onto those files too, giving .inc.php, .class.php etc. SARCASTIC IOW make them into .php files? /SARCASTIC -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* So, is the glass half empty, half full, or just twice as large as it needs to be? */ -- 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] official statement about PHP file extensions?
At 19.04.2002 13:32, you wrote: Hi, Is there any official statement (by php.net) about which file extension you should use when using PHP (1, 2, 3 or 4)? I know that's server related, but isn't there a standard? http://www.fatcow.com/help/php.shtml states when using PHP4, you should use .php4. But I have the feeling that's not true. I can remember the windows installation of PHP4 which said .phtml and .php3 were deprecated and .php was the only alternative. Thanks in advance This only belongs to the settings your webserver allows. f.e. I have configured, to parse every html file, so it looks like there were static files, but they are php files. (not recommended on real traffic/big sites Some ISP´s suggest that you use php3/4 extensions, as they have both versions running. Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error for write with ming function!
It does not work. Can somebody to help me!?!?!? Each time I try to write with ming it does not work. I have Popup: The instruction At 0x00b907fc referenced memory At 0x00abc000. The memory could not Be written. I maked a file .mdb by my self (if the file would not be portable...) I use a server win2K PHP4 v.4.1.2 Ming was already installed with the basic package and to draw functions work. here the code used: ?php $f=new SWFFont(Sydnie.fdb); $t=new SWFText(); $t-setFont($f); $t-moveTo(200,2400); $t-setColor(0xff,0xff,0); $t-setHeight(1200); $t-addString(PHP fait du Flash avec Ming!!); $m=new SWFMovie(); $m-setDimension(5400,3600); $m-add($t); header('Content-type: application/x-shockwave-flash'); $m-output(); ? Thank you Franky [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to popup a new browser window from php
Thanks for all the reply! I think I didn't make myself clear. I want to use php command to popup a dialog or window msg to alert user like the Javascript alert without using javascript. Is it possible? Thanks again. --Wo - Original Message - From: Wo Chang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 18, 2002 7:14 PM Subject: how to popup a new browser window from php Dear All, One simple question: Is there any easy way to popup a new browser from PHP without using any Javascript? Any helps would be greatly appreciated. --Wo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Determine the difference between two dates
If I have two variables of time both in the format of Y-m-j J:i:s How would I go about and get the difference? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .inc over .php
Hi By using .inc you can be sure they will not get executed out of context which can be dangerous, but also you should add this to apache config to stop them being delivered as plain text which can also be dangerous. I don't know about IIS but I guess they have something similar. FilesMatch \.(inc)$ Order allow,deny Deny from all /FilesMatch Tom At 06:10 PM 19/04/2002, you wrote: Just a few quick questions if anybody is out there. Why use .inc as a file extenstion when you can use .php ?? What are the advantages/disadvantages to using .inc? Is one more secure? Which is faster? Which is consider a better pratice? Thanks a lot. _ Do You Yahoo!? Get your free yahoo.com address at http://mail.yahoo.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] Re: how to popup a new browser window from php
Your message was clear, and as stated by several people already, you can't do it in PHP. PHP is a server side scripting language, Javascript and VBScript are client side languages. Popping up a dialog box is a client side function, thusly cannot be done in PHP. :) HTH --Sam -Original Message- From: Wo Chang [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:00 AM To: Wo Chang; [EMAIL PROTECTED] Subject: [PHP] Re: how to popup a new browser window from php Thanks for all the reply! I think I didn't make myself clear. I want to use php command to popup a dialog or window msg to alert user like the Javascript alert without using javascript. Is it possible? Thanks again. --Wo - Original Message - From: Wo Chang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 18, 2002 7:14 PM Subject: how to popup a new browser window from php Dear All, One simple question: Is there any easy way to popup a new browser from PHP without using any Javascript? Any helps would be greatly appreciated. --Wo -- 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] Array Question
On Thursday, April 18, 2002, at 05:38 PM, Jason Lam wrote: But, $arr1[0] = 1; $arr1[1] = 10; $arr2[0] = $arr1; $arr3 = each($arr2); print $arr3[1]; Result is not 10. So, function each is not taking the whole $arr2[0] out.. My question is what function should I use to iterate array elements (with arrays in it)? $arr3 = (list($arr3) = each($arr2)); I think. Untested. Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to popup a new browser window from php
On Friday, April 19, 2002, at 12:48 AM, Jason Wong wrote: On Friday 19 April 2002 07:14, Wo Chang wrote: Dear All, One simple question: Is there any easy way to popup a new browser from PHP without using any Javascript? No. What about target=_blank ? I didn't think this was JavaScript, but achieves the same effect. Or is it JavaScript? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] printer functionality under 4.2
hi anybody knows how to activate printer functionallity under 4.2 ?? why was it removed from the releases afer 4.1 ?? thx m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to popup a new browser window from php
Thanks for all the reply! Understood. --Wo - Original Message - From: Sam Masiello [EMAIL PROTECTED] To: 'Wo Chang' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 19, 2002 8:21 AM Subject: RE: [PHP] Re: how to popup a new browser window from php Your message was clear, and as stated by several people already, you can't do it in PHP. PHP is a server side scripting language, Javascript and VBScript are client side languages. Popping up a dialog box is a client side function, thusly cannot be done in PHP. :) HTH --Sam -Original Message- From: Wo Chang [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:00 AM To: Wo Chang; [EMAIL PROTECTED] Subject: [PHP] Re: how to popup a new browser window from php Thanks for all the reply! I think I didn't make myself clear. I want to use php command to popup a dialog or window msg to alert user like the Javascript alert without using javascript. Is it possible? Thanks again. --Wo - Original Message - From: Wo Chang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 18, 2002 7:14 PM Subject: how to popup a new browser window from php Dear All, One simple question: Is there any easy way to popup a new browser from PHP without using any Javascript? Any helps would be greatly appreciated. --Wo -- 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] Determine the difference between two dates
Firstly, I assume you mean Y-m-j H:i:s for the date format. To get the difference between 2 time strings : ?php // orginal time strings $firstTime=2002-04-19 13:49:00; $lastTime=2002-04-19 14:00:00; // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; //echo out the difference printf (Difference is %d seconds,$timeDiff); ? HTH Danny. - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:08 PM Subject: [PHP] Determine the difference between two dates If I have two variables of time both in the format of Y-m-j J:i:s How would I go about and get the difference? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .inc over .php
On Friday, April 19, 2002, at 04:10 AM, Jacob Wyke wrote: Why use .inc as a file extenstion when you can use .php ?? What are the advantages/disadvantages to using .inc? Is one more secure? Which is faster? Which is consider a better pratice? It's just to help me organize which files I use as included files (.inc) and which files are actual PHP scripts that can be requested with a URI (.php). Also, I set an Apache directive to refuse requests for any file with the .inc extension, so my database connection info, password, etc is (theoretically) safe from being served directly. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Validating User Input
I am trying to validate an user's input. I can get the ereg function to work if I just type in the pattern I'm searching for but my problem is I want to build the pattern through a variable first and then use that variable in the ereg function. For example, I want to check an input that's only text and only between 5 to 20 characters in length. Is this possible? function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { if ($text) $pattern .= a-zA-Z; if ($number) $pattern .= 0-9; if ($special) $pattern .= [:space:]; if (ereg(^[$pattern]{$min,$max}$, $user_input)) return $user_input; else return $default; } Also, which of the following special characters is considered safe to accept? I am just allowing spaces now but would like as many of the below characters to be included. ~ ` ! # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to popup a new browser window from php
add this to the head section; script language=JavaScript function popupcontent(urll) { window.open(urll,'popup','toolbar=no,location=no,directories=no,status=n o,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=400,height =250'); } //-- /SCRIPT then use the following to open a window however ya want it to appear; a href=\javascript:popupcontent('announcements.php?action=viewthisone=$i d')\b$title/b/a works nicely :) -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: 19 April 2002 1:39 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] how to popup a new browser window from php On Friday, April 19, 2002, at 12:48 AM, Jason Wong wrote: On Friday 19 April 2002 07:14, Wo Chang wrote: Dear All, One simple question: Is there any easy way to popup a new browser from PHP without using any Javascript? No. What about target=_blank ? I didn't think this was JavaScript, but achieves the same effect. Or is it JavaScript? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [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
Re: [PHP] .inc over .php
On Friday, April 19, 2002, at 07:22 AM, .ben wrote: i'm not sure if the same rules apply to PHP but with ASP I make all my includes contain only functions and constants, no free mark-up, and then save them as .inc.asp so if requested directly they return an empty script. Until the ASP processor craps out. Or if you had any scripts in such format they would be executed -- which might not be desirable. Much better to keep includefiles outside of document root or set a directive with your web server to deny requests for those files somehow. In Apache it's as easy as Files ~ \.inc$ Order allow,deny Deny from all /Files Not sure about IIS though. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] official statement about PHP file extensions?
On Friday, April 19, 2002, at 07:42 AM, [EMAIL PROTECTED] wrote: Is there any official statement (by php.net) about which file extension you should use when using PHP (1, 2, 3 or 4)? I know that's server related, but isn't there a standard? http://www.fatcow.com/help/php.shtml states when using PHP4, you should use .php4. But I have the feeling that's not true. I can remember the windows installation of PHP4 which said .phtml and .php3 were deprecated and .php was the only alternative. Thanks in advance This only belongs to the settings your webserver allows. f.e. I have configured, to parse every html file, so it looks like there were static files, but they are php files. (not recommended on real traffic/big sites Some ISP´s suggest that you use php3/4 extensions, as they have both versions running. Yeah, it really only depends on the web server. I saw someone just the other day posting on this list who had their httpd.conf set to parse any .asp-suffixed files with PHP. That was funny. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to popup a new browser window from php
On Friday, April 19, 2002, at 08:00 AM, Wo Chang wrote: I think I didn't make myself clear. I want to use php command to popup a dialog or window msg to alert user like the Javascript alert without using javascript. no Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: official statement about PHP file extensions?
I don't think there's nothing official. If I am not mistaken, rare case, PEAR recommends using only .php It's kind of an informal consensus to use .php for anything beyond PHP3 and .php3 for PHP3-only files. This way, you script will work in most of webservers that exist. As an open source developer, if you are, I would go with the most used, .php. Even if you are not.. :-) A client or boss can always change webhosting services and you gotta be prepared ;-) -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 Durk Strooisma [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Is there any official statement (by php.net) about which file extension you should use when using PHP (1, 2, 3 or 4)? I know that's server related, but isn't there a standard? http://www.fatcow.com/help/php.shtml states when using PHP4, you should use .php4. But I have the feeling that's not true. I can remember the windows installation of PHP4 which said .phtml and .php3 were deprecated and .php was the only alternative. Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] .inc over .php
On Friday, April 19, 2002, at 07:22 AM, .ben wrote: i'm not sure if the same rules apply to PHP but with ASP I make all my includes contain only functions and constants, no free mark-up, and then save them as .inc.asp so if requested directly they return an empty script. Until the ASP processor craps out. Or if you had any scripts in such format they would be executed -- which might not be desirable. ASP what does what? I've never experienced anything like that... what do you mean? Confused. Much better to keep includefiles outside of document root or set a directive with your web server to deny requests for those files somehow. In Apache it's as easy as Files ~ \.inc$ Order allow,deny Deny from all /Files Not sure about IIS though. Not sure if you can do that in IIS, but the method i describe works fine. Keeping includes out of the document root leads to messy webservers ime, tho, i have worked with a messy bunch of SysAdmins in the past :) .b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to popup a new browser window from php
On Friday 19 April 2002 20:48, Brian McGarvie wrote: add this to the head section; script language=JavaScript function popupcontent(urll) { window.open(urll,'popup','toolbar=no,location=no,directories=no,status=n o,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=400,height =250'); } //-- /SCRIPT then use the following to open a window however ya want it to appear; a href=\javascript:popupcontent('announcements.php?action=viewthisone=$i d')\b$title/b/a This looks suspiciously like javascript. works nicely :) I'm sure it does. Now do it again *without* javascript :) Is there any easy way to popup a new browser from PHP without using any Javascript? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The mome rath isn't born that could outgrabe me. -- Nicol Williamson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] official statement about PHP file extensions?
On Fri, 19 Apr 2002 [EMAIL PROTECTED] wrote: At 19.04.2002 13:32, you wrote: Hi, Is there any official statement (by php.net) about which file extension you should use when using PHP (1, 2, 3 or 4)? I know that's server related, but isn't there a standard? http://www.fatcow.com/help/php.shtml states when using PHP4, you should use .php4. But I have the feeling that's not true. I can remember the windows installation of PHP4 which said .phtml and .php3 were deprecated and .php was the only alternative. Thanks in advance This only belongs to the settings your webserver allows. f.e. I have configured, to parse every html file, so it looks like there were static files, but they are php files. (not recommended on real traffic/big sites Some ISP´s suggest that you use php3/4 extensions, as they have both versions running. I wonder why they do this? In my experience, php3 code runs fine on a php4 server and on the servers I manage, the apache configuration passes both .php3 and .phtml scripts to php4 for execution. Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to popup a new browser window from php
No. You want a client side browser popup. PHP runs on the server. PHP does not run in a browser. Javascript runs on the browser. You need to use Javascript. Matt Friedman Web Applications Developer -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Friday April 19, 2002 9:14 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] how to popup a new browser window from php On Friday 19 April 2002 20:48, Brian McGarvie wrote: add this to the head section; script language=JavaScript function popupcontent(urll) { window.open(urll,'popup','toolbar=no,location=no,directories=no,status=n o,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=400,height =250'); } //-- /SCRIPT then use the following to open a window however ya want it to appear; a href=\javascript:popupcontent('announcements.php?action=viewthisone=$i d')\b$title/b/a This looks suspiciously like javascript. works nicely :) I'm sure it does. Now do it again *without* javascript :) Is there any easy way to popup a new browser from PHP without using any Javascript? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The mome rath isn't born that could outgrabe me. -- Nicol Williamson */ -- 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] Binding to LDAP/SASL w/PHP
Hi Quinn I see no one has responded yet. As I said on the OpenLDAP list, this is not currently possible. Maybe I implement something some time in the future, but patches would be welcome... If no one responds, I suggest you go to http://bugs.php.net/ and submit a feature request. Or you could of course help implement something if you like. Stig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 3dim Array problem
Hi Folks, I have a problem assigning an 3dim array, maybe I´m to tired today to see the mistake, but PHP thinks, that it finds Illegal string index at the marked line. could someone verify this, maybe find my mistake?? FYI getDbAns(), talk2DB are substitutions for DB - related routines, and the produce the correct data. Sorry for the overcommented code, but I have syntax highlighting. TIA Oliver while( $res=$UDV - getDbAns()) // fetch mains { if(strlen($res[0]) 2) // if result is OK { $menarr[$h]=$res[0]; // put them in array // get submenues $selchi=select chi from link where pa = '$res[0]'; $UDB - talk2DB($selchi); while($chia=$UDB - getDbAns()) { if(strlen($chia[0]) 3) // if result is OK { //echo b.$chia[0]./bbr; // Youll get a 0x20 separated string $subp=explode( ,$chia[0]); // explode it, to get single values if(is_array($subp)) // if there are more than one in it { $maxs=count($subp); // check out how many for($n=0; $n $maxs ; $n++)// each child in main/sub/n { // put the value in main/sub/n error here - $menarr[$h][$s][$n]=$subp[$n]; } } else // if there´s only one value { $menarr[$h][$s][0]=$chia[0]; } }// end if sub $s++; // submenues plus one }// end while subs }// end if main $h++; // mainmenues plus one }// end while mainmenues -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating User Input
Hi, ?php function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { $pattern=; if ($text) $pattern.='a-zA-Z'; if ($number) $pattern.='0-9'; if ($special) $pattern.='[:space:]\~\`\@\#\$\%\^\\*\(\)\_\+\-\=\\\{\}\|\:\\;\'\\\?\,\. \/'; $regexp='^['.$pattern.']{'.$min.','.$max.'}$'; if (ereg($regexp,$user_input)) return $user_input; else return $default; } ? That should take care of everything except the square brackets - not sure how to go about getting them (escaping them didn't seem to work). HTH Danny. - Original Message - From: SP [EMAIL PROTECTED] To: Php [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:57 PM Subject: [PHP] Validating User Input I am trying to validate an user's input. I can get the ereg function to work if I just type in the pattern I'm searching for but my problem is I want to build the pattern through a variable first and then use that variable in the ereg function. For example, I want to check an input that's only text and only between 5 to 20 characters in length. Is this possible? function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { if ($text) $pattern .= a-zA-Z; if ($number) $pattern .= 0-9; if ($special) $pattern .= [:space:]; if (ereg(^[$pattern]{$min,$max}$, $user_input)) return $user_input; else return $default; } Also, which of the following special characters is considered safe to accept? I am just allowing spaces now but would like as many of the below characters to be included. ~ ` ! @ # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / -- 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] Determine the difference between two dates
*This message was transferred with a trial version of CommuniGate(tm) Pro* Yes, but note that strtotime has a second parameter, which is now if not indicated. What strtotime returns is relative to this second parameter. I would use: $ahora = time(); $firstTime=strtotime($firstTime, $ahora); $lastTime=strtotime($lastTime, $ahora); Pedro. Danny Shepherd escribió: *This message was transferred with a trial version of CommuniGate(tm) Pro* Firstly, I assume you mean Y-m-j H:i:s for the date format. To get the difference between 2 time strings : ?php // orginal time strings $firstTime=2002-04-19 13:49:00; $lastTime=2002-04-19 14:00:00; // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; //echo out the difference printf (Difference is %d seconds,$timeDiff); ? HTH Danny. - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:08 PM Subject: [PHP] Determine the difference between two dates If I have two variables of time both in the format of Y-m-j J:i:s How would I go about and get the difference? -- 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 extentions as module
Hi, I was wondering. PHP is within our company compiled as a apache module (libphp4.so). But i want to do some experiments with domxml. Therefor is it possible to create an extention as a module and load it with dl()? We're running Linux (Debian). Thanks, Dave Mertens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determine the difference between two dates
If I wanted to represent it in the format of Days,Hours,Minutes,Seconds how would that work Danny Shepherd [EMAIL PROTECTED] wrote in message 020e01c1e7a1$70098eb0$0200a8c0@dannys">news:020e01c1e7a1$70098eb0$0200a8c0@dannys... Firstly, I assume you mean Y-m-j H:i:s for the date format. To get the difference between 2 time strings : ?php // orginal time strings $firstTime=2002-04-19 13:49:00; $lastTime=2002-04-19 14:00:00; // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; //echo out the difference printf (Difference is %d seconds,$timeDiff); ? HTH Danny. - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:08 PM Subject: [PHP] Determine the difference between two dates If I have two variables of time both in the format of Y-m-j J:i:s How would I go about and get the difference? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How long does a session last? Need to have it at 20mins
Garbage collection is launched according to the gc_probablility. If it finds a session file that has not been modified for a longer time than gc_maxlifetime, it deletes it. So, whenever a user requests a page, they essentially reset the session timer to zero for that particular session, since the session file gets modified on each page request for that session. If you want to set a hard timeout of 20 minutes, you may need to write your own garbage collection process. Kirk -Original Message- From: Phil Powell [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 1:02 AM To: [EMAIL PROTECTED] Subject: [PHP] How long does a session last? Need to have it at 20mins I had thought that a session would last only 20 mins if session.gc_maxlifetime is set at 1440. Was I wrong in assuming this? I have pages that have session_start() at the top to persist the session throughout the life-cycle of these pages, however, I want the session to expire after 20 mins or so of use. How can I assure that the session will expire after 20 mins? Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parse error= doc contains no data
Try setting error_reporting = E_ALL ~E_NOTICE, or just E_ALL, in php.ini. Kirk -Original Message- From: Pedro Garre [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 11:25 AM To: php-general Subject: [PHP] parse error= doc contains no data I set my own error handler as described in the documentation. It seems to work, as I can catch NOTICE errors. The problem is that PARSE errors do not display anywhere, nor are catched by my error handler. The browser just says document contains no data. I know parse errors are not supposed to be catched by my error handler, but ... why are not them processed anywhere ? (display_errors is On in php.ini) Thanks in advance. Pedro. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determine the difference between two dates
use the date() command (http://www.php.net/date) - using $timeDiff as the datestamp. HTH Danny - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 2:56 PM Subject: Re: [PHP] Determine the difference between two dates If I wanted to represent it in the format of Days,Hours,Minutes,Seconds how would that work Danny Shepherd [EMAIL PROTECTED] wrote in message 020e01c1e7a1$70098eb0$0200a8c0@dannys">news:020e01c1e7a1$70098eb0$0200a8c0@dannys... Firstly, I assume you mean Y-m-j H:i:s for the date format. To get the difference between 2 time strings : ?php // orginal time strings $firstTime=2002-04-19 13:49:00; $lastTime=2002-04-19 14:00:00; // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; //echo out the difference printf (Difference is %d seconds,$timeDiff); ? HTH Danny. - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:08 PM Subject: [PHP] Determine the difference between two dates If I have two variables of time both in the format of Y-m-j J:i:s How would I go about and get the difference? -- 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] Validating User Input
Thanks Danny, that worked! Now should I include all those special characters? I want it to be hack proof so I don't want to add the user input into my database and have something bad happen. Which ones are safe? ~ ` ! @ # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / -Original Message- From: Danny Shepherd [mailto:[EMAIL PROTECTED]] Sent: April 19, 2002 9:32 AM To: Php Subject: Re: [PHP] Validating User Input Hi, ?php function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { $pattern=; if ($text) $pattern.='a-zA-Z'; if ($number) $pattern.='0-9'; if ($special) $pattern.='[:space:]\~\`\@\#\$\%\^\\*\(\)\_\+\-\=\\\{\}\|\:\\;\'\\\?\,\. \/'; $regexp='^['.$pattern.']{'.$min.','.$max.'}$'; if (ereg($regexp,$user_input)) return $user_input; else return $default; } ? That should take care of everything except the square brackets - not sure how to go about getting them (escaping them didn't seem to work). HTH Danny. - Original Message - From: SP [EMAIL PROTECTED] To: Php [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:57 PM Subject: [PHP] Validating User Input I am trying to validate an user's input. I can get the ereg function to work if I just type in the pattern I'm searching for but my problem is I want to build the pattern through a variable first and then use that variable in the ereg function. For example, I want to check an input that's only text and only between 5 to 20 characters in length. Is this possible? function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { if ($text) $pattern .= a-zA-Z; if ($number) $pattern .= 0-9; if ($special) $pattern .= [:space:]; if (ereg(^[$pattern]{$min,$max}$, $user_input)) return $user_input; else return $default; } Also, which of the following special characters is considered safe to accept? I am just allowing spaces now but would like as many of the below characters to be included. ~ ` ! @ # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if elseif else
I redoing some code, and the original author has code like if elseif elseif elseif else I have always known it to have just one elseif, not multiple ones. I was going to move it to a switch/case, but there is no common switch. So I wanted to know if its technically ok, or just ok to use multiple elseif Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if elseif else
You can use as many elseifs as you need. I'm not sure how it affects performance, but it works (I have one that goes through all 50 states). -Natalie -Original Message- From: Gerard Samuel [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 10:02 AM To: PHP Subject: [PHP] if elseif else I redoing some code, and the original author has code like if elseif elseif elseif else I have always known it to have just one elseif, not multiple ones. I was going to move it to a switch/case, but there is no common switch. So I wanted to know if its technically ok, or just ok to use multiple elseif Thanks -- 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] include() and require() problem
List, I'm trying to include some .inc files in my project, but I got errors all time saying that this includes couldn't be found. I'm a newbie, so I can't understand what's happend, since it worked pretty good in my local machine and not in the ISP. I tried to speak to ISP many times but they couldn't solve to. My directorie structure is : HRM(directorie)-includes(directorie)-my inc files(to be included in files that is in the directorie HRM). Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if elseif else
Nope.. That is fine.. I use it all the time.. It's quite acceptable.. - Original Message - From: Gerard Samuel [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Saturday, April 20, 2002 12:01 AM Subject: [PHP] if elseif else I redoing some code, and the original author has code like if elseif elseif elseif else I have always known it to have just one elseif, not multiple ones. I was going to move it to a switch/case, but there is no common switch. So I wanted to know if its technically ok, or just ok to use multiple elseif Thanks -- 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] Determine the difference between two dates
How is this going to give the overall time in difference... For instance A circuit went down at 17:30:45 it came back up at 18:37:49 what is the difference in time between the 2 in the format Days XX Hours XX Minutes XX Seconds XX Danny Shepherd [EMAIL PROTECTED] wrote in message 027601c1e7a9$fbe6f0f0$0200a8c0@dannys">news:027601c1e7a9$fbe6f0f0$0200a8c0@dannys... use the date() command (http://www.php.net/date) - using $timeDiff as the datestamp. HTH Danny - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 2:56 PM Subject: Re: [PHP] Determine the difference between two dates If I wanted to represent it in the format of Days,Hours,Minutes,Seconds how would that work Danny Shepherd [EMAIL PROTECTED] wrote in message 020e01c1e7a1$70098eb0$0200a8c0@dannys">news:020e01c1e7a1$70098eb0$0200a8c0@dannys... Firstly, I assume you mean Y-m-j H:i:s for the date format. To get the difference between 2 time strings : ?php // orginal time strings $firstTime=2002-04-19 13:49:00; $lastTime=2002-04-19 14:00:00; // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; //echo out the difference printf (Difference is %d seconds,$timeDiff); ? HTH Danny. - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:08 PM Subject: [PHP] Determine the difference between two dates If I have two variables of time both in the format of Y-m-j J:i:s How would I go about and get the difference? -- 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] multidimensional array
Hi list, In order to avoid many left joins I took an aproach that I didn't know if it's good, but I couldn't figure out another way. If my cliente has 10 phone numbers I buld an array, serialize it and store in database, so I didn't have to create another table. The problem is now I need to migrate the data to this format, how can I select the multiple data and put in multidimensional array at runtime to store again. for example I need to put all fileds with graduation and all fields with discipline with equal id in array named school serialize it and after insert in another table. Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determine the difference between two dates
Appreciate the assistance Danny Figured it out $totaltime= date(H:i:s, mktime(0,0,$totaltime)); Just followed PHP from this page http://www.php.net/manual/en/function.mktime.php Ron Allen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... How is this going to give the overall time in difference... For instance A circuit went down at 17:30:45 it came back up at 18:37:49 what is the difference in time between the 2 in the format Days XX Hours XX Minutes XX Seconds XX Danny Shepherd [EMAIL PROTECTED] wrote in message 027601c1e7a9$fbe6f0f0$0200a8c0@dannys">news:027601c1e7a9$fbe6f0f0$0200a8c0@dannys... use the date() command (http://www.php.net/date) - using $timeDiff as the datestamp. HTH Danny - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 2:56 PM Subject: Re: [PHP] Determine the difference between two dates If I wanted to represent it in the format of Days,Hours,Minutes,Seconds how would that work Danny Shepherd [EMAIL PROTECTED] wrote in message 020e01c1e7a1$70098eb0$0200a8c0@dannys">news:020e01c1e7a1$70098eb0$0200a8c0@dannys... Firstly, I assume you mean Y-m-j H:i:s for the date format. To get the difference between 2 time strings : ?php // orginal time strings $firstTime=2002-04-19 13:49:00; $lastTime=2002-04-19 14:00:00; // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; //echo out the difference printf (Difference is %d seconds,$timeDiff); ? HTH Danny. - Original Message - From: Ron Allen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:08 PM Subject: [PHP] Determine the difference between two dates If I have two variables of time both in the format of Y-m-j J:i:s How would I go about and get the difference? -- 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] parse error= doc contains no data
*This message was transferred with a trial version of CommuniGate(tm) Pro* My php.ini has E_ALL and E_NOTICE I have tried several values with function error_reporting, including error_reporting(0) as recommended in the documentation. I am using the example of error handler function provided in the documentation. Note that if I don't set my own error_handler everything works and parse error messages are displayed as usual. More ideas ? Pedro. Johnson, Kirk escribió: *This message was transferred with a trial version of CommuniGate(tm) Pro* Try setting error_reporting = E_ALL ~E_NOTICE, or just E_ALL, in php.ini. Kirk -Original Message- From: Pedro Garre [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 11:25 AM To: php-general Subject: [PHP] parse error= doc contains no data I set my own error handler as described in the documentation. It seems to work, as I can catch NOTICE errors. The problem is that PARSE errors do not display anywhere, nor are catched by my error handler. The browser just says document contains no data. I know parse errors are not supposed to be catched by my error handler, but ... why are not them processed anywhere ? (display_errors is On in php.ini) Thanks in advance. Pedro. -- 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] parse error= doc contains no data
Sorry, I missed the main point of your original question. No more ideas here. -Original Message- From: Pedro Garre [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 3:23 PM To: php-general Subject: Re: [PHP] parse error= doc contains no data *This message was transferred with a trial version of CommuniGate(tm) Pro* My php.ini has E_ALL and E_NOTICE I have tried several values with function error_reporting, including error_reporting(0) as recommended in the documentation. I am using the example of error handler function provided in the documentation. Note that if I don't set my own error_handler everything works and parse error messages are displayed as usual. More ideas ? Pedro. Johnson, Kirk escribió: *This message was transferred with a trial version of CommuniGate(tm) Pro* Try setting error_reporting = E_ALL ~E_NOTICE, or just E_ALL, in php.ini. Kirk -Original Message- From: Pedro Garre [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 11:25 AM To: php-general Subject: [PHP] parse error= doc contains no data I set my own error handler as described in the documentation. It seems to work, as I can catch NOTICE errors. The problem is that PARSE errors do not display anywhere, nor are catched by my error handler. The browser just says document contains no data. I know parse errors are not supposed to be catched by my error handler, but ... why are not them processed anywhere ? (display_errors is On in php.ini) Thanks in advance. Pedro. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: include() and require() problem
be sure that the path to the include file is relative to the script that was requested by the user. that's important if you include include-files into included files. you then have to make sure that the path to your include-file in the include-file is relative to the file that included the file, in which the include-file is included. *lol* what a sentence. anyway, hope you get my meaning! another problem is using include /myincfiles/myfile.inc; this way it could be searched in the root of the server, where for sure your file can't be found. use relative path instead: include ./myincfiles/myfile.inc; ./ means the same directory. or use an absolute path, which has to contain the whole path from the server's root, e.g.: include /wwwroot/somedir/yourdocroot/myincfiles/myfile.inc; Regards Michael Rodrigo Peres [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... List, I'm trying to include some .inc files in my project, but I got errors all time saying that this includes couldn't be found. I'm a newbie, so I can't understand what's happend, since it worked pretty good in my local machine and not in the ISP. I tried to speak to ISP many times but they couldn't solve to. My directorie structure is : HRM(directorie)-includes(directorie)-my inc files(to be included in files that is in the directorie HRM). Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Memory Leak... tracking?
I have written an extension that I compile into PHP in both CGI and in module mode. The CGI version never crashes with a segfault in my code; however, the module version almost always crashes on the second page load. I've tracked it down to what appears to be one of my pointers being overwritten, however, I have no way of finding out where it is being overwritten, and Electric Fence bailed with a free called on non malloc'd data error before the script even got executed. Anyone know of another way I can track a buffer overflow or underflow in PHP core code? Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySql query
Ok this could be the wrong place to ask this but there seems to be some people in here that know mysql quite well. My question is this; I have a database that looks like this. galleries gallery_id gallery_name 1 3d 2 fractals 3 abstract 4 cats 5 cars Images image_id gallery_id image_name etc 1 4 cat1 2 4 cat2 3 2 sky 4 2 blue 5 5 car1 I am trying to run a SQL query that will return an array of rows from the images table. But I want the gallery_id number to be replaced with the actual gallery name from the galleries table.
Re: [PHP] Discarded extension on file download
This don't work for me :( Extension .gz is still throwed away. Tom Danny Shepherd wrote: Hi, I recently had this problem and, after hours of hair pulling, found that it seems to work best if you send the words Content-Type and Content-Disposition in **lower case**. Not sure why it has to be like that but it was the only way I found. HTH, Danny. - Original Message - From: Tomas Mikulecky [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 19, 2002 9:40 AM Subject: [PHP] Discarded extension on file download Hi I am trying to offer downloading files from a web server, using PHP. The files are gzipped text and have all .txt.gz extensions. Now while on Windows systems both IE and Netscape offers to download it under the full name (althought IE adds [some_number] to the base of the file name), under Unix or Linux systems (tested with netscape 4.7) the '.gz' part is discarded from the file name and the file is saved with .txt only. Downloaded file is still gzipped. The part of script serving the files is as follows: header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=$my_filename); echo($file_body); What am-I doing wrong? Thanks in advance Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Querying Oracle from PHP
On Fri, 19 Apr 2002, Jon wrote: I am evaluating if it is posible to connect Oracle 8i from PHP, running a PL/SQL procedure and returning the results, avaible in a temp table, to HTML. Besides, I need to format the results of the query in PDF document and make a pie chart based on he results of the contents of the table I mentioned before. I looking for some adds-on to PHP that makes it posible to do this all.. You can do all this by building PHP with Oracle 8i and PDFlib support. Pie charts are easy to draw with the PDFlib-provided primitives if you paid attention in geometry class. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySql query
Ok the formatting got lost on that I will try this again. -Original Message- From: Fifield, Mike [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:57 AM To: [EMAIL PROTECTED] Subject: [PHP] MySql query Ok this could be the wrong place to ask this but there seems to be some people in here that know mysql quite well. My question is this; I have a database that looks like this. galleries gallery_id gallery_name 1 3d 2 fractals 3 abstract 4 cats 5 cars Images image_idgallery_id image_name etc 1 4 cat1 2 4 cat2 3 2 sky 4 2 blue 5 5 car1 I am trying to run a SQL query that will return an array of rows from the images table. But I want the gallery_id number to be replaced with the actual gallery name from the galleries table. -Original Message- From: Fifield, Mike [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:57 AM To: [EMAIL PROTECTED] Subject: [PHP] MySql query Ok this could be the wrong place to ask this but there seems to be some people in here that know mysql quite well. My question is this; I have a database that looks like this. galleries gallery_id gallery_name 1 3d 2 fractals 3 abstract 4 cats 5 cars Images image_id gallery_id image_name etc 1 4 cat1 2 4 cat2 3 2 sky 4 2 blue 5 5 car1 I am trying to run a SQL query that will return an array of rows from the images table. But I want the gallery_id number to be replaced with the actual gallery name from the galleries table. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] .inc over .php
I've settled on .inc.php, .class.php, etc. that way you get the best of both worlds. Your files are identified as what they are and don't get sent out unparsed Tim Ward Internet Chess www.chessish.com http://www.chessish.com -- From: Jason Wong [SMTP:[EMAIL PROTECTED]] Sent: 19 April 2002 09:28 To: [EMAIL PROTECTED] Subject: Re: [PHP] .inc over .php On Friday 19 April 2002 16:10, Jacob Wyke wrote: Just a few quick questions if anybody is out there. Nobody here but us chickens. Why use .inc as a file extenstion when you can use .php ?? Just a matter of aesthetics. Some people might like to use .inc to remind themselves that the file is to be included and not run on its own. What are the advantages/disadvantages to using .inc? None from a technical point of view Is one more secure? On default webserver settings, .inc may be less secure because by default the webserver would not treat .inc files as php files and thus return them as-is. Thus if people know the name of your filename.inc they could potentially browse to it and thus see its contents. There are two ways to counter this: 1) have the .inc files in a directory outside the scope of the webserver directory. 2) set the webserver to treat .inc files as php files. Which is faster? No difference. Which is consider a better pratice? As long as you take the necessary precautions then it boils down to a matter of preference. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Home, Sweet Home must surely have been written by a bachelor. -- Samuel Butler */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySql query
Try: SELECT gallery_name, image_id, image_name FROM galleries, Images WHERE galleries.gallery_id = images.gallery_id At 07:57 AM 4/19/2002 -0700, you wrote: Ok this could be the wrong place to ask this but there seems to be some people in here that know mysql quite well. My question is this; I have a database that looks like this. galleries gallery_id gallery_name snip Images image_id gallery_id image_name etc snip I am trying to run a SQL query that will return an array of rows from the images table. But I want the gallery_id number to be replaced with the actual gallery name from the galleries table. -Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .inc over .php
On Friday 19 April 2002 15:58, Erik Price wrote: On Friday, April 19, 2002, at 04:10 AM, Jacob Wyke wrote: Why use .inc as a file extenstion when you can use .php ?? What are the advantages/disadvantages to using .inc? Is one more secure? Which is faster? Which is consider a better pratice? It's just to help me organize which files I use as included files (.inc) and which files are actual PHP scripts that can be requested with a URI (.php). Also, I set an Apache directive to refuse requests for any file with the .inc extension, so my database connection info, password, etc is (theoretically) safe from being served directly. Erik Those files should be placed outside DocumentRoot (if you control the server). Then set include_path in php.ini to include that dir, and you're done. No need to rely on apache for this. -- Meir Kriheli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] official statement about PHP file extensions?
At 19.04.2002 14:21, you wrote: snip Is there any official statement (by php.net) about which file extension you should use when using PHP (1, 2, 3 or 4)? I know that's server related, but isn't there a standard? snip This only belongs to the settings your webserver allows. f.e. I have configured, to parse every html file, so it looks like there were static files, but they are php files. (not recommended on real traffic/big sites Some ISP´s suggest that you use php3/4 extensions, as they have both versions running. I wonder why they do this? In my experience, php3 code runs fine on a php4 server and on the servers I manage, the apache configuration passes both .php3 and .phtml scripts to php4 for execution. 8 Andy Maybe PHP3 scripts work fine on 4, but if you´ve 4th, you cannot run them on 3. And which ISP can/will guarantee that 3s work fine on 4, even in the beginning of 4? (BTW some of my 3 scripts don´t work on 4) Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Within the date format
This is what I have right now $totaltime= date(:H:i:s, mktime(0,0,$totaltime)); This is the result 04:20:46 from the following dates 2002-04-25 16:30:16 2002-04-19 12:09:30 534046 seconds I would like to be able to get the days and, if needed, the number of months and years -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validating User Input
On Fri, 19 Apr 2002, SP wrote: Now should I include all those special characters? I want it to be hack proof so I don't want to add the user input into my database and have something bad happen. Which ones are safe? ~ ` ! # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / All characters are safe for database use as long as they're handled properly. Basically that means escaping ' and \ which should be taken care of automatically by addslashes (or by the abominable magic_quotes_gpc if you happen to have it on). Now, when you're dealing with path/file names and arguments to external programs, you need to be more careful... miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Within the date format
On Fri, 19 Apr 2002, Ron Allen wrote: This is what I have right now $totaltime= date(:H:i:s, mktime(0,0,$totaltime)); This is the result 04:20:46 from the following dates 2002-04-25 16:30:16 2002-04-19 12:09:30 534046 seconds I would like to be able to get the days and, if needed, the number of months and years Well, I think the easiest way is going to be to split your date apart into $day, $month, $year and then subtract. You can't just do a cascading modulus calculation on the delta between the timestamps, because that won't take leap years into account. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Within the date format
Wouldn't it be easier to convert each date into a unix timestamp, then subtract... the resulting number is the difference in seconds. Then devide by 60 for minutes, again for hours 24 for days, etc, etc -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:44 AM To: Ron Allen Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Within the date format On Fri, 19 Apr 2002, Ron Allen wrote: This is what I have right now $totaltime= date(:H:i:s, mktime(0,0,$totaltime)); This is the result 04:20:46 from the following dates 2002-04-25 16:30:16 2002-04-19 12:09:30 534046 seconds I would like to be able to get the days and, if needed, the number of months and years Well, I think the easiest way is going to be to split your date apart into $day, $month, $year and then subtract. You can't just do a cascading modulus calculation on the delta between the timestamps, because that won't take leap years into account. miguel -- 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] Within the date format
Like I said, if it crosses through a leap year, your calculation may be off. How many days are there in February when you don't know what year it is? miguel On Fri, 19 Apr 2002, Demitrious S. Kelly wrote: Wouldn't it be easier to convert each date into a unix timestamp, then subtract... the resulting number is the difference in seconds. Then devide by 60 for minutes, again for hours 24 for days, etc, etc -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:44 AM To: Ron Allen Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Within the date format On Fri, 19 Apr 2002, Ron Allen wrote: This is what I have right now $totaltime= date(:H:i:s, mktime(0,0,$totaltime)); This is the result 04:20:46 from the following dates 2002-04-25 16:30:16 2002-04-19 12:09:30 534046 seconds I would like to be able to get the days and, if needed, the number of months and years Well, I think the easiest way is going to be to split your date apart into $day, $month, $year and then subtract. You can't just do a cascading modulus calculation on the delta between the timestamps, because that won't take leap years into account. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable name assembly
How do I assemble strings to become a variable? These code do not work... $abc = 10; echo $('ab'.'c');
RE: [PHP] Within the date format
function is_leap($) { $leap=0; $refy=2000; while ( $ = $refy ) { if ( $refy == $ ) { $leap=1; } else if ( $refy $ ) { break; } $refy++; $refy++; $refy++; $refy++; } return($leap); } -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:52 AM To: Demitrious S. Kelly Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Within the date format Like I said, if it crosses through a leap year, your calculation may be off. How many days are there in February when you don't know what year it is? miguel On Fri, 19 Apr 2002, Demitrious S. Kelly wrote: Wouldn't it be easier to convert each date into a unix timestamp, then subtract... the resulting number is the difference in seconds. Then devide by 60 for minutes, again for hours 24 for days, etc, etc -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 8:44 AM To: Ron Allen Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Within the date format On Fri, 19 Apr 2002, Ron Allen wrote: This is what I have right now $totaltime= date(:H:i:s, mktime(0,0,$totaltime)); This is the result 04:20:46 from the following dates 2002-04-25 16:30:16 2002-04-19 12:09:30 534046 seconds I would like to be able to get the days and, if needed, the number of months and years Well, I think the easiest way is going to be to split your date apart into $day, $month, $year and then subtract. You can't just do a cascading modulus calculation on the delta between the timestamps, because that won't take leap years into account. miguel -- 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] .inc over .php
3) Block downloads on .inc files, like using a Files directive in httpd.conf or a .htaccess file in apache. (Or whatever on another web server.) Now, even if a user tries to view that file, it won't execute at all, thus perhaps saving you some memory and clock cycles. (And it's generally more secure than treating them as php files since the includes might do something to, say, a database that you don't want them to do unless they're included into a valid php file request.) J Jason Wong wrote: There are two ways to counter this: 1) have the .inc files in a directory outside the scope of the webserver directory. 2) set the webserver to treat .inc files as php files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file extension validation
Here is what I have currently to validate the file type on upload to a server: ?php if ($htm1 != eregi('.htm$', $htm1)) { copy($htm1, /path/to/upload/directory/$htm1) or die (Could not upload file, please try again after making sure the file is less than 2mb in size and the file name correct); } else { die(No file selected for upload, or the file was not the correct type. Please only upload .htm files.); } ? Right now it just checkes the file extension, I would like to know how I can use this piece of code and add the functionality of actually checking the file first. If anyone can point me in the right direction that would be great. Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php