Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
need help with find and delet text on logs
Old 10-28-2010, 02:29 AM need help with find and delet text on logs
ZoC
Skilled Talker

Posts: 68
Trades: 0
hello there,
i need the commands php for logs to find text and delet text example (webmaster) ... hope someone can help me with this, thank you
ZoC is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-28-2010, 02:44 AM Re: need help with find and delet text on logs
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
So you are trying to delete part of a text file? Can you provide some more details? Does the file have a particular organization? How do you determine what needs to be deleted?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 10-28-2010, 03:03 AM Re: need help with find and delet text on logs
ZoC
Skilled Talker

Posts: 68
Trades: 0
i just make now the command to find ip on .txt

PHP Code:
// Find Text From Logs
 
function findText$log$ip_address )
 {
  
$fp  file_get_contents($log,NULL);
  if(
stristr($fp$ip_address) === FALSE) {
   echo 
'no';
  } else {
   echo 
'yes';
  }
  
fclose($fp);
 } 
but can you tell me the command how i can delet the ip from txt

thank you so much
ZoC is offline
Reply With Quote
View Public Profile
 
Old 10-28-2010, 03:27 AM Re: need help with find and delet text on logs
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Just read in the contents of the file, delete the ip (str_replace), then write the modified contents back to the file.

fopen
fwrite

Use the 'w' flag with fopen when writing to the file.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 10-28-2010, 03:47 AM Re: need help with find and delet text on logs
ZoC
Skilled Talker

Posts: 68
Trades: 0
can you please help me with this ... i try to make the command but is not working ... is deleting evryting from the log and is remaining just the ip what i need to delet lol ...


PHP Code:
// Delete Text From Logs
 
function deleteText$log$ip_address )
 {
  
$fp1 file($log);
  
$fp1 str_replace($ip_address''$fp1);
  
$fp2 fopen($log'w+') or die('ERROR: Open Delet Line');
  
fwrite($fp2,$fp1);
  
fclose($fp);
 } 
ZoC is offline
Reply With Quote
View Public Profile
 
Old 10-28-2010, 03:53 AM Re: need help with find and delet text on logs
ZoC
Skilled Talker

Posts: 68
Trades: 0
nvm i find the mistake thank you for the help
ZoC is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to need help with find and delet text on logs
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40954 seconds with 12 queries