Jump to content

Stuie_b

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by Stuie_b

  1. You could build the link in the way the form would pass the data, for example if your form was too pass the field id too a file called del.php then you could build the link like this del.php?id=idoftheentry then the del.php file would get the variable of id and then delete the database entry as it would if a form passed the data. hope it helps Stuie
  2. [quote]at the moment I get this error: Code: The requested URL /<br /><b>Warning</b>: rename(uploadFile,test): No such file or directory in <b>/Library/WebServer/Doc [/quote] This is because rename() function is a file function, it's used too rename one filename too another. [code]<form enctype='multipart/form-data' action="<?php $file_old = "uploadFile"; $file_new = "test"; if(!rename($file_old, $file_new)) {     echo ("Rename failed"); } ?>" method='post'> Picture: <input name='uploadFile' type='file'> <input type='submit' value='Upload'> [/code] can you please explain why are you trying too change uploadfile too test? too me it doesn't make any sence? below is an example of how i would do it you may find that it's not what your after but it may be of benifit too someone else, form.html [code] <form enctype='multipart/form-data' action="upload.php" method="post"> Picture: <input name='uploadFile' type='file'> <input type='submit' value='Upload'> </form> [/code] upload.php [code] if($FILES['uploadFile']['name']){ //A picture was supplied lets move it too the correct dir if(move_uploaded_file ($_FILES['test'] ['tmp_name'],"users/images/pictures/{$_FILES['uploadFile'] ['name']}"){ //Ok were moving it, but did it get there? echo "Your picture was successfully uploaded"; //Success the picture was uploaded successfully }else{ echo "Unable too upload your picture"; //Strangly the picture didn't upload, php should have given you a reason above } }else{ echo 'No Picture supplied!'; //They didnt supply a picture } [/code] The example above will check too see if an upload was supplied, if it finds it is it will then move the file too the pictures directory. hope it helps Stuie
  3. if i'm not mistaken it's something too do with the way html passes it's form values and how magic_quotes_gpc works, (could be wrong on that) try too remove any slashes from the filenames before they are saved, [code]$handle = fopen(stripslashes($filename), "w")[/code] if that works then i'd check too see what is actually being passed too $filename, making sure there are no whitespaces at the begining or end. use trim too remove any that may be there. hope it helps Stuie
  4. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Question 1. How do I make a php form executable and how do I set the permissions.[/quote] Php files are compiled at runtime by the php compiler and dont need to be compiled by you. Setting file permisions needs to be done on the server, ususally by an ftp client or ssh and is known as CHMODing look at your ftp clients manual for info on to do this. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Question 2. Do I need to save the php form as a cgi?[/quote] No, save it as a php file. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Question 3. How can I get the below form to send an email to the person who fills out the form and a email to me also?[/quote] Replace your handle_form.php file with the following code, [code]<html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1 /> <title>Your Feedback</title> </head> <body> <?php //handle_form.php //This page recieves the data from feedback.html. //It willreceive :title, name, email, response, comments, and submit. //Adjust for register_globals being off ini_set ('display_errors',1); //let me learn from my mistakes. $msg = "Thank you $_POST['title']] $_POST['name']] for your comments. <br />"; $msg .= "You stated that you found this example to be $_POST['response'] and added: $_POST['comments']"; mail($_POST['email'],"Thank you",$msg,"FROM: webmaster@yourdomain.com"); //Send email to them mail('YOUR EMAIL ADDRESS',"Feedback left",$msg,"FROM: webmaster@yourdomain.com"); //Send email to you, you could use a different message if you wish echo $msg; //Display the message to browser (same as email) ?> </body> </html>[/code] hope it helps Stuie
  5. personally i'd have setup like this, You would have a php file that would be linked to a database, then each of the links inside the email would link to this php script with a unique id number (process.php?id=1), so the php file (process.php for arguments sake) //Process.php [code] <?php require('db.php'); //Used to connect the database require('mail_data.php'); //Used to make it easier to edit the email sent to you $id = $_GET['id']; //Gets the supplied id number $qry = mysql_query("SELECT * FROM links WHERE id='".mysql_real_escape_string($id)."'"); //Get any results that match the id address $check = mysql_num_rows($qry); if($check > 0){ $fetch = mysql_fetch_array($qry); mail("myemail@email.net","Link Click",$mail_body,$mail_headers); //Sends you the email (set in mail_data.php) //if you wanted you could also track links by updating the database on a click //mysql_query("UPDATE links SET (click) VALUE('click+1') WHERE id='".mysql_real_escape_string($id)."'"); header("location: ".$fetch['url']); //This will redirect them to the sites actual link exit(); }else{ //Do somthing if the id supplied isn't found in the database header('location: google.co.uk); //simply redirects to google do what you like here (if anything) } ?> [/code] //mail_data.php [code]<?php //I only do this because it's easier for you to change //becuase i dont know how your  e-mail autoresponder  works with user data //i cant add there name, you will have to do that your self. $mail_body = "Somebody visited link ".$id. " you should replace this with the message your after"; $Mail_headers = "FROM: linkproc@system.com"; ?>[/code] hope it helps Stuie
  6. try the following code [code]// multiple recipients $to  = $_POST['to']; // subject $subject = stripslashes($_POST['subject']); //Will remove the Slashes added by Magic Quotes and give you a clean subject // message $message = $_POST['message']; $headers  = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; //from $from = $_POST['from']; $headers .= 'From: '.$from. "\r\n"; // Mail it if (mail($to, $subject, $message, $headers)) {     echo '<h1>Success</h1>'; } else {     echo 'Failure'; }[/code] [b] [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]Be careful!! Removing Slashes could be a potential security risk, it also doesn't prevent your script from being hijacked by code injection![!--colorc--][/span][!--/colorc--][/b] hope it helps Stuie
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.