Re: [PHP] php code in templates... how to?
eval() should work for you http://www.php.net/eval You also may want to consider including files coded something like this: html head?=$headers;?/head title?=$title;?/title body ?=$header;? ?=$body;? ?=$footer;? /body /html Then you just set the values for the vars in your code - include the file. Josh --- Hendrik Daldrup [EMAIL PROTECTED] wrote: Hi, i am working with templates, which i put into a string ($user_screen) and in the end i make the output with echo $user_screen; where $user_screen would contain the template file data. However, if the $user_screen contains any php code it gets echo'ed as well, instead of parsed. (ok, that sounds logical), but is there a way i can make php parse the php code within this string? i thought, that maybe include would work that way, but its not possible to include a string, is it? thx Hendrik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? New DSL Internet Access from SBC Yahoo! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: No ouput until program end, why?
Have you tried this way ? php -q your_file.php /path/to/output_filename Jean-Christian Imbeault [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am running a PHP program under Linux on the command line. The problem I have is that I get no output to the screen until the program finishes. I have lots of echo statements throughout the program to help me debug but none of them are printed until the program finishes, which is really a pain since the prog takes 30 minutes to run ... The main() looks something like this. Can someone help me figure out why it is not printing anything until the program exists? pg_exec($CONN, BEGIN); for ($i = 0; $i 6001; $i++) { $retval = process($aFields); if ( ($i % 100) == 0 ) echo $i\n; if ($retval == 1) echo error on line $i \n; } echo COMMIT \n; pg_exec($CONN, COMMIT); Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Please help - Safe mode and directory permission
Hello, I'm working with Safe mode and I have a big trouble how the PHP is behaved. I have the web root and under them is directory, where my scripts are. This is my situation: rwxr-xr-x www www /var/www/htdocs Web root rwxr-xr-x www www /var/www/htdocs/test PHP scripts rw-r--r-- user user /var/www/htdocs/test/safe.php script ?php readfile(noowner); readfile(owner); ? rw-r--r-- abc abc /var/www/htdocs/test/noowner.php script rw-r--r-- user user /var/www/htdocs/test/owener.php script And everything is working OK. That mean the noowner file is not included in script. BUT I need to change the owner of directory to user USER and after that change, the file noowner is included in spite of the user is different. New situation: rwxr-xr-x www www /var/www/htdocs Web root rwxr-xr-x user user /var/www/htdocs/test PHP scripts rw-r--r-- user user /var/www/htdocs/test/safe.php script ?php readfile(noowner); readfile(owner); ? rw-r--r-- abc abc /var/www/htdocs/test/noowner.php script rw-r--r-- user user /var/www/htdocs/test/owener.php script My configuration: Apache 2.0.40 and PHP 4.2.3, the same problem on Apache 2.0.39 and PHP 4.2.2. Do you know, where the problem is? Thanks, Rudolf Wolf. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] force download and file size issue
this is what i have exactly in my code... header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); readfile($file_fullpath); exit; it works for files upto 10M (same as memory limit) but not above. the paths to file and content length are correct as i have checked them and made comparisons to other files which i can download. is there a problem with this code? i have tried it with win ie 6 and mac ie 5.1.2 and ns 4.7.. same issue cheers christian Rasmus Lerdorf wrote: readfile() reads 8k blocks at a time and dumps them out. It does not read the entire thing into ram, so that wouldn't be what was causing you to hit a memory limit. You must have done something else wrong then. -Rasmus On Fri, 4 Oct 2002, christian haines wrote: thanks rasmus, i have tried read file but it gave me the same issues as fpassthru.. both cap on the memory_limit directive withint the php.ini file any other suggestions maybe? cheers christian Rasmus Lerdorf wrote: readfile() On Fri, 4 Oct 2002, christian haines wrote: hi all, i have successfully created a download script to force a user to download, however attempting to download large files causes an error saying that the file cannot be found. my code header(Cache-control: private); header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); $fp = fopen($file_fullpath,r); fpassthru($fp); fclose($fp); my code this is a memory issue in the php.ini i.e. memory_limit = 8M then the largest file i can download is 8M is there anyway to force a download without having to use the system hungry fpassthru function? this is driving me nuts so any help would be greatly appreciated cheers christian ps i read the following at php.net fpassthru man page but could not make sense of it (it appears to be some kind of solution) fpassthru() works best for small files. In download manager scripts, it's best to determine the URL of the file to download (you may generate it locally in your session data if you need so), and then use HTTP __temporary__ redirects (302 status code, with a Location: header specifying the effective download URL). This saves your web server from maintaining PHP scripts running for long times during the file downloadn and instead the download will be managed directly by the web server without scripting support (consequence: less memory resources used by parallel downloads)... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mime Types
you could use the command file -bin your_filename and capture the output using popen or exec. i have found this to work well.. seee below function mimetype($file) { // execute command $fp = popen(file -bin $file,r); // determine mimetype to output if(!$fp) { // default mimetype if no mimetype exists $mimetype=application/octet-stream; } else { // iterate through return value to determine mimetype while($string=fgets($fp, 1024)) { $mimetype .= $string; } pclose($fp); } // return output return $mimetype; } Php List wrote: Hi, Is it possible to get a mime type of a file? I need to be able to attach files, but I won't always know the mime type of what is being attached. I could look at the extension of the file for a general Idea, but I wouldn't know if a .jpg file is an image/jpg or image/jpeg.(progressive) and there seems to be a difference between the two. Thanks for any help. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] --enable-trans-sid ?
[EMAIL PROTECTED] propably said: I am trying to re-compile php 4.2.2. It seems that the option --enable-trans-sid is no longer there (but still in the manual). The reason for a re-compilation is that I was not able to have SID printed out. Here is the code I tried, but SID is empty: ?php session_start(); echo SID; Don?t know why you can't recompile. But try echoing PHPSESSID instead and you should get it printed. - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] recent encrpyt decrypt code... (problems)
Hi, Friday, October 4, 2002, 3:01:53 PM, you wrote: JB I've seen a few other post on this, and it sounds like there is more then JB one of use that is trying this script. I've got it so that I can use the JB commands, but I still get errors on the page... JB here is what I have done. JB I downloaded libmycrpt from JB ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt and configured it with JB the following options; JB ./configure \ JB --with-included-algos=rijndael-128 arcfour stream cbc cfb\ JB --disable-posix-threads That is a class I put together. I use libmcrypt-2.5.2 configured with: configure --prefix=/usr --enable-ltdl-install=no and mcrypt-2.6.2 configured with: configure --prefix=/usr and in php configure: --with-mcrypt=/usr/src/mcrypt-2.6.2 (thats where it was untarred) and it works like a dream :) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Thumbnail with GD
Net Php wrote: Hi, I am pretty lost.. I am trying to create a php thumbnail with php without using any *sql database.this script was supposed to open a directory then read it resize the images without losing quality and displays it on screen. ok, here is what I am trying to do and its now working: If it's working, then what's the question??? ? $dir = imagestrips; if($abre = opendir($dir)) { while($arq = readdir($abre)) { $filename = imagestrips/ . $arq; if(is_file($filename)) { $neww = 100; $newh = 100; header(Content-type: image/jpeg); $dst_img=imagecreate($neww, $newh); $src_img=imagecreatefromjpeg($filename); imagecopyresized($dst_img,$src_img,0,0,0,0,$neww,$newh,imagesx($src_img),ima gesy($src_img));imagejpeg($dst_img); } } } closedir($abre); ? It look to me, this can't work. You are sending one header, then a jpeg, then a header, then a jpeg. Don't you get a broken image? The browser expects a header, then one image. You're resize script will have to look like this: resize.php ? if ( !file_exists( $_GET['filename'] ) { header( 'HTTP/1.0 404 Not Found' ); exit; } $new = imagecreate( 100, 100 ); $im = imagecreatefromjpeg( $_GET['filename'] ); if ( !$im ) { header( 'HTTP/1.0 404 Not Found' ); exit; } imagecopyresampled( $new, $im, 0, 0, 0, 0, 100, 100, imagesx( $im ), imagey( $im ) ); imagejpeg( $new ); ? You can invoke this with http://domain/resize.php?filename=img.jpg. You can create a nice directory listing this way, just call the resize.php script for every image on the page. Create the directory listing with the opendir function you used above, but let it print a img src='resize script url' width='100' height='100' instead of an image! HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] force download and file size issue
Which OS and which PHP version? On Fri, 4 Oct 2002, christian haines wrote: this is what i have exactly in my code... header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); readfile($file_fullpath); exit; it works for files upto 10M (same as memory limit) but not above. the paths to file and content length are correct as i have checked them and made comparisons to other files which i can download. is there a problem with this code? i have tried it with win ie 6 and mac ie 5.1.2 and ns 4.7.. same issue cheers christian Rasmus Lerdorf wrote: readfile() reads 8k blocks at a time and dumps them out. It does not read the entire thing into ram, so that wouldn't be what was causing you to hit a memory limit. You must have done something else wrong then. -Rasmus On Fri, 4 Oct 2002, christian haines wrote: thanks rasmus, i have tried read file but it gave me the same issues as fpassthru.. both cap on the memory_limit directive withint the php.ini file any other suggestions maybe? cheers christian Rasmus Lerdorf wrote: readfile() On Fri, 4 Oct 2002, christian haines wrote: hi all, i have successfully created a download script to force a user to download, however attempting to download large files causes an error saying that the file cannot be found. my code header(Cache-control: private); header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); $fp = fopen($file_fullpath,r); fpassthru($fp); fclose($fp); my code this is a memory issue in the php.ini i.e. memory_limit = 8M then the largest file i can download is 8M is there anyway to force a download without having to use the system hungry fpassthru function? this is driving me nuts so any help would be greatly appreciated cheers christian ps i read the following at php.net fpassthru man page but could not make sense of it (it appears to be some kind of solution) fpassthru() works best for small files. In download manager scripts, it's best to determine the URL of the file to download (you may generate it locally in your session data if you need so), and then use HTTP __temporary__ redirects (302 status code, with a Location: header specifying the effective download URL). This saves your web server from maintaining PHP scripts running for long times during the file downloadn and instead the download will be managed directly by the web server without scripting support (consequence: less memory resources used by parallel downloads)... -- 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] force download and file size issue
PHP Version 4.1.2 Red Hat Linux release 7.3 (Valhalla) (Kernel 2.4.18-3 on an i686) Apache/1.3.23 Rasmus Lerdorf wrote: Which OS and which PHP version? On Fri, 4 Oct 2002, christian haines wrote: this is what i have exactly in my code... header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); readfile($file_fullpath); exit; it works for files upto 10M (same as memory limit) but not above. the paths to file and content length are correct as i have checked them and made comparisons to other files which i can download. is there a problem with this code? i have tried it with win ie 6 and mac ie 5.1.2 and ns 4.7.. same issue cheers christian Rasmus Lerdorf wrote: readfile() reads 8k blocks at a time and dumps them out. It does not read the entire thing into ram, so that wouldn't be what was causing you to hit a memory limit. You must have done something else wrong then. -Rasmus On Fri, 4 Oct 2002, christian haines wrote: thanks rasmus, i have tried read file but it gave me the same issues as fpassthru.. both cap on the memory_limit directive withint the php.ini file any other suggestions maybe? cheers christian Rasmus Lerdorf wrote: readfile() On Fri, 4 Oct 2002, christian haines wrote: hi all, i have successfully created a download script to force a user to download, however attempting to download large files causes an error saying that the file cannot be found. my code header(Cache-control: private); header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); $fp = fopen($file_fullpath,r); fpassthru($fp); fclose($fp); my code this is a memory issue in the php.ini i.e. memory_limit = 8M then the largest file i can download is 8M is there anyway to force a download without having to use the system hungry fpassthru function? this is driving me nuts so any help would be greatly appreciated cheers christian ps i read the following at php.net fpassthru man page but could not make sense of it (it appears to be some kind of solution) fpassthru() works best for small files. In download manager scripts, it's best to determine the URL of the file to download (you may generate it locally in your session data if you need so), and then use HTTP __temporary__ redirects (302 status code, with a Location: header specifying the effective download URL). This saves your web server from maintaining PHP scripts running for long times during the file downloadn and instead the download will be managed directly by the web server without scripting support (consequence: less memory resources used by parallel downloads)... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: No ouput until program end, why?
Ernani Joppert Pontes Martins wrote: Have you tried this way ? php -q your_file.php /path/to/output_filename How would this help?? All that would do is redirect the output to a file. My problem is that I want output *before* the program ends ... Why aren't the echo statements I have in my for loop being printed out to the screen until the program terminates ??? I should get something printed out at every 100 lines ... but nothing gets printed until the end of the program ... At the end I get all the output I should. But not *before* the program ends ... Jc Jean-Christian Imbeault [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am running a PHP program under Linux on the command line. The problem I have is that I get no output to the screen until the program finishes. I have lots of echo statements throughout the program to help me debug but none of them are printed until the program finishes, which is really a pain since the prog takes 30 minutes to run ... The main() looks something like this. Can someone help me figure out why it is not printing anything until the program exists? pg_exec($CONN, BEGIN); for ($i = 0; $i 6001; $i++) { $retval = process($aFields); if ( ($i % 100) == 0 ) echo $i\n; if ($retval == 1) echo error on line $i \n; } echo COMMIT \n; pg_exec($CONN, COMMIT); Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Umm... Uh-oh
Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- Kyrie Eleison, Rick www.spiritsword.com/phpBB2/ Rick Beckman wrote: Sarcasm aside, I do have the script set up (although I didn't note so in the last response) to not accept files with '.' or '..' in the path. The URL can accept directories within the one the PHP script is in, but not in a different path or any directory above its own (i.e., the server files). John W. Holmes wrote: I have a page set up that loads the contents of a text file into an HTML template using PHP. (i.e. something.com/page.php?include=1 where 1 is a simple no-extension text file in the same directoy as page.php). Is there a way to modify the PHP code in the template page to search for the included page in another directory? Right now, the only way to do it is to have the URL as page.php?include=files/1. Currently, here is the code I use to takes the $include URL variable and makes the file accessible in the template: $info = file($include); Can I get the URL to your server, please, so I can pull up page.php?include=/etc/passwd ?? Thanks, I would really appreciate that. But seriously, I really hope you are validating what $include is. If you want the file to be included from a different directory, then you have to pass some flag/variable to PHP to tell it where to look. If you always want it to be in the same dir, then use $info = file('files/' . $include); ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: No ouput until program end, why?
does output buffering not work with command line PHP? http://www.php.net/manual/en/ref.outcontrol.php Tim Ward www.chessish.com -Original Message- From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 05:59 To: [EMAIL PROTECTED] Subject: No ouput until program end, why? I am running a PHP program under Linux on the command line. The problem I have is that I get no output to the screen until the program finishes. I have lots of echo statements throughout the program to help me debug but none of them are printed until the program finishes, which is really a pain since the prog takes 30 minutes to run ... The main() looks something like this. Can someone help me figure out why it is not printing anything until the program exists? pg_exec($CONN, BEGIN); for ($i = 0; $i 6001; $i++) { $retval = process($aFields); if ( ($i % 100) == 0 ) echo $i\n; if ($retval == 1) echo error on line $i \n; } echo COMMIT \n; pg_exec($CONN, COMMIT); Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] after mysqlfront?
Hello MySqlfront.de's mysqlfront program has been discontinued any equivalent alternative? thanks, Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: after mysqlfront?
Mascon or Free Mascon is really a good value HTH, Ernani Lallous [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello MySqlfront.de's mysqlfront program has been discontinued any equivalent alternative? thanks, Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] timeout
Hello, if i set set_time_limit(0) will my script still timeout and see in the browser: Page timed out and cannot be displayed? is there is anything I can do to prevent a script that takes an hour to finish processing from being killed when timeout occurs? Thanks, Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] timeout
If you set_tiome_limit(0) your script will not be timed out as long as it keeps sending something every now and then. If it just sits there without outputting anything, then Apache will kill it off eventually. On Fri, 4 Oct 2002, lallous wrote: Hello, if i set set_time_limit(0) will my script still timeout and see in the browser: Page timed out and cannot be displayed? is there is anything I can do to prevent a script that takes an hour to finish processing from being killed when timeout occurs? Thanks, Elias -- 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] timeout
so do you suggest that I send space-characters and then do a flush() ? Thanks, Elias Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... If you set_tiome_limit(0) your script will not be timed out as long as it keeps sending something every now and then. If it just sits there without outputting anything, then Apache will kill it off eventually. On Fri, 4 Oct 2002, lallous wrote: Hello, if i set set_time_limit(0) will my script still timeout and see in the browser: Page timed out and cannot be displayed? is there is anything I can do to prevent a script that takes an hour to finish processing from being killed when timeout occurs? Thanks, Elias -- 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] force download and file size issue
thanks for all your help and that last suggestion. it helped me isolate the issue. which i believe relates to a header previously sent.still debugging it but got a simple vers running cheers christian Rasmus Lerdorf wrote: Which OS and which PHP version? On Fri, 4 Oct 2002, christian haines wrote: this is what i have exactly in my code... header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); readfile($file_fullpath); exit; it works for files upto 10M (same as memory limit) but not above. the paths to file and content length are correct as i have checked them and made comparisons to other files which i can download. is there a problem with this code? i have tried it with win ie 6 and mac ie 5.1.2 and ns 4.7.. same issue cheers christian Rasmus Lerdorf wrote: readfile() reads 8k blocks at a time and dumps them out. It does not read the entire thing into ram, so that wouldn't be what was causing you to hit a memory limit. You must have done something else wrong then. -Rasmus On Fri, 4 Oct 2002, christian haines wrote: thanks rasmus, i have tried read file but it gave me the same issues as fpassthru.. both cap on the memory_limit directive withint the php.ini file any other suggestions maybe? cheers christian Rasmus Lerdorf wrote: readfile() On Fri, 4 Oct 2002, christian haines wrote: hi all, i have successfully created a download script to force a user to download, however attempting to download large files causes an error saying that the file cannot be found. my code header(Cache-control: private); header(Content-Type: application/force-download; name=\$file\); header(Content-Disposition: attachment; filename=\$file \); header(Content-Transfer-Encoding: binary); header(Content-Length: $content_length); $fp = fopen($file_fullpath,r); fpassthru($fp); fclose($fp); my code this is a memory issue in the php.ini i.e. memory_limit = 8M then the largest file i can download is 8M is there anyway to force a download without having to use the system hungry fpassthru function? this is driving me nuts so any help would be greatly appreciated cheers christian ps i read the following at php.net fpassthru man page but could not make sense of it (it appears to be some kind of solution) fpassthru() works best for small files. In download manager scripts, it's best to determine the URL of the file to download (you may generate it locally in your session data if you need so), and then use HTTP __temporary__ redirects (302 status code, with a Location: header specifying the effective download URL). This saves your web server from maintaining PHP scripts running for long times during the file downloadn and instead the download will be managed directly by the web server without scripting support (consequence: less memory resources used by parallel downloads)... -- 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] Re: after mysqlfront?
DB tools (getting better every version) http://www.dbtools.com.br/EN/ Cheers Brendon -Original Message- From: Ernani Joppert Pontes Martins [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 6:34 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: after mysqlfront? Mascon or Free Mascon is really a good value HTH, Ernani Lallous [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello MySqlfront.de's mysqlfront program has been discontinued any equivalent alternative? thanks, Elias -- 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] Can't put Inquiry and Response into same form
Hello, in the example on the bottom of this email I try to make an inquiry from my form to a PHP script and get the response, created by the PHP script, back into my form. Does anyone know what I am doing wrong? Any hints from you are welcome, regards, Darya Here the 2 PHP files: 1) irtest.php: HTML HEAD TITLEInquiry - Response - Test/TITLE /HEAD BODY H1Inquiry - Response - Test/H1 FORM ACTION=inquiry.php METHOD=POST TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=220 TR TDINPUT TYPE=TEXT NAME=Inquiry ALIGN=LEFT/TD TD INPUT TYPE=SUBMIT NAME=Submit VALUE=Inquiry /TD /TR TR TD INPUT TYPE=TEXT NAME=Response ALIGN=LEFT /TD TD /TD /TR /TABLE /FORM /BODY /HTML 2) inquiry.php html head titlePHP Test/title /head body ?php $inquiry = $_POST[Inquiry]; $response = $inquiry.' successfull returned'; echo $response; ? /body /html __ Gesendet von Yahoo! Mail - http://mail.yahoo.de Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Umm... Uh-oh
Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Umm... Uh-oh
erm..would that alow hackers access? Say I have a database include file would hackers be able to get access to my database like this? (include('http://mysite.com/datainc.php');) I hope bloody not!!! if so how on earth do i get round that! John On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote: Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Umm... Uh-oh
all my include files are *.inc, and I have a .htaccess file that makes apache refuse to serve those files directly thru http. Justin on 04/10/02 7:58 PM, John Wards ([EMAIL PROTECTED]) wrote: erm..would that alow hackers access? Say I have a database include file would hackers be able to get access to my database like this? (include('http://mysite.com/datainc.php');) I hope bloody not!!! if so how on earth do i get round that! John On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote: Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- 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] Umm... Uh-oh
so as my files are all .php I would be okay from an external hacking attempt? I don't have any worry about internal as I am on a dedicated server John On Friday 04 Oct 2002 11:02 am, Justin French wrote: all my include files are *.inc, and I have a .htaccess file that makes apache refuse to serve those files directly thru http. Justin on 04/10/02 7:58 PM, John Wards ([EMAIL PROTECTED]) wrote: erm..would that alow hackers access? Say I have a database include file would hackers be able to get access to my database like this? (include('http://mysite.com/datainc.php');) I hope bloody not!!! if so how on earth do i get round that! John On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote: Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- 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] Umm... Uh-oh
That would not help you if you include files based on unchecked user input. Justin French wrote: all my include files are *.inc, and I have a .htaccess file that makes apache refuse to serve those files directly thru http. Justin on 04/10/02 7:58 PM, John Wards ([EMAIL PROTECTED]) wrote: erm..would that alow hackers access? Say I have a database include file would hackers be able to get access to my database like this? (include('http://mysite.com/datainc.php');) I hope bloody not!!! if so how on earth do i get round that! John On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote: Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- 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] Include
You can include as many files as you want (or manage to), but you can declare functions only once. So include your files declaring functions using require_once(); Matias Silva wrote: This might sound like a dumb question but I just need verification so that I can convince myself that I'm going insane! I have this error in which I include 3 files (common_html.inc, common_db.inc, common_functions.inc) well I have a clean() function in the common_functions.inc file. But it seems that it is not getting called and then my script crashes. If I comment out the clean() function then it works. The clean() function is just for added security. Is there a maximum number of times you can include different files? -Matias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Umm... Uh-oh
The easiest and safest way to get around this problem is to place all your include files outside of your webroot directory (say one level up), so they will be accessible locally via includes, but NOT accessible via http. HTH, Stas - Original Message - From: John Wards [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Friday, October 04, 2002 10:58 AM Subject: Re: [PHP] Umm... Uh-oh erm..would that alow hackers access? Say I have a database include file would hackers be able to get access to my database like this? (include('http://mysite.com/datainc.php');) I hope bloody not!!! if so how on earth do i get round that! John On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote: Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- 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] Umm... Uh-oh
ah never thought of that! John On Friday 04 Oct 2002 11:14 am, Stas Maximov wrote: The easiest and safest way to get around this problem is to place all your include files outside of your webroot directory (say one level up), so they will be accessible locally via includes, but NOT accessible via http. HTH, Stas - Original Message - From: John Wards [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Friday, October 04, 2002 10:58 AM Subject: Re: [PHP] Umm... Uh-oh erm..would that alow hackers access? Say I have a database include file would hackers be able to get access to my database like this? (include('http://mysite.com/datainc.php');) I hope bloody not!!! if so how on earth do i get round that! John On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote: Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: No ouput until program end, why?
Try checking the output_buffering option Jean-Christian Imbeault wrote: Ernani Joppert Pontes Martins wrote: Have you tried this way ? php -q your_file.php /path/to/output_filename How would this help?? All that would do is redirect the output to a file. My problem is that I want output *before* the program ends ... Why aren't the echo statements I have in my for loop being printed out to the screen until the program terminates ??? I should get something printed out at every 100 lines ... but nothing gets printed until the end of the program ... At the end I get all the output I should. But not *before* the program ends ... Jc Jean-Christian Imbeault [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am running a PHP program under Linux on the command line. The problem I have is that I get no output to the screen until the program finishes. I have lots of echo statements throughout the program to help me debug but none of them are printed until the program finishes, which is really a pain since the prog takes 30 minutes to run ... The main() looks something like this. Can someone help me figure out why it is not printing anything until the program exists? pg_exec($CONN, BEGIN); for ($i = 0; $i 6001; $i++) { $retval = process($aFields); if ( ($i % 100) == 0 ) echo $i\n; if ($retval == 1) echo error on line $i \n; } echo COMMIT \n; pg_exec($CONN, COMMIT); Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] timeout
Is this true? I haven't heard about this. I thought it's the browser that closes conection a thus terminates the script, but this can be avoided using ignore_user_abort(false); Rasmus Lerdorf wrote: If you set_tiome_limit(0) your script will not be timed out as long as it keeps sending something every now and then. If it just sits there without outputting anything, then Apache will kill it off eventually. On Fri, 4 Oct 2002, lallous wrote: Hello, if i set set_time_limit(0) will my script still timeout and see in the browser: Page timed out and cannot be displayed? is there is anything I can do to prevent a script that takes an hour to finish processing from being killed when timeout occurs? Thanks, Elias -- 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] Unix passwd file
I apologize if this is might be OT. I have 5,000+ users in a unix passwd file that I would like to move to a MySQL table to build a login system with php. I could then use this table for Postfix and Radius. I know about the getpwent in perl, but does anyone know if I populate a MySQL table with the login/password can php then use that encrypted password to validate users? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Good Practice: Variables, Error Reporting and Security
Hi All, I have been a subscriber of php-db for quite some time, and I have seen MANY ppl ask why their variables aren't being passed though, etc, due to register_globals, etc, blah blah blah I have kept my eyes open reading all the material I can, and I understand the security implications of certain programming actions. Like most programmers, I am lazy. I prefer to construct functions to do the hard work for me. Before the register_globals issue was widespread, I loved programming in PHP (compared to ASP), because of the automatic passing of variables from page to page (also, referencing undefined variables without a hitch).I had some techniques to deal with security, and other things, so register_globals = on wasn't such big deal for me. But I acknowledge that if I do contract work for a business, and their server is set to I have set my php.ini to E_ALL and register_globals = off, etc, although I don't want to have to do $var = $_GET['var'] for each variable i want imported. I have also noted people are using $HTTP_GET_VARS['var'] to allow for older php compatibility. But doing it this way reminds me too much of ASP. Now, my question is, has anyone created functions or developed techniques to prevent obvious security breaches and also not collapse when using E_ALL? I have read somewhere that some people wrote a function which would accept an array of variable names (and get,post,session flag etc), and globalize all of those variables listed. Such an example (i imagine) would be something like this: import_vars( GET, array('id','var2','name') ); Now I don't think that I would have any troubles writing this sort of a function, although I was wondering if anyone had already considered this approach, or decided on a better solution. Really, I don't want to have to do isset(), etc on all my vars when using them. What I could deal with is having one line, where I list all the variables i use on the page, and it either imports it or creates an empty string if not found (therefore initializing it). What do you all think of this approach? PS. Sorry if this is talked about WAY too much on these lists, but I think this is a more informative thread for people who know about register_globals etc, but want scripting to be easier (and faster) with PHP, but still maintaining a good code structure (and sensible programming logic). Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error disabling
I need to be able to disable error reporting on one page with php, I just dont remember how to do this, if I remember correctly I could call some function in the begining of a php doc and tell it not to disply any errors that occur while parsing the doc.
Re: [PHP] Unix passwd file
You can just put the username and password in the MySQL database as normal text, then build your applications that are reading them to check the passwords with the UNIX Crypt function. In other words, just as your passwords are stored in a plain text file, store them in plain text in the db. Then to confirm them, take the first 2 characters of the crypted password, use them as the salt to crypt the password the user entered, and compare the results. If that are the same, they entered a valid password. I guess I'm assuming your existing passwords are in crypt format, but the same process is probably possible with whatever format they are in. HTH, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 - Original Message - From: Scott [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 04, 2002 4:43 AM Subject: [PHP] Unix passwd file I apologize if this is might be OT. I have 5,000+ users in a unix passwd file that I would like to move to a MySQL table to build a login system with php. I could then use this table for Postfix and Radius. I know about the getpwent in perl, but does anyone know if I populate a MySQL table with the login/password can php then use that encrypted password to validate users? TIA -- 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] Error disabling
A quickie woudl be put an before every function that would report an error like mysql_query etc John On Friday 04 Oct 2002 11:51 am, Davíð Örn Jóhannsson wrote: I need to be able to disable error reporting on one page with php, I just dont remember how to do this, if I remember correctly I could call some function in the begining of a php doc and tell it not to disply any errors that occur while parsing the doc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix passwd file
Scott wrote: [...] does anyone know if I populate a MySQL table with the login/password can php then use that encrypted password to validate users? http://www.php.net/manual/en/function.crypt.php should be the answer to your questions. -- jakob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix passwd file
Peter, I think he's stuck with the parsing part? you can file() the /etc/passwd file then explode() it and add the username,passhash parts and/or more values into the mysql table. Elias, Peter Janett [EMAIL PROTECTED] wrote in message 026a01c26b94$7b45d0a0$55285742@peters">news:026a01c26b94$7b45d0a0$55285742@peters... You can just put the username and password in the MySQL database as normal text, then build your applications that are reading them to check the passwords with the UNIX Crypt function. In other words, just as your passwords are stored in a plain text file, store them in plain text in the db. Then to confirm them, take the first 2 characters of the crypted password, use them as the salt to crypt the password the user entered, and compare the results. If that are the same, they entered a valid password. I guess I'm assuming your existing passwords are in crypt format, but the same process is probably possible with whatever format they are in. HTH, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 - Original Message - From: Scott [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 04, 2002 4:43 AM Subject: [PHP] Unix passwd file I apologize if this is might be OT. I have 5,000+ users in a unix passwd file that I would like to move to a MySQL table to build a login system with php. I could then use this table for Postfix and Radius. I know about the getpwent in perl, but does anyone know if I populate a MySQL table with the login/password can php then use that encrypted password to validate users? TIA -- 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] Need to move all MySQL tables to another server
I'm upgrading a web server, and need to move all the MySQL data from the old box to the new one. I have approx. 50 databases, some of which have a lot of tables in them. I know I can write a script to list all the databases, then export the sql for each database, then each table in it, then the data, but I'm guessing someone else has faced this need, so there may be a PHP solution out there. I'm hoping I can find an open source Perl or PHP script that I can simply point at the old and new server and tell it to copy all databases and data to the new server. Any ideas? Thanks, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error disabling
Error Reporting : php.net/error_reporting looks like this: error_reporting(0); // for outputting nothing error_reporting(55); // PHP4's default error_reporting(E_ALL | E_NOTICE); // for anything PHP can complain of Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // where PHP Begins On Fri, 4 Oct 2002 10:51:01 - Davíð Örn Jóhannsson [EMAIL PROTECTED] wrote: I need to be able to disable error reporting on one page with php, I just dont remember how to do this, if I remember correctly I could call some function in the begining of a php doc and tell it not to disply any errors that occur while parsing the doc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Installing PHP
did you try www.phpbuilder.com for how to install PHP /win ? Elias, Dan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am trying to create a message board. I setup a windows 2000 server and installed IIS. In order to setup this messageboard i need to have PHP installed. I downloaded the PHP installer and tried to run it but i get a error message stating that there was a missing OCX component and it cant configure the webserver. Does any know where i can get step by step instructions in setting this up. The instructions that come from php.net are too confusing. THanks Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need to move all MySQL tables to another server
With the mysqldump utility (comes with mysql) you can backup/restore any database. I don't know if you can tell it to dump all databases and their tables too. If you've got root access, you can simply copy the 'data' (i.e: C:\mysql\data) from a server to another. good luck, Elias Peter Janett [EMAIL PROTECTED] wrote in message 026d01c26b95$0bf65f70$55285742@peters">news:026d01c26b95$0bf65f70$55285742@peters... I'm upgrading a web server, and need to move all the MySQL data from the old box to the new one. I have approx. 50 databases, some of which have a lot of tables in them. I know I can write a script to list all the databases, then export the sql for each database, then each table in it, then the data, but I'm guessing someone else has faced this need, so there may be a PHP solution out there. I'm hoping I can find an open source Perl or PHP script that I can simply point at the old and new server and tell it to copy all databases and data to the new server. Any ideas? Thanks, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix passwd file
I found this code in a web (or somthink like this), but can remever where to give the credits, sorry. include_once('/etc/php/bases.php'); function autentifica($user,$pass) { global $db1Host, $db1User, $db1Pass; $auth = false; mysql_connect($db1Host,$db1User,$db1Pass) or die ('Unable to connect to server.'); // Select database on MySQL server mysql_select_db('mysql') or die ('Unable to select database.'); // Formulate the query $sql = SELECT user FROM user WHERE User='$user' password=PASSWORD('$pass'); // Execute the query and put results in $result $result = mysql_query($sql) or die ('Unable to execute query.'); // Get number of rows in $result. $num = mysql_numrows( $result ); if ($num != 0) { // A matching row was found - the user is authenticated. $auth = true; } return $auth; } Josep R. Raurell En/na Scott ha escrit: I apologize if this is might be OT. I have 5,000+ users in a unix passwd file that I would like to move to a MySQL table to build a login system with php. I could then use this table for Postfix and Radius. I know about the getpwent in perl, but does anyone know if I populate a MySQL table with the login/password can php then use that encrypted password to validate users? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need to move all MySQL tables to another server
On Friday 04 October 2002 18:58, Peter Janett wrote: I'm upgrading a web server, and need to move all the MySQL data from the old box to the new one. I have approx. 50 databases, some of which have a lot of tables in them. I know I can write a script to list all the databases, then export the sql for each database, then each table in it, then the data, but I'm guessing someone else has faced this need, so there may be a PHP solution out there. I'm hoping I can find an open source Perl or PHP script that I can simply point at the old and new server and tell it to copy all databases and data to the new server. Any ideas? Stop the mysql server on old box. Copy all the directories/files in the data directory to the new box. Start up mysql server on the new box. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Man is an animal that makes bargains: no other animal does this-- no dog exchanges bones with another. -- Adam Smith */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good Practice: Variables, Error Reporting and Security
On Fri, 4 Oct 2002 20:50:32 +1000 Adam Royle [EMAIL PROTECTED] wrote: Hi All, I have been a subscriber of php-db for quite some time, and I have seen MANY ppl ask why their variables aren't being passed though, etc, due to register_globals, etc, blah blah blah I have kept my eyes open reading all the material I can, and I understand the security implications of certain programming actions. Like most programmers, I am lazy. I prefer to construct functions to do the hard work for me. Before the register_globals issue was widespread, I loved programming in PHP (compared to ASP), because of the automatic passing of variables from page to page (also, referencing undefined variables without a hitch).I had some techniques to deal with security, and other things, so register_globals = on wasn't such big deal for me. But I acknowledge that if I do contract work for a business, and their server is set to Not only that it is better security-wise, but also it helps you differentiate between SERVER, GET, POST, COOKIES and SESSION variables. Say, you need to always read a session variable called 'id', then, you install some app that passes 'id' in GET. Isn't it better own the entire control on the things? I have set my php.ini to E_ALL and register_globals = off, etc, although I don't want to have to do $var = $_GET['var'] for each variable i want imported. I have also noted people are using $HTTP_GET_VARS['var'] to allow for older php compatibility. But doing it this way reminds me too much of ASP. Who cares of ASP? I don't. Now, my question is, has anyone created functions or developed techniques to prevent obvious security breaches and also not collapse when using E_ALL? I have read somewhere that some people wrote a function which would accept an array of variable names (and get,post,session flag etc), and globalize all of those variables listed. Such an example (i imagine) would be something like this: import_vars( GET, array('id','var2','name') ); I made one. Here: // Alter variables for the versions prior to 4.1.0 // NOTE: $_REQUEST global variable is NOT supported. if(strnatcasecmp('4.1.0', PHP_VERSION)=0) { foreach(Array( '_GET' = 'HTTP_GET_VARS' ,'_POST' = 'HTTP_POST_VARS' ,'_COOKIE' = 'HTTP_COOKIE_VARS' ,'_SESSION' = 'HTTP_SESSION_VARS' ,'_SERVER' = 'HTTP_SERVER_VARS' ,'_ENV' = 'HTTP_ENV_VARS' ,'_FILES'= 'HTTP_POST_FILES' ) as $transvar['new']=$transvar['old']) { if(isset($$transvar['old']) and is_array($$transvar['old'])) { $GLOBALS[$transvar['new']] = $$transvar['old']; } } // Unset transvar, we do not need it anymore. unset($transvar); } Now I don't think that I would have any troubles writing this sort of a function, although I was wondering if anyone had already considered this approach, or decided on a better solution. Really, I don't want to have to do isset(), etc on all my vars when using them. What I could deal with is having one line, where I list all the variables i use on the page, and it either imports it or creates an empty string if not found (therefore initializing it). What do you all think of this approach? Well, if you really care then maybe the approach should be: if PHP version is less than v4.1.0 then start up a file with the code that gets the HTTP_*_VARS and changes them into $_GET, $_POST etc... this makes you being more compatible PS. Sorry if this is talked about WAY too much on these lists, but I think this is a more informative thread for people who know about register_globals etc, but want scripting to be easier (and faster) with PHP, but still maintaining a good code structure (and sensible programming logic). One thing to add: ever asked yourself why people, after retrieving some data from DB call their variables similar like: $recID and not just $id or $dbTime and not just $time? Obviously to differentiate between the origins of data. Now, if you understood what I meant here, why using $id within the script instead of $_GET['id'] or $_SESSION['id'] ? Isn't is a cleaner, rather elegant code? That is a good practice. You shouldn't be lazy writing 6 more characters for a variable... You'd do that anyway for the data names because would be confused :) Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // where PHP Begins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error disabling
Hi there, i use this line in my code. #error_reporting(E_ALL); // set to -- (E_ERROR) (E_WARNING) (E_PARSE) (E_NOTICE) (E_CORE_ERROR) (E_CORE_WARNING) (E_ALL) check out the docs: http://www.php.net/manual/en/function.error-reporting.php holger - Original Message - From: Davíð Örn Jóhannsson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 04, 2002 12:51 PM Subject: [PHP] Error disabling I need to be able to disable error reporting on one page with php, I just don't remember how to do this, if I remember correctly I could call some function in the begining of a php doc and tell it not to disply any errors that occur while parsing the doc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Umm... Uh-oh
That still wouldn't fix anything if you're including a file based on unchecked user input. Make an array in your file of safe files to include, that can be designated by the user. $safe_files = array(file1,file2,file3); include(/path/to/include/ . $safe_files[$_GET['include']] . .php); or... switch($_GET['include']) { case 1: include(file1.php); break; case 2: include(file2.php); break; } You should really, really, rethink your design where you have to include files based on something passed in the url. ---John Holmes... -Original Message- From: John Wards [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 6:14 AM To: Stas Maximov Cc: PHP General Subject: Re: [PHP] Umm... Uh-oh ah never thought of that! John On Friday 04 Oct 2002 11:14 am, Stas Maximov wrote: The easiest and safest way to get around this problem is to place all your include files outside of your webroot directory (say one level up), so they will be accessible locally via includes, but NOT accessible via http. HTH, Stas - Original Message - From: John Wards [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Friday, October 04, 2002 10:58 AM Subject: Re: [PHP] Umm... Uh-oh erm..would that alow hackers access? Say I have a database include file would hackers be able to get access to my database like this? (include('http://mysite.com/datainc.php');) I hope bloody not!!! if so how on earth do i get round that! John On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote: Use realpath() to check the path. I also suspect your script is vulnarable to cross-site includes (include('http://hacker.com/script.inc');) Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) -- 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] No ouput until program end, why?
I am running a PHP program under Linux on the command line. The problem I have is that I get no output to the screen until the program finishes. I have lots of echo statements throughout the program to help me debug but none of them are printed until the program finishes, which is really a pain since the prog takes 30 minutes to run ... The main() looks something like this. Can someone help me figure out why it is not printing anything until the program exists? pg_exec($CONN, BEGIN); for ($i = 0; $i 6001; $i++) { $retval = process($aFields); if ( ($i % 100) == 0 ) echo $i\n; if ($retval == 1) echo error on line $i \n; } echo COMMIT \n; pg_exec($CONN, COMMIT); Thanks, Take a look at flush(). You may have to play with it to get enough data in the buffer for flush() to flush it, but hopefully it'll help. Also, make sure output_buffering is off. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help on regex
Hi everybody, I am trying to learn regex and could need some help. There are 2 function I would need. 1 which returns false if the data does contain anything else than numbers or fullstops I tryed this: function validate_phone ($phone) { return (ereg('^[0-9][:punct:]', $phone)); } The next one is to return fals if the data does not contain a number inside the string (street 893 would be valid) I tryed this: function validate_street ($street) { return (ereg('^[0-9]', $street)); } Unfortunatelly this does not work like I want ;-) Thank you for any help on this, andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] the files I'm working with
song.php is the file that I'm using as my template file, and it calls information from the includes/ directory, which the file 1 would be in. If someone would please look at song.php (I stripped it down to the basics pretty much) and let me know the best and most secure way to do what I want it to do. When finished, the includes directory will have dozens of files (numbered 1 and up), as you can see from the dropdown list in song.php . Thanks for the help. -- Kyrie Eleison, Rick www.spiritsword.com/phpBB2/ Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) Rick Beckman wrote: Sarcasm aside, I do have the script set up (although I didn't note so in the last response) to not accept files with '.' or '..' in the path. The URL can accept directories within the one the PHP script is in, but not in a different path or any directory above its own (i.e., the server files). John W. Holmes wrote: I have a page set up that loads the contents of a text file into an HTML template using PHP. (i.e. something.com/page.php?include=1 where 1 is a simple no-extension text file in the same directoy as page.php). Is there a way to modify the PHP code in the template page to search for the included page in another directory? Right now, the only way to do it is to have the URL as page.php?include=files/1. Currently, here is the code I use to takes the $include URL variable and makes the file accessible in the template: $info = file($include); Can I get the URL to your server, please, so I can pull up page.php?include=/etc/passwd ?? Thanks, I would really appreciate that. But seriously, I really hope you are validating what $include is. If you want the file to be included from a different directory, then you have to pass some flag/variable to PHP to tell it where to look. If you always want it to be in the same dir, then use $info = file('files/' . $include); ---John Holmes... begin 666 song.php M/%$3T-465!%($A434P@4%53$E#((M+R]7,T,O+T141!(5$U,(#0N,#$@ M5')A;G-I=EO;F%L+R]%3B(@(FAT=' Z+R]W=WN=S,N;W)G+U12+VAT;6PT M+VQO;W-E+F1T9(^#0H\:'1M;!L86YG/2)E;B(^#0H\/PT*21I;F9O(#T@ M9FEL92@DV]N9RD[#0H))YE=S @/2!S=')?F5P;%C92@B7XB+(B+1I M;F9O6S!=*3L-@DD;F5W,2 ]('-TE]R97!L86-E*);B(L(B(L)EN9F]; M,5TI.PT*21N97R(#T@W1R7W)EQA8V4H(EQN(BPB(BPD:6YF;ULR72D[ M#0H))YE=S,@/2!S=')?F5P;%C92@B7XB+(B+1I;F9O6S-=*3L-@DD M;F5W- ]('-TE]R97!L86-E*);B(L(B(L)EN9F];-%TI.PT*21N97U M(#T@W1R7W)EQA8V4H(EQN(BPB(BPD:6YF;ULU72D[#0H))YE=S8@/2!S M=')?F5P;[EMAIL PROTECTED](L(CQBCXB+1I;F9O6S9=*3L-C\^#0H\:5A9#X- MCQT:71L93XB/#\@96-H;R D;F5W,#L@/SXB($QYFECSPO=ET;4^#0H\ M;65T82!N86UE/2)K97EW;W)DR(@8V]N=5N=#TB)SP_(5C:\@)YE=S [ M(#\^)RP@/#\@96-H;R D;F5W,3L@/SXL(\/R!E8VAO(1N97R.R _/BL M(QYFECR(^#0H\;65T82!N86UE/2)D97-CFEP=EO;B(@8V]N=5N=#TB M3'ER:6-S(%N9!S;VYG(EN9F]R;6%T:6]N(9OB G/#\@96-H;R D;F5W M,#L@/SXG(%S('!EF9OFUE9!B2 \/R!E8VAO(1N97Q.R _/B!O;B!T M:4@86QB=6T@)SP_(5C:\@)YE=S([(#\^+BB/@T*/]H96%D/@T*#0H\ M8F]D3X-@D\:#$@8VQAW,](FAE860Q(CX\/R!E8VAO(1N97Q.R _/CPO M:#$^#0H)/@R(-L87-S/2)H96%D,B(^(CP_(5C:\@)YE=S [(#\^(CPO M:#(^#0H-CQF;W)M(YA;64](G-O;F=.878B(UE=AO9#TB9V5T(B!A8W1I M;VX](G-O;FNAP(CX-@D\!C;%SSTB8V5N=5R(CY3;VYG($YA=FEG M871I;VXZ( T*3QS96QE8W0@;F%M93TBV]N9R(@=%B:6YD97@](C$B('1I M=QE/2)3;VYG($EN95X(B!S:7IE/2(Q(CX-@D)/]P=EO;CX\+V]P=EO M;CX-@D)/]P==R;W5P(QA8F5L/2(J2G5S=!/=F5R(EN($AE879E;BH@ M*$1O6QE($QA=W-O;B F86UP.R!1=6EC:W-I;'9EBDB/@T*0D\;W!T:6]N M('9A;'5E/2(Q(B!L86)E;#TB5')A8VL@,2(^22=L;!+965P(]N(%-A:6QI M;F\+V]P=EO;CX-@D)/]P=EO;B!V86QU93TB,B(@;%B96P](E1R86-K M(#(B/E1H92!/;FQY(%1H:6YG(%1H870@36%T=5RSPO;W!T:6]N/@T*0D\ M;W!T:6]N('9A;'5E/2(S(B!L86)E;#TB5')A8VL@,R(^5AE($UA;B!5'-T M86ERSPO;W!T:6]N/@T*0D\;W!T:6]N('9A;'5E/2(T(B!L86)E;#TB5')A M8VL@-(^1V]D($ES(%=A=-H:6YG($]V97(@364\+V]P=EO;CX-@D)/]P M=EO;B!V86QU93TB-2(@;%B96P](E1R86-K(#4B/DQIW1E;B!T;R!T:4@ M0F5L;',\+V]P=EO;CX-@D)/]P=EO;B!V86QU93TB-B(@;%B96P](E1R M86-K(#8B/E1H92!2:6=H=!(86YD(]F($9E;QO=W-H:7 \+V]P=EO;CX- M@D)/]P=EO;B!V86QU93TB-R(@;%B96P](E1R86-K(#B/E-A9F4@5VET M:!9;W4@870@2]M93PO;W!T:6]N/@T*0D\;W!T:6]N('9A;'5E/2(X(B!L M86)E;#TB5')A8VL@.(^5V4@3F5E9!T:4@3EG:'0\+V]P=EO;CX-@D) M/]P=EO;B!V86QU93TB.2(@;%B96P](E1R86-K(#DB/D=O;FYA(%)O=R!- M2!;V%T/]O'1I;VX^#0H)3QO'1I;VX@=F%L=64](C$P(B!L86)E;#TB M5')A8VL@,3 B/DES(%1H870@=AE($)E;QS(]F($AE879E;C\\+V]P=EO M;CX-@D)/]P=EO;B!V86QU93TB,3$B(QA8F5L/2)4F%C:R Q,2(^25A M=F5N)W,@3F]T('-O($9AB!!=V%Y/]O'1I;VX^#0H)3QO'1I;VX@=F%L M=64](C$R(B!L86)E;#TB5')A8VL@,3(B/DD@06T@1VQA9#PO;W!T:6]N/@T* M0D\;W!T:6]N('9A;'5E/2(Q,R(@;%B96P](E1R86-K(#$S(CY'F5A=!7 M:ET92!!;F=E;#PO;W!T:6]N/@T*0D\;W!T:6]N('9A;'5E/2(Q-(@;%B M96P](E1R86-K(#$T(CY*=7-T($]V97(@:6X@25A=F5N/]O'1I;VX^#0H) M3PO;W!T9W)O=7 ^#0H)/]S96QE8W0^#0H)/EN'5T('1Y4](G-U8FUI
[PHP] Re: the files I'm working with
Outlook Express added a .dat extension to the 1 file... The actual files I'm working with do NOT have extensions. Just wanted to clear that up. -- Kyrie Eleison, Rick www.spiritsword.com/phpBB2/ Rick Beckman wrote: song.php is the file that I'm using as my template file, and it calls information from the includes/ directory, which the file 1 would be in. If someone would please look at song.php (I stripped it down to the basics pretty much) and let me know the best and most secure way to do what I want it to do. When finished, the includes directory will have dozens of files (numbered 1 and up), as you can see from the dropdown list in song.php . Thanks for the help. Rick Beckman wrote: Okay, I was mistaken... There is a gaping security hole in my simple li'l script... How do I modify it to only accept files from a certain path? I want the url format to be script.php?call=1 where 1 is the called file in the /includes/ directory. Just when I get optimistic I leave the entire system exposed. Yeah, that fits with my luck. :-) Rick Beckman wrote: Sarcasm aside, I do have the script set up (although I didn't note so in the last response) to not accept files with '.' or '..' in the path. The URL can accept directories within the one the PHP script is in, but not in a different path or any directory above its own (i.e., the server files). John W. Holmes wrote: I have a page set up that loads the contents of a text file into an HTML template using PHP. (i.e. something.com/page.php?include=1 where 1 is a simple no-extension text file in the same directoy as page.php). Is there a way to modify the PHP code in the template page to search for the included page in another directory? Right now, the only way to do it is to have the URL as page.php?include=files/1. Currently, here is the code I use to takes the $include URL variable and makes the file accessible in the template: $info = file($include); Can I get the URL to your server, please, so I can pull up page.php?include=/etc/passwd ?? Thanks, I would really appreciate that. But seriously, I really hope you are validating what $include is. If you want the file to be included from a different directory, then you have to pass some flag/variable to PHP to tell it where to look. If you always want it to be in the same dir, then use $info = file('files/' . $include); ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Good Practice: Variables, Error Reporting and Security
[snip] I made one. Here: // Alter variables for the versions prior to 4.1.0 // NOTE: $_REQUEST global variable is NOT supported. if(strnatcasecmp('4.1.0', PHP_VERSION)=0) { foreach(Array( '_GET' = 'HTTP_GET_VARS' ,'_POST' = 'HTTP_POST_VARS' ,'_COOKIE' = 'HTTP_COOKIE_VARS' ,'_SESSION' = 'HTTP_SESSION_VARS' ,'_SERVER' = 'HTTP_SERVER_VARS' ,'_ENV' = 'HTTP_ENV_VARS' ,'_FILES'= 'HTTP_POST_FILES' ) as $transvar['new']=$transvar['old']) { if(isset($$transvar['old']) and is_array($$transvar['old'])) { $GLOBALS[$transvar['new']] = $$transvar['old']; } } // Unset transvar, we do not need it anymore. unset($transvar); } One thing to add: ever asked yourself why people, after retrieving some data from DB call their variables similar like: $recID and not just $id or $dbTime and not just $time? Obviously to differentiate between the origins of data. Now, if you understood what I meant here, why using $id within the script instead of $_GET['id'] or $_SESSION['id'] ? Isn't is a cleaner, rather elegant code? That is a good practice. You shouldn't be lazy writing 6 more characters for a variable... You'd do that anyway for the data names because would be confused :) [/snip] This points out a system wide concern, self-taught developers (Not that there is anything wrong with that! :^]) and coders who have come to the party from a new path where they learned there thing by reading, surfing, and hacking until they got it right. They have missed out on things like significant notation or Hungarian notation, planning, charting, and many other factors that enter into the equation. The recent register globals discussion points this out clearly. Having worked with a couple of developers who came down this path and watching the outright surprise and shock on their faces when flowcharts, variable keys, and other pre-code documentation are requested in project meetings it is no surprise that many find the register globals update inconvenient. What if PHP had strongly typed variables? (BTW, using the $_GET, $_POST, etc is a move in that direction, a good thing ...) Maxim, you are dead on with this! Here is some good reading for variable naming, a good place to start; http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=Hungarian+notation Jay Now, if I could only get a book deal to write about this -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the files I'm working with
safe enough would be to put this at the begining if(!ereg('^[0-9]+$',$song) { die('Sorry...') } Rick Beckman wrote: song.php is the file that I'm using as my template file, and it calls information from the includes/ directory, which the file 1 would be in. If someone would please look at song.php (I stripped it down to the basics pretty much) and let me know the best and most secure way to do what I want it to do. When finished, the includes directory will have dozens of files (numbered 1 and up), as you can see from the dropdown list in song.php . Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help me please.
got a problem here people. What I want to do is upload a file and store its name in a database. For some reason I cant. I can upload the file fine but can't pass it's name to the mysql DB. Any ideas: Upload form: ? require( ../Cart.php); Brand(); DBInfo(); echo bYou can now upload a picture.../bbrbr; echo form enctype='multipart/form-data' action='uploadItem.php' method=post; echo INPUT TYPE='hidden' name='MAX_FILE_SIZE' value='25000'; echo INPUT TYPE='hidden' name='ID' value='$II'; echo INPUT name='userfile' type='file'; blueFont( Arial, Send this file: ); echo INPUT TYPE='submit' VALUE='Send File'/form; echo pbThis file MUST be a JPEG (jpg) image./b; //adminFooter($Relative); ? Process the form: ? require(../Cart.php); Root(); DBinfo(); mysql_connect($DBHost,$DBUser,$DBPass); $UploadURL = ../images/; if ($usefile==none) { echo Error: no file uploaded; exit; } //Connect to DB $mysql = mysql_connect($DBHost,$DBUser,$DBPass); if(!$mysql) { echo Cannot connect to database.; exit; } mysql_query(INSERT INTO Items (ImageName) WHERE ItemID = '$II' VALUE('test')); $upfile = $UploadURL.$userfile_name; if ( !copy($userfile, $upfile)) { echo Error: Could not move file into directory; exit; } ? Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML dom encode
?php header(Content-Type: application/xml); //query database records $connection = mysql_connect(localhost, user, pass) or die(can't connect); mysql_select_db(webbish); $query = SELECT id, title, artist FROM xmldb; $result = mysql_query($query); if(mysql_num_rows($result) 0){ //Create DomDocument $doc = new_xmldoc(1.0); //Add root note $root = $doc-add_root(cds); //Iterate through result set while(list($id, $title, $artist) = mysql_fetch_row($result)){ //create item node $record = $root-new_child(cd, ); $record-set_attribute(id, $id); //Attach title and artist as children of item node $record-new_child(title, $title); $record-new_child(artist, $artist); } echo $doc-dumpmem(); } ? makes a xml doc that looks like this: ?xml version=1.0 ? - cds - cd id=1 titlesdfsdfsdf/title artistssdfsdf/artist /cd - cd id=2 titleasdf/title artistasdf/artist /cd - cd id=3 titlesdfasdf/title artist涩/artist /cd /cds But I need to modify this script so that I can set the encoding of the xml document to ISO-8859-1 so it would look like this: ?xml version=1.0 encoding=”iso-8859-1” ? - cds - cd id=1 titlesdfsdfsdf/title artistssdfsdf/artist /cd - cd id=2 titleasdf/title artistasdf/artist /cd - cd id=3 titlesdfasdf/title artist涩/artist /cd /cds Any Ideas how to do this? I’ve been searching the net for solutions without any results. Thanks David
[PHP] Distance Script Available?
There has to be somewhere you can pick up a script or function that will calculate distance? :-) Roy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML dom encode
On 10/04/2002 09:14 AM, 翽 wrote: But I need to modify this script so that I can set the encoding of the xml document to ISO-8859-1 so it would look like this: ?xml version=1.0 encoding=”iso-8859-1” ? - cds - cd id=1 titlesdfsdfsdf/title artistssdfsdf/artist /cd - cd id=2 titleasdf/title artistasdf/artist /cd - cd id=3 titlesdfasdf/title artist涩/artist /cd /cds Any Ideas how to do this? I’ve been searching the net for solutions without any results. This question was asked sometime ago but I could not understand if anybody actually solved it. Anyway, I use this XML writer class instead of DOM API as it allows me not only to generate nicely formatted XML documents with the character set encoding but also the stylesheet and DTD if I need it. Take a look: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help me please.
got a problem here people. What I want to do is upload a file and store its name in a database. For some reason I cant. What version of php are you using? Did you check the register_globals in php.ini??? O...in the process script, you have $usefile, but in the submit script, it's $useRfile If register_globals is On, then skip the Change to: parts Process the form: ? require(../Cart.php); Root(); DBinfo(); mysql_connect($DBHost,$DBUser,$DBPass); $UploadURL = ../images/; if ($usefile==none) Change to: if ( $_FILES['userfile']['name'] == none ) or if ( is_uploaded_file( $_FILES['userfile']['tmp_name'] ) ) { echo Error: no file uploaded; exit; } //Connect to DB $mysql = mysql_connect($DBHost,$DBUser,$DBPass); if(!$mysql) { echo Cannot connect to database.; exit; } mysql_query(INSERT INTO Items (ImageName) WHERE ItemID = '$II' VALUE('test')); This query is wrong. An insert query can't have a WHERE clause...check the MySQL documentation about that. $upfile = $UploadURL.$userfile_name; Change to: $upfile = $UploadUrl . $_FILES['userfile']['name'] if ( !copy($userfile, $upfile)) Change to: if ( !copy( $_FILES['userfile']['tmp_name'], $upfile ) ) OR if ( !move_uploaded_file( $_FILES['userfile']['tmp_name'], $upfile ) ) { echo Error: Could not move file into directory; exit; } ? HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix passwd file
At 04:54 AM 10/4/2002 -0600, Peter Janett wrote: You can just put the username and password in the MySQL database as normal text, then build your applications that are reading them to check the passwords with the UNIX Crypt function. Basically that is what I am trying to do. I just converted a BSDI passwd file to Linux to move the users to a new server. Now I want to move the user accounts to a MySQL table that Postfix, Radius and Apache/PHP can share to authenticate the users. In other words, just as your passwords are stored in a plain text file, store them in plain text in the db. Then to confirm them, take the first 2 characters of the crypted password, use them as the salt to crypt the password the user entered, and compare the results. If that are the same, they entered a valid password. So this would validate the user? What about if the user wants to change their password? In PHP can I crypt backwards and still be compatible with the Linux passwd file? I am trying to avoid manually typing in over 5,000 usernames and passwords. -Scott --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help on regex
I am trying to learn regex and could need some help. There are 2 function I would need. 1 which returns false if the data does contain anything else than numbers or fullstops I tryed this: function validate_phone ($phone) { return (ereg('^[0-9][:punct:]', $phone)); } try using ^[0-9.]*$ The next one is to return fals if the data does not contain a number inside the string (street 893 would be valid) I tryed this: function validate_street ($street) { return (ereg('^[0-9]', $street)); } try using just [0-9] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: XML dom encode
-Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: 4. október 2002 12:23 To: [EMAIL PROTECTED] Subject: [PHP] Re: XML dom encode On 10/04/2002 09:14 AM, 翽 wrote: But I need to modify this script so that I can set the encoding of the xml document to ISO-8859-1 so it would look like this: ?xml version=1.0 encoding=”iso-8859-1” ? - cds - cd id=1 titlesdfsdfsdf/title artistssdfsdf/artist /cd - cd id=2 titleasdf/title artistasdf/artist /cd - cd id=3 titlesdfasdf/title artist涩/artist /cd /cds Any Ideas how to do this? I’ve been searching the net for solutions without any results. This question was asked sometime ago but I could not understand if anybody actually solved it. Anyway, I use this XML writer class instead of DOM API as it allows me not only to generate nicely formatted XML documents with the character set encoding but also the stylesheet and DTD if I need it. Take a look: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos Thanks for the reply but I just have to go with this xmlwriter class if no one can help me with this php xmlDom thing, but I can't imagin that nobody has found a way to solve this, there are that many people using iso-8859-1 encoding. But thanks again and if anybody has a solution for this I would be greatful. Regards, David -- 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] Unix passwd file
At 01:54 PM 10/4/2002 +0200, lallous wrote: Peter, I think he's stuck with the parsing part? you can file() the /etc/passwd file then explode() it and add the username,passhash parts and/or more values into the mysql table. I can parse the file just fine, what I am trying to do is actually make use of the data coming out of the passwd file. In other words if you set up a simple table: UserID Username Password And then populate the table using a PHP script that parses the /etc/passwd file and then write your app to verify the user on that data can it be done? Username is no problem, the Unix encrypted password is the one I am trying to work out. If the user has a password of: phprocks and in /etc/passwd that encrypted password works out to be: !#@KJCKMSD, then I validate the user, they enter the correct username and password, will PHP be able to validate that the password they entered matches the encrypted password. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Distance Script Available?
Distance of what? On Fri, 4 Oct 2002 07:21:53 -0500 RoyW [EMAIL PROTECTED] wrote: There has to be somewhere you can pick up a script or function that will calculate distance? :-) Roy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // where PHP Begins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix passwd file
Username is no problem, the Unix encrypted password is the one I am trying to work out. If the user has a password of: phprocks and in /etc/passwd that encrypted password works out to be: !#@KJCKMSD, then I validate the user, they enter the correct username and password, will PHP be able to validate that the password they entered matches the encrypted password. Just as Peter said, you can use crypt to check the passwords, it'll be something like: if ( '!#@KJCKMSD' == crypt( 'phprocks', substr( 'phprocks', 0, 2 ) ) ) { // Validation succeeded } else { // Invalid password } Crypt can not be unencrypted, but you can of course compare the crypted passwords... HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML dom encode
Hi, Friday, October 4, 2002, 10:14:31 PM, you wrote: DÖJ ?php DÖJ header(Content-Type: application/xml); DÖJ //query database records DÖJ $connection = mysql_connect(localhost, user, pass) or die(can't connect); DÖJ mysql_select_db(webbish); DÖJ $query = SELECT id, title, artist FROM xmldb; DÖJ $result = mysql_query($query); DÖJ if(mysql_num_rows($result) 0){ DÖJ //Create DomDocument DÖJ $doc = new_xmldoc(1.0); DÖJ //Add root note DÖJ $root = $doc-add_root(cds); DÖJ //Iterate through result set DÖJ while(list($id, $title, $artist) = mysql_fetch_row($result)){ DÖJ //create item node DÖJ $record = $root-new_child(cd, ); DÖJ $record-set_attribute(id, $id); DÖJ //Attach title and artist as children of item node DÖJ $record-new_child(title, $title); DÖJ $record-new_child(artist, $artist); DÖJ } DÖJ echo $doc-dumpmem(); DÖJ } DÖJ ? DÖJ makes a xml doc that looks like this: DÖJ ?xml version=1.0 ? DÖJ - cds DÖJ - cd id=1 DÖJ titlesdfsdfsdf/title DÖJ artistssdfsdf/artist DÖJ /cd DÖJ - cd id=2 DÖJ titleasdf/title DÖJ artistasdf/artist DÖJ /cd DÖJ - cd id=3 DÖJ titlesdfasdf/title DÖJ artist?/artist DÖJ /cd DÖJ /cds DÖJ But I need to modify this script so that I can set the encoding of the xml document to ISO-8859-1 so it would look like this: DÖJ ?xml version=1.0 encoding=iso-8859-1 ? DÖJ - cds DÖJ - cd id=1 DÖJ titlesdfsdfsdf/title DÖJ artistssdfsdf/artist DÖJ /cd DÖJ - cd id=2 DÖJ titleasdf/title DÖJ artistasdf/artist DÖJ /cd DÖJ - cd id=3 DÖJ titlesdfasdf/title DÖJ artist?/artist DÖJ /cd DÖJ /cds DÖJ Any Ideas how to do this? Ive been searching the net for solutions without any results. DÖJ Thanks David One way to force it: ? ob_start(); echo '?xml version=1.0 encoding=iso-8859-1?cds/'; $buffer = ob_get_contents(); ob_end_clean(); $dom = domxml_open_mem($buffer); echo 'pre'; echo htmlentities($dom-dump_mem(true)); echo '/pre'; ? -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Distance Script Available?
From concept to reality? mt At 02:51 PM 10/4/2002 +0200, Maxim Maletsky wrote: Distance of what? On Fri, 4 Oct 2002 07:21:53 -0500 RoyW [EMAIL PROTECTED] wrote: There has to be somewhere you can pick up a script or function that will calculate distance? :-) Roy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // where PHP Begins -- 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] the files I'm working with
Hi Marek, safe enough would be to put this at the begining if(!ereg('^[0-9]+$',$song) { die('Sorry...') } Sure, but why incur the expense of using the ereg() parser? If you're only ever going to be testing whether $song is a number or not, use http://php.net/is-numeric. Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail headers filtering
I like that ;-) Manuel Lemos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, On 09/30/2002 01:29 PM, Henry wrote: How about somebody making a javascript email encoder so that if you use a javascript enabled mail client it will get decoded only once it arrives with the recipient. With a link for those people without javascript enabled email clients to view the message remotely on a decode server if they wish. That won't work in many mail programs either because they do not support HTML mail or because they disable Javascript. Most Webmails even strip Javascript from the HTML. A more reliable alternative is to put a remote image in the HTML that is generated dynamically by PHP script that serves a static image after it records the identity of the user that read the message. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $B$($($H(B
The best translation I could find comes from worldlingo.com ... $B$3(B $B$l(B $B$C(B $B$F(B $B$I(B $B$(B $B$d(B $B$C(B $B$F(B solution? $B$9(B $B$k(B $B$s(B $B$G(B $B$7(B $B$g(B $B$(B? Obviously, that's not enough to help.. Sorry. However, they do offer clarification by human translators for only 31 bucks... I suppose if the problem is great enough, someone will shell out the cash. Other than that, no dice. --? Kyrie Eleison, Rick www.spiritsword.com/phpBB2/ $BK\AO(B wrote: $B$3$l$C$F$I$$d$C$F2rFI$9$k$s$G$7$g$!!!(B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $B$($($H(B
And I see my post got butchered... Well, that's what I get for trying to help. :-\ -- Kyrie Eleison, Rick www.spiritsword.com/phpBB2/ Rick Beckman wrote: The best translation I could find comes from worldlingo.com ... $B$3(B $B$l(B $B$C(B $B$F(B $B$I(B $B$(B $B$d(B $B$C(B $B$F(B solution? $B$9(B $B$k(B $B$s(B $B$G(B $B$7(B $B$g(B $B$(B? Obviously, that's not enough to help.. Sorry. However, they do offer clarification by human translators for only 31 bucks... I suppose if the problem is great enough, someone will shell out the cash. Other than that, no dice. --? Kyrie Eleison, Rick www.spiritsword.com/phpBB2/ $BK\AO(B wrote: $B$3$l$C$F$I$$d$C$F2rFI$9$k$s$G$7$g$!!!(B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] XML dom encode
Hi, Untested but it would be something like this: ?php header(Content-Type: application/xml); //query database records $connection = mysql_connect(localhost, user, pass) or die(can't connect); mysql_select_db(webbish); $query = SELECT id, title, artist FROM xmldb; $result = mysql_query($query); if(mysql_num_rows($result) 0){ //Create DomDocument ob_start(); echo '?xml version=1.0 encoding=iso-8859-1?cds/'; $buffer = ob_get_contents(); ob_end_clean(); $doc = domxml_open_mem($buffer); //Get root node $root = $doc-document_element(); //Iterate through result set while(list($id, $title, $artist) = mysql_fetch_row($result)){ //create item node $record = $root-new_child(cd, ); $record-set_attribute(id, $id); //Attach title and artist as children of item node $record-new_child(title, $title); $record-new_child(artist, $artist); } echo $doc-dumpmem(); } ? -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $B$($($H(B
Not that this is relevant but... "$B2rFI$9$k(B"(kaidoku suru) means "to decipher" or "to decode". So, perhaps, the person who posted the message was just wondering how will the ml figure out what the message was. Or, ... (I don't really know... there's a Japanese ml so the post must be a mistake or something--perhaps, testing whatever...) Just guessing, - E "Rick Beckman" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The best translation I could find comes from worldlingo.com ... $B$3(B $B$l(B $B$C(B $B$F(B $B$I(B $B$&(B $B$d(B $B$C(B $B$F(B solution? $B$9(B $B$k(B $B$s(B $B$G(B $B$7(B $B$g(B $B$&(B? Obviously, that's not enough to help.. Sorry. However, they do offer "clarification by human translators" for only 31 bucks... I suppose if the problem is great enough, someone will shell out the cash. Other than that, no dice. --? Kyrie Eleison, Rick www.spiritsword.com/phpBB2/ $B>>K\AO(B wrote: $B$3$l$C$F$I$&$d$C$F2rFI$9$k$s$G$7$g$&!&!&!&(B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem uploading files
Hello guys This is my first post to the list, hope you can give point me to the right direction. Well, I've been trying to upload a file without much success so far. All I get is my firs error message: There is no file to send (shown in the script). This is my form: form enctype=multipart/form-data name=book_add method=post action=.$PHP_SELF.?management=5 input type=hidden name=MAX_FILE_SIZE value=2000 table width=100% border=0 bgcolor=#CC tr td width=51%Book Name:/td td width=49%input type=text name=form_title size=40/td /tr tr td width=51%File:/td td width=49%input type=file name=formfile/td /tr tr align=center td width=51%input type=reset name=reset value=Clean/td td width=49%input type=submit name=submit value=Add new book/td /tr /table /form And this is the script that handles the data: if ($formfile == none) { echo There is no file to send; exit; } if ($formfile_size == 0) { echo Bad file size; exit; } if ($formfile_type != application/pdf) { echo Non a PDF file; exit; } if (!is_uploaded_file($formfile)) { echo Warning!!!; exit; } $upfile = /var/www/bva/new/pdf/.$formfile_name; if (!copy($formfile, $upfile)) { echo There was a problem moving the file to the repository; exit; } else { echo New book has been uploaded; exit; } Thanks a lot for your help. *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem uploading files
A few observations: if ($formfile == none) { echo There is no file to send; exit; } for starters, I don't see how $formfile could ever be none... secondly, if you have register_globals set to off in your php.ini, $formfile wont' even be a variable, but you've only sent what looks like partial code, so I can't be sure. Can I recommend you try to get the perfectly good, working example of file uploads working that is available on this page: http://www.php.net/manual/en/printwn/features.file-upload.php Once you get it working, you can tweak it to suit your needs, rather than reinventing the wheel over and over... just improve on it. Justin on 05/10/02 2:04 AM, Wilmar Perez ([EMAIL PROTECTED]) wrote: Hello guys This is my first post to the list, hope you can give point me to the right direction. Well, I've been trying to upload a file without much success so far. All I get is my firs error message: There is no file to send (shown in the script). This is my form: form enctype=multipart/form-data name=book_add method=post action=.$PHP_SELF.?management=5 input type=hidden name=MAX_FILE_SIZE value=2000 table width=100% border=0 bgcolor=#CC tr td width=51%Book Name:/td td width=49%input type=text name=form_title size=40/td /tr tr td width=51%File:/td td width=49%input type=file name=formfile/td /tr tr align=center td width=51%input type=reset name=reset value=Clean/td td width=49%input type=submit name=submit value=Add new book/td /tr /table /form And this is the script that handles the data: if ($formfile == none) { echo There is no file to send; exit; } if ($formfile_size == 0) { echo Bad file size; exit; } if ($formfile_type != application/pdf) { echo Non a PDF file; exit; } if (!is_uploaded_file($formfile)) { echo Warning!!!; exit; } $upfile = /var/www/bva/new/pdf/.$formfile_name; if (!copy($formfile, $upfile)) { echo There was a problem moving the file to the repository; exit; } else { echo New book has been uploaded; exit; } Thanks a lot for your help. *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem uploading files
Hello Justin, thanks for your comments. Well just to answer your questions: 1. I've got register_globals set to ON. I have never had problem before with my forms, but this is the first time I try to upload a file. 2. I'm following the sample code you recommend. They're in fact pretty simmilar . Thanks a lot again. *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD on Linux
I was wondering if anyone could point me in the right direction as to why I can't get image manipulation with PHP to work. I am running 4.1.2 on Redhat with Apache. The configure script has --with-gd and in the php.ini file I added the line extension=gd.so. I got it working on my W2K IIS5 Server by just adding the uncommenting the line extension=php_gd.dll and restarting the server, but I can't seem to figure out why I can't get it to work on the Linux box. Any help or direction is greatly appreciated ~Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GD on Linux
Joshua E Minnie [EMAIL PROTECTED] wrote: : I was wondering if anyone could point me in the right direction as to why I : can't get image manipulation with PHP to work. I am running 4.1.2 on Redhat : with Apache. The configure script has --with-gd and in the php.ini file I : added the line extension=gd.so. : : I got it working on my W2K IIS5 Server by just adding the uncommenting the : line extension=php_gd.dll and restarting the server, but I can't seem to : figure out why I can't get it to work on the Linux box. : : Any help or direction is greatly appreciated A little adendum to my first post .. I can get the image to display but none of the text I am writing on the image shows up. ~Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] globals not working?
I have an odd problem. I have a file called evt_to_web.php. This file contains some variable assignments and a few functions. I have used require_once evt_to_web.php; in another file, indextest.php. In indextest.php, I then call a function that is in evt_to_web.php. That function cannot seem to see it's own global variables, even though I have used global etc;. I'm pulling my hair out. Here is evt_to_web.php: $evthostname = localhost; $evtusername = paukai; $evtpassword = imctiger88; $evtdatabase = imc_evts; $evtevents_table = evt_events; // Table where all events will be stored. $evtclient_table = evt_clients; // The owners of events and their login info $evtcategory_table = evt_cats; // Small table with categories for event sorting // Administration password $evtadmin_password = imccalendar; $evtimg_dir = images/; // Webmaster, in case of error: $evtwebmaster = [EMAIL PROTECTED]; // Redir site in case of error: $evtredir_site = http://www.illinimedia.com/;; function testGlobal() { global $evtredir_site; echo TestGlobal: '$evtredir_site'br\n; } When I do testGlobal(); I get: TestGloal: '' Showing me that the function testGlobal thinks that $everedir_site is empty. What have I done wrong here?? Thanks, Paul Kaiser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] use_cookies not working
I am using ini_set(session.use_cookies,0); to disable cookies but I don't see PHPSESSID showing up like I thought it would, so I don't think its working. I call it before session_start(). After the ini_set call I do session_log(CSE_Session_Start); session_module_name(user); session_set_save_handler(sess_open, sess_close, sess_read, sess_write, sess_remove, sess_gc); session_start(); ANy ideas? Thanks Rich
RE: [PHP] globals not working?
Hi Paul, function testGlobal() { global $evtredir_site; echo TestGlobal: '$evtredir_site'br\n; } When I do testGlobal(); I get: TestGloal: '' Change this function to: function testGlobal() { global $evtredir_site; echo TestGlobal: . $evtredir_site. br\n; } Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] form and php
Hi, I jsut install apache1.3.26 and php 4.2.3 on my win2000 machine for my course project. when I run: ? phpinfo(); ? everything works fine, it will show me the information. but when I try the followings, it give me an error: test.html html titleThis page is for Power Calculation/title body form action=testphp1.php method=GET Variable 1: input type=text name=varone Variable 2: input type=text name=vartwo br input type=submit name=submit value=Submit Variables input type=reset /form /body /html testphp1.php html titleTest/title body pbTest/b/p ?php $tmp = 20; print(the value of tmp variable is $tmp); print(the first variable is $varone); print(the second variable is $vartwo); ? /body /html error message Test the value of tmp variable is 20 Notice: Undefined variable: varone in c:\apache\htdocs\testphp1.php on line 8 the first variable is Notice: Undefined variable: vartwo in c:\apache\htdocs\testphp1.php on line 9 the second variable is *** please help me, thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Obfuscating E-Mail
What's the best (or easy, whichever) way to obfuscate e-mail addresses, either in plain HTML, or through a PHP script to prevent harvesters from collecting them? I don't mind if the address shows up as 'mickey at disney dot com (as opposed to [EMAIL PROTECTED]), however I want it to be a 'mailto:' link that visitors can just click on. However, for that to work, one needs to put the real address in the HREF tag - I want to avoid this and obfuscate it somehow, yet maintain the functionality. Suggestions? -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 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] form and php
I believe - html titleTest/title body pbTest/b/p ?php $tmp = 20; print(the value of tmp variable is $tmp); print(the first variable is . $_POST['varone']); print(the second variable is . $_POST['vartwo']); ? /body /html Tao Hou wrote: Hi, I jsut install apache1.3.26 and php 4.2.3 on my win2000 machine for my course project. when I run: ? phpinfo(); ? everything works fine, it will show me the information. but when I try the followings, it give me an error: test.html html titleThis page is for Power Calculation/title body form action=testphp1.php method=GET Variable 1: input type=text name=varone Variable 2: input type=text name=vartwo br input type=submit name=submit value=Submit Variables input type=reset /form /body /html testphp1.php html titleTest/title body pbTest/b/p ?php $tmp = 20; print(the value of tmp variable is $tmp); print(the first variable is $varone); print(the second variable is $vartwo); ? /body /html error message Test the value of tmp variable is 20 Notice: Undefined variable: varone in c:\apache\htdocs\testphp1.php on line 8 the first variable is Notice: Undefined variable: vartwo in c:\apache\htdocs\testphp1.php on line 9 the second variable is *** please help me, thank you -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obfuscating E-Mail
simple str_replace() stuff will get the address into a mickey at disney dot com format... but the link needs to be done with javascript, and you have to accept that it will not work for everyone. the phpclasses.org site does this along with 1000's of others, so I'm sure you can find some code. in fact, phpclasses HAS a few classes to do this too!!! search around for one that you like. justin on 05/10/02 3:36 AM, Ashley M. Kirchner ([EMAIL PROTECTED]) wrote: What's the best (or easy, whichever) way to obfuscate e-mail addresses, either in plain HTML, or through a PHP script to prevent harvesters from collecting them? I don't mind if the address shows up as 'mickey at disney dot com (as opposed to [EMAIL PROTECTED]), however I want it to be a 'mailto:' link that visitors can just click on. However, for that to work, one needs to put the real address in the HREF tag - I want to avoid this and obfuscate it somehow, yet maintain the functionality. Suggestions? -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 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] Obfuscating E-Mail
Justin French wrote: simple str_replace() stuff will get the address into a mickey at disney dot com format... but the link needs to be done with javascript, and you have to accept that it will not work for everyone. What about if I made the link point to another PHP script that will then create the valid link and push the browser to it (through header location)? Will harvesters be able to capture this? I mean, I've seen cases where the link looks like this: HREF=mailto:%61%73%68%6C%65%79%40%70%63%72%61%66%74%2E%63%6F%6D; Which when clicked on, translates to the real address. So if I have my script generate something like that for email, will harvesters be able to capture that information and translate it? -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 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] recent encrpyt decrypt code... (problems)
I had not downloaded mcrypt, but I download it (which required a later version of mhash so I downloaded, and installed it too). I compiled everything with the instrucitons you listed, and I am still getttng the same error messages. Jeff Tom Rogers [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Friday, October 4, 2002, 3:01:53 PM, you wrote: JB I've seen a few other post on this, and it sounds like there is more then JB one of use that is trying this script. I've got it so that I can use the JB commands, but I still get errors on the page... JB here is what I have done. JB I downloaded libmycrpt from JB ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt and configured it with JB the following options; JB ./configure \ JB --with-included-algos=rijndael-128 arcfour stream cbc cfb\ JB --disable-posix-threads That is a class I put together. I use libmcrypt-2.5.2 configured with: configure --prefix=/usr --enable-ltdl-install=no and mcrypt-2.6.2 configured with: configure --prefix=/usr and in php configure: --with-mcrypt=/usr/src/mcrypt-2.6.2 (thats where it was untarred) and it works like a dream :) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help with fsockopen()
I have a script that downloads html pages from many different sites. The script executes as expected but is slw. I would like to replace fopen() with fsockopen() so that I can set a time limit for the page downloads. Here is an example of how I'm using fopen(): $OpenFile = fopen($site_url, 80); //$site_url = www.domainname.com/complete/path/to/the/page.htm $getFile = fread($OpenFile, 5); Simply put, how do I do the exact same thing as above with fsockopen(). Thanks, Cliff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help with fsockopen()
http://www.php.net/manual/en/function.fsockopen.php Seems to be A LOT of useful information there? Did you check it out? -Brad I have a script that downloads html pages from many different sites. The script executes as expected but is slw. I would like to replace fopen() with fsockopen() so that I can set a time limit for the page downloads. Here is an example of how I'm using fopen(): $OpenFile = fopen($site_url, 80); //$site_url = www.domainname.com/complete/path/to/the/page.htm $getFile = fread($OpenFile, 5); Simply put, how do I do the exact same thing as above with fsockopen(). Thanks, Cliff -- 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 debugger
Hello, is there any application with I can test my php-based web site? I know Zend Studio and PHPEdit but I can't use them if any variable comes from an other html site. (For example in logging there are loginname and password as html variable and the debugger don't see them and the script doesn't works.) Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Modifying the size of a jpg.
Hello, I'm trying to modify the size of jpgs so they can be less big, so easily downloadable. If anyone has worked on it, contact me please. Thanks. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Distance Script Available?
On 10/4/02 8:21 AM, RoyW [EMAIL PROTECTED] tapped the keys: There has to be somewhere you can pick up a script or function that will calculate distance? If you can search by US Zip Code or lat/long, search the archives of this list for 'proximity'. You'll find this comes up quite often. Also, I believe PHP Classes (http://www.phpclasses.org/mirrors.html?page=%2Findex.html) has some scripts that do this (based on zip). -- Ed Marczak [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files
I would like to be able to upload files from the client computer to the server via a form. I know how to build the form, but am not sure of the best way to process this. I know there are certain ftp functions that can do this, which I'm not sure how to use. Are there any others? Jason D. Williard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading Files
Jason [EMAIL PROTECTED] disgorged: : I would like to be able to upload files from the client computer to the : server via a form. I know how to build the form, but am not sure of the : best way to process this. I know there are certain ftp functions that can : do this, which I'm not sure how to use. Are there any others? http://www.php.net/manual/en/features.file-upload.php More specifically, move_uploaded_file() and is_uploaded_file() HTH.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading Files
Okay, I checked out the link listed below, and tried using what is given there, but I get the following error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in d:\www_root\locutus\phpman\admin\test.php on line 16 Here's the code that I am using: form enctype=multipart/form-data action=test.php method=post input type=hidden name=MAX_FILE_SIZE value=10 Send this file: input name=userfile type=file input type=submit value=Send File /form ?php move_uploaded_file($_FILES['userfile']['tmp_name'], ../images/$_FILES['userfile']['name']); ? I am able to get rid of this error, but changing the line to: move_uploaded_file($_FILES['userfile']['tmp_name'], ../images/$_FILES[userfile][name]); However, the file is then uploaded as Array[name] How do I get past this? Jason Williard Eriol [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jason [EMAIL PROTECTED] disgorged: : I would like to be able to upload files from the client computer to the : server via a form. I know how to build the form, but am not sure of the : best way to process this. I know there are certain ftp functions that can : do this, which I'm not sure how to use. Are there any others? http://www.php.net/manual/en/features.file-upload.php More specifically, move_uploaded_file() and is_uploaded_file() HTH.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Incrementing the value
It's not very clear what you want but the following could be it: ?if(!isset($_GET['hid'])) {$h=1;} else {$h=$_GET['hid'];}? a href=Delay.php?hid=?php echo $h+1; ? img src=Gif/nextque.gif border=0/a i have written code such that initially it will display the value correspond to the value 1..after every click it will increment the value 2,3...so on..but now it is displaying the value 1 and for after each click again it is displaying 1 and 2...so on I have intiallised the value for the variable as if(!$_GET['hid']) $hid=1; like that..Can anyone please tell me how to avoid displaying the value 1 again..?? Watch a championship game with Elway or McGwire. Enter Now at http://champions.lycos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem uploading PDF files
Hello guys I do have a problem uploading PDF files. Whenever I try to upload a PDF file, the enviromental variable of the file field in the form gets set to none, otherwise it goes fine. Any idea? *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Execution Time
Edit your php.ini, change max_execution_time to something greater than 30. Mark -Original Message- From: Pong-TC [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 2:44 PM To: [EMAIL PROTECTED] Subject: [PHP] Execution Time Hello All I have a problem with the execution time. I use PHP to update database, but it could not perform well due to the limited execution time. How could I extend the execution time? Here is my error: Fatal error: Maximum execution time of 30 seconds exceeded in d:\inetpub\wwwroot\cgi-bin\finaid\upfinwhole.php on line 468 I am using PHP on IIS5 as a cgi. Thank you. Pong -- 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] elseifs and ereg
Okay, I think I'm just being stupid here. Can someone please tell me why this is wrong? Yeah I know it looks lame, but I'm just testing something. This always returns no matches Thanks, Bryan ? $now = strtotime(now); $out = never set; if ($now == ereg([2200-2230])) $out = special; elseif ($now == ereg([0600-1159])) $out = morning; elseif ($now == ereg([1200-1659])) $out = afternoon; elseif ($now == ereg([1700-1959])) $out = evening; elseif ($now == ereg([2000-])) $out = night; elseif ($now == ereg([0001-0559])) $out = too late; else $out = no matches; print(date(Hi, $now)); print \n$out\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: elseifs and ereg
check the manual page for ereg... you'll find that it takes 2 parameters minimum, and the return value is not what your code expects it to be. http://www.php.net/ereg Bryan Koschmann - Gkt [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Okay, I think I'm just being stupid here. Can someone please tell me why this is wrong? Yeah I know it looks lame, but I'm just testing something. This always returns no matches Thanks, Bryan ? $now = strtotime(now); $out = never set; if ($now == ereg([2200-2230])) $out = special; elseif ($now == ereg([0600-1159])) $out = morning; elseif ($now == ereg([1200-1659])) $out = afternoon; elseif ($now == ereg([1700-1959])) $out = evening; elseif ($now == ereg([2000-])) $out = night; elseif ($now == ereg([0001-0559])) $out = too late; else $out = no matches; print(date(Hi, $now)); print \n$out\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading Files
Jason [EMAIL PROTECTED] disgorged: : ?php : move_uploaded_file($_FILES['userfile']['tmp_name'], : ../images/$_FILES['userfile']['name']); : ? : : I am able to get rid of this error, but changing the line to: : move_uploaded_file($_FILES['userfile']['tmp_name'], : ../images/$_FILES[userfile][name]); : : However, the file is then uploaded as Array[name] : : How do I get past this? I'm not 100% sure this will work, but try this: ?php $savetopath = /path/to/your/upload/area . $userfile; mode_uploaded_file($_FILES['userfile']['tmp_name'], $savetopath); ? If you're using $_FILES, I assume you have Register_Globals = on? If not, use $HTTP_POST_FILES instead.. From 4.2.0 on register globals is off in the php.ini by default.. Also, you might try hotscripts.com for file upload scripts that allow one or multiple files at a time.. There may be a script there that's already created that'll serve your purpose.. http://www.hotscripts.com/PHP/Scripts_and_Programs/File_Manipulation/Upload_Sy stems/ HTH.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php