Search the Community
Showing results for tags 'php email upload'.
-
Hi all, I have a website in which users can upload listings for me to then confirm via the CMS. At present I have it set that admin approval is requested so that there is no spam. What I would like to do is have it that when somebody uploads an item that I recieve an email so that I know to go into the CMS to confirm it. I´m just not sure how!!!! Can anyone help me with this? The page code is as follows: <?php session_start (); //check if its not logged or its admin redirect to login page include ("scheck.php"); //Connect to db include ("conn.php"); //Select db include ("select.php"); //header codes include ("headercodes.php"); //PAGE DISPLAY //******************* PAGE CODES HERE foreach ($_POST as $field => $value) { if (!$value){ $err .="<center><br><font color=#f69900><b>$field</b></font> is required<br>"; } } if ($err){ echo $err; echo"<br><br><a href='javascript:history.go(-1)'>Back</a>"; include ("footercodes.php"); exit; } else { //$file = trim(addslashes($_POST['file'])); //$manufacturer = trim(addslashes($_POST['manufacturer'])); //$listingdate = trim(addslashes($_POST['listingdate'])); //$views = trim(addslashes($_POST['views'])); //check if user create new name for group or use current names. //if ($_POST[imggroup]=="Create New Category") //{ //$imggroup=$_POST[newproduct]; //} //else //{ //$imggroup=$_POST[imggroup]; //} $listingdate= date('j F Y'); $views=0; $username=$_SESSION ["valid_user"]; $confirm=0; //file upload if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if (file_exists("uploads/products/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists change your file name. "; } else { $random_digit=rand(0000,9999); $_FILES["file"]["name"]=$random_digit.$_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/products/" . $_FILES["file"]["name"]); echo "<center><br><b>Thank You!</b>"; $file=$_FILES["file"]["name"]; //Create columns and records in database with file $sql="INSERT INTO `products` (`category`,`county`,`name`,`condition`,`partno`,`price`,`file`,`manufacturer`,`listingdate`,`views`,`username`,`confirm`,`description`) VALUES ('$_POST[category]','$_POST[county]','$_POST[name]','$_POST[condition]','$_POST[partno]','$_POST[price]','$file','$_POST[manufacturer]','$listingdate','$views','$username','$confirm','$_POST[description]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "<br>Your product has been uploaded successfully , as soon as admin confirm it , it will be listed</center><br/>"; } } } else { echo "You did not specify any image to upload or your image is not acceptable (Acceptable types : .JPG and .GIF) <br> Please make sure your image name does not have space or special characters"; } //******************* PAGE CODES ENDS HERE include ("footercodes.php"); } ?> Your help is greatly appreciated Regards Daniel