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




Deleting A Message


I want a button to delete each message in you inbox wen clicked. im using this that doesn't work, because i coded it Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Batch File Deleting And Folder Deleting
I have a folder in my web site where I used php to create and copy in files. but now I can't delete them easily. The only way I know how that is possible is through php. I get an error the following ftp error:

550 th: Permission denied
I had the chmod() set to 0777 on every file and folder. But I still seem to loss control over the files when I try and do things with them through other means.

I think it is because the user I use to access the files via ftp a diffrent user. So I tryed to add a function with chown() for the new files I was posting and uploading. It didn't work on those new files. so it looks like the only thing I can do is use the unlink() function which deletes the files fine.

The only problem is now I have something like 100 sub directories all with files in them. I need to figure out a way to batch delete them. I can't find a script that goes through and finds all file contents including all sub directories and unlink those things.

I found some that will use a for loop to list out the contents of a folder but it is just files. No sub directories. Any body got any ideas on which functions I should use or know where a script is that I can base mine off of.

I am not sure how to approach this since what I tryed with chown and chmod has failed thus far. I currently have no code and am starting from scratch on this batch flushing of my directory.

Deleting
how could i delete everything from a table in a mysql db except for the 10 latest things ?

Mail() - Message Len
Is there a length limit to the $message parm in the mail() func ?
I am doing a customer survey, with several multiline text boxes and my php code hangs when i have a couple of long comments in there. I have tried wordwrap and chunk_split, but they didn't seem to help. Any ideas?

Message Box In Java
I want to do something like bringing up a message box in Java where after
clicking OK the box disappears and processing continues.

How do I do this in PHP?

I want the processing after the message box to be conditional upon what was
used to bring up the particular message box. (I have been handling
something like this so far by having inline messages and reposting the
page.)

Send Message
I want to send a message to a user in his yahoo messenger id and MSN Id through my php script. Actually user will provide his MSN or Yahoo Id in my web form, and after
some server operation he will receive a message in MSN or Yahoo messenger.

Mail(): $message =
unsing the mail() function, I want my message to appear somewhat like this:

Hi myFriend,
thanks for coming to my site. This is what I remember of you:
group: (a var)
os: (b var)
Regards, best wishes,
Me

How do I manage to get the line breaks, and insert the vars using
[php]
$message = "Hello myFriend.....";
[/b]

Do I remove the inverted commas whenever I put a var?(for example $group).

Warning Message
I installed MySQL4.1.11 and PHP4.3.10. When trying to connect an existing
database, it showed me the following warning message which I have no idea how to
solve it.

Warning: mysql_connect(): Client does not support authentication protocol
requested by server; consider upgrading MySQL client in
c:inetpubwwwrootprojectconnection.php on line 12
Could not connect: Client does not support authentication protocol requested by
server; consider upgrading MySQL client

Error Message
On my Apache host, localhost:8080, no error message are being displayed. If
I have an error in my PHP code, all I get is a blank screen. Do I need to
configure something in Apache or PHP.ini to turn on error messages?

Send A Message
This maybe a nice little script for some new-newbies to get amongst a bit of
php action (I am still a newish-b myself)

To follow is the PHP:

<?php

$content = '
<html>
<head>
<title>test me</title>
<script src="j/j.js" type="text/javascript"></script>
<style type="text/css"> img.iletter { display: none; } </style>
</head>'

$location = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

if(($_POST["submit"] && $_POST["txt"]) || $x) {
$content .= '<body onload="reveal('l', 1, 300);" style="margin: 0px;
padding: 50px; background-color: #000;">'
if($x) {
$letters = urldecode(base64_decode($x));
}
else {
$letters = htmlentities($_POST["txt"], ENT_QUOTES);
$code = urlencode(base64_encode($letters));
$content .= '<p style="color: white;">link is :
http://'.$location.'?x='.$code.'</p>'
}
$content .= letterer($letters).'<p style="clear: both;"><br><br><a
href="go.php" style="color: white;">try another one</a></p>'
}
else {
$content .= '
<body style="margin: 50px;">
<form method="post" action="go.php">
<textarea name="txt" cols="30" rows="10">type anything you want
here</textarea>
<br><br><input name="submit" type="submit" value="show me the money">
</form>'
}

function letterer ($letters) {
$v = '<div id="letters">'
$len = strlen($letters);
for($i = 0; $i < $len; $i++){
$let = substr($letters,$i, 1);
$let = replacer($let);
$v .= '<div class="iletter" id="divl'.($i+1).'" style="float: left";><img
src="a/'.strtolower($let).'.gif" alt="'.$let.'" class="iletter"
id="l'.($i+1).'"></div>' //
}
$v .= '</div>'
return $v;
}

$content .= '</body></html>'
echo $content;

Can't Send Message
I'm filling out forms on one page, then trying to send an
email and print out the vars on the next page.

Q1: Whenever I insert the mail script, it gives me a parse error.
Please point out my syntax errors, etc.

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in /mypathhere/proposalconfirm.php on line 2

--script in question
<? session_start();
$msg = "x x proposal for:
$_POST['cpname'], $_POST['cptitle']
";
$msg .= " $_POST['cpcomp']
";
$msg .= " Address: $_POST['cpaddress']
";
$msg .= " $_POST['cpcity'], $_POST['cpstate'] $_POST['cpzip']
";
$mailheaders = "From: company name here
";
$mailheaders = "CC: $_POST['cpemail']";
mail("me@my.com","x x Custom Proposal",$msg,$mailheaders);
?>
<html>
--rest of script--

The printing of all vars works fine (once I removed the double
quotes from the post var callouts)

Q2: Do I need sessions to track the form vars from page to page
or am I adding unnecessary complexity to this?

My last large PHP dev work was about 2 years ago. Since then,
quick and dirty flatfile database connections (member lists)
are all I've had to contend with. Things have really changed


Posting Message
im making a forum system and i was wondering if i could have a post delay (flood control). e.g. say if user1 posted a message and then wanted to post again straight after, and then got a custom flood control message.

can i ask how would i make it so i could select how long you had to wait before posting another message and  how would i make it so i can select a custom flood control message. i would like the flood control custom message and time limit (in seconds) to be stored in a mysql table.

Message Boards
I have written a message board and it has been test properly, the problem is it looks naff in apearance. When I see this message board I would like to model it on this. I can't work out the top section. It seems to be in 3 sections pinned to top, pinned to top and read only, and the rest with the occasioal read only. I can't work out the best query. all entries will be in the same table with a field type maybee of

1=Pinned
2=Pinned read only
3=other. 

But then there is the ocasional read only.  their is one of these now 18 recs down. Any Idea on a table structure. Would it require 3 seperate queries. Not good.

Loading Message.
I was wondering if there was a way to display a message while a script loads. I have a safety deposit box script, and if people have alot of items, it takes a while to load the script. So some people are sitting at a dead page for a couple seconds. So to inform them that their page is being processed, I would like to display a message while the script loads up everything from the database.

I am not aware of a function that does this, but maybe someone else does. If someone could point me in the right direction that would be great.

PHP Timeout Message?
I have a page that queries a database.  Well, often the DB goes down and the script returns the standard PHP timeout error:

Fatal error: Maximum execution time of 60 seconds exceeded in blah on line 70

Is there any way to write a custom message into the page that will display something like:

Using GET To Send Message
Im making a little live private chat system, I am not superp with javascript or ajax but I can use what i know to do this

To send a message to my server, I am using getelementbyid().value to pull out what ever they have typed in the <input field>

To send it to the server I am using ajax which will send something like this to a php file for parsing

parse.php?user=Jamie&message=What ever the have typed in the box is here&val=yes

That is working fine, I sent a message 1000 chars long and there was no hiccups
Is this ok? I mean its working.. Perhaps another way would be better? using POST with AJAX instead of GET.. although if both work..?

Error Message
after upgrading to php 5.2.1, when I try to load a php file I get the folowing error message :

Server Application Error

The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server administrator for assistance.

Deleting All Files
Is it possible to delete all files in a folder using unlink() or something similar?

Deleting The Saved Db The One Before?
I made a script that backups the database as sql file in the server. I mean script writes it into the harddrive, but everytime when i execute the script the harddrive loss another 3 mb. How can i modify the script to delete the one before when i execute it to write the new one?

Need Help With Deleting Records
I'm trying to add a link on the display of a record to delete that record.

The main part of the record is stored in pw_event, then there are several rating fields for that record stored in pw_rate, and there is also several records for the first record stored in pw_whois.

I need to have a link that will deleted everything for that record in all three tables.

Here is my display script:

PHP Code:

Deleting Last Comma
The code below displays pet names like so:

Fido, Bowser, Kittycat, Spot,

and I want to delete only the last comma. I tried 'substr' and 'rtrim' and both of those delete the space and comma between each name, not just the last name as I'd like, so I end up with:
Fido,Bowser,Kittycat,Spot,

How would I delete only the last comma, so that it is this instead?
Fido, Bowser, Kittycat, Spot

Even with trim and substr, I end up with:

Deleting A Session
I want to be able to delete a session so that the next time there's a call to session_start, it creates a new session ID. I don't want to destroy the session variables specifically (though this will be a side-effect of what I'm doing) so I know that session_destroy isn't what I want to do.

I presume I should just delete the session cookie manually. Is there a neater way? And if not, how do I do this?

Deleting A Director
I'm using this code trying to make ato delete a file or folder under w2k, apache.

$direct=split("repadmin.php",$PATH_TRANSLATED);
$file=$direct[0].$filedeleted;
$filesys = eregi_replace("/","",$file);
$delete = @chmod ($filesys, 0775);
unlink("$delete");
header("Location:repadmin.php");
exit;

but return this warning:

Warning: unlink(1) [function.unlink]: No such file or directory in c:program filesapache groupapachehtdocsguonline epositorio epadmin.php on line 94

I checked the whole path and looks good.

Deleting Files
The below should delete files from a dir older than a week. I set the $dtime to 0 to test the script but it deletes nothing. What is wrong? Code:

Deleting Files
I'm using different files to store some arrays to make administration of a very small job-logger very easy. I currently read the file, remove the element to be deleted, delete the whole file, and write the file again without that element. Is there a way to remove a single element out of that file without deleting the whole file?

Deleting Cookies?
For some reason is i set my cookies like this PHP Code:

Deleting A Line
how do i delete from a text file 1 of the following lines

jon|scott
adam|smith <--delete
paul|clark

say i would like to delete the middle line of this txt, in member.txt
what php code or logic would help me accomplish this?

Also i am clicking on a hyperlink that is keeping count of the entries
i have
made. e.g php?record_id =1
php?record_id =2

Deleting A Record.
One last (hopefullly) problem I can't seem to get around for this
program...why isn't this deleting the row i want? It does nothing. Now error
messages either. HELP!

$link = mysql_connect("localhost");
if(! $link)
die("Could not connect to MySQL");

$database = "PC_Store";
mysql_select_db($database)
or die ("could not open $database: ".mysql_error() );

$result = mysql_query("DELETE FROM inventorydata VALUES('$ProductID')");

The $ProductID variable is brought in from a menu choice on a diffrent page,
it is also the primary of the table...so it should delete the whole row
right?

Deleting Records
I've been trying to delete records since a week and i'm not able to do it. Before with this script, i was doing so many things at a time and i was confused.But, now, i just displaying the records from a table N trying to delete them.Would somebody pls guide me.

I just wanna set the delete flag(i.e, i want to set the RBS_DELETE column to Y or something) when i check a check box to delete it. I've some 5 records displaying on my form and i want to check 3 of them and when i check them and hit submit, i want the RBS_DELETE column to have some value. PHP Code:

Deleting A Row From A Database
I can't fiqure out why my delete function isn't working. I have a listing of rows in my database with an option to delete an individual row at the end: Code:

Cookie Not Deleting
login.php:
setcookie('id', $userinfo['id'], time()+60*60*24*31*3 , '/');

logout.php:
setcookie('id', '', time()-60*60*24*2);

Any idea why it is not deleting my cookie?

Deleting Posts
How can I delete my previous post?  It's showing up in Google when I search for the url referenced in my previous post (if I put the name here, it will show this post, too).  If I can't delete it, can I make it so that Google can't pick it up?

Deleting Files
I'm trying to modify this script to remove files that end with %enlarged.jpg or %enlarged.gif or %enlarged.png, can someone help with the if statement, I've tried several things, of which, nothing is working: Code:

Deleting Folder
is there anyway of deleteing a folder and deleting all of its contents with it?
i know that with rm_dir needs to folder to be emptied

Deleting The Pages!!!
I wanted the php files in my computer to be protected.If someone copies them and use in different machines,how can the php code find that the code is running in nextmachine. Is there any idea,that I delete the files using the unlink() method,when they are stored/run in next machine.

Deleting Using Checkboxes
im wanting to delete multiple things from a database using checkboxes, now i know how to use checkboxes in php etc. my question is would this be done using a basic while loop? i mean would i query all the things and then do

while ($check_box == 'ON')
{
do the delete script
}

or is there something more to it?

Deleting A Line From.txt
it writes the line or lines to be deleted correctly into issues_deleted.txt which is line fwrite($file_contents_deleted, $value);

and when it refreshes the line still exists in banip.txt it does echo out the line as well just doesnt remove it from banip.txt anyone know why? Code:

Deleting From Sql Database
I have used this script I made to delete files from a server and simultaneously remove information about the file from a database. I have uploaded the same script to a new website and it no longer works. The file does get deleted but the database line doesn't get removed. I can tell where it's going wrong by the error custom error message 'echo'ed on the page ("your file was only partially uploaded"), but I really don't know why.

Deleting Files
I have some script that takes an album id and deletes that album and the specific photos in that album. The code does run. The problem is that an error message i set to echo appears saying error deleting photo once the page automatically refreshes. When i check the image folder the images actually have been deleted. Code:

I Want To Know If An Autoresponse Message Bounces
I'm fairly new to php but am getting around. Getting too technical will lose me though.

My situation:
For every person that fills out my form for my information, (my form sends to three places) they get an immediate autoresponse message thanking them for their request. If the person has a typo in thier email address which appears to be a valid email but isn't, they don't receive this autoresponse.

My form is currently set to send a message to:
the recipient
an autoresponder system
the website owner

I want to know every time someone DOESN'T get this autoresponse message. I want the bounce message to come back to me (actually my associates where applicable) so I can see it wasn't delivered. Right now the bounce just gets lost in cyberspace.

My host told me this:

It will just be lost, the web server doesn't know who is sending the email - it will bounce to the web server, but the web server won't know who owns it and ignore it. With the correct script it could probably bounce to a known address.

I have associates who I host webpages for and I want this to work for them as well. I am able to get my messages to bounce back to me but not on my associates pages.

On my own personal form, when a person enters their information it is set to forward emails to:
the recipient
the autoresponder

And because I own the autoresponder I automatically get the response via that system as well so the third part is left out on my page. When an invalid email address is used on my form, I get the bounced message directly from the server because I own the domain.

Are there any scripts or something that I can use to catch bounced messages and send it back to the webpage owner?

How Do We Echo The Message On The Same Screen..
How do we echo the message on the same screen ( e.g. the bottom of the screen then erase the message after a while?

Sending A MIME Message
I failed to send a MIME Message with attachment file. The following code I used was crashed my Apache Webserver.

The code works if I removed the attachment 'part'.
Any clue?

note: Im running it under a Windows Platform. PHP Code:

How Do You Display A Message If There Is No Image Please
I use the code:

echo "<img src="newsimages/$five">";

to display an image taken from the database. So if there is an image the HTML becomes

<img src="newsimages/testpic.gif"> or whatever.

But if a record does not have an image, then it displays:

<img src="newsimages/"> which just brings up the missing image red cross. How can I display a message saying there is no image if there isn't one?

Decrypting An Error Message
I'm getting the following error message on a web page:

Warning: mysql_connect(): Access denied for user:
'tgsstaff@...' (Using password: YES) in
/web/tgs.gargoyles-fans.org/htdocs/experiment.php on line 9

Here's what lines 9-11 look like:

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
echo "Has connected to database $database
";

Above it, I have variable declarations for $host, $username, and
$password.

Any help would be appreciated so I can determine the cause of the error.

Any Way To Suppress Security Message
Is there any way to suppress security messages while going in and out of https servers messages like You are about to be redirected to a connection that is not secure... Do u wish to continue..

Output Message And Redirection
I have a link to a page that executes a perl script to generate an Excel Spreadsheet, then it outputs this using Header(). How would I tell the user to be patient while the script executes? (Obviously, I can't do it on this page because whitespace will be output before the headers). I need something similar to the search function message on this actual forum. PHP Code:

HTML Message Problem
I have a newsletter that has the ability, to send either HTML or Text newsletters. Here's the thing, when I press the HTML option, and I put in HTML code, all the email addresses, get the HTML code, not the output. In the mail() function, I use this:

$headers = "Content-type: text/html; charset=iso-8859-1
";

So that it can send HTML, but still it only shows the HTML code instead. What's wrong, and how can I fix it?

Displaying Error Message
I've got a problem. I need to display an error message when unable to find a record. Below is one section of the code I'm working on. Code:

Getimagesize ( ) Error Message Please Help!
What is with this error message?????? First part validates, second part
fails...

getimagesize (filename...) failed to open stream: No such file or directory

} elseif ($photo) {

$ext = strtolower(substr($photo, -3));

if ($ext == "peg") { $ext = "jpg"; }

if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext != "bmp" )
{

$focus = "photo";
$msg2 = "Please provide a valid gif, jpeg, or bmp photo or do not
attach one.";

} else {

$size = getimagesize($photo);

if ($size > 25000) {

$msg2 = "Photo must be smaller than 25k.";

}}}

Mysql Error Message:
If I enter this query at the sql prompt, I'll get results, but the code at the end of this yields the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in...on line 104 PHP Code:


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