[PHP] Database problem - works in Windows - not Linux
Hi there, I'm moving an application from Windows - Linux, and am having a problem with the database. I have the following script to test my database connection (Linux): -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $connection = mysql_connect(localhost,,) or die (Couldn't connect.); $dbs = mysql_list_dbs($connection) or die(Couldn't list databases.); $db_list = ul; $i = 0; while ($i mysql_num_rows($dbs)) { $db_names[$i] = mysql_tablename($dbs,$i); $db_list .= li$db_names[$i]/li; $i++; } $db_list .= /ul; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This works fine and displays: * mysql * sasdap * test * testDB However, the code that I developed under Windows doesn't work in Linux: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function db_connect() { // the connection string (host, user, password) $result = mysql_pconnect(localhost, , ); if (!$result) return false; if (!mysql_select_db(sasdap)) return false; // false is returned! return $result; } -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Which is called like so: // connect to db $conn = db_connect(); if (!$conn) return 0; Any thoughts on why this is happening? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $HTTP_POST_VARS problem
Hi there, I'm currently using PHP 4.2.2 and I am have encountered some problems when trying to access $HTTP_POST_VARS. The following statements have the following return values: echo $HTTP_POST_VARS['userfile']; = C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp1.ir echo $userfile; = C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp1.ir echo $HTTP_POST_VARS['userfile']['name']; = NOTHING RETURNED echo $HTTP_POST_VARS['userfile']['size']; = NOTHING RETURNED echo $userfile_size; = NOTHING RETURNED echo $userfile_name; = NOTHING RETURNED Does anyone know what the problem is? I suspect that the '\\' in the path may have something to do with it. Thanks, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
Thanks for all the replies. However, I still have problems as the following code produces the following output: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= echo 0: . $userfile . br; echo 1: . $HTTP_POST_FILES['userfile']['size'] . br; echo 2: . $HTTP_POST_FILES['userfile']['name'] . br; echo 3: . $HTTP_POST_FILES['userfile']['type'] . br; echo 4: . $HTTP_POST_FILES . ( . sizeof($HTTP_POST_FILES) . )br; echo 5: . $HTTP_POST_FILES['userfile_size'] . br; echo 6: . $HTTP_POST_FILES['userfile']['type'] . br; echo 7: . $HTTP_POST_FILES['userfile_type'] . br; echo 8: . $usefile_type . br; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 0: C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp05.iR 1: 2: 3: 4: Array (0) 5: 6: 7: 8: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
Problem solved: I forgot to add the enctype to the original FORM tag. Cheers, Lee, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] external program execution error
Hi there, I am having problems with passthru, exec, etc. on Red Hat 8 (w/ PHP 4.2.3; Apache 1.3.27). When I use passthru / exec to execute pwd or ls-al I have no problems executing viewing the output. However, when I try and execute a program using the command line e.g ./lee54 GNOM_FILE_g4Dxx4.args using passthru, the value 127 is returned. What is this? An error code of some sort? I'm 99.9% sure that the external program itself isn't returning this. All the files are chmodded to 777. I don't know if there are there any configuration directives that I need to set or something..? If anyone has any idea as to what the problem could be, I'd be glad to gear it! Cheers, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passthru / exec question - '127' returned
Hi, I've ran into a problem using the passthru/exec commands with RH8. When I try and run my program (or even pwd, ls, etc) the number '127' is returned every_time. With passthru, the size of the optional return array is 0. Can anyone fathom a guess at the problem? Is the 127 value signifcant? Thanks in advance. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passthru / exec question - '127' returned
Ahhh... no reply necessary. safe_mode :-o -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Red Hat 8 Apache problem - stumped :-(
Hi there, This might be better suited for an Apache newsgroup, but I thought I'd try here first. I installed Apache and PHP on RH8 a few weeks ago following the instructions on [URL 1, below], and both were running with absolutely no problems. Today however, I rebooted my machine and http://localhost gave me a connection was refused when trying to contact localhost. Also, Apache would not restart: -- Syntax error on line 52 of /www/conf/httpd.conf: Invalid command 'ServerType', perhaps mis-spelled or defined by a module not included in the server configuration -- On removing the ServerType statement, I get: -- [root@localhost conf]# /usr/sbin/apachectl -f /www/conf/httpd.conf Syntax error on line 236 of /www/conf/httpd.conf: Port was replaced with Listen in Apache 2.0 -- On fixing this, I get: -- [root@localhost conf]# /usr/sbin/apachectl -f /www/conf/httpd.conf Syntax error on line 330 of /www/conf/httpd.conf: Invalid command 'Order', perhaps mis-spelled or defined by a module not included in the server configuration -- Of course, the problems go on and on... and on. I'm new to the world of Linux, so could anyone throw some ideas my way? Thanks, Lee [URL 1] [http://www.e-gineer.com/instructions/install-php4x-for-apache1xx-on-linux.phtml] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload problem - PC, *nix, and Max EOL characters
Hi everyone, I have an application, where users can upload data files formatted as follows: 0.0106375 686.60165.391 0.01147 606.46754.997 0.0122815 640.284 46.5355 0.0130753 668.396 39.3671 0.0138809690.05 34.6031 0.0146936 619.947 30.5329 0.0155071 640.413 26.9145 My code deals with the uploaded files by splitting the lines into an array, and then obtaining the 3 particular fields from the array elements. My code is something like this: -=-= BEGIN CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // put each line of the file into an array $filearray = file($file); // parse the file one line... at... a... time while (list(,$oneline) = each($filearray)) { // if the line starts with ; or a #... if ($oneline[0]==; || $oneline[0]==#) { // take out the ; and EOL characters $oneline = str_replace(; ,, $oneline); $oneline = str_replace(# ,, $oneline); $oneline = str_replace(\r,, $oneline); $size = strlen($oneline); } /* Some IQ files seperated columns by tabs; others, by whitespace. We parse the data file are delimit the columns by 'X9728430182298Z' (a random string), which will allow the program to recognise the start and end of each column. e.g. 0.00542 8691.64 901.605 0.0067759381.3 1235.78 becomes... 0.00542X9728430182298Z8691.64X9728430182298Z901.605 0.006775X9728430182298Z9381.3X9728430182298Z1235.78 */ $oneline = ltrim($oneline); $oneline = preg_replace(/\s+/, X9728430182298Z, $oneline); $text = explode (X9728430182298Z, $oneline); // now element [0] = Q, [1] = I. [2] = Error -=-= END CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This works perfectly well when the data is uploaded from a PC, but it fails when it's uploaded from Mac/Unix. When I vied the uploaded file the EOL characters *appear* as , which I believe is actually \n. When I output the contents of $filearray[0] (uploaded via a PC) I get one line, but when I ouput $filearray[0] from a file uploaded via a Mac I get the entire file. Therefore the problem occurs with: $filearray = file($file); while (list(,$oneline) = each($filearray)) I thought I had found a solution to the problem on the web* where I found the following extract of php.ini file: -- ; If your scripts have to deal with files from Macintosh systems, ; or you are running on a Mac and need to deal with files from ; unix or win32 systems, setting this flag will cause PHP to ; automatically detect the EOL character in those files so that ; fgets() and file() will work regardless of the source of the file. ; auto_detect_line_endings = Off -- However, this never solved the problem. The file itself is stored in a database, so how can I get rid of the EOL characters before it is being inserted? Is there a function to change the Unix EOL chars to PC EOL chars? Thanks in advance. - Best regards, Lee Reilly *[http://216.239.33.100/search?q=cache:GwerlDVFv8wC:linux.sarang.net/ftp/mirror/development/language/php_cvs/php4/php.ini-dist+MAC+EOL+character+PHPhl=enie=UTF-8] -- Lee P. Reilly, ms:G758 Szilard Resource, tel:505-665-7025 Bioscience Division, SM-30 Bikini Atoll Rd, Los Alamos National Laboratory, mailto:[EMAIL PROTECTED] Los Alamos, NM 87545. http://home.lanl.gov/lreilly Quidquid latine dictum sit, altum viditur -.__.--'`'--.__.--'`'--.__.--'`'--.__ '-:`.'|`|':-. '-:`.'|`|':-. '-:`.'|`|':-. '.` : '. '. '. | | | |'. '. | | | |'. '. | | | |'. '.: '. '. : '. '.| | | | '. '.| | | | '. '.| | | | '. '. : '. `. ' '. `.:_ | :_.' '. `.:_ | :_.' '. `.:_ | :_.' '. `.' `. `-..,..-' `-..,..-' `-..,..-' ` ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload problem - PC, *nix, and Max EOL characters
Hi, Thanks for the reply. I appreciate your help. fgets() reads to the EOF; not the EOL. Is there something similar to fgets() that I can use? Perhaps where I can state explicity read the file until you encounter and EOL char? Cheers, Lee Matt Vos wrote: Loop an fgets() i.e. $fp = fopen($file) while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL, whichever is first) */ { -- Lee P. Reilly, ms:G758 Szilard Resource, tel:505-665-7025 Bioscience Division, SM-30 Bikini Atoll Rd, Los Alamos National Laboratory, mailto:[EMAIL PROTECTED] Los Alamos, NM 87545. http://home.lanl.gov/lreilly Quidquid latine dictum sit, altum viditur -.__.--'`'--.__.--'`'--.__.--'`'--.__ '-:`.'|`|':-. '-:`.'|`|':-. '-:`.'|`|':-. '.` : '. '. '. | | | |'. '. | | | |'. '. | | | |'. '.: '. '. : '. '.| | | | '. '.| | | | '. '.| | | | '. '. : '. `. ' '. `.:_ | :_.' '. `.:_ | :_.' '. `.:_ | :_.' '. `.' `. `-..,..-' `-..,..-' `-..,..-' ` ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload problem - PC, *nix, and Max EOL characters
Actually, there appears to be a solution on the PHP.web [http://www.php.net/manual/en/function.fgets.php] Note: The length parameter became optional in PHP 4.2.0, if omitted, it would assume 1024 as the line length. As of PHP 4.3, omitting length will keep reading from the stream until it reaches the end of the line. If the majority of the lines in the file are all larger than 8KB, it is more resource efficient for your script to specify the maximum line length. Thanks :-) Matt Vos wrote: Loop an fgets() i.e. $fp = fopen($file) while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL, whichever is first) */ { $filerow = str_replace(; ,, $filerow); $filerow = str_replace(# ,, $filerow); $filerow = str_replace(\r,, $filerow); $size = strlen($filerow); $row_split = preg_split(/\s+/, $filerow); $value1 = $row_split[0]; $value2 = $row_split[1]; $value3 = $row_split[2]; } Matt - Original Message - From: Lee P. Reilly [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 2:58 PM Subject: [PHP] Upload problem - PC, *nix, and Max EOL characters Hi everyone, I have an application, where users can upload data files formatted as follows: 0.0106375 686.60165.391 0.01147 606.46754.997 0.0122815 640.284 46.5355 0.0130753 668.396 39.3671 0.0138809690.05 34.6031 0.0146936 619.947 30.5329 0.0155071 640.413 26.9145 My code deals with the uploaded files by splitting the lines into an array, and then obtaining the 3 particular fields from the array elements. My code is something like this: -=-= BEGIN CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // put each line of the file into an array $filearray = file($file); // parse the file one line... at... a... time while (list(,$oneline) = each($filearray)) { // if the line starts with ; or a #... if ($oneline[0]==; || $oneline[0]==#) { // take out the ; and EOL characters $oneline = str_replace(; ,, $oneline); $oneline = str_replace(# ,, $oneline); $oneline = str_replace(\r,, $oneline); $size = strlen($oneline); } /* Some IQ files seperated columns by tabs; others, by whitespace. We parse the data file are delimit the columns by 'X9728430182298Z' (a random string), which will allow the program to recognise the start and end of each column. e.g. 0.00542 8691.64 901.605 0.0067759381.3 1235.78 becomes... 0.00542X9728430182298Z8691.64X9728430182298Z901.605 0.006775X9728430182298Z9381.3X9728430182298Z1235.78 */ $oneline = ltrim($oneline); $oneline = preg_replace(/\s+/, X9728430182298Z, $oneline); $text = explode (X9728430182298Z, $oneline); // now element [0] = Q, [1] = I. [2] = Error -=-= END CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This works perfectly well when the data is uploaded from a PC, but it fails when it's uploaded from Mac/Unix. When I vied the uploaded file the EOL characters *appear* as , which I believe is actually \n. When I output the contents of $filearray[0] (uploaded via a PC) I get one line, but when I ouput $filearray[0] from a file uploaded via a Mac I get the entire file. Therefore the problem occurs with: $filearray = file($file); while (list(,$oneline) = each($filearray)) I thought I had found a solution to the problem on the web* where I found the following extract of php.ini file: -- ; If your scripts have to deal with files from Macintosh systems, ; or you are running on a Mac and need to deal with files from ; unix or win32 systems, setting this flag will cause PHP to ; automatically detect the EOL character in those files so that ; fgets() and file() will work regardless of the source of the file. ; auto_detect_line_endings = Off -- However, this never solved the problem. The file itself is stored in a database, so how can I get rid of the EOL characters before it is being inserted? Is there a function to change the Unix EOL chars to PC EOL chars? Thanks in advance. - Best regards, Lee Reilly *[http://216.239.33.100/search?q=cache:GwerlDVFv8wC:linux.sarang.net/ftp/mir ror/development/language/php_cvs/php4/php.ini-dist+MAC+EOL+character+PHPhl= enie=UTF-8] -- Lee P. Reilly, ms:G758 Szilard Resource, tel:505-665-7025 Bioscience Division, SM-30 Bikini Atoll Rd, Los Alamos National Laboratory, mailto:[EMAIL PROTECTED] Los Alamos, NM 87545. http://home.lanl.gov/lreilly Quidquid latine dictum sit, altum viditur
Re: [PHP] Upload problem - PC, *nix, and Max EOL characters
Ah, okay. However, it seems to ignore a Mac EOL character. I'm installing the PHP4.3 (test version) to try the auto_detect_line_endings configuration option. Cheers, Lee Matt Vos wrote: No, fgets() reads to EOL, I use it all the time. fread() will read to EOF, if you let it, as it is binary safe. Matt - Original Message - From: Lee P. Reilly [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 4:09 PM Subject: Re: [PHP] Upload problem - PC, *nix, and Max EOL characters Hi, Thanks for the reply. I appreciate your help. fgets() reads to the EOF; not the EOL. Is there something similar to fgets() that I can use? Perhaps where I can state explicity read the file until you encounter and EOL char? Cheers, Lee Matt Vos wrote: Loop an fgets() i.e. $fp = fopen($file) while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL, whichever is first) */ { -- Lee P. Reilly, ms:G758 Szilard Resource, tel:505-665-7025 Bioscience Division, SM-30 Bikini Atoll Rd, Los Alamos National Laboratory, mailto:[EMAIL PROTECTED] Los Alamos, NM 87545. http://home.lanl.gov/lreilly Quidquid latine dictum sit, altum viditur -.__.--'`'--.__.--'`'--.__.--'`'--.__ '-:`.'|`|':-. '-:`.'|`|':-. '-:`.'|`|':-. '.` : '. '. '. | | | |'. '. | | | |'. '. | | | |'. '.: '. '. : '. '.| | | | '. '.| | | | '. '.| | | | '. '. : '. `. ' '. `.:_ | :_.' '. `.:_ | :_.' '. `.:_ | :_.' '. `.' `. `-..,..-' `-..,..-' `-..,..-' ` ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Lee P. Reilly, ms:G758 Szilard Resource, tel:505-665-7025 Bioscience Division, SM-30 Bikini Atoll Rd, Los Alamos National Laboratory, mailto:[EMAIL PROTECTED] Los Alamos, NM 87545. http://home.lanl.gov/lreilly Quidquid latine dictum sit, altum viditur -.__.--'`'--.__.--'`'--.__.--'`'--.__ '-:`.'|`|':-. '-:`.'|`|':-. '-:`.'|`|':-. '.` : '. '. '. | | | |'. '. | | | |'. '. | | | |'. '.: '. '. : '. '.| | | | '. '.| | | | '. '.| | | | '. '. : '. `. ' '. `.:_ | :_.' '. `.:_ | :_.' '. `.:_ | :_.' '. `.' `. `-..,..-' `-..,..-' `-..,..-' ` ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reasons for error message: Warning: Failed opening'/www/servers/webGNOM/test.php' for inclusion(include_path='.:/usr/local/lib/php') in Unknown on line 0
Hi there, Can someone suggest a reason for the following? I am trying to INCLUDE the JPGraph libraries in my PHP script as follows: BEGIN CODE -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ? /* ___ __ __ ___ / / | / / __ \/ |/ / / / __/ |/ / / / / /|_/ / / /_/ / /| / /_/ / / / / \/_/ |_/\/_/ /_/ sasdap version ,+ | Comments to go here. `- */ // Include the PGraph libraries include (jpgraph.php); include (jpgraph_log.php); include (jpgraph_scatter.php); include (jpgraph_error.php); include (jpgraph_line.php); $xData = array(); // holding the R (X) data $yData = array(); // holding the P(R) (Y) data $eData = array(); // holding the error margin data .. .. .. snip -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- END CODE My INCLUDE_PATH is set to /usr/local/lib/php, so the 5 INCLUDED scripts are in there. However, this code results in the following error message: Warning: Failed opening '/www/servers/webGNOM/test.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0 I also tried changing the include line to ../../../www/server/webGNOM/JpGraph_1.9.2/ blah blah... but that gave me the same error. Any ideas anyone? Cheers, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Installation on Redhat 8 - General Questions
Hi there, I wonder if someone could answer a few questions for me? First of all, excuse my ignorance as I'm somewhat of a Linux newbie. I have installed PHP, Apache, Mysql, etc. on Windows numerous times, but have found the Linux installation to be more troublesome due in part (more likely in whole) to my lack of Linux experience. Following the instructions for setting up on PHP 4.x for Apache 1.x.x on the URL, http://www.e-gineer.com/instructions/install-php4x-for-apache1xx-on-linux.phtml I installed PHP as a module under Apache. I am using JPGraph which requires the GD graphics library, so after installing PHP with the basic options, I decided to reinstall it with GD support. Here is what I did to accomplish this: In my PHP directory, I removed the config.cache file, did a 'make clean' and recompiled as follows: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ./configure \ --with-config-file-path=/www/conf \ --with-apache=../apache_1.3.27 \ --with-png-dir=/usr/local \ --with-gd=/usr/local \ --with-zlib \ --enable-track-vars -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This seemed to be successful! In the Apache directory, I did a 'make clean' and and recompiled as follows: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ./configure \ --with-layout=Apache \ --prefix=/usr/local/httpd \ --sysconfdir=/www/conf \ --enable-module=rewrite \ --enable-module=status \ --activate-module=src/modules/php4/libphp4.a -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Typed 'make' Stopped Apache Typed 'make install' Started Apache This also seemed to be successful. However, phpinfo() generates information from the previous install. The configure command generated by phpinfo() is -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= './configure' '--with-config-file-path=/www/conf' '--with-apache=../apache_1.3.27' '--enable-track-vars' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= And the build date show the time/date when I built it yesterday. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Can anyone suggest a reason for this? Is there something I am doing wrong? Thanks very much in advance for your help! - Best regards, Lee Reilly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] JPgraph: Autoscaling [OT perhaps]
Anybody out there using JpGraph? I directed the following question to the support web site, but as yet... there's been no reply: Could somebody tell me how to disable the autoscaling in JpGraph, and/or how to provide my own scaling? It's perfect for 99% of the graphs and plots I create, but when I plot some data in a linearXlogY scale it's surrounded by way too much white space. Particularly, I've noticed that the logY scale always seems to go from 10,000 to 100,000 for my data sets when the Y range is only from 20k to 10k. E.g. Say I had 2 data points : 1,5 and 5,1 +The graph may show a grid e.g. 10 x 10 + How can I set it so that it only pads a few pixels, or say display 0,0 up to 6,6? Does this make sense? Hope someone can help! While I'm on the topic, does JpGraph support Sub/SuperScript text? Nothing about it in the documentation, but I need to display N^2 (N squared) and stuff like that. Thanks in advance, Lee PS: JpGraph is an awesome little library ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What the heck is this Zope?
My two cents: I used Zope a while back for a university project, and I've been using PHP for the best part of a year. Zope is very similar to PHP, but Zope is better suited for the novice web designer / developer. Zope makes it easy to interact with databases and allows you to iterate through a result set using HTML-like tags (DTML) like: some HTML dtml-in getAllMyData bdtml-var getAllMyData[name]/dtml-var/b /dtml-in !-- don't remember the exact syntax -- some more HTML Simple web application require very little or no programming. It also allows you to edit the (HTML) source via a web browser, which (too some) is an attractive feature. Zope is good for silly little DB apps, and coding in Python is easy (although the syntax is probably a LOT different to anything you've used before). AFAIK, it can do everything that PHP can, but I believe that PHP is faster it's definitely more widely used and has a bigger user base. Lee recommends PHP any day. - Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dynamically creating variable names
Hi, Can someone tell me if it's possible to create variable names from varaible names? I could work around this problem using some if/else statements, but I'm interested to see if there's another solution. I have 20 associative arrays all named compA, compB, compF, etc. The user supplies a string e.g. YB... // one of the 20 arrays $compY = array ( // Y Tyr Tyrosine H = 9 ,X = 2 ,C = 9 ,N = 1 ,O = 2 ,S = 0 ); $sequence = YB; $sequence = strtoupper ($sequence); for ($i = strlen($sequence)-1; $i = 0; $i--) { // create a temp variable called comp + $i // e.g. on first iteration access the array, $compB // and on the second, access $compY } Thanks very much in advance. - Best regards, Lee Reilly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: dynamically creating variable names
No reply neccessary. A list minute search on google proved helpful... [http://216.239.35.100/search?q=cache:hLxGJH-pFeYC:www2.themanualpage.org/php/php_syntax.php3+PHP+dynamic+variable+nameshl=enie=UTF-8] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamically creating variable names
Thanks for the replies. I'm still having a litte trouble though... Say I have an array called $compX, and given the letter 'X'... how can I access the variable $compX using these methods? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] while loop question - problem (new set of eyes needed)
Hi, I wonder if someone could have a quick look at this for me? It's a simple while loop, but it's not acting the way (I think) it should. If I break down the while loop, it reads: // $result contains 3 rows while($row = mysql_fetch_array($result)) { echo xxx ; } = xxx xxx xxx is displayed (as expected) If I add the following code to the loop, it only seems to iterate through it *once*: while($row = mysql_fetch_array($result)) { $pri = $row['pri']; $fg = $row['fg']; $molw = $row['molw']; $density = $row['density']; $denstype = $row['denstype']; $pctd = $row['pctd']; $maxpctd = $row['maxpctd']; $compid = $row['compid']; $sql = select * from compounds where compid = \$compid\; $result = mysql_query($sql,$conn); $row = mysql_fetch_array($result); $compname = $row['compname']; $concentration = $row['concentration']; $concunit = $row['concunit']; $type = $row['type']; $composition = $row['composition']; if ($fg==Y) $html .= b$concentration $concunit $compname/bbr; else if ($pri==Y) $html .= font color=\#66\ $concentration $concunit $compname/fontbr; else $html .= $concentration $concunit $compnamebr; } Expected results: Actin #2543: Description here. 1 mol AEBSF 1.3 mol Calcium Chloride 1.4 mol Potassium Chloride Actual results: Actin #2543: Description here. 1 mol AEBSF i.e the last two compounds are not displayed. I can't for the life of me see the problem. A new set of eyes looking at this would be GREATLY appreciated. Thanks very much in advance. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: while loop question - problem (new set of eyes needed)
I see the problem. No reply neccessary. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] recognising plain text files
Hi, I am doing some validation on files that are being upload. I only wish to allow users to upload files that are in *plain text* format (not neccessarily with a .txt extension). I have the following piece of code, which works fine in IE, but in Netscape Navigator: if ($file_type != text/plain) ... error handling... Can anyone explain the reason for this, or offer a better solution? Thanks, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Warning: Max file size of 4194304 bytes exceeded...
Hi, I have another quick question (still on the topic of validating uploaded files). I have upload_max_filesize = 4194304 in my php.ini file. When I upload the file, the script that processes does the following: 1-Sets up the session info 2-Starts the HTML header template 3-Displays user login info 4-Does some error checking - file validation file content validation. 5-Various info menus are displayed 6- echos the HTML footer This way, if there are any errors I can display them in a nice way i.e. in between the HTML headers. The question(s): - Is there anyway to catch the error that causes the Warning: Max file size of blah exceeded message e.g. something like if (max_file_exceeded) {...} ? Right now, this message appears at the top of the screen (therefore, before any of the script is processes). - Is there anyway to prevent the error message from being displayed on screen, and perhaps set a flag so we know that the problem has occured? Thank you very much in advance for any input. - Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Warning: Max file size of 4194304 bytes exceeded...
- Is there anyway to prevent the error message from being displayed on screen, and perhaps set a flag so we know that the problem has occured? I know that if I set display_errors = Off in php.ini I can stop the message from being displayed, but can I set a flag to say the upload_max_filesize has been exceeded and handle the error my own way? Cheers, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] socket support question
Hi, I understand that PHP has experimental extension for sockets. I am currently running both versions 4 and 4.1.2 on Windows machines, but I have read that in order to use the socket functions, the --enable-sockets option must be enabled at compile time. My problem is the of the undefined function: socket_create() variety. I guess I don't support sockets :( An article on DevShed.com says that quote Windows users get a pre-built binary with their distribution/quote. Is this true? If I update to 4.2 will sockets be supported? If not, is it even worth compiling it on Windows (is it even possible)? Thanks and please excuse my ignorance! Lee PS: I just noticed on [http://www.php.net/downloads.php] that the following file can be downloaded: PHP 4.2.0 zip package [4,898Kb] - 22 April 2002 (CGI binary plus server API versions for Apache, AOLserver, ISAPI and NSAPI. MySQL support built-in, many extensions included, packaged as zip) Are sockets included in the many extensions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] windows development - linux production
Hi, Just a quick question. I'm developing on a Windows machine right now, and will later move it onto Linux. Should I expect to run into major difficulty at all? I anticipate a few problems - mainly altering the file system interaction, maybe even database connections. I don't know if anybody else works this way, but if so... did you run into any problems, or was it a relatively smooth ride? Cheers, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL query
Hi, Can someone tell me if there is a way to execute multiple MySQL statements by passing *one* query containing a number of individual statements to MySQL e.g. UPDATE sampcomp SET fg=N, pctd=69, maxpctd=69.1 WHERE sampcompid=3;UPDATE sampcomp SET fg=N, pctd=69.2, maxpctd=69.3 WHERE sampcompid=2; And just return FALSE if one of the queries cannot be executed? Just curious... Cheers, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] arrays of strings - accessing elements of array elements
Hi, Dodgy subject header or what... I have array of strings called $composition, and I itterate through this using: $composition[$i] Is there any way to echo the first character of the string by doing something like: $composition[$i][0] or ($composition[$i)][0] ? I can easily just do something like: $temp_var = $composition[$i]; echo $temp_var[0]; , but I want to know if it's possible to do it another way. Any input greatly appreciated! - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drawing graphs - opinions
Hi, I see there a number of PHP scripts/libraries out there for the purpose of graphing data. Which one is considered to be the best, most powerful / easiest to use? I need to plot X/Y graphs for some data sets with vertical error margin lines going along the y-axis. Any recommendations? Cheers, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Drawing graphs - opinions
Lee P Reilly wrote: with vertical error margin lines going along the y-axis. Any recommendations? Ahem, the X axis. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/MySQL application - how to schedule server processes?
Hi there, I wonder if anyone can offer me some advice... I have developed a portal using PHP, which allows users to uploads files into their own personal storage locations. These files are stored in a MySQL database. The system also allows the users to select these files and submit them for analysis. By analysis, I mean that these files will be used as the input to separate executables (written in C) running on the server. This aspect of the system be accomplished in 2 ways: CASE 1: Where the analysis program has a run time of less than 1 second (nb: the amount of users estimated at any one time is no greater than 10). Here, the file can be extracted, a command line argument generated, and then passed to the server via the PHP passthru() function. The result will then be returned to the user. Easy peasy. CASE 2: Where the analysis program may have a run time in excess of 2 hours. The passthru() function is obviously not an option as we do not expect the user to sit in front of the computer for a few hours, or even minutes waiting for a result. I am not sure as to the correct terminology, but I believe I am looking for something like an 'application server' / 'process management scheduler'. Maybe something that is commercially/freely available, or an idea of how to go about writing my own. Here is a rough idea of what I am trying to accomplish: The user accesses the web application and, and selects a file for analysis. The system (implemented in PHP) updates the databases to say that 'ANALYSIS A' of 'FILE B' has been requested. A separate entity running on the server watches the database for analysis requests, and either (a) runs them one after another updates the database appropriately (b) or schedules according to some priority. When each analysis is complete, the user will have access to the a results folder in the system containing a list of their submitted analysis (either pending or complete). Can anyone offer any advice/suggestions on how this can be accomplished? Thank you very much for your time. - Best regards, Lee Reilly -- Lee P. Reilly, ms:G758 Szilard Resource, tel:505-665-7025 Bioscience Division, SM-30 Bikini Atoll Rd, Los Alamos National Laboratory, mailto:[EMAIL PROTECTED] Los Alamos, NM 87545. http://home.lanl.gov/lreilly Quidquid latine dictum sit, altum viditur filterPHP SQL/filter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] removing ALL whitespace from a string
Can somebody tell me if there is a function that will remove *all* whitespace (\n, \r, \t, \w, etc) from a string i.e. from the beginning, the end, and the middle?. Something like chop(), trim()? e.g. input =12 3ad e.g. output = 123ad Thanks, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regular expression; problem with '-' character
Hi, Could someone be kind enough to have a look at this regular expression and perhaps tell me why is returns false when a '-' character is included in the $center string? if (eregi(^[a-zA-Z0-9!@#\$%^\*\(\),/.//\?;':\~`_\+\|\-\\\t\n\ ]*$, $center)) { return true; } else { return false; } This regular expression is just for making sure that the input contains only characters that are available on a standard (American-English) keyboard i.e. if the string contains a '©' it will return false. Maybe there's a better way to do this without using regular expressions? Thanks very much in advance for any help. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] downloading text files stored in database?
Hi, I wonder if someone can point me in the direction of an example and / or some documentation for the following task: I have a DB table containing the name and contents of plain text files that users have uploaded. I have a facility which allows users to view these, but I would also like the users to be able to *download* these files (i.e. display an 'open from present location / save to disk' dialogue). I am thinking that this would be accomplished by including a few META data lines at the top of a .php script, but would this allow me to specify the default saved name? e.g. there is record in the DB for a file called test.dat. I have a form that will submit to something like download_file.php, which will then (given the file id) obtain the appropriate data from the database and prompt the user whether they wish to open the file or save it (this will be the built-in dialogue with the browser). On selecting the save option, the default file name will appear as test.dat as opposed to download_file.php. Any information would be greatly appreciated. Thank very much in advance. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] downloading text files stored in database?
Hi, Thanks for your help, but that assumes that file is (at least temporarily) stored on disc - I'd like to take the file data straight out of the database and be available for download by the user. Is this possible at all, or will I have to create a temporary file to hold the data, and *then* allow the user to download it? Cheers, Lee Ivan Balazs wrote: In the download_file.php put a header() function which redirects the browser to the file, like header(Location: test.dat). After that it should show the dialog screen. Bala -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie: regular expression suggestios
Hi, I am using (getting to grips with) regular expressions for validating form data and have come across a little problem: I have a statement like the following: if (eregi(^[a-z0-9]{strlen($name)}$, $name)) { blah... return true; } , but the strlen($name) does not seem to evaluated. Is there any way this can be accomplished? If the code above is not clear (or correct!), I am returning true iff the input is comprised of chars (letters/numbers) only. Maybe there's a better/more efficient way to accomplish this..? Any information greatly aprpeciated. Thanks in advance! - Best regards, Lee Reilly -- Lee P. Reilly, ms:G758 Szilard Resource, tel:505-665-7025 Bioscience Division, SM-30 Bikini Atoll Rd, Los Alamos National Laboratory, mailto:[EMAIL PROTECTED] Los Alamos, NM 87545. http://home.lanl.gov/lreilly Quidquid latine dictum sit, altum viditur -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] browser back button - Page has Expired.. problem
Hi, I wonder if anyone can offer me a few pointers..? I'm building a portal to do various bits and bobs. I'm using sessions to facilitate the user authentication/login, etc. The only problem I have is that when viewing these (.php) pages in IE once the session variable has been set, a Warning: Page has Expired page is displayed whenever the 'Back' button is pressed. This means that the user can only access the page again by hitting 'Refresh' (and therefore posting the form data back executing whatever scripts again). The rest of IE's error message reads, The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. I know from using other web applications (Hotmail is one example), that this doesn't always have to be the case. Is there anyway I can eliminate this security precaution on the *server side* i.e. without telling users to ditch IE ;-) Thanks very much in advance for any advice. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Newbie: Ending Sessions
Hi, I wonder if someone could tell me what I am doing wrong with the following? I am trying to end a session (logout), but am having a problem... I register a new session as follows: authenticate.php (snippet) // if the user has just tried to login if ($username $password) { // if the user is present in the database, register the username in the session if (login($username, $password)==1) { $valid_user=$username; session_register(valid_user); } } ^ This works okay. BTW, session_start() is present - just not shown above. I then have a hyperlink to a logout function: logout.php (snippet) session_start(); include(sasdap_fns.php); $result = session_unregister(valid_user); session_unset(); session_destroy(); ^ $result always returns 1, but when I return to /reload /refresh the login screen I see that I am still logged in i.e. the session is still active. Can anyone see a problem anywhere? Thanks very much in advance. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]