Re: [PHP] HTML output buffering
On Thu, 2003-10-16 at 15:50, Robin Kopetzky wrote: Good afternoon! Is there a simple way to have PHP buffer all HTML output via echo/print until the program flushes the output buffer?? http://us2.php.net/manual/en/ref.outcontrol.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Offering files from below the webroot
Read the user comments here: http://www.php.net/manual/en/function.header.php On Thu, 2003-10-16 at 23:12, Ryan A wrote: (b)open a file save dialog, give him the file I can do (a)...how to do (b)? I have checked up fpassthru and readfile...got confused and came here :-D, any pointers? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return to browser and keep running!
Read : PHP's process control functions may do what you need http://us3.php.net/manual/en/ref.pcntl.php Other alternative is to fork an external command with the exec or similar function, which would run another php script, in another php instance, in the background... make sure you redirect all in/out streams and add a sign to the end of the command string, or else you script would hang waiting for child completion... On Wed, 2003-10-15 at 10:52, Manuel Vzquez Acosta wrote: Hi all: I need to know if there is a way to send the output buffer to the browser, disconnect from it but keep running a task the user doesn't need to realize that is happening and that may take a few minutes to be complete. Something like: ?php /// PREPARE OUTPUT... flush(); disconnect_from_browser(); /// Figure out if its required an optimization pass to /// the DB and make it. This could take a long time before ? Manu. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested queries don't work
I would guess you have to use some extra layer of connection pools... each of those queries should go in a separate sql connection... i believe... On Wed, 2003-10-15 at 15:36, Rich Fox wrote: I have the following code querying MS SQL Server $query = SELECT * FROM mytable; $res = mssql_query($query); $nr = mssql_num_rows($res); for ($i=0; $i$nr; $i++) { $a = mssql_fetch_array($res); $query = SELECT * FROM anothertable WHERE id=.$a['anotherID']; $res1 = mssql_query($query); $anr = mssql_num_rows($res1); ... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Run the same php function several times in th background
You're talking multithreading and/or forking extra processes? check the docs for that... search for fork... Mohamed~ On Tue, 2003-10-14 at 11:05, KB wrote: Hi NG I would like to intiate the same function many times, running in the background using php, Thank you in advance for any suggestion Kind regards Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
On Tue, 2003-10-14 at 17:33, Curt Zirzow wrote: //use fopen() instead of readfile... $fp = fopen($filepath, 'rb'); $pdf_buffer = fread($fp, $filesize); fclose ($fp); print $pdf_buffer; Loading the whole file in memory and not doing anything with it before sending it to the client doesn't make much sense. Are you saying readfile() somehow avoids loading the whole file into memory? maybe it does, you learn everyday, I am just wondering... Mohamed~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to fire off a unix command WITHOUT waiting for it to return (I want to use )
I tried this exec() suggestion and that didn't work right either. exec(/bin/scan /dev/null 2/dev/null); try : exec(/bin/scan /dev/null 21 ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Slow searches in large database
You might wanna see if a search engine/indexing tool can help you, I use: http://search.mnogo.ru/features.html On Mon, 2003-10-13 at 18:54, Adrian Teasdale wrote: Hi there Wondering if someone could help or give some advice. We have a mysql database that has approximately 20,000 records and has a total size of 125mb There are approximately 25 fields that we need to search each time that someone performs a search. We have installed TurckMMCache onto the server which speeded up the searching, but it still takes around 15 seconds for the results to be displayed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connecting to Linux server from windows
How about CURL and telnet? see http://php.net/curl On Mon, 2003-10-13 at 08:12, Binay wrote: Hi all ! I have PHP (4.3.2) running on windows 2k. Now i want to connect to a Linux Server and execute some commands and get the results back to win2k server. How can i achiece this. Please help me out. Thanks in advance Binay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace newb
I would try a petern like this: $pattern=!a href='([^]*)'([^]*)/a! check the docs for greedy not greedy thingy... Mohamed~ On Mon, 2003-10-13 at 06:27, Justin French wrote: Hi, Trying to get this working, without any luck: $str = preg_replace(!a href='(.*?)'(.*?)/a!,'{link|\\2|\\1}',$str); FWIW, I'm aware that this doesn't ANY WHERE NEAR cover all instances of a link, but in this case, I KNOW that the link will have the above format, because it was generated by another PHP script I wrote. Any hints? Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (newbie) How to keep files ?
Your question is not clear enough Who are you trying to protect your files from? All of you files must be accessible to the web server and to yourself, via ftp or ssh or sth. your php script needs the mysql login info... where would it find them, if not hard coded in the script, or in a file accessible to the script? Mohamed~ On Mon, 2003-10-13 at 20:40, Sudheer Palaparambil wrote: Hi, I have a few gif files and five php files and using mysql database and planning a shared hosting. The web contents are static. How should I keep the files in my web space? Should I restrict access to the php files? How do I safeguard my mysql login parameters (which I hard coded in the php files)? Pls help. Thank you. Sudheer. _ Access Hotmail from your mobile now. http://server1.msn.co.in/sp03/mobilesms/ Click here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx -- help
Untested: function fixhisnumber($str){ //remove all but numbers $str = preg_replace(/[^0-9]/,,$str); //append 1, unless it's already there $str = $str[0] == '1'? $str:1.$str; if (strlen($str) == 10) return $str; else return -1; } Mohamed~ On Fri, 2003-10-10 at 14:01, Lists wrote: I do not know if this is the right list, but if someone could help me with the following I need a function that does this: function phone($num) { take num and remove anything that is not a number ex: () - / If there is not 1 at the start, add a one to the start of the number. make sure that the number is 10 digits (if not return -1) } Thank you for your help, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP weirdo bahavior (code mutation)
Hello all, I am using a PHP application called modernbill, which uses iocube encoder... PHP very frequently dies with SIG fault... 4.3 dies systematically While working on this problem I stumbled on this behavior : In my code, I have something like this: $table_customer=customer; $sql=select * from [$table_customer] where [id] = '$id' ; $result = $db_plat-query($sql); if (DB::isError($result)) { mylog(__FUNCTION__ . : . sql was: $sql ); mylog(__FUNCTION__ . : . $result-getMessage()); return false; }else{ $row = $result-fetchRow(DB_FETCHMODE_ASSOC); } Well, sometimes, at least twice I noticed it, sometimes I get this in my log file: sql was: select * fro?2351ERROR_RETURNd_id] = '2351' DB Error: Syntax error. There are binary chars after the select * fro How could that possibly happen? Who changed my code? Thanks for any input. Mohamed~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP weirdo bahavior (code mutation)
Thanks Khalid... but that still does not help :) The problem does not reproduce systematically, at all.. here is another example I just found in a new log of my script: Here is my code first: $table=client_package; $sql = INSERT INTO `$table` (`cp_id`,`client_id`,`pack_id`,`pack_price`,`parent_cp_id`,`cp_start_stamp`, `cp_renew_stamp`,`cp_billing_cycle`,`cp_status`,`cp_comments`,`cp_renewed_on`,`cp_stamp`,`aff_code`, `aff_last_paid`,`domain`,`ip`,`server`,`username`,`password`) VALUES(NULL,'$client_id','$pack_id','$price',NULL,'$domain_created', '$domain_expires','$bcycle','$cp_status',NULL,'$domain_created','$cp_stamp',NULL, NULL,NULL,NULL,NULL,NULL,NULL) ; $result = $db_mbill-query($sql); if (DB::isError($result)) { mylog(__FUNCTION__ . : .[MbillClientID: $client_id]: .sql was: $sql ); mylog(__FUNCTION__ . : .[MbillClientID: $client_id]: . $result-getMessage()); return false; }else{ mylog(__FUNCTION__ . : .[MbillClientID: $client_id]: .Successfully added pkg Domain Registration [$domain_name]); } Now here the log, again this does not happen systematically, often the code works... but when it does not, it s very weirdo : __FUNCTION__:[MbillClientID: 4135]:sql was: INSERT INTO `client_package` (`cp_id`,`client_id`,`pack_id`,`pack_price`,`parent_cp_id`,`cp_start_stamp`, `cp_renew_stamp`,`cp_billing_cycle`,`cp_status`,`cp_comments`,`cp_renewed_on`,`cp_stamp`,`aff_code`, [EMAIL PROTECTED]@[EMAIL PROTECTED] date or [EMAIL PROTECTED],`server`,`username`,`password`) VALUES(NULL,'4135','12','0',NULL,'1038200400', '1069736400','12','2','','1038200400','1065728768',NULL, [EMAIL PROTECTED]@[EMAIL PROTECTED] database [EMAIL PROTECTED]) __FUNCTION__:[MbillClientID: 4135]:DB Error: syntax error Any ideas? Mohamed~ On Fri, 2003-10-10 at 16:03, Burhan Khalid wrote: Mohamed Lrhazi wrote: I am using a PHP application called modernbill, which uses iocube encoder... PHP very frequently dies with SIG fault... 4.3 dies systematically While working on this problem I stumbled on this behavior : In my code, I have something like this: $table_customer=customer; $sql=select * from [$table_customer] where [id] = '$id' ; Try $sql = SELECT * FROM .$table_customer. WHERE id = '.$id.'; and see if you get the same error. If you are using MSSQL, I think that [ ] are optional, but I could be mistaken. [ snip ] -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Exec() wont run program
Where are you expecting gedit to appear? try with -display argument Also, try other commands, such as ls first. Mohamed~ On Fri, 2003-10-10 at 17:18, steve wrote: Curt Zirzow wrote: What is gedit? it looks like the gnu text editor command. most X applications wont run from the webserver in most cases. gedit is a simple text editor - I think it stands for Gnome Edit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Network Connectivity help please
Brian, Why don't leave the pinging to some other script, and have that other script run continuesouly and upfate a sql table with the ststus of each and time stamp of when it was last ping'ed...etc Mohamed~ Brian wrote: I'm writing a script to help us manage one of our Class C networks. The page loads all of the host IPs, who owns them, phys desc. of the box, and does a forward reverse lookup on all of the addresses. I'd like to add a column that shows which machines are currently reachable on the network. A simple ping would probably be easiest, but parsing a standard ping for 254 hosts would cause the script to have about a 10 minute load time. are there any quick easy, and most importly, low system overhead, solutions to this problem? Brian Artiaco [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Parse error with simple script
Hello All, I am sure this is simple, but I really cant figure it out by myself.. at least not tonight :) This simple script gives : Parse error: parse error in /var/www/html/test.php on line 2 # cat /var/www/html/test.php ?php $user = root ; echo hello $user; ? If I comment (//) line 2, it works and the hello shows up. If I replace the double quotes with single quotes, it gives the same parse error. I already tried overwritng my php.ini with the original one and also tried reinstalling the mod_php rpm. Thanks a lot for any hints. Mohamed~ I am using Linux Mandrake 8.0 with these rpms: rpm -qa|egrep php\|apache php-ldap-4.0.4pl1-6mdk apache-common-1.3.19-3mdk apache-modules-1.3.19-3mdk apache-mod_perl-1.3.19_1.25-3mdk apache-1.3.19-3mdk php-common-4.0.4pl1-6mdk apache-suexec-1.3.19-3mdk mod_php-4.0.4pl1-6mdk php-imap-4.0.4pl1-6mdk apache-conf-1.3.19-3mdk php-4.0.4pl1-6mdk apache-manual-1.3.19-3mdk php-gd-4.0.4pl1-6mdk php-readline-4.0.4pl1-6mdk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Parse error with simple script
Hi again, Ok, I wasnt that tired after all :) and had the belliant idea of loading my script in vi and lo and behold here is what I saw: $user| =| 'root' ; Nice, huh? This was generated by this cute editor called BlueFish.. no more bluefish for me. Mohamed~ Mohamed LRHAZI wrote: Hello All, I am sure this is simple, but I really cant figure it out by myself.. at least not tonight :) This simple script gives : Parse error: parse error in /var/www/html/test.php on line 2 # cat /var/www/html/test.php ?php $user = root ; echo hello $user; ? If I comment (//) line 2, it works and the hello shows up. If I replace the double quotes with single quotes, it gives the same parse error. I already tried overwritng my php.ini with the original one and also tried reinstalling the mod_php rpm. Thanks a lot for any hints. Mohamed~ I am using Linux Mandrake 8.0 with these rpms: rpm -qa|egrep php\|apache php-ldap-4.0.4pl1-6mdk apache-common-1.3.19-3mdk apache-modules-1.3.19-3mdk apache-mod_perl-1.3.19_1.25-3mdk apache-1.3.19-3mdk php-common-4.0.4pl1-6mdk apache-suexec-1.3.19-3mdk mod_php-4.0.4pl1-6mdk php-imap-4.0.4pl1-6mdk apache-conf-1.3.19-3mdk php-4.0.4pl1-6mdk apache-manual-1.3.19-3mdk php-gd-4.0.4pl1-6mdk php-readline-4.0.4pl1-6mdk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] group comparision
You might also want to check the xor logical op: http://www.php.net/manual/en/language.operators.logical.php Mohamed~ [EMAIL PROTECTED] wrote: i have a php script that has three variables that could be set to 1 depending on the values of a form being sent to the .php file. $add $remove $view i need to do some error control in my script to make certain that one and only one of these is set to 1. i am coming up with a very long control structure: if (($add=1) ($remove=1) || ($add=1) ($view=1) || etc...)) is there a shorter method to do this? and can i break this up onto multiple lines to make my code a bit cleaner? can i do something like: if ( ($add=1) ($remove=1) || ($add=1) ($view=1) || ($remove=1) ($view=1) ) { Thanks! -Charles -- ** There are two major products to come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Testing if variable was set
Jordan, http://www.php.net/manual/en/function.isset.php When you do: if ($var) you are saying if $var is boolean true which is not what you say you want: Hi, If I want to test if a variable exists (or has been passed) then I just do: Mohamed~ Jordan Elver wrote: Hi, If I want to test if a variable exists (or has been passed) then I just do: if($var) { // variable is here } But I've noticed that a lot of people do: if(isset($var)) { // variable is here } What's the difference and which is the best way? TIA, Jord -- Jordan Elver while (!asleep()) sheep++; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] today and yesterday (finding them)
Isnt it ? $yesterday = date("Y-m-d",mktime(0,0,0,date("m") ,date("d")-1,date("Y"))); Mohamed~ - Original Message - From: "Chuck Barnett" [EMAIL PROTECTED] To: "PHP General List" [EMAIL PROTECTED] Sent: Tuesday, January 30, 2001 11:10 PM Subject: [PHP] today and yesterday (finding them) $today = getdate(); $mon = $today[mon]; $mday = $today[mday]; $year = $today[year]; $text=sprintf("%s-%s-%s", $year, $mon, $mday); $date=$text; This code gets me today in the form -00-00 What do I need to do to get yesterday in that form? Thanks, Chuck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]