Re: comparing strings values, etc.

From: Date: Sun, 03 Mar 2002 10:58:33 +0000
Subject: Re: comparing strings values, etc.
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-80634@lists.php.net to get a copy of this message
Hello Tim, you should be writing to the php-general@lists.php.net mailinglist. This list is fro developing PHP, not for developing _with_ PHP. regards, Derick On Sun, 3 Mar 2002, Tim Martens wrote: > Hi - I'm a major newbie. > > - I have a file that pulls an include into a <textarea> for a user to edit > - before pulling the include, I'd like to open it and check it's value > - if the include's value is exactly equal to the string: > <div style='color: #eee; font: bold 80px Georgia, serif'>Hello > World</div> > then I want to overwrite that string with nothing; close the include; and > then load it (now null) into the textarea > - else, if the include's value is not equal to the above string, just load > it into the <textarea> > > However embarrassing, I'll give what I have which hasn't been working > > $noting = ""; > $checkval = "<div style='color: #F00; font: bold 80px Georgia, > serif'>Hello > World</div>"; > $filename = "thefile.inc"; > > $fd = fopen ($filename, "w"); > $contents = fread ($fd, filesize ($filename)); > if ($contents == fread ($checkval)) { > fwrite ($filename, $nothing); > fclose ($fd); > include($filename); > } else { > fclose ($fd); > include($filename); > } > clearstatcache(); //for the next time around? > > Also - does thefile.inc have to be CHMOD 666? > BTW - the server is running PHP4/Apache. > > thx //t > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.dev (#80634) next »