Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How To Delete Single Email Adres From Text File


I have a textfile:

bla@domain.com
blabla@domain2.com
haha@domain.com
la@domain3.com
zaza@domain4.com

How can I delete a single email from that text file ? E.g. I want to delete blabla@domain2.com so that the textfile will be:

bla@domain.com
haha@domain.com
la@domain3.com
zaza@domain4.com

How can this be done ??




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Echo A Single, Specific Line From A Text File
How do I echo a single, specific line from a text file?  Let's say, for example, the second line?

How To Delete A Single Field?
I have a database with ten fields for image paths, [imgpath1] [imgpath2] etc. I would like to make a delete button to delete these individually if needed and just have no idea where to start - what is the typical method of deleting just ONE FIELD using a button?

Get All The Email Addresses From A Text File
I have a .txt file with a lot of text mixed with some email addresses. I
would like to get all the email addresses in a $mails[] variable. Does
anyone know how to do this in php.

How To Extract An Email-address From A Text File
Can somebody show me a quick code snippet to reliably extract an
email-address form a text file ?

Delete Entire Line In Text File If Anything In The Line Matches Search String
how would I code a php script that would open a text file, look for a string i specified, and if it finds that string, it will delete the entire line in the text file that contained that text. I'm new to php, so sorry if this is really obvious..

Trouble Extracting Email Address From Text File
I'm trying to put together a script that will read an email box set up for newsletter bounces and remove the bad addresses.

There's an old script I've worked with that looks for --- Permanant fatal errro ---, but not all the bounced emails have that line included (3 out of about 700 do).

I need to find the bad address, then delete that address out of the database. I've got the deleting out of database down, but am not sure how to find any email address & delete it.

How To Delete Only Certain Text In A Mysql Row?
I have a table setup that has a column setup as friends and users can add friends to this column no problem.

What I would like to know is how to delete only certain parts of the text of the row/cell where their friends are stored.

The friends text is seperated by the following :

" , "

That is a space on either side and comma in the middle of the space.

I know how to explode the results and put into an array to display the reuslts, but is there a way to delete only one of the friends if the text is as follows.

 , thomas , frank , irene ,

I think you can get the idea.

Is it possible to do this or should I just update the whole cell without the array[$i] result being the friend?

Updating A Single File
i want to update a single file some of the info i request is being display except for the picture and the second one is that it is not updating into the database i guess. i have to problem in one Code:

Download File And Delete File From Server With One Button Click
I want the user to be able to download a CSV file and delete the file from the server all with the click of a button.  Currently, in firefox, it will just display the CSV and not delete it. In IE, it will download the CSV and not delete it. Code:

Is There A Way To Assign Multiple Variables A Single Value On A Single Line?
$f1, $f2, $f3 = Ƈ'
and
list($f1, $f2, $f3) = 1;

neither work... second obviously cuz its looking for an array on the right
side, correct?

Right now i have ot build a for loop to assign the values

Reading A Single Line From A File
In asp I can read a text file line by line like this.

<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("FileName.txt"), 1)
strLine1 = (f.ReadLine)
strLine2 = (f.ReadLine)
strLine3 = (f.ReadLine)
f.Close
Set f=Nothing
Set fs=Nothing
%>

I need to assign line 1 to one variable line 2 to a different variable and so on. Any help is greatly appreciated. Btw, I'm using php4.

How To Access A Single Line From A File
I want to select a single line from a file. How can I select a line from the file and save it in a variable.

Single PHP File - *.php = Process, *.phps = Source.
Hoping for some direction here (I have searched, without avail, for a
solution already).

I was toying with trying to find a way whereby I could have a single
PHP file, and then specify whether to either see the processed output
or the source code by using the extensions php and phps (respectively).

So, with one file called "theFile.php" on the server, going to
"www.server.com/theFile.php" would show the end result of the php
actions, whereas going to "www.server.com/theFile.phps" would show the
actual content of the file itself.

I thought this could be done by modifying the htaccess file as follows:

AddType application/x-httpd-php-source phps

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+).phps$ $1.php

However this does not work:
- if a *.php file exists, then accessing *.php or *.phps returns the
end result of the php actions.
- if a *.phps file exists, then accessing *.php returns a 404 error,
and *.phps shows the actual file contents.

Looking for any direction, references, or assistance.

Downloading Multiple Files In Single Zip File
I am developing the project management system.

Each Project:
1. Title, description ... , stored in mysql database
2. Upto ten files (initial description), (name in db, file in file
system)
3. Message board, stored in mysql database (1 file per message, message
in db, file in file system)

I need a link (Download Project) which will download all the project
related files, description, message board in the single zip file.

Delete File
I want to delete a file that is located on a server. The filename is in a Mysql database and now I have to put the line 'system("del c:apachehtdocsshopimg.gif");' somewhere in my code underneath. Any Idea how ? This line works already, but now the '.GIF' has to become a $file that equals the filename from the database...

What Is The Best Way To Delete File ...?
I have script that allows a user to upload a txt file for processing, filtering, to save bandwidth,instead of user reuploading the file everytime he/she does a new process on the same file, i save the file to the server, and process from that file. What I want to be able to do is, when the user uploads a new file, or leaves the site, this temp file is automatically deleted (saves disk space).

Delete File();
I was wondering if php4 has a built in function that could delete a file. In my case I need my php to delete a picture. (jpg, gif) Does php4 have the ability to delete an exsiting file? Something like this?? delete_image("../images/somePic.jpg");

Delete A File
How do i delete a file from my server with php?

Delete File
Is there any way to use PHP to delete an external file?

Delete File
How do I delete a file with PHP?

Delete File With Php
Im a little new in php, and just made a site where u can upload pictures, but how can i make it possible to delete pictures as well.

Read And Display Japanese Text From Text File
I posted a question regarding reading japanese
text from a text file.

Well, since I solved the problem, I thought I'd post my solution for
the benefit of other people with the same problem.

The plan was to make a script to read and display japanese text. I
will use it for making a japanese proverb script and for a japanese
language study script.

Method :

I wrote a simple kanji text file (saved with UTF-8 encoding)
I wrote a simple PHP script to display the file contents (saved with
UTF-8
encoding)
I specified the content-type header for the HTML page :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

*** All files have the same encoding. ***

UTF-8 supports japanese characters.

and it works!

this is my PHP (and HTML) script :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHP : Japanese Text File Read : Exercise 1</title>
</head>
<body>

<?php

$filename="japanese.txt";
//open file
$fp = fopen($filename,'r');

//loop through each line in the file
while($line=fgets($fp))
{
//output current text file line
print $line."<br>";
}
//close file handle
fclose($fp);

?>

</body>
</html>

I know it's a very simple script, for testing purposes only. It
displays the contents of the japanese text file line by line.

The key was to save all files in the same encoding (I used UTF-8) and
to specify the encoding / charset in the HTML header (<meta
http-equiv="Content-Type" content="text/html; charset=utf-8">)

Using Php To Delete A File In A Directory- Help
I can use php to execute the cp command to copy an image file into a directory.

Now I want to delete images in that directory if they are not named "picturelink.gif" when an entry with a corresponding id is deleted.

Below is the code I am using which doesn't seem to be working when it comes to deleteing the file. The directory has the correct permissions for read/write access.

$query = "DELETE FROM $userstable WHERE id ='$id' ";

if($picture != "picturelink.gif")
{
exec("rm $picture /virtualhosts/capefearantiques.com/www/pictures/$picture");
}

Delete Lines From File:
How to delete $n first lines from $str if i know how much lines shuld remain in the string?

$str = "aaaaaaaaa
bbbbbbbb
ccccccccc
ddddddddd
...
zzz";

Can it be done easly with preg_replace? (i.e without splitting it by '', removing elements from array and joining tham back.

How Do You Delete A File From A Listing Please?
I have the code:

<?php
if ($dir = @opendir("../project/proj_images")) {
while (($file = readdir($dir)) !== false)
if($file != ".." && $file != ".")
echo "<tr><td align="left" class="bodyblue2">$file</td></tr>";
closedir($dir);
}
?>

which displays a list of files in a directory.

What I want, is to be able to click on a file in the list and delete it.

I know you use unlink but how do you tie it in with the above code?

Can I Delete A File From A PHP Script?
Is it possible to delete a file(a jpg in fact) from a PHP script. I would like to ad this functionality to an existing script that deletes a record from a MySQL db. Only the image name is stored in the db.

Trying To Delete A File Using Unlink
i am trying to delete a file using the unlink function but it just is not working. i just get the Could not delete message. Is there anyway to find out exactly what is wrong? I've tried the exact path which is C:/domain/wwwroot/temp/0000000.txt but it just does not delete. Also i dont think it can be related to permissions because the 0000000.txt was created automatically by a script. The code i used is as follows:

<?
$delete = unlink("C:/domain/wwwroot/temp/0000000.txt");

if($delete)
{
echo "Succesfully Deleted";
}
else
{
echo "Could not Delete";
}
?>

How Do You Delete A Zip File From A Directory?
Once again, I thought my class method deleteZip() would do the trick,
but it never deletes any .zip* file found in a directory: Code: ( php )

Php File Delete Form
How would i go about making a file delete form in php. so that the user can delete .jpg and .gif files from a web directory.

How To Delete Last Line Of File
I have a flat file on the server which I append to from a HTML web form.
I need to delete the last line of the flat file before I append though.

How do i do that?

I have the following code. I'm not sure if it's correct.

$pattern = "</member>"; // what I want to look for.
$ora_books = preg_grep($pattern, file('/path/to/your/file.txt'));

How Can I Have Permissions To Delete A File?
How can I have permissions to delete a file? example: I have to delete a file, but I don't to public users have permission to delete that file but, with a certain "login" they can.

Delete Lines From A File
Can someone show how I open a file and delete everything in it except for the last 20 lines.

How To Delete N Lines From The Top Of A File?
I'm not sure how to do this in php - need to calculate and delete an unspecified
number of lines from the *top* of a file.

<?php
//append $visitor to the bottom of $visdata
$fp = fopen($visdata,"a");
fwrite($fp, "
".$visitor;)
//count the lines in $visdata
$lines = count($visdata);
if $lines > 10
{
//delete as many lines off the top as necessary
//to end up with 10 lines total in $visdata
}
fclose($fp);
?>

How To Delete Log File In The Given Period
I dont have much knowledge og PHP. i need to delete log files in the given period. so i need to know how to delete file content using php. i know how to read file content. but i dont know how to delete file content.

Delete File Contents
Can someone post some code to show me how to delete a file from a folder please? I need to delete a file first, and then upload something in it's place. Maybe a bit of code to slide in what i have already would work? Code:

Mysql Row And File Delete
I have a database with the following colums, imageID, imageName, imageDesc, imageFile, imageHeight, imageWidth, imageThumb, imageThumbHeight, and imageThumb Width. I can easily delete a row from the mysql table, galImages, but I also want to delete two files from a directory. The file names are stored in the columns imageFile and imageThumb.

Delete A File Within A Directory
Is there a way to delete a file within a directory using a link?

I have a script that will list all the files in a directory and, in the output, I'd like to create a link next to each file that says "delete This file" and then will delete the file from the /dir

filename1.jpg delete file
filename2.jpg delete file
filename3.jpg delete file
filename4.jpg delete file

I try but when I click on the delete button I delete all the files of the /dir...

Delete String In External File
I must: open a file, keep out a string and delete it.

(force) Delete A Session File, How?
I dunno if this is meant for here or apache anyway.. my script uses sessions... if the person logsout.. the session is closed and the session file is deleted.. if the person just shuts down the browser the session file is not deleted and hence i've got hundreds of redundant session files.

Delete Flat File Content
Just have a basic notes.txt to which notes are obviously added to. However, i would like a page "delete.php" to have all content within that file deleted, but keep the notes.txt file intact.

Delete Or Post To Print Txt File Or Pdf
i have a file that loads all my records from a table in my database. What i want is to add the option of posting the info in a selected record to a file, either a pdf or text file so that it is printer friendy. At the moment the only option available is to delete the record, can i add another button to my form to do what i am aiming?

Delete Temp File On Server
I am using the following to generate an xml doc to the users browser:

$fp = fopen("document.xml", 'w+');
$str = ($xml_frame->Fields('top_xml').$content->Fields('xml').$content->Fields('xml').$xml_frame->Fields('bottom_xml'));
fwrite($fp, $str);
fclose($fp);
header( 'Location: https://www.website.com/document.xml') ;

I would like to delete 'document.xml' after it has been loaded to the user's browser but unlinking the file kills it before it loads and sleep hangs everything. I there a way to detect when it's finished downloading to the user?

Plain Text Email
I'm wanting to protect all inputs for sending a plain text email, in a common
routine.

Have just found POSIX [:print:] which I thought looked useful.
I didn't want to use htmlentities(); because it's a plain text email.

Would this protect me from anyone sending spam though this?

$raw = stripslashes($raw);
$raw = preg_replace("/(content-type|bcc:|cc:|onload|onclick)/i", "DELETED",
$raw);
$raw = strip_tags($raw);
$raw = preg_replace("/[^[:print:]]/", " ", $raw);
$raw = substr($raw, 0, 500);
$raw = trim($raw);

Or, should I use:
$raw = htmlentities($raw, ENT_NOQUOTES);

The email address would obviously be different.
This would cover just the name, subject and message.
I don't need newlines etc.

Email Box - Text Editor
I'm writing a PHP program that will mass email to my clients in my database. Does anyone have any ideas how to create a email box similar to yahoo o Googles compose email form? It would be nice to edit text size and color.

Remove Text Header In Text File
I have been having trouble removeing two header lines at the top of my txt file. You will see in my code the different things I have tried but with no luck. Below I posted my script and data. I am doing a few other things in my script as you will notice but this is the only thing I am having troble with. Code:

PHP File To Delete Multiple Talbes In MySQL
i installed PHP Nuke, didnt really like it. I think its much more then what I need. Great System, just think alot of it is useless for my needs. In any case i want to delete all the tables it created in my DB. Anyone got a script I can run to delete all tables that start with.

Delete File (timestamp & Date Problem)
I want to delete a file which is modified at least 60 minutes ago. i failed to do it.i fetched the last modified timestamp using filectime() or filemtime. but how can compare if it is last modified at 60 mins ago?

Delete Uploaded File When User Exits
I've been working for this simple project. User fills out the application form (uploads a file), redirected to the confirmation page, make a payment, redirected to the payment confirmation page and then it sends an email with this file to the customer or admin. There is no user authentication so it could be anybody uploading files.

The problems is that I want to delete the uploaded file when the user exits the browser or click onto some other page when the user decides to withdraw from making a payment. Because this temporary file becomes permenant. Of course you can delete the files manually using ftp but it could be a hassle for the end user.

I've been thinking about session_set_save_handler, register_shutdown_function or connection aborted functions but none seems to work in this situation.


Copyright © 2005-08 www.BigResource.com, All rights reserved