Re: [PHP] PHP Application server / Expression of Interest
Devraj Mukherjee wrote: Yes that is the sort of stuff we are looking at. Objects will be able to live endlessly, we are planning to address issues such as DB connection pooling, etc. For those who wish to learn more about app servers, I recommend you looking at some of the Java stuff http://java.sun.com/j2ee/ http://jboss.org/ We will be releasing the specs soon, so you guys can have a look at what we are upto. I look forward to it. who knows what it might become! Are most guys here Unix users? generally (from the impression I get, and taken from my own experience): 1. new phpers often run on windows, with an idea to moving to company/shared hosting in *nix boxes (although the phper may have little experience of *nix) 2. more experienced users are familiar with *nix and most often develop on linux (quite often I see people run dual-boot development machines) 3. the most advanced users generally make the most use of *nix variants, MacOSX, FreeBSD, Solaris etc being more exotic (and less used). in short, on the 'low' end there is lots of windows only uses on the 'higher' end alot of *nix usage with a predominance of linux. at the end of the day most production webservers running php sites/apps are LAMP based, if only due to the economics. (free is hard to beat, especially when it class kit so to speak) so I imagine the compentency of the 'group' would generally be be focused around Linux, Apache based systems - if you can build a _transparent_ app server that plugs directly into that setup you may very well have a winner (?) maybe others see it differently? Devraj Jochem Maas wrote: I'm assuming he means a process which contains/maintain 'space' for long term classes/objects/vars/etc which instantly available in every request space and sharable across requests (of different users) so you could do something like (just a thought): startMyApp('OfficeCalendar'); and then you script could talk to objects that exist server wide for everyone as if they were objects taken from the session or created in that particular request. am I even close? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimize code?
Wiberg wrote: Hi! I wonder if I can optimize following code (or do something better) below? It works fine when about 3.000 rows exists in the textfile, but when it gets to 10.000 rows then it will get a session timeout. (or internal server error) I assume the func gets called for every row in the textfile. If you are not worried about exactly how long it takes then unset the timeout on the script, e.g.: set_time_limit(0); and checkout this function also: http://nl2.php.net/manual/en/function.ignore-user-abort.php ?php function checkSaldo($url, $articleNrFieldNr, $saldoFieldNr, $separator, $startLine, $prefix) { require (phpfunctions/opendb.php); this require() can live outside the function, that saves 3000+ calls to it. //Read in specified file into array // $fileArray = file($url); oops! I wasn't reading properly, obviously the function is called once and the iteration happens inside it... you grab the whole contents of the file at once - potentially storing a 1 item array in memory, why not check out some of the other 'file' functions (like fgets(), which allows you to grab 1 line at a time) //Go through array // for ($i=$startLine;$icount($fileArray);$i++) { ARGH!!! at the very least change this line to: $cFA = count($fileArray); for ($i=$startLine;$i$cFA;$i++) { that will save 3000+ calls to count(). //Get line of file (through array) // $lineRead = $fileArray[$i]; //Make array of all elements in this line // $lineArray = explode($separator,$lineRead); //Get manufacturers articlenumber // if (isset($lineArray[$articleNrFieldNr])) { $articleNumberManufacturer = $lineArray[$articleNrFieldNr]; } else { $articleNumberManufacturer = 0; } //Get saldo for this product // if (isset($lineArray[$articleNrFieldNr])) { $saldo = $lineArray[$saldoFieldNr]; } else { $saldo = 0; } //There is no data on this row //set saldo and articlenr to zero, so nothing happens // if (strlen($lineRead)==0) { $saldo = 0; $articleNumberManufacturer = 0; } //echo brARTICLENR: $articleNumberManufacturerbr; //echo SALDO: $saldobr; //Articlenr exists in line // if (intval($articleNumberManufacturer)0) { //Get ID of product (if there is any in varupiratens db) //skip the product if the saldo is the same as in //the textfile // $sql = SELECT IDVara FROM tbvara WHERE Varunamn = '$prefix$articleNumberManufacturer' LIMIT 1;; $querys = mysql_query($sql); $dbArray = mysql_fetch_array($querys); $IDVara = $dbArray[IDVara]; if ($IDVara == Null) {$IDVara = 0;} maybe cache this result of this query, assuming it returns repetetive values? although if the cache (array?) grows too large then that might slow it down again... double edged sword. //If product is found, then update saldo // if (intval($IDVara)0) { considering the UPDATE query, you can probably drop the call to intval(): if ($IDVara 0) { $sql = UPDATE tbvara SET Saldo=$saldo WHERE IDVara=$IDVara LIMIT 1;; I don't think the semicolon in the sql statement should be passed according to official docs, although I guess it works anyway :-) $querys = mysql_query($sql); echo QUERY DB - $sqlbr; also if you are using a very new version of MySQL _I_think_ you have the ability to use prepared queries - i.e. a query where the statement, with some placeholders is compiled once and then you execute the prepared query x number of times each time passing the 'execute()' func the relevant vars. this is as opposed to what you are doing now which is having the query compiled for every line you parse. prepared queries may not be an option. } //END Articlenr exists in line } } mysql_close(); } ? /G @varupiraten.se -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 2005-01-19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Log-in script help
Joe Harman wrote: Hey Andrew... IN MY OPINION... forget the cookies... only use php sessions... but like I said IMO you can never rely on the end user having them cookies enabled... same with things like javascript... let me outline some steps for you... everyone else... feel free to state pros and cons to theses.. cause i always make mistakes, or forget things :o) 1. get the user's access info... ie username password 2. look for the user in the database that stores the access infro 3. if access is granted, I usually set 2 session variables a. $_SESSION['auth'] = TRUE // They are authorized b. $_SESSION['user_id'] = {who} // Who is it a. $_SESSION['user_level'] = {level} // What level access do they have (optional) 4. at the beginning of each restricted access page, verify that they are authorized to access that page... if they are not redirect them to a access denied page. that should get you started... maybe the second step would be to make this stuff into functions... ... also, IMO.. it's a good idea to make a logout script that will distroy that user's active session... my turn for an IMO :) - my preference is to have a check on the function that writes the $_SESSION vars or the cookie (I generally use encrypted cookies which are in turn restricted to certain areas of the site). This check is on the referer - if it's not from a foreign URL, then write them new as if the user is non auth. This stops people on public machines from hitting a back button and being authenticated as the previous user. Tom not sure what your PHP experience is... but hopefully the above steps will help you out some.. Cheers! Joe On 25 Jan 2005 17:35:08 -0600, Bret Hughes [EMAIL PROTECTED] wrote: On Tue, 2005-01-25 at 16:45, [EMAIL PROTECTED] wrote: Hey, I need a particular type log in script. I'm not sure how to do it or where I could find a tutorial that would help me, so I'll describe what I need and then maybe someone could tell me what kind of script I need (sessions or whatever) and where I could get the script/learn how to make it. I need a pretty basic log in script. Something that people log in to, and the page and all linked/related pages cannot be accessed unless the person has logged in. So what do I need for this? Cookies, sessions both? And where can I learn how? -Andrew I use the pear auth package and like it alot. I know I did some modification for our purposes but I suspect it works out of the box. All you do is include auth.php on all pages you want to protect and it will direct you to a login page if you have not logged in. Pretty cool stuff. http://pear.php.net/package/Auth HTH Bret -- 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] Magic quotes question (still driving me mad)
On Tue, 25 Jan 2005 17:02:21 -0800, Chris [EMAIL PROTECTED] wrote: You should probably use get_magic_quotes_runtime() , as _gpc only applies to GET/POST/COOKIE, htmlspecialchars is needed so the HTML can be parsed properly: So this is this only done to stuff that is to be displayed on a web page? What happens if it is done to stuff that is (possibly) also passed through addslashes and written to the database. Also douse it matter what order htmlspecialcharacters/addslashes??? However this is the least of my problems, I still dont have the main magic quotes thing working. So I will detail what I am doing and c if anyone can help. Everything that comes from the database (regardless of what is done to it next) is passed through the following function. function unprep( $text ) { // Take data coming from the database an get it ready to be presented // to the user. if ( get_magic_quotes_gpc() ){ $result = stripslashes($text); } else{ $result = $text; } $result = htmlspecialchars( $result ); return $result; } This is done regardless of what is to be done to the data by using foreach on the row that is returned. foreach( $this-record as $index = $value ) { $this-record[$index] = unprep( $value ); } And before anything is written to the database it goes through the following function. function prep( $text ) { if ( get_magic_quotes_gpc() ) { return $text; } else { return addslashes($text); } } But I am still getting the \', \\' thing happening. One of my problems is I am not sure at how to reliably look at the data at various stages. If I do echo $value and it has \' in it is '\ displayed or or is ' displayed. I.e. is it only in the input type=text tag that the \' shows up. Thanks for every body's help, hope I am nearly there;) Ben if the value in the text box was something like: Hello World! when you go to put in the value attribute it would end up: input type=text value= Hello World! / That would not parse correctly. but if you escaped it with htmlspecialchars or htmlentities you'd get: input type=text value=quot;gt; Hello World! / And the box would contain the proper data Ben Edwards wrote: PS. How does htmlspecialchars fit into this. The unprep function is to prepare date coming from the database to be used in input type=text, douse the below function make sence? Ben function unprep( $text ) { // Take data coming from the database an get it ready to be presented // to the user. if (magic_quotes_gpc()){ $result = stripslashes($text); } else{ $result = $text; } return htmlspecialchars( $result ); } -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache: Request exceeded the limit of 10 internal redirects
Hi I've just installed Apache 2.0.52, with: ./configure --prefix=/usr/local/httpd --enable-so --enable-modules=all My httpd.conf includes: --- VirtualHost mydomain ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/mydomain ServerName mydomain ErrorLog logs/mydomain-error_log CustomLog logs/mydomain-access_log common DirectoryIndex index.php index.html index.html.var Directory /home/mydomain php_flag allow_url_fopen 1 php_flag magic_quotes_gpc 0 RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php /Directory /VirtualHost - (I try to make Apache serve 'foo' as 'foo.php') But when accessing 'http://mydomain/foo', I get no webpage, but this error log: -- [Mon Jan 24 10:47:59 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/15. [Mon Jan 24 10:47:59 2005] [error] [client 192.168.2.101] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. [Mon Jan 24 10:47:59 2005] [debug] core.c(2748): [client 192.168.2.101] r-uri = /favicon.ico.php.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r-uri = /favicon.ico.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r-uri = /favicon.ico.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r-uri = /favicon.ico.php.php.php.php.php.php.php If I remove the line 'RewriteOptions MaxRedirects=15', I get a very similar error: [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/10. [Wed Jan 24 10:31:29 2005] [error] [client 192.168.2.101] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 0/10. --- What am I doing wrong? Thank you very much. __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Working with Multi by Multi levels menu
Marek wrote: Hello Creating a three dimensional menu system is pretty easy with arrays, but when you want to create a menu system that is 10 or 15 levels deep using arrays the conventional method is not so simple. I'm writing an application that shows a multi level (up to 30 levels) menu which is generated dynamically not in any particular order. There are three stages: First stage, generates the levels of the menu and assigns titles, Second stage needs to come the levels and change its properties, ie icon, font, colour, etc. This is a critical part of the process as the menus are not generated in any order and this stage also changes the properties of the level not in any particular order. The third stage needs to display this menu. My search on hotscripts and google didn't turn up anything that's relevant. I know I can write a recursive function for each of these stages, but thats not the best method. One recursive function that will take care of all stages. I'm not sure what table design you desided use, at level this deep you might use Flat Table or Modified Preorder Tree Traversal Algorithm: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
James Guarriman wrote: Hi I've just installed Apache 2.0.52, with: ./configure --prefix=/usr/local/httpd --enable-so --enable-modules=all My httpd.conf includes: --- VirtualHost mydomain ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/mydomain ServerName mydomain ErrorLog logs/mydomain-error_log CustomLog logs/mydomain-access_log common DirectoryIndex index.php index.html index.html.var Directory /home/mydomain php_flag allow_url_fopen 1 php_flag magic_quotes_gpc 0 RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php /Directory /VirtualHost - (I try to make Apache serve 'foo' as 'foo.php') But when accessing 'http://mydomain/foo', I get no webpage, but this error log: -- [Mon Jan 24 10:47:59 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/15. [Mon Jan 24 10:47:59 2005] [error] [client 192.168.2.101] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. [Mon Jan 24 10:47:59 2005] [debug] core.c(2748): [client 192.168.2.101] r-uri = /favicon.ico.php.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r-uri = /favicon.ico.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r-uri = /favicon.ico.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r-uri = /favicon.ico.php.php.php.php.php.php.php If I remove the line 'RewriteOptions MaxRedirects=15', I get a very similar error: [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/10. [Wed Jan 24 10:31:29 2005] [error] [client 192.168.2.101] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 0/10. --- What am I doing wrong? Thank you very much. What you are doing wrong is trying to use mod_rewrite, the nightmare extension from hell! Seriously though, it is your rewrite rule that is wrong, you have defined a recursion in there for any filename that do not already end '.php' or have no . RewriteRule ^(.*)$ /$1.php = add '.php' to the end of any filename that has a '.' in it somewhere (remember that you are in unix world, so the . does not signify a file extension in the same way as a domestos environment, it is just part of the filename). eg1) blah = blah (no change as it doesn't match the regex) eg2) favicon.ico = favicon.ico.php when the rule next runs, it finds that favicon.ico.php does not match the exception of .php (the .ico gives the first match), so adds .php again, and again, and again, and again. Tom __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting two queries into one result set
Hi, I have a query where I select all table names where the table name has PID_1 in i.e. SHOW TABLES LIKE '%PID_1%'; However there may be cases where I need to search for tables where the table name is PID_1 or PID_2. In MySQL this can't be done in one query, so how can I do two queries and combine the result set so I can loop through it? Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting two queries into one result set
Shaun wrote: Hi, I have a query where I select all table names where the table name has PID_1 in i.e. SHOW TABLES LIKE '%PID_1%'; However there may be cases where I need to search for tables where the table name is PID_1 or PID_2. In MySQL this can't be done in one query, so how can I do two queries and combine the result set so I can loop through it? Thanks for your help UNION -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
James Guarriman wrote: Hi I've just installed Apache 2.0.52, with: ./configure --prefix=/usr/local/httpd --enable-so --enable-modules=all My httpd.conf includes: --- VirtualHost mydomain ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/mydomain ServerName mydomain ErrorLog logs/mydomain-error_log CustomLog logs/mydomain-access_log common DirectoryIndex index.php index.html index.html.var Directory /home/mydomain php_flag allow_url_fopen 1 php_flag magic_quotes_gpc 0 RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php The above condition matches favicon.ico because it's neither directory or file, so it's rewritten to favicon.ico.php, that again matches the above condition...etc. So you need to come up with regexp that does not match if the file extension is .php /Directory /VirtualHost - (I try to make Apache serve 'foo' as 'foo.php') -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting two queries into one result set
Shaun wrote: Hi, I have a query where I select all table names where the table name has PID_1 in i.e. SHOW TABLES LIKE '%PID_1%'; However there may be cases where I need to search for tables where the table name is PID_1 or PID_2. In MySQL this can't be done in one query, so how can I do two queries and combine the result set so I can loop through it? Thanks for your help SHOW TABLES REGEXP 'PID_[0-9]+'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting two queries into one result set
Marek Kilimajer wrote: Shaun wrote: Hi, I have a query where I select all table names where the table name has PID_1 in i.e. SHOW TABLES LIKE '%PID_1%'; However there may be cases where I need to search for tables where the table name is PID_1 or PID_2. In MySQL this can't be done in one query, so how can I do two queries and combine the result set so I can loop through it? Thanks for your help SHOW TABLES REGEXP 'PID_[0-9]+'; nice! :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] round
Hello, I have these values: 8.26456 9.7654 3. 5.2689 and I want them rounded to two decimal places so I use the round : round($value,2) which gives me, for example: 8.26 But, it also gives me 3 instead of 3.00. How can I round but retain the 0's? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: round
use number_format() Blackwater Dev wrote: Hello, I have these values: 8.26456 9.7654 3. 5.2689 and I want them rounded to two decimal places so I use the round : round($value,2) which gives me, for example: 8.26 But, it also gives me 3 instead of 3.00. How can I round but retain the 0's? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] round
You can use the number_format($number, decimal_places) function. -Original Message- From: blackwater dev [mailto:[EMAIL PROTECTED] Sent: 26 January 2005 01:33 PM To: php-general@lists.php.net Subject: [PHP] round Hello, I have these values: 8.26456 9.7654 3. 5.2689 and I want them rounded to two decimal places so I use the round : round($value,2) which gives me, for example: 8.26 But, it also gives me 3 instead of 3.00. How can I round but retain the 0's? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] round
On Wed, 26 Jan 2005 06:32:32 -0500 blackwater dev [EMAIL PROTECTED] wrote: Hello, I have these values: 8.26456 9.7654 3. 5.2689 and I want them rounded to two decimal places so I use the round : round($value,2) which gives me, for example: 8.26 You can try the sprintf() function But, it also gives me 3 instead of 3.00. How can I round but retain the 0's? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- RE5PECT Sergio Gorelyshev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Understanding intval() and types conversion
Many thanks to all for clarifiying this. Finally I could remember some things and understand why things go that way. Thanks again. Jordi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Magic quotes question (still driving me mad)
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: Ben Edwards [mailto:[EMAIL PROTECTED] Sent: 26 January 2005 10:15 On Tue, 25 Jan 2005 17:02:21 -0800, Chris [EMAIL PROTECTED] wrote: You should probably use get_magic_quotes_runtime() , as _gpc only applies to GET/POST/COOKIE, htmlspecialchars is needed so the HTML can be parsed properly: So this is this only done to stuff that is to be displayed on a web page? What happens if it is done to stuff that is (possibly) also passed through addslashes and written to the database. You get HTML entities in your database. This may not matter if all you do is use your database to make Web pages, but it's generally regarded as better form to store the text in clear in the database and convert it to the appropriate format for display at the time you want to display it. Also douse it matter what order htmlspecialcharacters/addslashes??? Yes. htmlspecialchars(addslashes('')) = \quot; addslashes(htmlspecialchars('')) = quot; Everything that comes from the database (regardless of what is done to it next) is passed through the following function. function unprep( $text ) { // Take data coming from the database an get it ready to be presented // to the user. if ( get_magic_quotes_gpc() ){ This should be magic_quotes_runtime(), since you are dealing with data obtained from the database at run time, not data passed via Get, Post or Cookie. $result = stripslashes($text); } else{ $result = $text; } $result = htmlspecialchars( $result ); return $result; } And before anything is written to the database it goes through the following function. function prep( $text ) { if ( get_magic_quotes_gpc() ) { return $text; } else { return addslashes($text); } } That one looks good to go, assuming your database uses \ as an escaping character. But I am still getting the \', \\' thing happening. One of my problems is I am not sure at how to reliably look at the data at various stages. If I do echo $value and it has \' in it is '\ displayed or or is ' displayed. If you echo a value that really does contain \', you will get \' displayed. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members
[EMAIL PROTECTED] (John Nichel) wrote in news:[EMAIL PROTECTED]: Jay Blanchard wrote: [snip] CR Just a thought, but would it be worth someone posting the list CR once a week to catch new users as they sign up? Isn't it posted once a month as it is? [/snip] It used to be, but it seems that it hasn't been posted in a while. So I retrieved it and posted it. I was thinking about setting up a cron to post it every other day or so. Didn't it used to get sent out to people when they subscribed to the list too? Anyone know if that still happens? Well, i only accesses this list on usenet. I haven't subscribed to anything. -- Rolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members
[snip] Now, perhaps, an INTERESTING project for some of us to work on would be that system: Spec: Robot subscriber to PHP-General. Reads all incoming messages. Discards anything that looks like a 'Reply:' including: Has 'Re: ' or 'Fwd: in subject Has Message ID in-reply-to header thingies Concats Subject and body, with signatures removed. Removes all common English words Searches for remaining [key]words in php.net/faq.php If any matches, deep-link (with #xyz) to the FAQ answers. If number of remaining [key]words (above) is small, also compose a URL link to http://php.net/remaining+keywords Creates a reply email (to original poster only) suggesting that maybe they just need to check those links, but to REPLY to their post if they're STILL lost after reading all that stuff. That way, if any of us see a question that we KNOW is answered in FAQ or php.net/xyz and that is not a Reply of some kind, we can let the robot handle it. What do you think? Worth doing? Waste of time? You interested in implementing or testing it? Got a server where you control smrsh and whatnot enough to handle it? [/snip] I like it a lot. And I would be glad to put in my 0.02. As we are developing a knowledge base for our internal users and this falls along the same lines I would have to say to count me in. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members
[snip] I'm not going to promise any of this. If someone else is willing to donate the hardware to make this happen then contact me / the list. Of course anyone else that wants to donate coding time is more than welcome to join project ParrotHeadPoster. :) I can already imagine it now... I'm a talking phParrot and I think I can help you. Try reading what you find at the following link(s): [/snip] Cool, a ParrotHead reference and name for the project in one post. WTG Jason! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Working with Multi by Multi levels menu
Hiya Marek K, Thanks for the link, however on that page the links regarding a Modified Preorder Tree Traversal Algorithm come up as 404. I would prefer not to use recursion until the third stage (display of menu). In fact I know, I will not use recursion for the first or second, simply because for each addition/change a recursion seems and is an overkill. The idea here is to have very elegant and simple code that can also be used in other classes/projects. I'm pretty much going to stick to what I have already where the only recursion that occurs is in the third stage (display of menu). One thing I forgot to add to in my original email is that the $element property also has an order id(int) for displaying the menus in particular order. My first and the second stage allow me to change/add elements directly without searching for them. Whereas the display does a recursion that displays in order. All of this done within php, so first and the second stage in reality is like an indexed stack. The third stage might get a little tricky due to the order property... if you have any ideas/tricks, please let me know. Thanks Marek J - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Marek [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, January 26, 2005 5:49 AM Subject: Re: [PHP] Working with Multi by Multi levels menu Marek wrote: Hello Creating a three dimensional menu system is pretty easy with arrays, but when you want to create a menu system that is 10 or 15 levels deep using arrays the conventional method is not so simple. I'm writing an application that shows a multi level (up to 30 levels) menu which is generated dynamically not in any particular order. There are three stages: First stage, generates the levels of the menu and assigns titles, Second stage needs to come the levels and change its properties, ie icon, font, colour, etc. This is a critical part of the process as the menus are not generated in any order and this stage also changes the properties of the level not in any particular order. The third stage needs to display this menu. My search on hotscripts and google didn't turn up anything that's relevant. I know I can write a recursive function for each of these stages, but thats not the best method. One recursive function that will take care of all stages. I'm not sure what table design you desided use, at level this deep you might use Flat Table or Modified Preorder Tree Traversal Algorithm: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/404 7/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members
[snip] ...lots of really good stuff... [/snip] So, basically I saw 3 possible action items from this discussion... 1. phParrot development 2. Weekly CRON of NEWBIE GUIDE (once I get the e-mail portion figured out) 3. OT posts should contain a TIP or TRICK? If we did this we could harvest them once in a while for dissemination to the group. How you say? You could contain the tip in a tag, example... [tip type=query error checking author=Jay Blanchard] When issueing a query to the database I always find it healthy to do error checking in this form if(!($resultOfQuery = mysql_query($query, $databaseConnection))){ echo This gave me an error . mysql_error() . \n; exit(); } If an error is thrown the application exits immediately so that I can correct and move on. [/tip] As you can see, using some reasonable regex would get the tip out. Also, when phParrot is up and running a tip can be given with each reply if a databse of these tips was gathered. Someone then could gather all of the tips, publish a book and make us all famous. I may have had too much caffeine this AM -- looks like my enthusiasm level is set to 'HIGH' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image manipulation without GD library
Tim Burgan wrote: Hello, Is there any way that I can do some image manipulation - resizing - without the GD libraries? I've always used the GD library and it's the only way that I'm aware of to do resizing. Unless of course you're willing to do all the resizing manually and just upload the new picture to the server in which case you have a lot of options. Heck I think even MS Paint can handle that :) Tim -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members
Jay Blanchard wrote: [snip] Now, perhaps, an INTERESTING project for some of us to work on would be that system: Spec: Robot subscriber to PHP-General. Reads all incoming messages. Discards anything that looks like a 'Reply:' including: Has 'Re: ' or 'Fwd: in subject Has Message ID in-reply-to header thingies Concats Subject and body, with signatures removed. Removes all common English words Searches for remaining [key]words in php.net/faq.php If any matches, deep-link (with #xyz) to the FAQ answers. If number of remaining [key]words (above) is small, also compose a URL link to http://php.net/remaining+keywords Creates a reply email (to original poster only) suggesting that maybe they just need to check those links, but to REPLY to their post if they're STILL lost after reading all that stuff. That way, if any of us see a question that we KNOW is answered in FAQ or php.net/xyz and that is not a Reply of some kind, we can let the robot handle it. What do you think? Worth doing? Waste of time? You interested in implementing or testing it? Got a server where you control smrsh and whatnot enough to handle it? [/snip] I like it a lot. And I would be glad to put in my 0.02. As we are developing a knowledge base for our internal users and this falls along the same lines I would have to say to count me in. I like the sound of it too. shall we crystalize what we want/decided into a new post? 1. what we want: i.e. repository of list tips/solutions etc 2. a parrot 3. where to host 4. who/where to run the parrot 5. any other business Jay maybe your the man for that job? not trying to force anything on you but I reckon we could do with a 'lead man' of some sorts to do a little coordinating and possibly just make a decision (avoid endless discusion about minutae) Also I may have a machine capable of running the parrot - its on the same subnet as nl2.php.net so connection speed is no probs but I have no idea how process intensive the parrot would be (if its too heavy I would have to decline cos there are commercial site running on the same box which expect a certain level of performance :-) ...paying customers, you get the picture!). BTW ParrotHeadPoster is a fitting name, lets keep it! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image manipulation without GD library
Tim Burgan wrote: Hello, Is there any way that I can do some image manipulation - resizing - without the GD libraries? Can you execute imagemagic's mogrify? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Working with Multi by Multi levels menu
Marek wrote: Hiya Marek K, Thanks for the link, however on that page the links regarding a Modified Preorder Tree Traversal Algorithm come up as 404. Then see: http://www.sitepoint.com/article/hierarchical-data-database/2 I would prefer not to use recursion until the third stage (display of menu). In fact I know, I will not use recursion for the first or second, simply because for each addition/change a recursion seems and is an overkill. The idea here is to have very elegant and simple code that can also be used in other classes/projects. I'm pretty much going to stick to what I have already where the only recursion that occurs is in the third stage (display of menu). One thing I forgot to add to in my original email is that the $element property also has an order id(int) for displaying the menus in particular order. My first and the second stage allow me to change/add elements directly without searching for them. Whereas the display does a recursion that displays in order. All of this done within php, so first and the second stage in reality is like an indexed stack. The third stage might get a little tricky due to the order property... if you have any ideas/tricks, please let me know. I think flat table model is suited for you just right. Updating it is a little ugly but it's not that big deal. You can also think about caching the result. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members
Jay Blanchard wrote: [snip] ...lots of really good stuff... [/snip] So, basically I saw 3 possible action items from this discussion... 1. phParrot development 2. Weekly CRON of NEWBIE GUIDE (once I get the e-mail portion figured out) 3. OT posts should contain a TIP or TRICK? If we did this we could harvest them once in a while for dissemination to the group. How you say? You could contain the tip in a tag, example... [tip type=query error checking author=Jay Blanchard] When issueing a query to the database I always find it healthy to do error checking in this form if(!($resultOfQuery = mysql_query($query, $databaseConnection))){ echo This gave me an error . mysql_error() . \n; exit(); } If an error is thrown the application exits immediately so that I can correct and move on. [/tip] 4. a website/subsite related DB to store data for phParrot, tips, etc. phparrot.net is up for grabs - I'm happy to register it (can't grace the list with ace mathematical explainations :-) but I'm happy to shell out a few bucks as a way of giving back a little) - and I'd just as happily transfer the domain into the hands of an 'official' php organisation if and when people think its required (at no charge). or maybe someone else want to register it? also nobody seems to dare speak up regarding a 'front man'? As you can see, using some reasonable regex would get the tip out. Also, when phParrot is up and running a tip can be given with each reply if a databse of these tips was gathered. Someone then could gather all of the tips, publish a book and make us all famous. I may have had too much caffeine this AM -- looks like my enthusiasm level is set to 'HIGH' thats a good thing, everyone feeds of the energy, its how balls start to roll :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Working with Multi by Multi levels menu
Marek wrote: Hiya Marek K, Thanks for the link, however on that page the links regarding a Modified Preorder Tree Traversal Algorithm come up as 404. Then see: http://www.sitepoint.com/article/hierarchical-data-database/2 This article is specifically for a database driven hierarchical data. Mine has to be memory based(as little as possible), a sort of flat based but yet efficient and elegant. I think I have a solution.. working on it now Thanks I would prefer not to use recursion until the third stage (display of menu). In fact I know, I will not use recursion for the first or second, simply because for each addition/change a recursion seems and is an overkill. The idea here is to have very elegant and simple code that can also be used in other classes/projects. I'm pretty much going to stick to what I have already where the only recursion that occurs is in the third stage (display of menu). One thing I forgot to add to in my original email is that the $element property also has an order id(int) for displaying the menus in particular order. My first and the second stage allow me to change/add elements directly without searching for them. Whereas the display does a recursion that displays in order. All of this done within php, so first and the second stage in reality is like an indexed stack. The third stage might get a little tricky due to the order property... if you have any ideas/tricks, please let me know. I think flat table model is suited for you just right. Updating it is a little ugly but it's not that big deal. You can also think about caching the result. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members
[snip] 4. a website/subsite related DB to store data for phParrot, tips, etc. phparrot.net is up for grabs - I'm happy to register it (can't grace the list with ace mathematical explainations :-) but I'm happy to shell out a few bucks as a way of giving back a little) - and I'd just as happily transfer the domain into the hands of an 'official' php organisation if and when people think its required (at no charge). or maybe someone else want to register it? also nobody seems to dare speak up regarding a 'front man'? [/snip] I'll take the lead. And go ahead and register. Does anyone know, off hand, if phpwebhosting.com will allow us to set up the server like we would like it? If so, I'll set up an account and pay for the space... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Log-in script help
Tom, That's a great tip! Joe On Wed, 26 Jan 2005 10:03:31 +, Tom [EMAIL PROTECTED] wrote: Joe Harman wrote: Hey Andrew... IN MY OPINION... forget the cookies... only use php sessions... but like I said IMO you can never rely on the end user having them cookies enabled... same with things like javascript... let me outline some steps for you... everyone else... feel free to state pros and cons to theses.. cause i always make mistakes, or forget things :o) 1. get the user's access info... ie username password 2. look for the user in the database that stores the access infro 3. if access is granted, I usually set 2 session variables a. $_SESSION['auth'] = TRUE // They are authorized b. $_SESSION['user_id'] = {who} // Who is it a. $_SESSION['user_level'] = {level} // What level access do they have (optional) 4. at the beginning of each restricted access page, verify that they are authorized to access that page... if they are not redirect them to a access denied page. that should get you started... maybe the second step would be to make this stuff into functions... ... also, IMO.. it's a good idea to make a logout script that will distroy that user's active session... my turn for an IMO :) - my preference is to have a check on the function that writes the $_SESSION vars or the cookie (I generally use encrypted cookies which are in turn restricted to certain areas of the site). This check is on the referer - if it's not from a foreign URL, then write them new as if the user is non auth. This stops people on public machines from hitting a back button and being authenticated as the previous user. Tom not sure what your PHP experience is... but hopefully the above steps will help you out some.. Cheers! Joe On 25 Jan 2005 17:35:08 -0600, Bret Hughes [EMAIL PROTECTED] wrote: On Tue, 2005-01-25 at 16:45, [EMAIL PROTECTED] wrote: Hey, I need a particular type log in script. I'm not sure how to do it or where I could find a tutorial that would help me, so I'll describe what I need and then maybe someone could tell me what kind of script I need (sessions or whatever) and where I could get the script/learn how to make it. I need a pretty basic log in script. Something that people log in to, and the page and all linked/related pages cannot be accessed unless the person has logged in. So what do I need for this? Cookies, sessions both? And where can I learn how? -Andrew I use the pear auth package and like it alot. I know I did some modification for our purposes but I suspect it works out of the box. All you do is include auth.php on all pages you want to protect and it will direct you to a login page if you have not logged in. Pretty cool stuff. http://pear.php.net/package/Auth HTH Bret -- 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: [NEWBIE GUIDE] For the benefit of new members
Jay Blanchard wrote: [snip] 4. a website/subsite related DB to store data for phParrot, tips, etc. phparrot.net is up for grabs - I'm happy to register it (can't grace the list with ace mathematical explainations :-) but I'm happy to shell out a few bucks as a way of giving back a little) - and I'd just as happily transfer the domain into the hands of an 'official' php organisation if and when people think its required (at no charge). or maybe someone else want to register it? also nobody seems to dare speak up regarding a 'front man'? [/snip] I'll take the lead. And go ahead and register. Does anyone know, off hand, if phpwebhosting.com will allow us to set up the server like we would like it? If so, I'll set up an account and pay for the space... I think we have our frontman: every say hello to Jay :-) phpwebhosting.com doesn't seem to run PHP5 yet - I would strongly suggest that whatever [we do/is done] with PHP for this project should be in PHP5. Also their servers run Redhat Linux Enterprise 3 edition. (which wouldn't be my first choice of OS). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mssql and paging
Hello Is there anybody who succed in doing per/page listing from a MS SQL Server db. knowing that mssql doesnt support LIMIT like mysql and it uses TOP. i didnt find an optimized way to make a per/page script. Here's what am doing know : to replace a MySQL SELECT FROM LIMIT $x,$y i did this with MSSQL : :1 $query = SELECT FROM ; //Without limit :2 $ligne = fetch_assoc(query_bd($query)); :3 $temp = Array(); :4 for ($i=$debut;$i($x+$y);$i++) { :5 if (isset($ligne[$i])) :6 $temp[] = $ligne[$i]; :7 } :8 $ligne = $temp; am loosing time between lines 4 to 7 when i have a big big array :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimize code?
yes, i recommend reading the file into a buffer and saving out the part you actually need. that way the buffer can only be so big, and you only keep what you really need... On Wed, 26 Jan 2005 10:27:35 +0100, Jochem Maas [EMAIL PROTECTED] wrote: Wiberg wrote: Hi! I wonder if I can optimize following code (or do something better) below? It works fine when about 3.000 rows exists in the textfile, but when it gets to 10.000 rows then it will get a session timeout. (or internal server error) I assume the func gets called for every row in the textfile. If you are not worried about exactly how long it takes then unset the timeout on the script, e.g.: set_time_limit(0); and checkout this function also: http://nl2.php.net/manual/en/function.ignore-user-abort.php ?php function checkSaldo($url, $articleNrFieldNr, $saldoFieldNr, $separator, $startLine, $prefix) { require (phpfunctions/opendb.php); this require() can live outside the function, that saves 3000+ calls to it. //Read in specified file into array // $fileArray = file($url); oops! I wasn't reading properly, obviously the function is called once and the iteration happens inside it... you grab the whole contents of the file at once - potentially storing a 1 item array in memory, why not check out some of the other 'file' functions (like fgets(), which allows you to grab 1 line at a time) //Go through array // for ($i=$startLine;$icount($fileArray);$i++) { ARGH!!! at the very least change this line to: $cFA = count($fileArray); for ($i=$startLine;$i$cFA;$i++) { that will save 3000+ calls to count(). //Get line of file (through array) // $lineRead = $fileArray[$i]; //Make array of all elements in this line // $lineArray = explode($separator,$lineRead); //Get manufacturers articlenumber // if (isset($lineArray[$articleNrFieldNr])) { $articleNumberManufacturer = $lineArray[$articleNrFieldNr]; } else { $articleNumberManufacturer = 0; } //Get saldo for this product // if (isset($lineArray[$articleNrFieldNr])) { $saldo = $lineArray[$saldoFieldNr]; } else { $saldo = 0; } //There is no data on this row //set saldo and articlenr to zero, so nothing happens // if (strlen($lineRead)==0) { $saldo = 0; $articleNumberManufacturer = 0; } //echo brARTICLENR: $articleNumberManufacturerbr; //echo SALDO: $saldobr; //Articlenr exists in line // if (intval($articleNumberManufacturer)0) { //Get ID of product (if there is any in varupiratens db) //skip the product if the saldo is the same as in //the textfile // $sql = SELECT IDVara FROM tbvara WHERE Varunamn = '$prefix$articleNumberManufacturer' LIMIT 1;; $querys = mysql_query($sql); $dbArray = mysql_fetch_array($querys); $IDVara = $dbArray[IDVara]; if ($IDVara == Null) {$IDVara = 0;} maybe cache this result of this query, assuming it returns repetetive values? although if the cache (array?) grows too large then that might slow it down again... double edged sword. //If product is found, then update saldo // if (intval($IDVara)0) { considering the UPDATE query, you can probably drop the call to intval(): if ($IDVara 0) { $sql = UPDATE tbvara SET Saldo=$saldo WHERE IDVara=$IDVara LIMIT 1;; I don't think the semicolon in the sql statement should be passed according to official docs, although I guess it works anyway :-) $querys = mysql_query($sql); echo QUERY DB - $sqlbr; also if you are using a very new version of MySQL _I_think_ you have the ability to use prepared queries - i.e. a query where the statement, with some placeholders is compiled once and then you execute the prepared query x number of times each time passing the 'execute()' func the relevant vars. this is as opposed to what you are doing now which is having the query compiled for every line you parse. prepared queries may not be an option. } //END Articlenr exists in line } } mysql_close(); } ? /G @varupiraten.se -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 2005-01-19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The Disguised Jedi [EMAIL PROTECTED] PHP rocks! Knowledge is Power. Power Corrupts. Go to school, become evil Disclaimer: Any disclaimer attached to this message may be ignored. This message
[PHP] LIMIT with MSSQL
Hello Is there anybody who succed in doing per/page listing from a MS SQL Server db. knowing that mssql doesnt support LIMIT like mysql and it uses TOP. i didnt find an optimized way to make a per/page script. Here's what am doing know : to replace a MySQL SELECT FROM LIMIT $x,$y i did this with MSSQL : :1 $query = SELECT FROM ; //Without limit :2 $ligne = fetch_assoc(query_bd($query)); :3 $temp = Array(); :4 for ($i=$debut;$i($x+$y);$i++) { :5 if (isset($ligne[$i])) :6 $temp[] = $ligne[$i]; :7 } :8 $ligne = $temp; am loosing time between lines 4 to 7 when i have a big big array :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pcntl_fork doesn't work
I'm trying to use pcntl_fork on php 4.3.10, but it says Call to undefined function: pcntl_fork() in test.php on line 3. The manual says pcntl is present in php = 4.1.0. I have 4.3.10, just the standard installation included on fedora core 3. I've done all the standard stuff - google'd, searched mailing list archive, looked through phpinfo() (didn't find anything relevant). Why wouldn't pcntl be working? Is there any other way for me to fork a process or thread? -John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: pcntl_fork doesn't work
John Davin wrote: The manual says pcntl is present in php = 4.1.0. I have 4.3.10, just the standard installation included on fedora core 3. Why wouldn't pcntl be working? Is there any other way for me to fork a process or thread? Take a look at http://www.php.net/pcntl. If you're using the standard installation of PHP on FC3, then it won't have pcntl enabled with --enable-pcntl because it's not enabled by default. You will have to recompiled PHP with this feature. -- Ben Ramsey Zend Certified Engineer http://benramsey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Isolated Execution Environment in PHP? (a la Safe module in Perl)
Hi, We've created our own CMS in PHP and we'd like to allow our users to do more sophisticated things, like embed there own PHP code in pages. We already run in safe-mode with our code, but we would like to run their code in an even more restricted environment than our own code (ie, disable some more functions, etc). Something similar to Perl's Safe module (http://www.cs.usask.ca/resources/documentation/perl/Safe.pm.html). Is this at all possible in PHP? Can you turn on more safe mode restrictions on certain bits of code? Thanks in advance. -- Eric Dorland [EMAIL PROTECTED] WCG 514.398-5023 ext. 09562 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pcntl_fork doesn't work
That's what I was afraid of. My web host (totalchoicehosting) doesn't have pcntl compiled in either, so I'm sort of stuck. Isn't there any other way to fork a process? PHP doesn't have thread support? Why isn't pcntl enabled by default? Surely the Windows compatibility isn't an issue, because pcntl could default to enabled in linux but disabled in windows. I'll tell you what I'm trying to do, in case there's another way to do it: I have a logging script which does a gethostbyaddr to obtain the hostname of the visitor to my site. But gethostbyaddr can take long or time out on some IP's, so I want to fork it so that the original script can terminate and not prevent the webpage from loading. I could run a background job which periodically does the gethostbyaddr on the IP's stored on disk, but that's sort of a hack, and is more complicated than if I could fork. -John On Wed, 26 Jan 2005, Ben Ramsey wrote: John Davin wrote: The manual says pcntl is present in php = 4.1.0. I have 4.3.10, just the standard installation included on fedora core 3. Why wouldn't pcntl be working? Is there any other way for me to fork a process or thread? Take a look at http://www.php.net/pcntl. If you're using the standard installation of PHP on FC3, then it won't have pcntl enabled with --enable-pcntl because it's not enabled by default. You will have to recompiled PHP with this feature. -- Ben Ramsey Zend Certified Engineer http://benramsey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pcntl_fork doesn't work
John Davin wrote: Isn't there any other way to fork a process? PHP doesn't have thread support? Why isn't pcntl enabled by default? Surely the Windows compatibility isn't an issue, because pcntl could default to enabled in linux but disabled in windows. I'll tell you what I'm trying to do, in case there's another way to do it: I have a logging script which does a gethostbyaddr to obtain the hostname of the visitor to my site. But gethostbyaddr can take long or time out on some IP's, so I want to fork it so that the original script can terminate and not prevent the webpage from loading. I could run a background job which periodically does the gethostbyaddr on the IP's stored on disk, but that's sort of a hack, and is more complicated than if I could fork. Sounds like passthru() might do what you want http://us3.php.net/passthru. Take a look at that manual page and read the first note about leaving the program running in the background. -- Ben Ramsey Zend Certified Engineer http://benramsey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UTF-16 strings, is there a simple way of using them?
So, I have to handle data that is UTF-16 encoded. No ifs ands or buts. Network messages on the service I'm communicating with sends and recieves UTF-16 encoded strings only. After taking a look at the Multibyte String functions, I don't know how much they will help me, though character encoding is a bit beyond me (For now). So what simple way is there to take a UTF-16 message and read it, analyze it, get information from it? -- llundi0v -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check server status...please help
I want to write a script that will check if the server is down if it is I want to redirect the user to another site, the backup server. Similarly I want users who go on to the seondary site when the main server is UP to be redirected to the main site. Can this be done using PHP. If not can you point me in the right direction? Kind regards, Ross Hulford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] check server status...please help
[snip] I want to write a script that will check if the server is down if it is I want to redirect the user to another site, the backup server. Similarly I want users who go on to the seondary site when the main server is UP to be redirected to the main site. Can this be done using PHP. If not can you point me in the right direction? Kind regards, [/snip] So I'm on this server at this URL right? And the HTTP server is down, right? The script would have to be aware of an HTTP request, right? Let us say I am on http://foo.com and I click a link or enter an address for http://bar.com . If the server is down that is hosting http://bar.com well, I think you see where I am going. Now, you could requests to port 80 maybe. And PHP CLI could be set in a loop to handle the request, but this may be a really bad plan. You would probably want some sort of port sniffer to monitor the port for activity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] check server status...please help
Ross Hulford wrote: I want to write a script that will check if the server is down if it is I want to redirect the user to another site, the backup server. If I go to http://www.yoursite.com and yoursite.com is down, how is it going to redirect me somewhere else? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] check server status...please help
I want to write a script that will check if the server is down if it is I want to redirect the user to another site, the backup server. Similarly I want users who go on to the seondary site when the main server is UP to be redirected to the main site. Can this be done using PHP. If not can you point me in the right direction? PHP can help you if you have multiple sql servers... but for true site redundancy php alone can not do what you ask. Some things to look at CISCO CSS, excellent for load balancer and many other things. However if you are concerned about the Internet connection being down to your server, well, that topic has been around for ages. The most simple one: two networks, one dns server on each network pointing to ips on the network. Kind regards, Ross Hulford -- 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: Message Error
Encrypted message is available. Attachment: No Virus found F-Secure AntiVirus - www.f-secure.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pcntl_fork doesn't work
I could run a background job which periodically does the gethostbyaddr on the IP's stored on disk, but that's sort of a hack, and is more complicated than if I could fork. Sounds like passthru() might do what you want http://us3.php.net/passthru. Actually forking to resolve ip based on a x amount of users is a very bad idea you could end up with having 1000's of programs looking up an IP address. Remember that you are spawning a new program not a thread. Therefore you are looking at some serious performance and load issues as spawning a new program is not anywhere near efficient as threading. This is very bad idea.. Got RAM ? To be honest the cron job to lookup IPS is a more elegant solution, and no I wouldn't call such a thing a hack. infact I know webtrends does that Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP based mysql search tool
I am looking for a full featured search tool I can plug into a couple of databases via a php front end. I currently have some of the text indexing done and have some basic search setup, using mysql queries like select from table where match 'search term' against column; But am looking for something like a prebuilt advance search tool that I can just plug in some variables into and have functional. Anyone know of anything like that? Dan Baughman IT Technician Professional Bull Riders, Inc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multi-language in script
Hi I'm interested, which is the best way to include multi-language support in scripts? By this I mean that with new version of script/program end-user don't need to translate whole site again... With flat-file and define function or with mysql ? Regards, Zoran
[PHP] Avoiding NOTICEs on Array References
I have many places where I use references like this: if ($fields['flags']['someflag']) ... or perhaps if ($_POST['checkboxfieldname']) ... If there is no value for 'someflag', or if the check box was not checked -- both of which are often the case -- these generate errors at level E_NOTICE. Is there any way to prevent references to missing array elements from generating errors without turning off all E_NOTICE notifications? Thanks, -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Avoiding NOTICEs on Array References
Tom Rawson wrote: I have many places where I use references like this: if ($fields['flags']['someflag']) ... or perhaps if ($_POST['checkboxfieldname']) ... if (isset($_POST['checkboxfieldname'])) { /** do stuff */ } -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding NOTICEs on Array References
-- Original message -- From: Tom Rawson [EMAIL PROTECTED] I have many places where I use references like this: if ($fields['flags']['someflag']) ... or perhaps if ($_POST['checkboxfieldname']) ... If there is no value for 'someflag', or if the check box was not checked -- both of which are often the case -- these generate errors at level E_NOTICE. Is there any way to prevent references to missing array elements from generating errors without turning off all E_NOTICE notifications? if (isset($fields['flags']['someflag']) $fields['flags']['someflag']) if (isset($_POST['checkboxfieldname']) $_POST['checkboxfieldname']) The short-circuits, so the second part of the conditional only gets evaluated if the first part is true. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding NOTICEs on Array References
Tom Rawson wrote: I have many places where I use references like this: if ($fields['flags']['someflag']) ... or perhaps if ($_POST['checkboxfieldname']) ... If there is no value for 'someflag', or if the check box was not checked -- both of which are often the case -- these generate errors at level E_NOTICE. Is there any way to prevent references to missing array elements from generating errors without turning off all E_NOTICE notifications? the answer is to write code that doesn't produce notices. which means checking the vars (array items) exist before using them. use of isset() may help you - isset() shouldn't give a notice if you are checking for an item in an array and it doesn't exist - I say shouldn't because I half remember reading about someone having that very problem, I can't remember whether it was bogus or a bug in their version of php. a cousin of isset() is empty() which is not a function as I undertstand it but a language construct, and will also be of help here I think. Thanks, -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Avoiding NOTICEs on Array References
On 26 Jan 2005 Jason Barnett wrote: if (isset($_POST['checkboxfieldname'])) { /** do stuff */ } Sorry, I should have mentioned that I knew about using isset -- it works OK for the checkbox example, though I'm not clear if this behavior is specified and therefore will not change -- i.e. can one rely on the fact that the checkbox field name is missing entirely from _POST if the box is not checked? Or are there cases where it could be present but with an empty or NULL value? If one must check the value and not just the existence of the checkbox entry, or for other uses, e.g. where a flag may or may not be present, one is saddled with clumsy constructs like: if (($isset($array['index']) ($array['index'] == 1)) ... I would prefer that the second expression return FALSE, or that $array['index'] where the index is not present simply return NULL -- or probably better, an option to avoid E_NOTICE level errors for such cases. -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multi-language in script
Hi I'm interested, which is the best way to include multi-language support in scripts? By this I mean that with new version of script/program end-user don't need to translate whole site again... With flat-file and define function or with mysql ? Regards, Zoran -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-language in script
Hello take a look a gettext in the manual BR/Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Avoiding NOTICEs on Array References
I'm pretty sure you can rely on the fact that they are undefined if not checked.. It's somewhere in the HTML or HTTP standard.. Also, the manual page of empty() says it won't generate errors if the variable isn't set.. So empty() is probably the best way to go then.. -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] On 26 Jan 2005 Jason Barnett wrote: if (isset($_POST['checkboxfieldname'])) { /** do stuff */ } Sorry, I should have mentioned that I knew about using isset -- it works OK for the checkbox example, though I'm not clear if this behavior is specified and therefore will not change -- i.e. can one rely on the fact that the checkbox field name is missing entirely from _POST if the box is not checked? Or are there cases where it could be present but with an empty or NULL value? If one must check the value and not just the existence of the checkbox entry, or for other uses, e.g. where a flag may or may not be present, one is saddled with clumsy constructs like: if (($isset($array['index']) ($array['index'] == 1)) ... I would prefer that the second expression return FALSE, or that $array['index'] where the index is not present simply return NULL -- or probably better, an option to avoid E_NOTICE level errors for such cases. -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing search strings from referer urls?
First time post, please be gentle. I'd like to be able to extract search strings from referer urls that come from search engines. (via php, of course) For example, http://www.google.com/search?q=foo+barie=UTF-8oe=UTF-8 Now, I realize one might employ grep to pull out this information and its easy for a human to examine a url like the one above, but I'd like to programmatically present a nice, tidy list of search words used to generate the url. My gut says that one would need to write a function for each major search engine to parse out this information since each engine is unique in how it builds the url. However, I thought after poring over the manual and online docs/list and not finding a solution, and before I went off and reinvented the wheel, I would float the question and see what you fine folks have to say about the subject. Thanks in advance for any insight. -- T.J. Mahaffey [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] in need of a directory/listing script/app
hi... i'm looking for a good app/function/code to allow users to select a given item(s) from a list of categories. i'd also like the user to be able to display users who have selected a given category from the list... i can't seem to find an app that has this kind of code incorporated... thanks bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Isolated Execution Environment in PHP? (a la Safe module in Perl)
Eric Dorland wrote: We've created our own CMS in PHP and we'd like to allow our users to do more sophisticated things, like embed there own PHP code in pages. We already run in safe-mode with our code, but we would like to run their code in an even more restricted environment than our own code (ie, disable some more functions, etc). Something similar to Perl's Safe module (http://www.cs.usask.ca/resources/documentation/perl/Safe.pm.html). Is this at all possible in PHP? Can you turn on more safe mode restrictions on certain bits of code? A crude start might be to use http://php.net/exec to start ANOTHER php process with a different php.ini which is more restrictive. The problem there, though, is that you can only rule out bad functions (black-list) instead of listing all good function (white list) in php.ini, so you'd have to come up with an exhaustive list of things you think are bad which will change with every release and is generally considered the wrong way to go about security... You may be better off, then, by writing something not unlike (or just plain using) Smarty or some other templating language, where you let them make up the templates, and only allow some simple pre-defined substitution of variables you pre-define or something... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pcntl_fork doesn't work
John Davin wrote: I'm trying to use pcntl_fork on php 4.3.10, but it says Call to undefined function: pcntl_fork() in test.php on line 3. The manual says pcntl is present in php = 4.1.0. I have 4.3.10, just the standard installation included on fedora core 3. I've done all the standard stuff - google'd, searched mailing list archive, looked through phpinfo() (didn't find anything relevant). Why wouldn't pcntl be working? Is there any other way for me to fork a process or thread? Sometimes you can use exec(... ) to fork... It's probably not really a good idea as others have stated. Most web log analyzers look up and cache IP-domain-name data for this exact same reason. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Parsing search strings from referer urls?
T.J. Mahaffey wrote: First time post, please be gentle. I'd like to be able to extract search strings from referer urls that come from search engines. (via php, of course) For example, http://www.google.com/search?q=foo+barie=UTF-8oe=UTF-8 Now, I realize one might employ grep to pull out this information and its easy for a human to examine a url like the one above, but I'd like to programmatically present a nice, tidy list of search words used to generate the url. My gut says that one would need to write a function for each major search engine to parse out this information since each engine is unique in how it builds the url. However, I thought after poring over the manual and online docs/list and not finding a solution, and before I went off and reinvented the wheel, I would float the question and see what you fine folks have to say about the subject. You will probably find parse_url() to be useful: http://www.php.net/manual/en/function.parse-url.php ?php $url = http://username:[EMAIL PROTECTED]/path?arg=valuearg2=valuearg3=value3#anchor; $parts = parse_url($url); $args = explode('', $parts['query']); for($i = 0; $i sizeof($args); $i++) { list($key, $value) = explode('=', $args[$i]); $query[$key] = urldecode($value); } print_r($query); ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LIMIT with MSSQL
Zouari Fourat wrote: Is there anybody who succed in doing per/page listing from a MS SQL Server db. Sure. knowing that mssql doesnt support LIMIT like mysql and it uses TOP. Ain't never heard of TOP... But start reading the MS SQL manual about cursors to get efficient paging. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Isolated Execution Environment in PHP? (a la Safe module in Perl)
On Wed, 2005-01-26 at 12:41 -0800, Richard Lynch wrote: Eric Dorland wrote: We've created our own CMS in PHP and we'd like to allow our users to do more sophisticated things, like embed there own PHP code in pages. We already run in safe-mode with our code, but we would like to run their code in an even more restricted environment than our own code (ie, disable some more functions, etc). Something similar to Perl's Safe module (http://www.cs.usask.ca/resources/documentation/perl/Safe.pm.html). Is this at all possible in PHP? Can you turn on more safe mode restrictions on certain bits of code? A crude start might be to use http://php.net/exec to start ANOTHER php process with a different php.ini which is more restrictive. I had thought of this, but performance wise and elegance wise it doesn't seem like a good solution. We may just run another webserver where we can put the untrusted code and just websuck it and pour it into our pages. I was just hoping for a cleaner solution. The problem there, though, is that you can only rule out bad functions (black-list) instead of listing all good function (white list) in php.ini, so you'd have to come up with an exhaustive list of things you think are bad which will change with every release and is generally considered the wrong way to go about security... You may be better off, then, by writing something not unlike (or just plain using) Smarty or some other templating language, where you let them make up the templates, and only allow some simple pre-defined substitution of variables you pre-define or something... This is indeed what we do now (well not with Smarty). It's more that there's pressure to allow people to develop there own applications within the system. -- Eric Dorland [EMAIL PROTECTED] WCG 514.398-5023 ext. 09562 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
James Guarriman wrote: RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php /Directory /VirtualHost Despite the very very very scary warnings not to, turn on the Rewrite Logging feature and tail -f the log until you figure this out. Otherwise, you will be banging your head against a black box, with NO IDEA why it does what it does (other than hurt). :-) Just remember to turn it OFF when you are on a Production site, or you'll regret it quickly. What you probably want is to only match things that don't already have a '.' in them -- If they ask for foo.jpg, and it's not there, you don't want foo.jpg.php instead, right? That's what you tried to do with this: RewriteRule ^(.*)$ /$1.php You probably wanted more like: RewriteRule ([^\.]) /$1.php That probably ain't right, but your goal is to get only filenames with NO '.' in them, and you need \ to esacpe the . so it doesn't mean any character -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic quotes question (still driving me mad)
Ben Edwards wrote: On Tue, 25 Jan 2005 17:02:21 -0800, Chris [EMAIL PROTECTED] wrote: You should probably use get_magic_quotes_runtime() , as _gpc only applies to GET/POST/COOKIE, htmlspecialchars is needed so the HTML can be parsed properly: So this is this only done to stuff that is to be displayed on a web page? What happens if it is done to stuff that is (possibly) also passed through addslashes and written to the database. Don't do it. What if tomorrow you decide you need to output a PDF as well as your HTML from that same data -- You've got all those funky htmlspecialchars() in your database that have NOTHING to do with your data. They are only needed for the HTML presentation of your data. For example, I have a web-site where we have had an on-line calendar for ages. A few years ago, I found out the client was re-typing all his calendar items (a hundred a month) into three different software packages, just so he could get a print-out for flyers/handouts of his calendar of events. Silly client. Now his web-site provides him with a PDF of his calendar with a single click, instead of 4 hours of drudge-work every month copying data from A to B by hand. There ain't no htmlspecialchars() in the database, thank [deity], or I'd have to un-do that just to make the PDF. Ugh! -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
Richard Lynch wrote: RewriteRule ^(.*)$ /$1.php You probably wanted more like: RewriteRule ([^\.]) /$1.php That probably ain't right, but your goal is to get only filenames with NO '.' in them, and you need \ to esacpe the . so it doesn't mean any character Dot has no special meaning in a character class (that's inside []). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding NOTICEs on Array References
On 26 Jan 2005 Jennifer Goodie wrote: if (isset($fields['flags']['someflag']) $fields['flags']['someflag']) if (isset($_POST['checkboxfieldname']) $_POST['checkboxfieldname']) The short-circuits, so the second part of the conditional only gets evaluated if the first part is true. I know I can use isset, it just adds a bunch of extra code. I like to find minimal solutions to these things if possible as they are easier to read, and faster to execute. -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image manipulation without GD library
Tim Burgan wrote: Is there any way that I can do some image manipulation - resizing - without the GD libraries? You can use ImageMagik (aka 'convert') through http://php.net/exec if ImageMagik is installed, and the PHP user can run it. I'm guessing that the same could be said for the GIMP though I've never seen it done -- or *any* command-line based image manipulation tool I've never heard of for that matter. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi by Multi level system
I know I can write a recursive function for each of these stages, but thats not the best method. FWIW, I happen to think recursion *IS* the best method, based on what you've said so far... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image Resolution
Hi, I have written a script that takes an uploaded jpeg-image and places it in a PDF-file with the PDFLib functions in php. The original image file is 560x420, 72 dpi. Later on the PDF-file will be printed, and our printshop requires at least 200 dpi. The format of the printed image should be A6 (15,2x10,9 cm). Is it possible to change resolution like this? Thanks // Martin M
[PHP] Image Resolution
Hi, I have written a script that takes an uploaded jpeg-image and places it in a PDF-file with the PDFLib functions in php. The original image file is 560x420, 72 dpi. Later on the PDF-file will be printed, and our printshop requires at least 200 dpi. The format of the printed image should be A6 (15,2x10,9 cm). Is it possible to change resolution like this? Thanks // Martin M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I convert UTF-8 strings into UTF-16
I tried the multi byte functions but those failed. So how cna I convert UTF-8 to UTF-16? -- llundi0v -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding NOTICEs on Array References
[EMAIL PROTECTED] wrote: On 26 Jan 2005 Jennifer Goodie wrote: if (isset($fields['flags']['someflag']) $fields['flags']['someflag']) if (isset($_POST['checkboxfieldname']) $_POST['checkboxfieldname']) The short-circuits, so the second part of the conditional only gets evaluated if the first part is true. I know I can use isset, it just adds a bunch of extra code. I like to find minimal solutions to these things if possible as they are easier to read, and faster to execute. -- Tom As already suggested, isset() and empty() are good choices here. Which one you choose it dependent on what exactly your truth table is. Or, it might work better for you to use !isset() or even !empty(). if (!empty($_POST['checkboxfieldname']) { /** do stuff */ } -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Resolution
Martin Magnusson wrote: Hi, I have written a script that takes an uploaded jpeg-image and places it in a PDF-file with the PDFLib functions in php. The original image file is 560x420, 72 dpi. Later on the PDF-file will be printed, and our printshop requires at least 200 dpi. The format of the printed image should be A6 (15,2x10,9 cm). Is it possible to change resolution like this? Yes, though the original could end up being awful grainy, depending on what size you make it in the PDF... PDFs are always 72-dpi, so you basically make everything be 200/72 X as big as you want to get 200-dpi, if you know what I mean. The image itself will get taken care of by libPDF pretty much -- Just scale it to fit the size you want. You can't take 72-dpi to 200-dpi in the same size and not get it grainy though. So maybe make the image 280x120 or even 140x60 at the 200 dpi to keep it looking good. Though, of course, when all is said and done, you'll be using 200/72 X 140 = ~500 in your script to get the PDF to be 200-dpi. Hope that makes sense. I'm no expert on this stuff, but that's what worked for me. Sorta like this: ?php $scale = 200/72; $pdf = pdf_new($scale * XX, $scale * YY); //XX == 15,2 cm - 72-dpi == ~7in X 72dpi == 500??? //YY == 10,9 cm == ~5in X 72dpi == 350??? pdf_image_place($pdf, 20 * $scale, 20 * $scale, 0.5); //Play with scale of 0.5 to see what works, or maybe base it on the image size and $scale or... . . . Basically draw everything with $scale as a multiplier so the 72-dpi PDF is 200/72 times as big as you want it to be, so it ends up being 200-dpi when it gets printed/shrunk to the actual paper. Again, that may be the wrong way to do it, but it worked for me in what I had to do to get what I needed... YMMV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF-16 strings, is there a simple way of using them?
v0id null wrote: So, I have to handle data that is UTF-16 encoded. No ifs ands or buts. Network messages on the service I'm communicating with sends and recieves UTF-16 encoded strings only. After taking a look at the Multibyte String functions, I don't know how much they will help me, though character encoding is a bit beyond me (For now). So what simple way is there to take a UTF-16 message and read it, analyze it, get information from it? multibyte string functions will help you. just use them. You can then use iconv or recode functions to get the encoding you need to display them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Resolution
Take a quick look at imagecopyresampled.. It can change the size of an image pretty good.. Now I know nothing about PDFs really.. But I suppose you could just scale it with the GD functions then place the result in a PDF.. Maybe the PDF functions can scale as well though.. Although, try both, because chances are the PDF functions will resize instead of resample, and resampling gives a MUCH nicer result in most cases.. -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Martin Magnusson [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, I have written a script that takes an uploaded jpeg-image and places it in a PDF-file with the PDFLib functions in php. The original image file is 560x420, 72 dpi. Later on the PDF-file will be printed, and our printshop requires at least 200 dpi. The format of the printed image should be A6 (15,2x10,9 cm). Is it possible to change resolution like this? Thanks // Martin M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I convert UTF-8 strings into UTF-16
On Wed, 2005-01-26 at 16:54 -0500, v0id null wrote: So how cna I convert UTF-8 to UTF-16? -- llundi0v Have you tried with iconv ? www.php.net/iconv for further details ;-) -- Josip Dzolonga, dzolonga at mt dot net dot mk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image Resolution
DvDmanDT wrote: Take a quick look at imagecopyresampled.. It can change the size of an image pretty good.. Now I know nothing about PDFs really.. But I suppose you could just scale it with the GD functions then place the result in a PDF.. Maybe the PDF functions can scale as well though.. Although, try both, because chances are the PDF functions will resize instead of resample, and resampling gives a MUCH nicer result in most cases.. In my experience, the libPDF just embeds the full picture in the document, and lets the printer/renderer worry about the dpi... So if you put a 300-dpi image in a PDF (72-dpi) scaled at 1.0 and print it, the image still comes out 300-dpi. If you scale the image to 2.0, you get a 150-dpi image (or whatever it works out to) to get that image in that much space. There may be ways to change this, or maybe I was mis-interpreting what I saw in my PDFs on my printer, but that's what it seemed like to me. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image Resolution
Hmm.. If PDFs are always 72dpi.. Then the OP would in other words need to resize the PDF document (and everything on it) to 200/72 times the normal size, and then the printer would print it correct? Hmm.. Isn't that pretty much exactly what Richard Lynch said? Seems like a kinda ugly solution to me, but it might be the way to go.. :p -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Richard Lynch [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] DvDmanDT wrote: Take a quick look at imagecopyresampled.. It can change the size of an image pretty good.. Now I know nothing about PDFs really.. But I suppose you could just scale it with the GD functions then place the result in a PDF.. Maybe the PDF functions can scale as well though.. Although, try both, because chances are the PDF functions will resize instead of resample, and resampling gives a MUCH nicer result in most cases.. In my experience, the libPDF just embeds the full picture in the document, and lets the printer/renderer worry about the dpi... So if you put a 300-dpi image in a PDF (72-dpi) scaled at 1.0 and print it, the image still comes out 300-dpi. If you scale the image to 2.0, you get a 150-dpi image (or whatever it works out to) to get that image in that much space. There may be ways to change this, or maybe I was mis-interpreting what I saw in my PDFs on my printer, but that's what it seemed like to me. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Parsing search strings from referer urls?
-- Original message -- From: Jason Barnett [EMAIL PROTECTED] T.J. Mahaffey wrote: First time post, please be gentle. You will probably find parse_url() to be useful: http://www.php.net/manual/en/function.parse-url.php ?php $url = http://username:[EMAIL PROTECTED]/path?arg=valuearg2=valuearg3=value3#anchor ; $parts = parse_url($url); $args = explode('', $parts['query']); for($i = 0; $i sizeof($args); $i++) { list($key, $value) = explode('=', $args[$i]); $query[$key] = urldecode($value); } print_r($query); ? parse_str will take care of turning the query string into key/value pairs http://us2.php.net/manual/en/function.parse-str.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing search strings from referer urls?
On Thursday 27 January 2005 04:16, T.J. Mahaffey wrote: First time post, please be gentle. I'd like to be able to extract search strings from referer urls that come from search engines. (via php, of course) For example, http://www.google.com/search?q=foo+barie=UTF-8oe=UTF-8 Now, I realize one might employ grep to pull out this information and its easy for a human to examine a url like the one above, but I'd like to programmatically present a nice, tidy list of search words used to generate the url. My gut says that one would need to write a function for each major search engine to parse out this information since each engine is unique in how it builds the url. However, I thought after poring over the manual and online docs/list and not finding a solution, and before I went off and reinvented the wheel, I would float the question and see what you fine folks have to say about the subject. My gut says that you haven't been looking too closely at the manual. There's a chapter on URL Functions, sounds promising, inside it mentions a function called parse_url(), very useful, the description for that function shows a link to parse_str(), bingo, you got all you need. Of course you still have to examine the extracted data to determine which search engine it came from and proceed accordingly. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getrusage() and ru_nswap
Hi, be kind enough to CC me as I'm not in the list. I wonder why getrusage() skip the ru_nswap ? quoting ext/standard/microtime.c: #if !defined( _OSD_POSIX) !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */ PHP_RUSAGE_PARA(ru_oublock); PHP_RUSAGE_PARA(ru_inblock); PHP_RUSAGE_PARA(ru_msgsnd); PHP_RUSAGE_PARA(ru_msgrcv); PHP_RUSAGE_PARA(ru_maxrss); PHP_RUSAGE_PARA(ru_ixrss); PHP_RUSAGE_PARA(ru_idrss); PHP_RUSAGE_PARA(ru_minflt); PHP_RUSAGE_PARA(ru_majflt); PHP_RUSAGE_PARA(ru_nsignals); PHP_RUSAGE_PARA(ru_nvcsw); PHP_RUSAGE_PARA(ru_nivcsw); #endif /*_OSD_POSIX*/ PHP_RUSAGE_PARA(ru_utime.tv_usec); PHP_RUSAGE_PARA(ru_utime.tv_sec); PHP_RUSAGE_PARA(ru_stime.tv_usec); PHP_RUSAGE_PARA(ru_stime.tv_sec); #undef PHP_RUSAGE_PARA Where is 'ru_nswap' ? Sure, there's a good reason for that not being reported. A pity is that it stands in the doc http://php.net/manual/en/function.getrusage.php. I believe it can be usefull to review over sites. Thanks, + -- bertrand Gugger (toggg) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] set-time-limit
Hi! when safe mode is one, i can't use set_time_limit. Is there any workarounds? why is it so that when I echo something to the screen then I can run the script for a longer time, than if I don't have echo? Don't get the logic... /G @varupiraten.se -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 2005-01-19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pcntl_fork doesn't work [RESOLVED]
Thanks. I had read about passthru before but missed the note about running a program in the background. I ended up working out a solution using exec: exec( /usr/bin/php my_other_php_script.php arg1 arg2 arg3 ). (passed some data to the other script on the commandline). thanks, -John On Wed, 26 Jan 2005, Ben Ramsey wrote: John Davin wrote: Isn't there any other way to fork a process? PHP doesn't have thread support? Why isn't pcntl enabled by default? Surely the Windows compatibility isn't an issue, because pcntl could default to enabled in linux but disabled in windows. I'll tell you what I'm trying to do, in case there's another way to do it: I have a logging script which does a gethostbyaddr to obtain the hostname of the visitor to my site. But gethostbyaddr can take long or time out on some IP's, so I want to fork it so that the original script can terminate and not prevent the webpage from loading. I could run a background job which periodically does the gethostbyaddr on the IP's stored on disk, but that's sort of a hack, and is more complicated than if I could fork. Sounds like passthru() might do what you want http://us3.php.net/passthru. Take a look at that manual page and read the first note about leaving the program running in the background. -- Ben Ramsey Zend Certified Engineer http://benramsey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Avoiding NOTICEs on Array References
[EMAIL PROTECTED] wrote: On 26 Jan 2005 Jason Barnett wrote: if (isset($_POST['checkboxfieldname'])) { /** do stuff */ } Sorry, I should have mentioned that I knew about using isset -- it works OK for the checkbox example, though I'm not clear if this behavior is specified and therefore will not change -- i.e. can one rely on the fact that the checkbox field name is missing entirely from _POST if the box is not checked? Or are there cases where it could be present but with an empty or NULL value? I can't see how it can be set to null unless you do it yourself - actually its all strings isn't it? but it could be an empty string if the checkbox value was set to that. If one must check the value and not just the existence of the checkbox entry, or for other uses, e.g. where a flag may or may not be present, one is saddled with clumsy constructs like: if (($isset($array['index']) ($array['index'] == 1)) ... okay, I get where your coming from - indeed nasty business them checkboxes. function getGP($v = '', $r = null, $t = null) { if (!empty($v)) { if (isset($_GET[$v])) { $r = (!is_null($t)) ? $t: $_GET[$v]; } if (isset($_POST[$v])) { $r = (!is_null($t)) ? $t: $_POST[$v];} } return $r; } $state = getGP('mychkbox', false, true); -- $state will be a boolean. $state = getGP('mychkbox', false, true); -- $state will be an 'id' or false. if you were expecting an array of checkbox values e.g. input type=checkbox name=mycheckboxes[] value=1 / input type=checkbox name=mycheckboxes[] value=2 / input type=checkbox name=mycheckboxes[] value=3 / then you need a little fancier function to cope. I would prefer that the second expression return FALSE, or that $array['index'] where the index is not present simply return NULL -- or probably better, an option to avoid E_NOTICE level errors for such cases. its E_NOTICE v. the Empty()-isset() Brothers at the OK Corral I'm afraid. basically it comes down to wrapping the checks is simple(looking?) functions. or turn off notices. may turn them off only in the place where you grab/check incoming vars? but that seems lame. anyway I just ran this on ... PHP 5.0.2 (cli) (built: Oct 21 2004 13:52:27) $ php -r 'echo error_reporting(E_STRICT | E_ALL);echo error_reporting(); if ([EMAIL PROTECTED]chumpy_joodab_revmoor]) { echo yeah; } ' 20394095yeah thats interesting. :-) -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Avoiding NOTICEs on Array References
Jochem Maas wrote: [EMAIL PROTECTED] wrote: If one must check the value and not just the existence of the checkbox entry, or for other uses, e.g. where a flag may or may not be present, one is saddled with clumsy constructs like: if (($isset($array['index']) ($array['index'] == 1)) ... okay, I get where your coming from - indeed nasty business them checkboxes. Here's an approach that I like which I think cuts down on the clumsy constructs. On a controller page (the C in MVC) that handles form submissions I create an array which defines what form variables are available and their default values if not entered. I then use array_merge() to combine that array with $_POST (or $_GET, as the case may be) and the result is an array that contains all of my form variables with each guaranteed to be set and contain a sane default. array_merge() works in such a way that values in the first default array will only be replaced if they actually exist in $_POST, which is what I want. (Contrived) example: $formVars = array_merge(array( 'firstName' = '', 'lastName' = '', 'contactMethod' = 'email', 'flags' = array('one' = 0, 'two' = 0, 'three' = 0) ), $_POST); The above handles the case where you have: input type=checkbox name=flags[one] value=1 input type=checkbox name=flags[two] value=1 input type=checkbox name=flags[three] value=1 Now, I do: if (!empty($_POST)) { if (trim($formVars['firstName']) == '') { //complain that first name is required } if ($formVars['flags']['one']) { //handle the case where the first checkbox is checked } ... } This way I can safely reference anything in $formVars under E_ALL without throwing notices. I think it's a lot cleaner than the constant (!isset($_POST['var']) || $_POST['var'] == '') stuff...YMMV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Web shopping cart
Can anyone recommend a freeware shopping card app in php? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compiling PHP 4.3.3 with large file support
I'm running Fedora Core 1, all packages up to date. I want to add large file support to php. I downloaded the source rpm. Added -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to CFLAGS in the spec file, rebuilt the rpm and installed it. Apache starts fine but I get [notice] child pid exit signal Segmentation fault (11) when ever I request a page. Compiling the same source without those flags works fine. I must be missing something, but I am in way over my head. Can someone tell me what I am doing wrong? Thanks, Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need to enhance functionality...
I have a Portal on PHP and I need to enhance the functionality to include Archieving, Searching and Versioning of files. Can I get the code/logic for doing so? Please send me if u have something that performs that task. I searched on sourceforge.net. I got a software KnowledgeTree but the coding is too difficult to understand. Waiting for replies... Rahul ** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. **
Re: [PHP] Linux PHP CLI and Environment variables
On Wed, 2005-01-26 at 22:38 -0700, Michael Gale wrote: I have searched every where ...is this possible ? Well, take a look here http://www.php.net/manual/en/function.shell-exec.php . So you can exec an echo command and get the result. -- Josip Dzolonga, dzolonga at mt dot net dot mk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Linux PHP CLI and Environment variables
Hello, I am running php 4.3.7 with ncurses support. I want to create a small app using php and ncurses but I will need to get some information from the shell environment variables. I have searched every where ...is this possible ? Michael. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Call-time pass-by-reference ??
Hello, I am trying to start a small php ncurses app but the documenatation is not helping. What does the following mean: PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of ncurses_getmaxyx(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/michael/gsmenu/gsmenu on line 10 Here is my code: #!/usr/local/bin/php ?php $y=0; $x=0; $ncurses_session = ncurses_init(); $main = ncurses_newwin(0,0,0,0); ncurses_getmaxyx ($main,$y,$x ); ncurses_border(1,1,1,1, 1,1,1,1); ncurses_wrefresh($main); ncurses_end(); ? If I remove the from main nothing happens at all, the php documentation says that the variables should be passed from reference. Any help would be appreciated. Michael. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux PHP CLI and Environment variables
Michael Gale wrote: Hello, I am running php 4.3.7 with ncurses support. I want to create a small app using php and ncurses but I will need to get some information from the shell environment variables. I have searched every where ...is this possible ? http://pear.php.net/package/Console_Getargs http://pear.php.net/package/Console_Getopt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call-time pass-by-reference ??
On Thursday 27 January 2005 14:47, Michael Gale wrote: I am trying to start a small php ncurses app but the documenatation is not helping. OK, I've never used the ncurse functions before, but cursory glance at the manual results in the following observations: What does the following mean: PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of ncurses_getmaxyx(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/michael/gsmenu/gsmenu on line 10 Here is my code: #!/usr/local/bin/php ?php $y=0; $x=0; $ncurses_session = ncurses_init(); $main = ncurses_newwin(0,0,0,0); OK, you've created a zero-sized window. ncurses_getmaxyx ($main,$y,$x ); It is $y $x that ought to be passed by reference, why are you using $main? In any case as the above error message says you should be simply doing: ncurses_getmaxyx ($main, $y, $x); ncurses_border(1,1,1,1, 1,1,1,1); You've specified not to draw any borders around your zero-sized window. ncurses_wrefresh($main); ncurses_end(); ? If I remove the from main nothing happens at all, So what did you expect to see? the php documentation says that the variables should be passed from reference. That bit of the documentation could be made clearer. It should probably say something along the lines of ... the variables *will* be passed by reference I'm assuming that the function definition has defined $y $x to be passed by reference. Any help would be appreciated. I suggest you start by giving some dimensions to your window and possibly some borders as well. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php