php-general Digest 18 Aug 2003 09:19:10 -0000 Issue 2243 Topics (messages 159863 through 159900):
Re: Discussion: do you consider null a value or strictly a type? 159863 by: Curt Zirzow 159867 by: Greg Beaver Re: Efficient structure 159864 by: Curt Zirzow Re: shell_exec 159865 by: Curt Zirzow Re: Semi-Newbie question about arrays 159866 by: Curt Zirzow DATE insertion 159868 by: Cesar Aracena 159880 by: John W. Holmes Newbie Question regarding Syntax 159869 by: Creative Solutions New Media 159871 by: Cesar Aracena 159872 by: Curt Zirzow 159873 by: Creative Solutions New Media 159874 by: Curt Zirzow 159876 by: Creative Solutions New Media Re: Nestled 'while's or 'for's or 'foreach's -- I'm lost 159870 by: Curt Zirzow test - please ignore 159875 by: Wouter van Vliet Re: preg_replace question 159877 by: Jean-Christian IMbeault "Form Feeds" within a HTML table 159878 by: Todd Cary 159881 by: John W. Holmes Re: Validate The Last Day of Month with server's clock???? 159879 by: Ralph Guzman Re: indexing a folder 159882 by: Mike Migurski Re: Category and sub-category logic 159883 by: Ralph Guzman get current path 159884 by: Tim Thorburn 159886 by: Mike Migurski comparing xml files, removing some html tags 159885 by: Robert Mena How do they do that? 159887 by: John Taylor-Johnston 159888 by: David Otton Got failed while calling strtotime(). 159889 by: Larry_Li.contractor.amat.com 159890 by: Curt Zirzow 159891 by: Larry_Li.contractor.amat.com 159892 by: Curt Zirzow Cannot output before input 159893 by: Chris Lee 159894 by: Curt Zirzow Re: Cache Question 159895 by: Josh Whiting problem with fsockopen ............ 159896 by: fongming 159898 by: cyz session.cookie_path problem 159897 by: Binay Agarwal Problem in sending mail 159899 by: murugesan 159900 by: murugesan Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message ---* Thus wrote Robert Cummings ([EMAIL PROTECTED]): > > Now the point of the discussion is not to indicate who is right or who > is wrong -- that would appear to be a ridiculous argument. I am more > interested in finding out the practices and experience of PHP > developers. I'd like to know how many people treat null as a value, and > how many do not. For instance to you ever assign default values of null > to instance variables, or local variable, or array entries? I know in > practice that I have, and find it quite convenient to represent a > default value. I've never used null as a value. Basically I just use '' as a null value, which changes some logic I used vs. other languages. for instance, take these values (or non values): false, 0, '', "", null if each is seperaly assigned to a variable the expression always yields the same: if ( $var) { } Which is why, I assume, the === operater was born. Although I've only used that operater maybe once or twice, because I have been used to having my logic not rely on the type of data that is stored. This also leads me to believe that the statement: if ($var === null) {} would be considered illegal or fail no matter what since null is not a value and has no type associated with it. Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
Curt Zirzow wrote:
This also leads me to believe that the statement:
if ($var === null) {}
would be considered illegal or fail no matter what since null is not a value and has no type associated with it.
Of course, it doesn't fail, because null is a value:
<?php $a = null; var_dump($a === null); ?>
Try that. you get "true"
null is a value that represents nothingness, kind of a variable equivalent of the number 0. I know there's been lots of blather about whether null is a value on an intellectual level, but if it wasn't a value, you couldn't assign it to a variable. That's how programming languages work. int is a type, for example. You can't do this:
$a = int;
You can do:
$a = (int) $b;
null is not a type. You can do:
$a = null;
but can't do:
$a = (null) $b;
You have to use the type unset:
$a = (unset) $b;
So, null is a value of type unset in the way that PHP has been designed. The odd thing is that unset() can't be used to create a variable of type unset, the way array() is used to create a variable of type array - this is the only inconsistency.
<?php $a = null; var_dump(is_null($a)); // doesn't throw a warning unset($a); var_dump(is_null($a)); // throws a warning ?>
It doesn't matter much what people think about it, PHP has implemented null as a value, and I actually find that quite useful. It helps to represent the difference between 0 and '' and NULL returned from a database query (yes, mysql supports all three), and also is useful in specifying default values for parameters to a function that can also accept boolean false.
Greg
--- End Message ---
--- Begin Message ---* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > I have multiple types of information to associate to one object. I have > data structures that store data structures. What is the best/most efficient > way to structure the data? A multi-dimensional array? A container object? > > Please Advise... It depends on the application you need to use the object. Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---* Thus wrote John ([EMAIL PROTECTED]): > > I know the perl script executes because a basic print statement in the > perl script is outputted to /tmp/error. However anything else in the > script not having to do with output is not executed. The perl script is > basically supposed to add a file. That is it. The perl script is fine > from command line. All paths are correct and like I said I do not care > about output to the browser for the user. My questions is why does the > perl script execute (and mostly work) but not execute certain pieces of > code when executed from my php page. The odds are that the perl script is running the code. The problem most likely is permissions. The web server generally (and should be) running as a different user. The user has very little permissions to the file system by default. You'll have to fix the permissions on the directoy that the perl script is trying to modify. Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---* Thus wrote Gremillion ([EMAIL PROTECTED]): > $recNum = $lastPart; > $ord++; > $updateEntries[$ord] = $recNum; > } > $updateEntries[$ord][] = array($first, $value); > //populate nested arrays of each entry > etc...... > > throws: > "PHP Fatal error: [] operator not supported for strings" > > How do I make $updateEntries[$ord] evaluate as an array? You'll have to add a little more structure to the array. Mabey something like: $updateEntries[$ord]['recNum'] = $recNum; $updateEntries[$ord]['values'] = array($first, $value); or $updateEntries[$ord][$recNum] = array($first, $value); Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---Hi all, First of all, thanks to everyone who helped me with the "checkbox" issue. I have an issue here while trying to INSERT INTO a MySQL table a date in a DATE format (YYYY-MM-DD). Obviously saying date(Y,m,d) doesn't work. What PHP function should I use? Thanks in advanced, Cesar Aracena www.icaam.com.ar Note: The information inside this message and also in the attached files might be confidential. If you are not the desired receptor or the person responsible of delivering the message, we notify you that it's copy, distribution, keep or illegal use of the information it has it's prohibited. Therefore we ask you to notify the sender by replying this message immediately and then delete it from your computer.
--- End Message ---
--- Begin Message --- Cesar Aracena wrote:Hi all,
First of all, thanks to everyone who helped me with the "checkbox" issue. I have an issue here while trying to INSERT INTO a MySQL table a date in a DATE format (YYYY-MM-DD). Obviously saying date(Y,m,d) doesn't work.
What PHP function should I use?
date('Ymd') to put it in a YYYYMMDD format. If you want to use date('Y-m-d') then you need to enclose the date string in quotes in your query.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---<?php echo 'Email: '.'<A HREF="mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].'</A>'; ?> Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? Thx Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498
--- End Message ---
--- Begin Message ---I would encourage you to use double quotes instead of single quotes inside the PHP code. After this, you must comment HTML double quotes so the PHP engine does not consider these as part of its code. I would type your example like this: <?php echo "Email: <a href=\"mailto:[EMAIL PROTECTED]">".$row_rep_RS['repEmail']."</a>"; ?> Note how the only concatenated string (using periods) is the variable $row_rep_RS[] and the double quotes inside the HTML link were commented using a backslash. HTH, Cesar Aracena www.icaam.com.ar > -----Mensaje original----- > De: Creative Solutions New Media [mailto:[EMAIL PROTECTED] > Enviado el: Domingo, 17 de Agosto de 2003 08:08 p.m. > Para: [EMAIL PROTECTED] > Asunto: [PHP] Newbie Question regarding Syntax > > <?php echo 'Email: '.'<A > HREF="mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].'</A>'; ?> > > Obviously this isn't working. What is the proper syntax when you have to > use > double quotes inside the tag? > > Thx > > Tim Winters > Manager, Creative Development > Sampling Technologies Incorporated (STI) > [EMAIL PROTECTED] > [EMAIL PROTECTED] > W: 902 450 5500 > C: 902 430 8498 > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---* Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > <?php echo 'Email: '.'<A > HREF="mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].'</A>'; ?> > > Obviously this isn't working. What is the proper syntax when you have to use > double quotes inside the tag? I usually prefer this method, its a style choice and others might argue using it.: Email: <a href="mailto:[EMAIL PROTECTED]"> <?php echo $row_rep_RS['repEmail']; ?></a> A lot easier/cleaner than to trying to concat and escape everything. Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---Sorry guys.....It think there is a bit of confusion. I miss typed what I need to do..... $row_rep_RS['repEmail'] is actually the email address I want to turn into a link. So I guess it would look something like..... <?php echo 'Email: '.'<A HREF=mailto:'.$row_rep_RS['repEmail'].'>'.$row_rep_RS['repEmail'].'</A>'; ?> Whew....think I made a mess of that!!!! Is that any more clear? Thanks for the very quick responses guys!!!!! Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -----Original Message----- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > <?php echo 'Email: '.'<A > HREF="mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].'</A>'; ?> > > Obviously this isn't working. What is the proper syntax when you have to use > double quotes inside the tag? I usually prefer this method, its a style choice and others might argue using it.: Email: <a href="mailto:[EMAIL PROTECTED]"> <?php echo $row_rep_RS['repEmail']; ?></a> A lot easier/cleaner than to trying to concat and escape everything. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---* Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > Sorry guys.....It think there is a bit of confusion. > > I miss typed what I need to do..... > > > <?php echo 'Email: '.'<A > HREF=mailto:'.$row_rep_RS['repEmail'].'>'.$row_rep_RS['repEmail'].'</A>'; ?> You should make sure to quote your html values ( href="value" ), it will lead to trouble if you don't. I would still do it like this: Email: <a href="mailto:<?php echo $row_rep_RS['repEmail']?>"> <?php echo $row_rep_RS['repEmail']?></a> Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---Thank you Curt. Works great and your right I makes more sense to do it that way. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -----Original Message----- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:45 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > Sorry guys.....It think there is a bit of confusion. > > I miss typed what I need to do..... > > > <?php echo 'Email: '.'<A > HREF=mailto:'.$row_rep_RS['repEmail'].'>'.$row_rep_RS['repEmail'].'</A>'; ?> You should make sure to quote your html values ( href="value" ), it will lead to trouble if you don't. I would still do it like this: Email: <a href="mailto:<?php echo $row_rep_RS['repEmail']?>"> <?php echo $row_rep_RS['repEmail']?></a> Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---* Thus wrote Verdon vaillancourt ([EMAIL PROTECTED]): > Hi, somewhat newbie warning :) > > I'm trying to take a paged result set and divide it into two chunks for > displaying on the page. Basically making something that looks like a typical > thumbnail gallery. I'm limiting my result set to 6 records and want to > display it as 2 rows of 3 cells with a record in each cell. I've had no > trouble getting my result set, paging etc. I'm not having much luck This can easily be done using the mod operator (%): $cols_per_page = 3; $cols_per_page_break = $cols_per_page - 1; // just to speed the loop echo "<table>"; echo "<tr><th>Col Headings....</th></tr>"; $counter = 0; while($row = db_fetch_row() ) { $new_row = $counter++ % $cols_per_page; if ($new_row == 0 ) { echo "<tr>"; // open a row } echo "<td>Col Data</td>"; if ($new_row == $cols_per_page_break ) { // close and open a row print "</tr>"; } } // Make sure the row was closed in case of uneven recordset. if ( ( ($counter - 1) % $cols_per_page) != $cols_per_page_break ) { // close and open a row // cause we didn't close it in the loop print "</tr>"; } echo "</table>"; //close row and table um.. ok, so it wasnt that easy.. I made this a little more complicated than I was expecting it to be. btw, this is completely untested. Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---I'm just testing if this list accepts text attachments .. would be much easier for code exchange and stuff...
--- End Message ---
--- Begin Message ---[EMAIL PROTECTED] wrote: > Then use a simple strstr to first find out if the string does contain > mydomain.com :-) My example was a simple one. I can't just check to see if the string contains the mydomain.com first because I am not passing a string to preg_replace but a whole text file. I want preg_replace to replace all occurrences in the text file of the regexp: "#<a href=(\"|')http://([^\"']+)(\"|')#ime" But only if the regexp doesn't contain http://www.mydomain.com. How can I get preg_replace to ignore instances of http://www.mydomain.com when it is doing it's global search and replace? Thanks, Jean-Christian Imbeault
--- End Message ---
--- Begin Message ---
I am creating a "report" that the user can download and it is a HTML table. Is there a way to put Page Breaks within the report so if the user prints it, it will page break a predefined places?
Todd.
--
<<inline: NewLogo.gif>>
--- End Message ---
--- Begin Message --- Todd Cary wrote:
I am creating a "report" that the user can download and it is a HTML table. Is there a way to put Page Breaks within the report so if the user prints it, it will page break a predefined places?
Use CSS.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---<?php // check last day of september $month = '08'; $year = date("Y"); $last_day = date("t", mktime (0,0,0, $month,1,$year)); print $last_day; ?> -----Original Message----- From: Scott Fletcher [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 12:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Validate The Last Day of Month with server's clock???? Hi! Here's a trick script. We know that some months have the last day which is 30 while other is 31. As for February, it can be either 28 or 29. So, what's the trick in using the php to find out what is the last day of the month if you want to checked it against the server's clock to find out the last day of the month. Suppose it is this month or 3 months ago or 3 months from now. Anyone know? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message --->> Thanks, but is this also possible for directories not on my server? Or >> can i just use these functions? > >Missed that bit, sorry. If the directory is not on your server, then you >need to go through FTP. or SSH, or HTTP, or one of the other innumerable ways to get information from one machine to another. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---Read this article: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17 /4047/index.html It explains the 4 different methods that you can use when working with hierarchical data. -----Original Message----- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 3:21 PM To: [EMAIL PROTECTED] Subject: [PHP] Category and sub-category logic Hi, I am thinking of making a program for personal use which does a very simple thing, just displays listings under categories, eg: under main category "Auto" there would be "cars","bikes" etc under "banking" there would be "financing","loans" etc (I as admin create master and sub-categories) then if you click on "cars" you would either see a sub category or all the listings there I have never done a project like this so am a bit confused but I am pretty sure quite a few of you must have done this because its a bit common on the net and while I am kind of new to php, most of you guys are fossils :-D So far the logic I have worked out is: Create a "master_category" table for the main categories, a "child_table" for the subs, a "the_listings" table for the details which will have a reference (number or word) field which will be to keep a reference as to which category/sub-category it belongs to.. Tell me if my logic is wrong or I missed anything The part where I am confused is, on the front page (say index.php) how do I display all the categories and sub categories in the correct order? eg: Auto --Cars --Bikes Banking --Finances --Loans Women --Boring but REALLY good looking --Great fun but not-so-good-looking Any ideas? I searched hotscripts and google but found crappy programs like phpyellow and zclassifieds which are really no good to me. If you know of something that already does the above kindly share it with me. Thanks, -Ryan ------------------- ----------------- The government announced today that it is changing it's emblem to a condom because it more clearly reflects the government's political stance. A condom stands up to inflation, halts production, destroys the next generation, protects a bunch of pricks, and gives you a sense of security while you're actually getting screwed. ------------------- ----------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message --- Hi,
The PHP site seems to be down right now ... so here's the question: Is it possible for PHP to tell me the current path of a page? For example: www.whatever.com/this/page.php - I'd like PHP to return /this/page.php ... is that possible and if so, how so?
TIA -Tim
--- End Message ---
--- Begin Message --->The PHP site seems to be down right now ... so here's the question: Is >it possible for PHP to tell me the current path of a page? For example: >www.whatever.com/this/page.php - I'd like PHP to return /this/page.php >... is that possible and if so, how so? PHP site looks up to me, though I have been having intermittent difficulties recently with one of the servers - us4 I think. To get the current path of the page or other webserver-related environmental informatio, check the contents of the $_SERVER superglobal and all will be revealed. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---Hi, I need to compare two XML files in order to find if they are "similar", i.e their DOM tree have the same structure. The ideia is to use Xerces to balance HTML files in order to create Xhtml and then compare. To make things a little easier for Xerces I am considering to remove some elements that do not make diference for my similarity point of view, for example, <script></script> tags, before calling xerces. So I was wondering which regular expression should I use to remove the <script>content</script> and so on... regards. __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
--- End Message ---
--- Begin Message ---I was wondering. http://www.php.net/date gives me/redirects to: http://www.php.net/manual/en/function.date.php How do they do that? What $_post[??] is that? Or is it a sevrer (Apache, I suppose?) thing? -- John
--- End Message ---
--- Begin Message ---On Sun, 17 Aug 2003 23:13:24 -0400, you wrote: >I was wondering. >http://www.php.net/date >gives me/redirects to: >http://www.php.net/manual/en/function.date.php > >How do they do that? >What $_post[??] is that? Or is it a sevrer (Apache, I suppose?) thing? I don't know how php.net does it, but I know how I'd approach it - either a custom 404 handler which examines the incoming URL and redirects to the appropriate page, or mod_rewrite. See http://httpd.apache.org/docs-2.1/mod/core.html#errordocument and http://httpd.apache.org/docs/mod/mod_rewrite.html
--- End Message ---
--- Begin Message ---I moved website from NT to W2K and got problem of date conversion. I'm using MS SQL Server. In SQL Server, the data looks like "06/09/03". I got "06 9 2003 12:00AM" in W2K and "Jun 9 2003 12:00AM" in NT. strtotime() works ok on NT, but return -1 on W2K. Any ideas? Thanks a lot! Larry
--- End Message ---
--- Begin Message ---* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > I moved website from NT to W2K and got problem of date conversion. I'm > using MS SQL Server. In SQL Server, the data looks like "06/09/03". I got > "06 9 2003 12:00AM" in W2K and "Jun 9 2003 12:00AM" in NT. strtotime() > works ok on NT, but return -1 on W2K. > > Any ideas? Thanks a lot! > "06 9 2003 12:00AM" is not a valid date string. see: http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---I knew it's incorrect format. But why string from NT is correct? I don't want to change source codes on website migration. ----------------------------------------------------------------------------------------------------------------------- To: [EMAIL PROTECTED] cc: Curt Zirzow Subject: Re: [PHP] Got failed while calling strtotime(). <[EMAIL PROTECTED]> 08/18/03 11:45 AM * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > I moved website from NT to W2K and got problem of date conversion. I'm > using MS SQL Server. In SQL Server, the data looks like "06/09/03". I got > "06 9 2003 12:00AM" in W2K and "Jun 9 2003 12:00AM" in NT. strtotime() > works ok on NT, but return -1 on W2K. > > Any ideas? Thanks a lot! > "06 9 2003 12:00AM" is not a valid date string. see: http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > > I knew it's incorrect format. But why string from NT is correct? I don't > want to change source codes on website migration. when you say you got ("06 9 2003 12:00AM" in W2K and "Jun 9 2003 12:00AM" in NT) how are you getting that value? > > > * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > > I moved website from NT to W2K and got problem of date conversion. I'm > > using MS SQL Server. In SQL Server, the data looks like "06/09/03". I got > > "06 9 2003 12:00AM" in W2K and "Jun 9 2003 12:00AM" in NT. strtotime() > > works ok on NT, but return -1 on W2K. > > > > Any ideas? Thanks a lot! > > > > "06 9 2003 12:00AM" is not a valid date string. > Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---Hi All, I run the following program at Windows command prompt c:\php\cli\php.exe input.php <?php print "Input:"; flush(); $fp = fopen("php://stdin", "r"); $input = fgets($fp); fclose($fp); echo $input; ?> The program did not show out "Input:" and waiting for input after run! Any hint to flush the output first? I am using PHP 4.3.2 (cli) (built: May 28 2003 15:10:38) Regards, Chris Lee
--- End Message ---
--- Begin Message ---* Thus wrote Chris Lee ([EMAIL PROTECTED]): > Hi All, > > I run the following program at Windows command prompt > > c:\php\cli\php.exe input.php > > <?php > print "Input:"; > flush(); use ob_flush() instead. Curt -- "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message --- this is off the topic of caching, but is related and could have an impact on the issue: using a .php instead of a .mp3 would seem like a good idea, but this ties into a problem i'm having right now with streaming mp3s using, in my case, the flash player plugin to stream and play the file. it would seem that there is a *distinct difference* between making a direct file request and making a request for a php file that sends the same data. this perhaps has something to do with the way apache/php handles the request? I can't come up with any other explanation, and i'm not an expert on the behind-the-scenes end the server-side applications. heres the unexplained difference: when directly requesting an .mp3 file, the app (flash plugin) works fine. when requesting a .php file that reads and sends the data from a file, things still work but the plugin/browser cannot interrupt the operation until the full file is downloaded - i.e., you can't click a link in the page and go somewhere else until the stream is completely downloaded and the php script is complete. the browser just sits there with its icon spinning until all is finished, no links work until then. its very weird. i am doing this just by using a fread() to a file handle and echoing the result. any explanations, or enlightened thoughts on 1) why this happens, and 2) how it could impact the differece between a direct .mp3 embed and a .php embed?
josh whiting
Ivo Fokkema wrote:Hi Tony,
Chris explained a lot about this... I'm not an expert on this, but you might want to give a try to embed something like :
"<embed src='mp3.php?mp3=filename' autostart=true>";
And then let mp3.php send all of the no-cache headers together with the contents of the filename.mp3.
It might work, I would give it a try...
HTH,
-- Ivo
--- End Message ---
--- Begin Message ---Hi,Sir: Can I block cookies when I ftput headers ? following is my fsockopen() scripts, but it always send back "cookies"..... Is there any way to prevent from it ? thanks ------------------------------------------------- $fp = fsockopen ("XXX.XXX.XXX.XXX", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n";} else { fputs ($fp, "GET /index.php HTTP/1.0\r\"); fputs($fp,"Host: XXX.XXX.XXX.XXX\r\n"); fputs($fp,"Pragma: no-cache\r\n"); fputs($fp,"Connection: close\r\n\r\n"); } fclose ($fp); ----------------------------------- Fongming from Taiwan. ------------------------------------------ ◆From: 此信是由桃小電子郵件1.5版所發出... http://fonn.fongming.idv.tw [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---If you want to block the http headers sent back by the web server,use fopen() instead. > -----Original Message----- > From: fongming [mailto:[EMAIL PROTECTED] > Sent: Monday, August 18, 2003 11:29 PM > To: [EMAIL PROTECTED] > Subject: [PHP] problem with fsockopen ............ > > > Hi,Sir: > > Can I block cookies when I ftput headers ? > following is my fsockopen() scripts, > but it always send back "cookies"..... > Is there any way to prevent from it ? > thanks > ------------------------------------------------- > > $fp = fsockopen ("XXX.XXX.XXX.XXX", 80, $errno, $errstr, 30); > if (!$fp) { echo "$errstr ($errno)<br>\n";} > else > { > fputs ($fp, "GET /index.php HTTP/1.0\r\"); > fputs($fp,"Host: XXX.XXX.XXX.XXX\r\n"); > fputs($fp,"Pragma: no-cache\r\n"); > fputs($fp,"Connection: close\r\n\r\n"); > } > > fclose ($fp); > > ----------------------------------- > Fongming from Taiwan. > > > ------------------------------------------ > 』From: ???パ?????ン1.5?┮??... > http://fonn.fongming.idv.tw > [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >
--- End Message ---
--- Begin Message ---Hi everybody I am having problem with session.cookie_path. By deafult path is "/". But what i think it should be client side path.. right?? In case client is win2k where does this cookie get saved.Any idea? Binay
--- End Message ---
--- Begin Message ---Hello all, [snip] $subject="Welcome"; $from = "MIME-Version: 1.0\r\n"; $from .= "Content-type: text/html; charset=iso-8859-1\r\n"; $from .= "From: <[EMAIL PROTECTED]>\r\n"; $subject="Welcome"; mail($mailid,$subject,$message1,$from); But I am not able to send the message. Eve n I checked mail return type. It is also working well. But I am not recieveing mail. Any ideas? -Murugesan
--- End Message ---
--- Begin Message ---Hello all, [snip] $subject="Welcome"; $from = "MIME-Version: 1.0\r\n"; $from .= "Content-type: text/html; charset=iso-8859-1\r\n"; $from .= "From: <[EMAIL PROTECTED]>\r\n"; $subject="Welcome"; mail($mailid,$subject,$message1,$from); But I am not able to send the message. Eve n I checked mail return type. It is also working well. But I am not recieveing mail. Any ideas? -Murugesan
--- End Message ---