[PHP] Get the date&time from server
Hi all, Can anyone teach me how to get the date and time from the web-server,it's not changed with the time of local machine. I found the date() cannot do this. Thank you! poetbox [EMAIL PROTECTED] 2003-06-05 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Get the date&time from server
CPT John W. Holmes,您好! Thank you very much,you're right!I've got it just now:-)Perhaps I tested it on localhost yesterday.This function is very good. === 2003-06-05 07:07:00 您在来信中写道:=== >> Can anyone teach me how to get the date >> and time from the web-server,it's not >> changed with the time of local machine. >> I found the date() cannot do this. > >That's exactly what date() does... the date and time from the server. Maybe >you're using it wrong. > >---John Holmes... > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = 致 礼! poetbox [EMAIL PROTECTED] 2003-06-19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to delete a line in a TXT-file
Hi all, I've been having trouble to delete a line from a TXT-file for days. The content of the text file just like below: ---begin==> 00145|test|line1 00255|test|line1 01143|test|line1 00469|test|line1 10146|test|line1 --<==end Every line begins with a random number.I read the file (named THIS.TXT) from a simple program just like this: ---begin==> $news=file("this.txt"); $num=count($news); echo ""; for($i=0;$i<$num;$i++) { $message=explode("|",$news[$i]); $id=$message[0]; $title=$message[1]; $time=$message[3]; $bgcol = (($i % 2) == 0) ? "CC": "EE"; echo "※ $title"; echo "DELETE THIS LINE";//HOW TO WRITE THIS LINE??HOW TO achieve the function? echo ""; } echo ""; --<==end # *The PROBLEM is:How to WRITE A FILE named del.php or WRITE A FUNCTION() to delete this line? My opinion is to read the content to a array and write any line but" $id=$id" line,but I delete all the content by this,what should I do? It's the first time I ask a question by the MAIL-LIST,my Enlish is poor,sorry. Thank you very much in advance. poetbox [EMAIL PROTECTED] 2003-06-03 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] How to delete a line in a TXT-file
Jason Wong,您好! Let me go back to have a try,thank you very much!:) Some people told me to use unset(mixed var [,mixed var [,...]]) to delete it ,but I cannot understand anything about it . === 2003-06-03 16:04:00 :=== >On Tuesday 03 June 2003 11:11, poetbox wrote: > >> I've been having trouble to delete a line from a TXT-file for days. >> The content of the text file just like below: >> ---begin==> >> 00145|test|line1 >> 00255|test|line1 >> 01143|test|line1 >> 00469|test|line1 >> 10146|test|line1 >> --<==end >> >> Every line begins with a random number.I read the file (named THIS.TXT) >> from a simple program just like this: >> >> ---begin==> >> $news=file("this.txt"); >> $num=count($news); >> >> echo "> bgColor=#efefef border=1>"; for($i=0;$i<$num;$i++) >> { >> $message=explode("|",$news[$i]); >> $id=$message[0]; >> $title=$message[1]; >> $time=$message[3]; >> $bgcol = (($i 2) == 0) ? "CC": "EE"; >> echo "※ > href=zcfgcont.php?id=$id>$title"; echo "DELETE >> THIS LINE";//HOW TO WRITE THIS LINE??HOW TO achieve the function? echo >> ""; >> } >> echo ""; >> --<==end >> # >> *The PROBLEM is:How to WRITE A FILE named del.php or WRITE A >> FUNCTION() to delete this line? My opinion is to read the content to a >> array and write any line but" $id=$id" line,but I delete all the content >> by this,what should I do? It's the first time I ask a question by the >> MAIL-LIST,my Enlish is poor,sorry. Thank you very much in advance. > > "... but I delete all the content by this" Why? > >In del.php you would read in the file using file() then write out any lines >not beginning with $id. So something like: > >$news=file("this.txt"); >$fp = fopen('outputfile', 'w'); >foreach ($news as $line) { > if (strpos($line, $_GET['id']) !== 0) { >fwrite($fp, $line); > } >} >fclose($fp); > >-- >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 >-- >/* >Rule of Creative Research: > (1) Never draw what you can copy. > (2) Never copy what you can trace. > (3) Never trace what you can cut out and paste down. >*/ > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = poetbox [EMAIL PROTECTED] 2003-06-03 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] How to delete a line in a TXT-file
Jason Wong,您好! As you know,I'm a newbie in PHP,I tried your way last night,but to my surprise,it do nothing for any way,it didn't delete any line in the TXT-file,even the file "outputfile.txt" indeed! Perhaps it because that I haven't understand your thought and absolutely copy your words to the program,but,can you give me more help? After I write "del.php" copy your words,I'v been trying to edit my manage file "edit.php" as follow: ---filename:edit.php> "; for($i=0;$i<$num;$i++){ echo "".$news[$i]."删除此行"; if($action!='del')[EMAIL PROTECTED]($fp,$news[$i]); } echo "ok"; fclose($fp);?> < I think this will work as my willings,but it not! It's troubling so long.I need more help. Thanks a lot,my friend! === 2003-06-03 16:04:00 you wrote:=== >On Tuesday 03 June 2003 11:11, poetbox wrote: > >> I've been having trouble to delete a line from a TXT-file for days. >> The content of the text file just like below: >> ---begin==> >> 00145|test|line1 >> 00255|test|line1 >> 01143|test|line1 >> 00469|test|line1 >> 10146|test|line1 >> --<==end >> >> Every line begins with a random number.I read the file (named THIS.TXT) >> from a simple program just like this: >> >> ---begin==> >> $news=file("this.txt"); >> $num=count($news); >> >> echo "> bgColor=#efefef border=1>"; for($i=0;$i<$num;$i++) >> { >> $message=explode("|",$news[$i]); >> $id=$message[0]; >> $title=$message[1]; >> $time=$message[3]; >> $bgcol = (($i 2) == 0) ? "CC": "EE"; >> echo "※ > href=zcfgcont.php?id=$id>$title"; echo "DELETE >> THIS LINE";//HOW TO WRITE THIS LINE??HOW TO achieve the function? echo >> ""; >> } >> echo ""; >> --<==end >> # >> *The PROBLEM is:How to WRITE A FILE named del.php or WRITE A >> FUNCTION() to delete this line? My opinion is to read the content to a >> array and write any line but" $id=$id" line,but I delete all the content >> by this,what should I do? It's the first time I ask a question by the >> MAIL-LIST,my Enlish is poor,sorry. Thank you very much in advance. > > "... but I delete all the content by this" Why? > >In del.php you would read in the file using file() then write out any lines >not beginning with $id. So something like: > >$news=file("this.txt"); >$fp = fopen('outputfile', 'w'); >foreach ($news as $line) { > if (strpos($line, $_GET['id']) !== 0) { >fwrite($fp, $line); > } >} >fclose($fp); > >-- >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 >-- >/* >Rule of Creative Research: > (1) Never draw what you can copy. > (2) Never copy what you can trace. > (3) Never trace what you can cut out and paste down. >*/ > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = poetbox [EMAIL PROTECTED] 2003-06-04 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] How to delete a line in a TXT-file
Jason Wong,您好! Thank you,Mr. Jason Wong,I think what you said is below.If not,tell me the right way,ok? =filename:edit.php===(still have ERRORs)=begin==> "; for($i=0;$i<$num;$i++) { echo "".$news[$i]." DELETE THIS LINE"; if(($action==del)&&($id!==$i)){ @fwrite($fp,$news[$i]); } } echo "ok"; fclose($fp);?> <end Is there any wrong above?Sorry,it do nothing again. A friend told me to use "UNSET" and I'v got it,here's the source code of another way. I'v got it from below source code,I'd like to share the code with you. Although I'v got it,to study more knowledge--on the other hand,I still like to discuss your way to got it. =filename:edit.php(This way is OK!)>begin "; for($i=0;$i<$num;$i++) { echo "".$news[$i]."DELETE THIS LINE"; } echo "ok"; if($action=='del') { unset($news[$line]); $news=implode("",$news); $fp=fopen('this.txt',"w"); fputs($fp,$news); } ?> <end === 2003-06-04 13:18:00 您在来信中写道:=== >On Wednesday 04 June 2003 08:36, poetbox wrote: > >> As you know,I'm a newbie in PHP,I tried your way last night,but to my >> surprise,it do nothing for any way,it didn't delete any line in the >> TXT-file,even the file "outputfile.txt" indeed! Perhaps it because that I >> haven't understand your thought and absolutely copy your words to the >> program,but,can you give me more help? After I write "del.php" copy your >> words,I'v been trying to edit my manage file "edit.php" as follow: > >The code that I gave should be in a separate file (del.php) and should NOT be >incorporated into edit.php as you have tried to do below. > >> ---filename:edit.php> >> > $news=file('this.txt'); >> $num=count($news); >> $fp=fopen('outputfile','w'); >> echo ""; >> for($i=0;$i<$num;$i++){ >> echo "".$news[$i]."> href=edit.php?action=del>删除此行"; >> if($action!='del')[EMAIL PROTECTED]($fp,$news[$i]); >> } >> echo "ok"; >> fclose($fp);?> >> < > >If you want to combine the functionality of edit.php and del.php into a single >page then the easiest way is to place this code at the beginning: > > if (isset($_GET['action']) && $_GET['action'] == 'del' && >!empty($_GET['id'])) { >$news=file("this.txt"); >$fp = fopen('outputfile', 'w'); >foreach ($news as $line) { > if (strpos($line, $_GET['id']) !== 0) { >fwrite($fp, $line); > } >} >fclose($fp); > } > >Then follow it with your original edit.php, BUT replace this link: > > DELETE THIS LINE > >with > > DELETE THIS LINE > >-- >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 >-- >/* >Billy: Mom, you know that vase you said was handed down from > generation to generation? >Mom: Yes? >Billy: Well, this generation dropped it. >*/ > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = 致 礼! poetbox [EMAIL PROTECTED] 2003-06-04 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hi I get some problems while using eregi_replace
hi,php-general,winst0n I'm from china,my English is not very good,too. Here's some example,perhaps it will help you a little. $post =str_replace("[b]","",$post); $post =str_replace("[/b]","",$post); $post = eregi_replace("\\[hr=([^\\[]*)\\]","",$post); $post=eregi_replace("\\[swf\\](.+\.swf)\\[/swf\\]","http://www.macromedia.com/shockwave/download/indexcgi?P1_Prod_Version=ShockwaveFlash\"; type=\"application/x-shockwave-flash\" width=\"580\" height=\"400\"> 左键全屏观赏",$post); poetbox [EMAIL PROTECTED] 2003-06-09 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to start?
hi, Simon Thurtle! " www.php.net " is the best on-line resource on the web. === 2003-06-05 13:36:00 you wrote:=== >Hi all, >I am looking into learning PHP, I have a good understanding of HTML, JS and >I know a little Perl. Firstly I know PHP is all server side and so a damn >sight different from the above, but will they help me at all? >Secondly where do I start? Are there any good on-line resources and or books >that anyone knows? I am plannig to develop an E-comm solution us Oscommerce, >does anyone know if this is any good or is naff? >Any hints, tips or pointers would be greatly appreciated. > >Thanks, > >Simon > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = Thanks for any suggestions. poetbox [EMAIL PROTECTED] 2003-06-09 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re:[PHP] Re: What program do you use to Create PHP Application?
hi, fongming£¡ What about HTML-KIT? === 2003-05-28 00:12:00 you wrote£º=== >Yes, I also use PHPEd to program, >I've been using it's free verison until now. > >I've been search another better, but PHPEd >is the best for me after all. > >Fongming from Taiwan. > > >>PHPEd is absolutely fantastic >> >>It colours everything so you don't forget to close >brackets or quotes and >>helps you keep an eye on escaped chars. >> >>I think you have to pay for it now though. >>Shame. > >"Grant" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> What program do you use to Create PHP Application? I am tired of doing >this >> in notepad or other editor and Front page. >> >> >> > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > > > >--- >Fongming from Taiwan. > > >-- >¡»From: ¦¹«H¬O¥Ñ®ç¤p¹q¤l¶l¥ó1.5ª©©Òµo¥X... >http://fonn.fongming.idv.tw >[EMAIL PROTECTED] > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = poetbox [EMAIL PROTECTED] 2003-06-09 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re:[PHP] Re: What program do you use to Create PHP Application?
hi, fongming£¡ poetbox,this is the test11abcccff === 2003-05-28 00:12:00 you wrote£º=== >Yes, I also use PHPEd to program, >I've been using it's free verison until now. > >I've been search another better, but PHPEd >is the best for me after all. > >Fongming from Taiwan. > > >>PHPEd is absolutely fantastic >> >>It colours everything so you don't forget to close >brackets or quotes and >>helps you keep an eye on escaped chars. >> >>I think you have to pay for it now though. >>Shame. > >"Grant" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> What program do you use to Create PHP Application? I am tired of doing >this >> in notepad or other editor and Front page. >> >> >> > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > > > >--- >Fongming from Taiwan. > > >-- >¡»From: ¦¹«H¬O¥Ñ®ç¤p¹q¤l¶l¥ó1.5ª©©Òµo¥X... >http://fonn.fongming.idv.tw >[EMAIL PROTECTED] > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = ¡¡Thanks for any suggestions. poetbox [EMAIL PROTECTED] 2003-06-09 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to get the date of this Saturday all the time?
hi,php-general£¬ We have a meeting at every Saturday,I'd like to post the news and write the date of this Saturday every week,how can I get the date of Saturday. For example,today is Monday, and today is 2003-23-06,I'd like to get the Saturday date "2003-28-06" ;If today is Friday on "2003-16-08",I'd like to get the date of "2003-17-08",the date is a var got by a special function,How to WRITE THE FUNCTION? Any thoughts or suggestions would be greatly appreciated!Thanks in advance. poetbox [EMAIL PROTECTED] 2003-06-25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] how to get the date of this Saturday all the time?
hi, Jennifer Goodie£¡ How quickly you are! Thank you,I'm testting now:) === 2003-06-24 17:20:00 you wrote£º=== >> We have a meeting at every Saturday,I'd like to post the >> news and write the date of this Saturday every week,how can I get >> the date of Saturday. > > >This has not been tested, there might be a bug. >function get_sat_ts($timestamp){ > $dow = date("w",$timestamp); > $days_to_add = 6 - $dow; > $ts_sat = mktime >(0,0,0,date("m",$timestamp),date("d",$timestamp)+$days_to_add,date("y",$time >stamp)); > return ($ts_sat); >} >$ts = get_sat_ts(time()); >echo date("Y-d-m",$ts); >?> > >Something like that should be what you want though. > > > >. = = = = = = = = = = = = = = = = = = = = ¡¡Thanks for your kindness. poetbox [EMAIL PROTECTED] 2003-06-25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] how to get the date of this Saturday all the time?
hi, James Hicks£¡ I got "1970-01-01"! Perhaps you missing give me the function strtotime(). Hi,Jennifer Goodie, Your function is very perfect!Thank you very much,I tested it and succeed! BTW,Can you pro it in another way? I say,I got "2003-28-06",but I like "2003-28-6",needn't the "0" before the month,is it difficult?If not,I'd like you to give me another function without '0' before the month! Thank you! === 2003-06-24 20:36:00 you wrote£º=== >How about > >date("Y-m-d",strtotime("next Saturday")); > >James Hicks > > >On Tuesday 24 June 2003 08:01 pm, poetbox wrote: >> hi,php-general£¬ >> >> We have a meeting at every Saturday,I'd like to post the news and >> write the date of this Saturday every week,how can I get the date of >> Saturday. For example,today is Monday, and today is 2003-23-06,I'd like >> to get the Saturday date "2003-28-06" ;If today is Friday on >> "2003-16-08",I'd like to get the date of "2003-17-08",the date is a var got >> by a special function,How to WRITE THE FUNCTION? Any thoughts or >> suggestions would be greatly appreciated!Thanks in advance. >> >> >> ¡¡¡¡poetbox >> [EMAIL PROTECTED] >> 2003-06-25 > >. = = = = = = = = = = = = = = = = = = = = ¡¡Thanks for your kindness. poetbox [EMAIL PROTECTED] 2003-06-25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] how to get the date of this Saturday all the time?
hi, Joseph Szobody£¡ THank you!I can only use "Jennifer Goodie"'s way because as james said,my server is to old to allow the function of "strtotime()"! Thank you by any way! === 2003-06-24 22:17:00 you wrote£º=== >> date("Y-m-d",strtotime("next Saturday")); > >That would give the Saturday for next week (2003-07-05). Try "this Saturday" or just >"Saturday". > >date("Y-m-d",strtotime("this Saturday")); // Currently returns 2003-06-28 > >Joseph > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > >. = = = = = = = = = = = = = = = = = = = = ¡¡Thanks for your kindness. poetbox [EMAIL PROTECTED] 2003-06-25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] free web host needed.
hi, Joel Rees£¡ " lycos " can do,and you can write a program to delete the ad! === 2003-06-25 11:50:00 you wrote£º=== >> >Joel Rees, programmer, Kansai Systems Group >Altech Corporation (Alpsgiken), Osaka, Japan >http://www.alpsgiken.co.jp > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = ¡¡Thanks for your kindness. poetbox [EMAIL PROTECTED] 2003-06-25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help please!
hi, Nadim Attari£¡ Well it doesn't... I have to send it as a mail to [EMAIL PROTECTED], then it works... If I click on the thread and try to "Reply to Group", it doesn't work !!! We always send the mail to [EMAIL PROTECTED], and not using "reply to group" function,I think there's no easy way to do this.If you really have problems with PHP,sending mail is not the important thing,the more important thing is to get a good reply!Sorry,it's my own opinion:) === 2003-06-25 15:17:00 you wrote£º=== >> hmm, well this post is here twice. so it works better than you thought? ;-) > >Well it doesn't... I have to send it as a mail to [EMAIL PROTECTED], then it works... >If I click on the thread and try to "Reply to Group", it doesn't work !!! > >Anyway I can send my post now... and special thanks goes to Edward Dudlik (Becoming >Digital). > >Nadim Attari >http://www.alienworkers.com = = = = = = = = = = = = = = = = = = = = ¡¡Thanks for your kindness. poetbox [EMAIL PROTECTED] 2003-06-26 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php