PHP - Need Code To Send The Info From Facebook Page To My Email
Hello every one
i need your help please about this i would like to add this tabs to my facebook fan page i got App allowing me to put php coding or html but i need when some one add his info and click on submit i receive it at my email so can any 1 here help me or tell me what shall i do ? i newbie and hope to get your help guys please Similar TutorialsThis is working just fine on a single page. It gives me all information I need. But I want to send an email with it. Although I couldn`t figure out how can I do it Code: [Select] $db = new mysqli('localhost', 'root', '', 'panel'); $sql = "select * from detail"; $read = $db->query($sql); <table style="border:0;width:600px;"> <tr> <td width="50px">Who</td> <td width="150px">Time</td> <td width="300px">What</td> </tr> <?php while($wr = mysqli_fetch_array($read)) { echo' <tr> <td>'.$wr['Who'].'</td> <td>'.$wr['Time'].'</td> <td>'.$wr['What'].'</td> </tr> '; } ?> I have a contact form with a file upload button, when you click on “submit” you are redirected on Paypal everything works fine but, I would like to send the contact form only when visitors have paid on Paypal. I’ve searched on google but I have not found a way to do this. Can anyone help? Cheers, Aidan. Hi I have tried and tried and tried again to get this to work
in simple terms I have very little knowledge with PHP and even less with mysql
I have a paid subscription and domain in order to learn more and I feel I have made ok progress so far
then I realised how unsafe my current work is;
here is my experience this far
I created a site for a group of voluntary online game hosts where they can posts points from their tournaments in a forum
and some info pages to go with this,
however what I did was create a base template and style sheet and then an admin dashboard linked to individual forms to allow the group admin to edit the info pages they go to my form and enter the desired info and submit this then sends through and action file which posts the text and <BR> to a .txt file,
then the connecting page reads the .txt file using the PHP code of " <? php include ( 'index.txt'); ?>
yes you are seeing this correctly I have allowed a direct edit of text in a .txt file rather silly of me but I didn't realise how unsafe this was until now I guess its a good job I trust that the admin has no knowledge or skills in coding
ok since all this I have created a DB in MySQL on my server,
My server uses PHPMyAdmin I have create a DB named " mnvbcou1_content1 " and a table named " home " with rows " ID " and " home "
what I am trying to do:
I want my page to display the content of the table row home and a form once submitted to send to the table row home
or if needed I can re make this DB if the names are not suitable
I have tried to create the needed coding to make this work but for some reason this just will not work I have already added 2 rows to my table to try and make the page to display the content but it just is not working I got an error every time
so I hope that someone out there is rather patient and is willing to help me learn how to do this correctly and safely,
also this is a closed group website the address to this site is only known by a handful of none programmers I am mainly trying to make this work for my own personal knowledge and server safety please help me
Hi guys, I have a booking form on my website for potential customers to request a booking. The form asks for their Name, Address, Email and Tel No. I need the code to be able to send the form by Php. I also need it to show an error message if they haven't completed any of the fields. The fields on my form a Name, Address, District, City, Postcode, Tel No, Email. Please help. i want send scheduled email. please help me how can i write code in php Hi FYI I'm a n00b in this particular forum & php n00b really but I'm having a problem & cant find a solution anywhere! I need to be able to send an email from a form. Within the form is a dropdown field for different regions. When a region is selected it sets the email address for that region into an input/text field. I need to pickup that value and send the email to that address but not sure how. Have been told to use echo$email & that perhaps my variable is empty but I haven't got a clue where to put it or what that means. Help please?! my code: include ('maketable.php'); include ('mailbot.php'); include ('auditFile.php'); $office = $_REQUEST["office"]; $callername = $_REQUEST["callername"]; $callerphone = $_REQUEST["callerphone"]; $callaction = $_REQUEST["callaction"]; $callerInfo = "Callers Name=".$callername; $commentInfo = "Callers Phone No=".$callerphone; $callDetail = "Action Taken=".$callaction; $title = "DOC Call Results"; $stylesheet = "stylesheet.css"; $logo = "tcclogo.jpg"; $display = makeHeader($title,$stylesheet,$logo); $display .= makeTable("Caller Details",$callerInfo,1); $display .= makeTable("",$commentInfo,1); $display .= makeTable("",$callDetail,1); $display .= '</body></html>'; $info = $callerInfo."; ".$commentInfo."; ".$callDetail; auditFile($title, $info); echo $email; mailbot($title,$display,"email","info@tcc.co.nz","ThankYou.html"); I have a small family only website and I use this code on my login page to see if members are having trouble re logging in.
// routine writes to file when this page is accessed
<?php $logfile = '/home/xxxxxxx/public_html/temp/trouble.txt'; $date = date('j M Y H:i:s'); if (isset($_COOKIE["family_user"])) { $user = $_COOKIE["family_user"]; } if ($file = @fopen($logfile, 'a')) { fwrite($file, "\r\n$date $user "); fclose($file); } ?> How can I use the information gathered (fwrite($file, "\r\n$date $user ") that writes to my trouble.txt file be sent to me via email. And ideally only once per session. I found this code will send me an email every time the page is accessed but can not figure out how to get fwrite($file, "\r\n$date $user " into either the subject (preferred) or into the body. <?php mail('yourEmailAddress@yourDomain.com','Subject of the e-mail','This is the body of the e-mail!'); ?> Anyone able to help with the code Thank you for your time I have a problem, i have page to send via mail function, cant snd html page, when recive mail, there is no layout, but text is there, also there are no images, and i put full address to image file. Using content type html/text, and still nothing :-( Can someone help me? Hello, I am creating a website with the use of php and mysql. While I am not advanced, I've been learning quite a bit on php. However, I am looking to build a tracker type script and hide it into my coding so that if someone were to hack into my website and take my website coding, that it would send me an email notifying that they were using my coding. How would I go about this? If you can help me, i'd be glad to credit you! Thank you! Ok i am stuck, i created a php script that draws data from a mysql dB into a php page. How can I send the page as the body in email? I do not need to preview the page, but can send it without ever viewing if that helps. When I put my code into a variable it does nothing. Is it caching? Should I load the results into mysql then send?please advise.. Okay, I'll make this short and sweet, and all side comments are irrelevant. I'm doing this for my own happies So using Facebook.com's API you can extract all of a specific user's friends in an array. Well I'm making a array check to see who on that users friend list was removed or deleted them that week using array_dif(); in this method: 1) User allows the application 2) Application catches the user's friends_id's in an array and stores them // this is where i'm having trouble, i'll come back to it 3) User then waits a few days and notices their friend count is no longer 400, it's now 399! 4) User logs into my application, and checks the previously uploaded array against their current array of friends. Okay now to the part i'm struggling with is, what would you do? Should i store them each uniquely in a database? Because some users have 4,000+ friends and that gets quite strenuous. OR! Should i save them into a txt file unique to that person's user_id. I kind of like the 2nd option, however it's less ( to my newbish mind ) customizable versus the sql_queries. Once again, i'd like to reiterate, i don't care that this is again Facebooks terms of service, it's for my own personal gain and just enjoy taking on projects in my spare time that force my brain to work hard. That's all, hope you excuse the typos and poor grammar. Typed this pretty quickly, any questions - feel free to ask! this is my code:
<?php include 'sqlconnect.php'; $sql = mysqli_query($con,"SELECT * FROM aktiviteter"); $data = array(); while ($row = mysqli_fetch_assoc($sql)) { $data[$row['id']] = array( 'title' => $row['title'], 'pris' => $row['pris'], 'beskrivelse' => $row['beskrivelse'], ); } print_r(error_get_last()); ?> <html> <head> <title>Polterplanner Bestilling</title> <link rel="stylesheet" type="text/css" href="style.css"> <script> var jsArray = []; <?php foreach($data as $key => $value): echo 'jsArray["'.$key.'"] = [];'; echo "\r\n"; foreach($value as $infoType => $info): echo 'jsArray["'.$key.'"]["'.$infoType.'"] = "'.$info.'";'; echo "\r\n"; endforeach; endforeach; print_r(error_get_last()); ?> function activitySelectionChanged(elementID) { var activitySelect = document.getElementById('activity' + elementID); var selectedValue = activitySelect.value; var priceOutputBox = document.getElementById('activityPrice' + elementID); priceOutputBox.innerHTML = jsArray[selectedValue]["pris"]; var price1 = document.getElementById('activityPrice').innerHTML; var price2 = document.getElementById('activityPrice2').innerHTML; var total = document.getElementById('activityTotal'); if(price1!='Pris' && price2!='Pris') { total.innerHTML = parseInt(price1) + parseInt(price2); } } </script> </head> <body> <div id"wrapper"> <div id="tableWrapper"> <table class="tables" width="349" height="27" border="0"> <tr> <td width="174" height="23"> <select class="styled-select" name="activity" id="activity" onChange="activitySelectionChanged('')"> <option value="">-----------------</option> <?php foreach($data as $key => $value): echo '<option value="'.$key.'">'.$value['title'].'</option>'; echo "\r\n"; endforeach; print_r(error_get_last()); ?> </select></td> <td width="86"> </td> <td width="75"><span class="Pris" id="activityPrice">Pris</span>,-</td> </tr> </table> <table class="tables" width="349" height="27" border="0"> <tr> <td width="174" height="23"> <select class="styled-select" name="activity2" id="activity2" onChange="activitySelectionChanged(2)"> <option value="">-----------------</option> <?php foreach($data as $key => $value): echo '<option value="'.$key.'">'.$value['title'].'</option>'; echo "\r\n"; print_r(error_get_last()); endforeach; ?> </select></td> <td width="86"> </td> <td width="75"><span class="Pris" id="activityPrice2">Pris</span>,-</td> </tr> </table> <table class="tables" width="349" height="27" border="0"> <tr> <td width="174" height="27">Total:</td> <td width="86"> </td> <td width="75"><span class="Pris" id="activityTotal">Total</span>,-</td> </tr> </table> </div> <!-- tableWrapper ends --> </div> <!-- wrapper ends --> </body> </html>what i want is the info send through a form, so that im ale to send this via an email. would i use: document.getElementById( ...... ); ? link to working page: http://polterplanner.dk/bestiller.php Hello all, I used simple php email function but it send an email in junk folder or spam. Can anyone tell me why is this so? Her is the code: $host = "ssl://smtp.gmail.com"; $port = "465"; $to = " xx@gmail.com"; // note the comma $subject = " $_POST[company_website] "; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: About Wholesale Account' . "<$_POST[email]>\r\n"; $headers .= 'Cc: mail@gmail.com' . "\r\n"; $headers .= 'Bcc: cc@gmail.com' . "\r\n"; mail($to, $subject, $message, $headers); Hello Guys,
I need your help as many PHPers here is more experienced in PHP coding than me. I have specific project I am working on and need a piece of code that can send an email from HTML form using PHP to the email address that is entered manually on the form, instead of standard sent to PHP code that is fixed within PHP script and executed during submission. I want sth that can grab manually enetered recipient's e-mail address, paste it to the PHP code and then use it to send the email to the recipient, instead of fixed sent to code. Something would say dynamically changed during the entry that can inject into PHP code the new address email entered on the form and then submit to it. Any ideas will be great.
Thanks.
Edited March 27, 2019 by slawotrend Hey guys, how do I send checkbox variables to my e-mail address once a user has checked it on the html form. Here is my html form: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Form</title> <script type="text/javascript"> //email form validation function everif(str) { var at="@" var punct="." var lat=str.indexOf(at) var lstr=str.length var lpunct=str.indexOf(punct) if (str.indexOf(at)==-1){ alert("Valid email must be entered") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Valid email must be entered") return false } if (str.indexOf(punct)==-1 || str.indexOf(punct)==0 || str.indexOf(punct)==lstr){ alert("Valid email must be entered") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Valid email must be entered") return false } if (str.substring(lat-1,lat)==punct || str.substring(lat+1,lat+2)==punct){ alert("Valid email must be entered") return false } if (str.indexOf(punct,(lat+2))==-1){ alert("Valid email must be entered") return false } if (str.indexOf(" ")!=-1){ alert("Valid email must be entered") return false } return true } function evalid(){ var emailID=document.contact_form.mail if (everif(emailID.value)==false){ emailID.focus() return false } //empty field validation var naam=document.contact_form.naam if ((naam.value==null)||(naam.value=="")){ alert("Fields marqued with * must be entered") naam.focus() return false } var telefoon=document.contact_form.telefoon if ((telefoon.value==null)||(telefoon.value=="")){ alert("Fields marqued with * must be entered") telefoon.focus() return false } var branche=document.contact_form.branche if ((branche.value==null)||(branche.value=="")){ alert("Fields marqued with * must be entered") branche.focus() return false } return true } </script> </head> <body> <form name="contact_form" method="post" id="contactform" action="doeactie.php" onSubmit="return evalid()"> <table border="0"> <tr> <td><label for="bedrijfsnaam">Company name</label></td> <td colspan="2"><input name="bedrijfsnaam" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="naam">Name *</label></td> <td colspan="2"><input name="naam" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="mail">E-mail *</label></td> <td colspan="2"><input type="text" name="mail" class="text" size="30" /></td> </tr><tr> <td><label for="adres">Address</label></td> <td colspan="2"><input name="adres" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="plaatsnaam">City</label></td> <td colspan="2"><input name="plaatsnaam" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="postcode">Zip</label></td> <td colspan="2"><input type="text" name="postcode" class="text" size="10" /></td> </tr><tr> <td><label for="branche">Niche *</label></td> <td colspan="2"><input name="branche" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="telefoon">Phone *</label></td> <td colspan="2"><input name="telefoon" class="text" type="text" size="30" /></td> </tr><tr> <td><label for="bericht">Question or Comment</label></td> <td colspan="2"><textarea name="message" class="text" onkeyup="return limitarelungime(this, 255)" cols="35" rows="5"></textarea></td> </tr> </table> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td></td> <td height="25"></td> </tr> <tr> <td></td> <td height="30" valign="top"><font face="arial" size="2"><b>I would also like to receive information about :</b></font></td> </tr> <tr> <td><input type="checkbox" name="emailmarketing" id="emailmarketing" value="emailmarketing" /></td> <td height="25"><font face="arial" size="2">E-mail Campaign</font></td> </tr> <tr> <td><input type="checkbox" name="zoekmachopt" id="zoekmachopt" value="zoekmachopt" /></td> <td height="25"><font face="arial" size="2">SEO</font></td> </tr> <tr> <td><input type="checkbox" name="socialmedia" id="id" value="socialmedia" /></td> <td height="25"><font face="arial" size="2">Social Media</font></td> </tr> <tr> <td><input type="checkbox" name="videomarketing" id="videomarketing" value="videomarketing" /></td> <td height="25"><font face="arial" size="2">Video Marketing</font></td> </tr> <tr> <td><input type="checkbox" name="webshop" id="webshop" value="webshop" /></td> <td height="25"><font face="arial" size="2">Webshop</font></td> </tr> <tr> <td><input type="checkbox" name="cms" id="cms" value="cms" /></td> <td height="25"><font face="arial" size="2">Content Management System</font></td> </tr> <tr> <td><input type="checkbox" name="grafisch" id="grafisch" value="grafisch" /></td> <td height="25"><font face="arial" size="2">Graphic Design</font></td> </tr> <tr> <td></td> <td align="left"><br /><input type="submit" name="Submit" value="Send"></td> <td align="right"></td> </tr> </table> </form> </body> </html> and this is the PHP script that processes this. Everything works except for the checkbox part. <?php session_start(); if(isset($_POST['Submit'])) { $youremail = 'blabla@gmail.com'; $fromsubject = 'Request from form'; $bedrijfsnaam = $_POST['bedrijfsnaam']; $naam = $_POST['naam']; $mail = $_POST['mail']; $adres = $_POST['adres']; $plaatsnaam = $_POST['plaatsnaam']; $postcode = $_POST['postcode']; $branche = $_POST['branche']; $telefoon = $_POST['telefoon']; $message = $_POST['message']; $to = $youremail; $mailsubject = 'Bericht ontvangen van'.$fromsubject.' Actie Pagina'; $body = $fromsubject.' Bedrijfsnaam: '.$bedrijfsnaam.' Naam Contact Persoon: '.$naam.' E-mail: '.$mail.' Adres: '.$adres.' Plaatsnaam: '.$plaatsnaam.' Postcode: '.$postcode.' Branche: '.$branche.' Telefoonnummer: '.$telefoon.' vraag of Wens: '.$message.' |---------End Message----------|'; echo "thank you for your request we will contact you asap."; mail($to, $subject, $body); } else { echo "Error Please <a href='form.html'>try again</a>"; } ?> Any help would be great! Thanks guys
The code below currently sends a separate Email with data from each row of a table when a Save All button is pressed. So, if I have 4 rows of data, 4 Email will be sent. $email="to@email.com"; $from="from@email.com"; $msg=""; $subject="Registers Info for: ".$values["first_name"]." ".$values["last_name"].""; $msg.= "Student: ".$values["first_name"]." ".$values["last_name"]."\r\n"; $msg.= "Absent or Present: ".$values["attendance_status"]."\r\n"; $msg.= "Class: ".$values["classname"]."\r\n"; $msg.= "Class Date: ".$values["attendance_date"]."\r\n"; $msg.= "Amount Received: ".$values["cash_received"]."\r\n"; $msg.= "Paid For: ".$values["cash_whatfor"]."\r\n"; $ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from)); if(!$ret["Sent"]) echo $ret["message"];
Edited February 27, 2020 by leemo Well this is pretty much the first time I'm attempting something new without a tutorial aiding me ( I know your gonna think I probably should have used 1 when checking my code ) Honestly my brain is fried, but I have a deadline for tomorrow. Basicly I'm sending an email upon registration ( email sends fine ) I made it so the email display the students name and course. However in my registration a student can select contact y or n, which determines whether the student wants to be contacted by other students. So when sending an email to a student who selected n for contact, is should only display the students name and course (sname, fname, cname). However, for a student who selected y for contact, it should display the name and course aswell of a list display the sname,fname and email of all the other students in my student table who selected y in their contact_flag field. Here is my misguided code: Code: [Select] <?php function sendmail(){ $cname = mysql_real_escape_string($_POST['cname']); $sname = mysql_real_escape_string($_POST['sname']); $fname = mysql_real_escape_string($_POST['fname']); $contact = mysql_real_escape_string($_POST['contact']); $Name = "Student Course Registration"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = ($_POST['email']); //recipient $mail_body = "Congratulations $fname $sname. You have successfully registered for the following course: $cname "; //mail body $subject = "Course registration successful!"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields if ($contact=='y'){ $query = "SELECT sname,fname,email FROM student WHERE $contact = ['contact_flag'] "; $run = mysql_query($query) or die(mysql_error()); $found = mysql_fetch_array($run); while ($found = mysql_fetch_array($run)) $contactemail=$person['email']; $contactsname=$person['sname']; $contactfname=$person['fname']; $mail_body2 = "Congratulations $fname $sname. You have successfully registered for the following course: $cname. Here is a list of all the students who you may be in contact with: $contactsname, $contactfname, $contactemail"; //mail body for contact flag { mail($recipient, $subject, $mail_body2, $header); } } else { mail($recipient, $subject, $mail_body, $header); } } ?> I am not receiving any errors from it, and I'm receiving an email which displays $mail_body instead of $mail_body2 which is my else statement. Please, help would be appreciate. Thanks in advance. Hello. I have series of pages which connect form data and insert it into my database. When someone completes the form, they get an autoresponder with some variables of their signup included ($park & $firstname below). I would like to include some more detailed information regarding the event that is found in a different table called 'event'. I am not sure if it would take a join, or how to pass the variables. Can I just create a new SELECT statement and then pass the variables along? Any guidance would be great. Code: [Select] <?php include('dbconfig.php'); $event_id = $_POST['event_id']; $park = $_POST['park']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $email_list = $_POST['email_list']; // Make a MySQL Connection mysql_connect("localhost", "$user", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); mysql_query("INSERT INTO volunteer (id, event_id, park, firstname, lastname, email, phone, email_list) VALUES('', '$event_id', '$park', '$firstname', '$lastname', '$email', '$phone', '$email_list') ") or die(mysql_error()); ?> <?php $to = "$email"; $subject = "Trailworker Event Signup Confirmation"; $message = "Hello [b]$firstname[/b]! Thank you for signing up to work the [b]$park [/b] trailworker event. A crew leader will contact you shortly."; $from = "info@xxxxxxxxxx.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Thank you for signing up. You will receive an email shortly letting you know event details and who your crew leader is."; ?> Hi guys, i have a custom made php that collect all the info in admin page (long story short), there's a button called "Approve" I would like to send back an email to user who applied with picture, once Approved button is pressed, so here's the script: <?php session_start(); $user = '123'; $pass = '123'; $to = $data['email']; $subject = 'blablabla'; $message = 'test123'; if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $pass) { header('WWW-Authenticate: Basic realm="Enter password to access this page."'); header('HTTP/1.0 401 Unauthorized'); echo"You must be logged in to see this page."; exit; } ################## PROTECTED CONTENT ######################## require('./config.php'); ?> <!DOCTYPE HTML> <html> <head> <title>ADMIN PANEL</title> <style type="text/css"> body{width: 960px; margin: auto; margin-top: 20px; padding: 5px 20px; box-shadow: 0px 0px 2px #000000; border-radius: 5px;background:transparent url(images/bg_header.gif) top left repeat-x;} a:link,a:active,a:visited{color: inherit; text-decoration: none;} a:hover{text-decoration: underline;} .button{background:transparent url(images/grad.PNG) bottom left repeat-x; padding: 3px 5px; border-radius: 4px; border: 1px solid #cccccc;} .button:hover{border-color:orangered;text-decoration:none;} .approve .img{max-height: 200px; max-width: 200px; position: absolute; right: 5px; top: 5px;} .approve{display: block; height: 200px; overflow: hidden; box-shadow: 0px 0px 2px #000000; margin-top: 20px; padding: 20px; position: relative; font:13px verdana;} textarea,input{padding: 3px;font: 13px helvetica,verdana;border:1px solid rgb(51,151,251);border-radius: 4px;width: 300px; display: block; margin: 5px 0px;} input:hover,textarea:hover{border-color:orangered;cursor:pointer;} form{font:bold 13px verdana;} input[type='submit'],input[type='button']{width: auto;} </style> </head> <body> <?php echo" <div id='head'> <h1 align='center'>ADMIN PANEL</h1> <h4 align='center'><a href='index.php' class='button'>Homepage</a> <a class='button' href='admin.php'>Approval Queue</a> <a class='button' href='admin.php?edit'>Edit Image info.</a> <a class='button' href='?edit&view'>View Image Info.</a></h4> </div>"; if (isset($_GET['edit'])) { if (isset($_GET['pid'])) { $pic = mysql_query('SELECT * from `' . $table_name . '` WHERE pid = ' . intval($_GET['pid'])); if (mysql_num_rows($pic) == 1) { if (isset($_POST['submit'])) { $approved = isset($_POST['approved']) && $_POST['approved'] == '1' ? 1 : 0; mysql_query('UPDATE `' . $table_name . '` SET ' . 'first_name = "' . $_POST['first'] . '",' . 'last_name="' . $_POST['last'] . '",' . 'phone="' . $_POST['phone'] . '",' . 'email="' . $_POST['email'] . '",' . 'first_name="' . $_POST['first'] . '",' . 'approved=' . $approved . ',' . 'address="' . $_POST['addr'] . '",' . 'admin_desc="' . $_POST['admin_desc'] . '"' . ' WHERE pid = ' . intval($_GET['pid'])) or exit("Unable to edit" . mysql_error()); echo'<h3>EDITED</h3>'; $pic = mysql_query('SELECT * from `' . $table_name . '` WHERE pid = ' . intval($_GET['pid'])); } $data = mysql_fetch_array($pic); if (isset($_GET['view'])) { echo' <strong>Uploaded by </strong>' . $data['first_name'] . ' ' . $data['last_name'] . ' <br /> <img src="' . $default_dir . $data['image_name'] . '" style="max-width: 200px; max-height:200px; float: right;" /> <br /> <br /> <b>First_name :</b> ' . $data['first_name'] . ' <br /> <br /> <b>Last_name :</b> ' . $data['last_name'] . ' <br /> <br /> <b>Phone :</b> ' . $data['phone'] . ' <br /> <br /> <b>Email :</b> ' . $data['email'] . ' <br /> <br /> <b>Approved :</b> ' . ($data['approved'] == 1 ? 'Yes' : 'No') . ' <br /> <br /> <b>Address :</b> ' . $data['address'] . ' <br /> <br /> <b>Admin_description :</b> <br /> <br />' . $data['admin_desc'] . ' <br /> <br /> <a href="?edit&pid=' . $data['pid'] . '" class="button">Edit</a> <br /> <br /> '; } else { echo'<form method="POST" action="?edit&pid=' . intval($_GET['pid']) . '"> Editting photo: <a style="color:rgb(51,151,251);" href="' . $default_dir . $data['image_name'] . '">' . $data['image_name'] . '</a> uploaded by ' . $data['first_name'] . ' ' . $data['last_name'] . ' <br /> <img src="' . $default_dir . $data['image_name'] . '" style="max-width: 200px; max-height:200px; float: right;" /> <br /> First_name : <input type="text" name="first" value="' . $data['first_name'] . '" /> Last_name : <input type="text" name="last" value="' . $data['last_name'] . '" /> Phone : <input type="text" name="phone" value="' . $data['phone'] . '" /> Email : <input type="text" name="email" value="' . $data['email'] . '" /> Approved : <input type="text" name="approved" value="' . $data['approved'] . '" /> 0 or 1 Address : <textarea name="addr">' . $data['address'] . '</textarea> Admin_description : <textarea name="admin_desc">' . $data['admin_desc'] . '</textarea> <input type="submit" name="submit" value="Edit" /> </form>'; } } else { echo"NO SUCH PICTURE EXISTS"; } } else { echo" <h3>Search for image to " . (isset($_GET['view']) ? 'view' : 'edit') . " it: </h3> <form id='form' method='POST' action='admin.php?edit" . (isset($_GET['view']) ? '&view' : '') . "'> Uploader's first name: <input type='text' name='name' value='' /> OR Image name: <input type='text' name='img' value='' /> OR Email: <input type='text' name='email' value='' /> <input type='submit' name='submit' value='Search' /> </form>"; if (isset($_POST['submit'])) { $name = empty($_POST['name']) ? '%' : '%' . $_POST['name'] . '%'; $email = empty($_POST['email']) ? '%' : '%' . $_POST['email'] . '%'; $img = empty($_POST['img']) ? '%' : '%' . $_POST['img'] . '%'; $query = mysql_query( 'SELECT * from `' . $table_name . '` where ' . 'first_name like "' . $name . '" and ' . 'email like "' . $email . '" and ' . 'image_name like "' . $img . '"'); if (mysql_num_rows($query) > 0) { while ($pic = mysql_fetch_array($query)) { echo"<hr/><strong>Uploaded by $pic[first_name] $pic[last_name] " . date(' \a\t H:i \o\n d/m/Y', intval($pic['image_name'])) . "</strong> - <a href='$default_dir$pic[image_name]' target='_blank'>$pic[image_name]</a> <a href='?edit" . (isset($_GET['view']) ? '&view' : '') . "&pid=$pic[pid]' class='button'>" . (isset($_GET['view']) ? 'View' : 'Edit') . "</a>"; } } else { echo "NO IMAGE MATCHES THAT DESCRIPTION"; } } } exit; } if (isset($_GET['approve'])) { if (mysql_query('UPDATE `' . $table_name . '` SET approved = 1 WHERE pid = ' . intval($_GET['approve']))) { if (@mail($to, $subject, $message)) { echo('<p>Mail sent successfully.</p>'); } else { echo('<p>Mail could not be sent.</p>'); } echo"<h2>APPROVEDs</h2>"; } } It's not whole script though. |