PHP - Email Post Link To User, How To Get Newest Id?
guys this function below posts the data into table and im also able to send a link in email with caregory name but the issue is getting the id to the particular post i got no isea how do i get that?
Code: [Select] function insert($postData) { $postData['description'] = clean($postData['description']); if(!EmailExists($postData['email'])){ $sql = " INSERT INTO tbl_emails SET email = '".$postData['email']."', postersname = '".$postData['postersname']."', phone = '".$postData['phone']."' "; executeSql($sql); } if(empty($_FILES['image']["name"])){ $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['location']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; executeSql($sql); }else{ global $uploadPath; $remove_symbols = array('+', '=', '-', '{', '}', '$', '(', ')','&'); $removed_symbols = str_replace($remove_symbols, "_", $_FILES['image']['name']); $randomnum=rand(00000000,99999999); $imagepath = uploadFile($_FILES['image'], $uploadPath); $image = new SimpleImage(); $image->load($imagepath); $image->resize(250,280); $resize_rename = $uploadPath.$randomnum._.$removed_symbols; $image->save($resize_rename); unlink($imagepath); //delete the original file $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '".$resize_rename."', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['ocation']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; executeSql($sql); } } Similar TutorialsHi I'm currently wondering how people check for latest records each time they refresh only the latest records display in another color. For example a chat. When people submit post and another user refresh their chat page the newest post always get highlighted. Does it work with sessions or how does it work?
Actually, what i want to do is to use the email to fetch the $email,$password and $randomnumber from database after Hi, I'm new here and new to php. My first attempt at a php project actually so I'm hoping to get some help. I want people to register at my site but I don't want them to put false emails on it. So I used the coding from this website http://www.phpeasystep.com/workshopview.php?id=24 to provide codings for forms and email confirmation links. The process worked up to when I click on the confirmation link (at testing) from the email and the link returns to a blank webpage. No data is transferred from "temp_members_db" table to "registered_members" table at all. I'll attach print screen of my tables. Hoping that someone can point out to me where I'm going wrong as I can't seem to get myself out of this one. Hi, n0obie here. I'm trying to identify where my customers are coming from via emails I've sent/received. However, many email providers (namely Gmail) have circumvented this by disallowing IP address geolocation/image caching. Hi, I have setup a standard contact form that sends an email using php "mail" function in my new website. Today, I received an email from a potential client through my website. However, unfortunately, I did not receive the user's email address because (as I discovered after wards), there was a syntax problem in the function, so all I received is their name and message. I am certain that the user has entered their email address because the form has validation, it just didn't send me the address so I have no way to contact that client... Is there a way to retrieve the lost email address from the server somehow? Thanks in advance I am having trouble on user post = rank This is the rank table: ----------------- post | rank ----------------- 0 | Noob 10 | Member 50 | Metal 100 | Silver 200 | Gold $user_post="120"; $query_rank=mysql_query("SELECT * FROM rank WHERE post<='$user_post' OR post>='$user_post'") or die ("Error"); while ($row=mysql_fetch_assoc($query_rank)){ $rank=$row['rank']; } echo "User Rank: $rank"; The above code output: User Rank: Gold The right output should be: User Rank: Silver Please help It will be better if someone willing to share a better ranking code. Hey fellas, and ladies, and all you other php wize's. Names mike and I'm new to php and mysql. Ive done alot of self study but have no formal training at all. I am pretty much just winging my code from w3 schools and other php online codeing helps. I am currently making a registration script for my site, and have hit a bit of a snag. Her is the current code for my regpass.php. <?php include('srvdbcon.php'); $NewUserNameTest=$_POST['NewUserName']; if(!ereg('[^A-Za-z0-9]',$NewUserNameTest)) { $query="SELECT * FROM user WHERE user ='$_POST(NewUserName)'"; $result=mysql_query($query); $num=mysql_num_rows($result); if($num == 0) { $query2="SELECT * FROM user WHERE email ='$_POST(NewUserEmail)'"; $result2=mysql_query($query2); $num2=mysql_num_rows($result2); if ($num2 == 0) { if(($_POST[NewUserPw]==$_POST[NewUserPwCon])&&($_POST[NewUserEmail]==$_POST[NewUserEmailCon])) { //Create a random code $confirm_code=md5(uniqid(rand())); //HACK PREVENTION $name=strip_tags($_POST['NewUserName']); $email=strip_tags($_POST['NewUserEmail']); $pw=strip_tags($_POST['NewUserPw']); //Insert Information Into Temp Code $sql="INSERT INTO temp SET code='$confirm_code',user='$name', email='$email', password='$pw'"; $result=mysql_query($sql); if($result) { $message="SCG.O Confirmation \r\n"; $message="Enter this confirmation code into confirmation page.\r\n"; $message="Enter code into confirmation: $confirm_code"; $sentmail=mail("$email",'Registration Confirmation',"$message",'From: SCGAdmin@uprisetechnology.com'); header("Location:index.php"); } else { die ("Something went wrong."); } } else { die("Password And / Or Email does not match the confirmation entry"); } } else { die("Email Already in Use"); } } else { die("Username already in use"); } } else { die("Username includes Bad Characters."); } ?> ---------------------------------------------------------------------------- The problem I am having is the code executes up to Confirming email and password with the confirming. I have checked, and double checked, the names of the variables $NewUserEmail $NewUserEmailCon $NewUserPw $NewUserPwCon When I click the register button it runs the regpass.php but I am getting the Die results for Error with matching confirmations. Any help would be appreciated. I know it is not the neatest codeing, nor is it probably logical to more vast programmers, but I am learning, and programming accourding to my own logic so I can understand it. Thanks. The code does not post anything to the mysql db but everything else is set up properly. The DB works, I have created this kind of script before with help from others, but this one is using my logic so I can understand the code. Thanks again. NeverBeGosu here's my code that i've used to send an email. Code: [Select] $link = "<a href=\"http://www.example.com/" . $num . "\">" . $num . "</a>"; $query = "SELECT content FROM emails"; $result = mysql_query($query) or die(); $email_content = mysql_result($result, 0); $email = sprintf($email_content, $first, $name, $from, $link, $record, $rec, $inc, $max); $email_body = stripslashes(htmlentities($email, ENT_QUOTES, 'UTF-8')); // this is sent to another php script via post.... $subject = $_POST['subject']; $message = nl2br(html_entity_decode($_POST['email_body'])); $to = "me@whatever.com"; $charset='UTF-8'; $encoded_subject="=?$charset?B?" . base64_encode($subject) . "?=\n"; $headers="From: " . $userEmail . "\n" . "Content-Type: text/html; charset=$charset; format=flowed\n" . "MIME-Version: 1.0\n" . "Content-Transfer-Encoding: 8bit\n" . "X-Mailer: PHP\n"; mail($to,$encoded_subject,$message,$headers); in the db, emails.content is of the text type and contains several lines of text with %4$s which inserts the value of $link into the body. when the email arrives, there is a link and it appears fine, with the value of $num hyperlinked. however when you click on it it doesn't go anywhere. when copying the link location from the email it gives me x-msg://87/%22http://www.example.com/16 what is x-msg? how can i get this to work properly? hello all - I have a social network for the cystic fibrosis community and we've had a spammer the passed couple of days. I have captchas set up and they work well, but in addition to those I want to limit the amount of blogs a user is allowed to post a day. I have been able to count and echo out the amount a user has made, but for some reason, when I use an if statement to stop the blog from posting it still post's. I have been working on this going on hour 8 now and need some major help Thanks in advnace. Here is my code Code: [Select] if(isset($_POST['subComposeBlog'])) { $query = "SELECT COUNT(`id`) FROM `cysticBlogs` WHERE `Author` = '".$auth."' && `date` = NOW() && `status` = 'active'"; $request = mysql_query($query,$connection) or die(mysql_error()); $result = mysql_fetch_array($request); $valid = true; if($_POST['Category'] == "null") { $valid = false; $error_msgs[] = "Whoops! Please select a category for this blog."; } if(empty($_POST['blogTitle'])) { $valid = false; $error_msgs[] = "Whoops! Cannot submit a blog without a title,how are you going to attract people's attention to read your masterpiece?"; } if(empty($_POST['blogBody'])) { $valid = false; $error_msgs[] = "Whoops! Cannot submit a blog without a body,that would not be a blog now would it?"; } if($result['COUNT(`id`)'] > 3) { $valid = false; echo "Whoops! You can only write three blogs per day due to spam"; } if($valid) { $query = "INSERT INTO `cysticBlogs` ( `blogTitle`, `blogBody`, `date`, `time`, `Author`, `Category` ) VALUES ( '" . mysql_real_escape_string($_POST['blogTitle']) ."', '" . mysql_real_escape_string($_POST['blogBody']) ."', '" . date("Y-m-d") ."', '" . date("G:i:s") ."', '" . $auth->id ."', '" . mysql_real_escape_string($_POST['Category']) ."')"; mysql_query($query, $connection) or die (mysql_error()); header("Location: BlogsSecurity.php"); } } Hi, During post of my form I am trying to send some table values. The three field values (DATE, SITE, PRICE) that I want to send are attached to the id field (RID) in the daterange table. The variable $FTGRID is attached to the RID field. Here is the structure of the daterange table and the code from the php page related to the email is below. Do I need to pre-define variables for these three field values? daterange Table: RID DEND MONTH DATE SITE PRICE STATUS Code: [Select] if ( $validationFailed === false ) { # Email to Form Owner $emailSubject = FilterCChars("Your Reservation"); $emailBody = "Reservation Date : \n" . "Site : \n" . "Price : \n" . "Fname : $FTGFNAME\n" . "Lname : $FTGLNAME\n" . "Addr1 : $FTGADDR1\n" . "Addr2 : $FTGADDR2\n" . "City : $FTGCITY\n" . "State : $FTGSTATE\n" . "Zip : $FTGZIP\n" . "Phone : $FTGPHONE1" . "- $FTGPHONE2" . "- $FTGPHONE3\n" . "Email : $FTGEMAIL\n" . "Payment Method : $FTGPM\n" . "Last Four CC : $FTGC4\n" . ""; $emailTo = 'u@yahoo.com'; $emailFrom = FilterCChars("inquiry@c.com"); $emailHeader = "From: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"UTF-8\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Confirmation Email to User $confEmailTo = FilterCChars($FTGEMAIL); $confEmailSubject = FilterCChars("Confirmation of Reservation"); $confEmailBody = "Reservation Date : \n" . "Site : \n" . "Price : \n" . "Fname : $FTGLNAME\n" . "Lname : $FTGLNAME\n" . "Addr1 : $FTGADDR1\n" . "Addr2 : $FTGADDR2\n" . "City : $FTGCITY\n" . "State : $FTGSTATE\n" . "Zip : $FTGZIP\n" . "Phone : $FTGPHONE1" . "- $FTGPHONE2" . "- $FTGPHONE3\n" . "Email : $FTGEMAIL\n" . "Payment Method : $FTGPM\n" . "Last Four CC : $FTGC4\n" . ""; $confEmailHeader = "From: inquiry@c.com\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"UTF-8\"\n" . "Content-transfer-encoding: 8bit\n"; mail($confEmailTo, $confEmailSubject, $confEmailBody, $confEmailHeader); Hey guys. This is my code: <?php session_start(); if ($_SESSION['adminlogin'] == 1){ //Run } else { header('Location: Log-In.php'); exit; } ?> <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Mailing List Administration | Worldwide Lighthouses</title> </head> <body> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="http://www.worldwidelighthouses.com/Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="http://www.worldwidelighthouses.com/Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="http://www.worldwidelighthouses.com/Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="http://www.worldwidelighthouses.com/Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="http://www.worldwidelighthouses.com/Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="http://www.worldwidelighthouses.com/Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="http://www.worldwidelighthouses.com/Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <?php if ($_SESSION['adminlogin']==1) { echo '<div id="logout"> <div style="float:left; width:30%; text-align:left;!important"> <a href="Log-In-Accept-Deny.php">Back to Admin Home</a> </div> <div style="float:right; width:70%;"> <a href="Logout.php">Log Out of Admin</a> <p style="font-size:10px;">Always Sign Out when Finished!</p> </div></div>';} ?> <article> <?php $title = $_POST['title']; $introparagraph = $_POST['introparagraph']; $update1title = $_POST['update1title']; $update2title = $_POST['update2title']; $update3title = $_POST['update3title']; $update1caption = $_POST['update1caption']; $update2caption = $_POST['update2caption']; $update3caption = $_POST['update3caption']; $update1link = $_POST['update1link']; $update2link = $_POST['update2link']; $update3link = $_POST['update3link']; $maincontenttitle = $_POST['maincontenttitle']; $article = $_POST['article']; $articlelink = $_POST['articlelink']; ################################################################# #####################IMAGE UPLOAD SCRIPT######################### ################################################################# // Where the mainimage file is going to be placed $target_path_mainimage = "Newsletter-Images/Main-Images/"; // Wheere the update images will be places $target_path_updateimage1 = "Newsletter-Images/Update-Images/1/"; $target_path_updateimage2 = "Newsletter-Images/Update-Images/2/"; $target_path_updateimage3 = "Newsletter-Images/Update-Images/3/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ //Main $target_path_mainimage = $target_path_mainimage . basename( $_FILES['mainimage']['name']); //Update Images $target_path_updateimage1 = $target_path_updateimage1 . basename( $_FILES['update1']['name']); $target_path_updateimage2 = $target_path_updateimage2 . basename( $_FILES['update2']['name']); $target_path_updateimage3 = $target_path_updateimage3 . basename( $_FILES['update3']['name']); //Move the main image file to its location if(move_uploaded_file($_FILES['mainimage']['tmp_name'], $target_path_mainimage)) { } else{ echo "There was an error uploading the main image file, please try again!"; } //Move the update images to their location if(move_uploaded_file($_FILES['update1']['tmp_name'], $target_path_updateimage1)) { } else{ echo "There was an error uploading the 1st update image file, please try again!"; } if(move_uploaded_file($_FILES['update2']['tmp_name'], $target_path_updateimage2)) { } else{ echo "There was an error uploading the 2nd update image file, please try again!"; } if(move_uploaded_file($_FILES['update3']['tmp_name'], $target_path_updateimage3)) { } else{ echo "There was an error uploading the 3rd update image file, please try again!"; } ############################################################################## ######################### END IMAGE UPLOAD SCRIPT ############################ ############################################################################## $mainimageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Main-Images/".basename( $_FILES['mainimage']['name']); $update1imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/1/".basename( $_FILES['update1']['name']); $update2imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/2/".basename( $_FILES['update2']['name']); $update3imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/3/".basename( $_FILES['update3']['name']); $emailcontent = ' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>'.$title.'</title> </head> <body style="margin: 0; padding: 0;"> <table width="100%" cellpadding="0" cellspacing="0" bgcolor="#333333"><tr><td> <table cellspacing="15" id="main" align="center" width="600" cellpadding="0" bgcolor="ffffff" style="margin-top: 10px; border: 1px solid #cfcece;"> <tr> <td> <table id="header" cellpadding="10" cellspacing="0" align="center" bgcolor="#000000"> <tr> <td width="570" bgcolor="#356A5C"><a href="http://www.worldwidelighthouses.com" style="color: #FFF; text-decoration: none;"><h1 style="font-size: 24px; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; margin: 0; color: #ffffff; padding: 0;">Worldwide Lighthouses</h1></a><h2 style="font-size: 24px; font-family: Arial, Helvetica, sans-serif; margin: 0; color: #ffffff !important; padding: 0;">'.$title.'</h2></td> </tr> <tr> <td width="570" align="right" bgcolor="#154A3C"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #ffffff; margin: 0; padding: 0;">'.date("F Y").'</p></td> </tr> </table><!-- header --> </td> </tr><!-- header --> <tr> <td></td> </tr> <tr> <td> <table id="content-1" cellpadding="0" cellspacing="0" align="center"> </table> <img src="'.$mainimageurl.'" height="190" alt="'.$title.'" width="570" style="display: block;" /><!-- content 1 --> </td> </tr><!-- content 1 --> <tr> <td> <table id="content-2" cellpadding="0" cellspacing="0" align="center"> <tr> <td width="570"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode',".' sans-serif; color: #444444; margin: 0; padding: 0;">'.$introparagraph.'</p></td> </tr> </table><!-- content-2 --> </td> </tr><!-- content-2 --> <tr> <td> <table id="content-3" cellpadding="0" cellspacing="0" align="center"> <tr> <td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> <a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update1imageurl.'" alt="'.$update1title.'" style="display: block;" /></a> </td> <td width="15"></td> <td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> <a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update2imageurl.'" alt="'.$update2title.'" style="display: block;" /></a> </td> <td width="15"></td> <td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> <a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update3imageurl.'" alt="'.$update3title.'" style="display: block;" /></a> </td> </tr> </table><!-- content-3 --> </td> </tr><!-- content-3 --> <tr> <td> <table id="content-4" cellpadding="0" cellspacing="0" align="center"> <tr> <td width="180" valign="top"> <a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update1title.'</h5></a> <a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'." 'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update1caption.'</p></a> </td> <td width="15"></td> <td width="180" valign="top"> <a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update2title.'</h5></a> <a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update2caption.'</p></a> </td> <td width="15"></td> <td width="180" valign="top"> <a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update3title.'</h5></a> <a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update3caption.'</p></a> </td> </tr> </table><!-- content-4 --> </td> </tr><!-- content-4 --> </tr><!-- content-5 --> <td> <tr bgcolor="#FFFFFF" align="center"> <a href="'.$articlelink.'" style="color: #FFF; text-decoration: none;"><td height="30"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444 !important; text-align:left;">'.$maincontenttitle.'</h5></a></td> </tr> <tr> <td> <table id="content-6" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF"> <p align="left" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$article.'</p> <p align="center" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;"><a href="http://www.worldwidelighthouses.com" style="text-decoration: none; color: #4A72AF;">Visit the website now!</a></p> </table> </td> </tr> </table><!-- main --> <table id="bottom-message" cellpadding="20" cellspacing="0" width="600" align="center"> <tr> <td align="center"> <p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;">You are receiving this email because you signed up for updates</p> <p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;"><a href="mailto:dantonybrown@hotmail.co.uk?subject=Unsubscribe%20Me&body=Please%20unsubscribe%20me%20from%20your%20mailing%20list" style="text-decoration: none; color: #4A72AF;">Unsubscribe instantly</a> </td> </tr> </table><!-- top message --> </td></tr></table><!-- wrapper --> </body> </html> '; echo '<div class="Textbox"><h2>Email Preview:</h2>'; echo '<p>If you are happy with the below preview (note: Make sure you check all links work and spelling is correct before sending) then click te button below</p>'; ?> <form action="Send-Email.php" method="post"> <input type="hidden" value="<?php $emailcontent?>" name="emailcontent"> <input type="submit" value="Send Email to Entire Contact List"> </form> </div> <?php echo $emailcontent;?> </article> <footer> <ul> <li><a href="http://www.worldwidelighthouses.com/About.php">About</a></li> <li><a href="http://www.worldwidelighthouses.com/Contact-us.php">Contact</a></li> <li><a href="http://www.worldwidelighthouses.com/Use-Our-Media.php">Use our media</a></li> <li><a href="http://www.worldwidelighthouses.com/Search/search.php">Search</a></li> <li><a href="http://www.worldwidelighthouses.com/Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> &#169; Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> Essentially what im trying to do is create and display a preview of an automatically generated email (which works) then i want the email (all of whoms code is contained in $emailcontent to be posted to the next page where it will actually send. However this does not seem to work. any advice? Thanks. Danny hi guys i have a problem my mail dosent send if some data is entered in the textbox. if data is there it says page not found. If no data and i say submit it submits the same page and a blank email is sent. the form is used in the middle of the entire page. <form name="enquiry" action="<?php echo get_bloginfo('wpurl') .'/home/' ?>" method="POST" id="enquiry" > <div id="registerrow"> <div id="texttitle">Naam:</div> <input type="text" class="textboxdiv" name="name" id="name"> </div> <div id="registerrow"> <div id="texttitle">Email:</div> <input type="text" class="textboxdiv" name="email" id="email"> </div> <div id="registerrow"> <div id="texttitle">Telefoonnr.:</div> <input type="text" class="textboxdiv" name="phone" id="phone"> </div> <div id="registerrow"> <div id="texttitle">KvK nr.:</div> <input type="text" class="textboxdiv" name="kvknr" id="kvknr"> </div> <input name="Submit" type="submit" id="btnregister" /> </form> <?php include_once('mail_class.php'); require_once('mail_class.php'); if ($_POST['Submit']){ $name = $_POST['name']; $phone = $_POST['phone']; $msga = $_POST['kvknr']; $to = "nrocks@gmail.com"; $subject = "Enquiry for infosites"; $mailmsg = "<table width='772' border='2' cellpadding='0' bordercolor='#0099FF'>"; $mailmsg .= "<tr bgcolor='#0099FF'>"; $mailmsg .= "<td height='34' colspan='2' bgcolor='#91C8FF'><p align='center' style='font-family: Georgia, 'Times New Roman', Times, serif; font-size: 14pt;font-weight: bold;'><strong>Enquiry Form</strong></p></td>"; $mailmsg .= "</tr>"; $mailmsg .= "<tr>"; $mailmsg .= "<td height='38'><span style='font-family: Georgia, 'Times New Roman', Times, serif; font-weight: bold'><strong>Name:</strong></span></td>"; $mailmsg .= "<td height='38' > $name </td>"; $mailmsg .= "</tr>"; $mailmsg .= "<tr>"; $mailmsg .= "<td height='38'><span style='font-family: Georgia, 'Times New Roman', Times, serif; font-weight: bold'><strong>Phone No:</strong></span></td>"; $mailmsg .= "<td height='38' > $phone </td>"; $mailmsg .= "</tr>"; $mailmsg .= "<tr>"; $mailmsg .= "<td height='43'><span style='font-family: Georgia, 'Times New Roman', Times, serif; font-weight: bold'><strong>Enquiry For:</strong></span></td>"; $mailmsg .= "<td height='43'><span style='font-family: Georgia, 'Times New Roman', Times, serif; font-weight: bold'> $enquiry </span></td>"; $mailmsg .= "</tr>"; $mailmsg .= "<tr bgcolor='#0099FF'>"; $mailmsg .="<td height='35' colspan='2' bgcolor='#91C8FF'><p align='center' class='style1'> </p></td>"; $mailmsg .="</tr>"; $mailmsg .="</table>"; $headers = "From: ".$_POST['email']."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; if (mail($to , $subject , $mailmsg, $headers)) { echo 'Mail Send Succesfully'; } else { echo 'Mail was not send, Try again'; } } ?> </div> thanks I have the simple code below which seems to have worked on forms from a contact page on a website. Unfortunately, it seems to only send the forms if all fields are entered. I have played with the code but cannot seem to get it to send any field that has been completed on submit. Can someone help please? <?php $emailAddress = "bigL@gmail.com"; $thankyouPage = ""; session_start(); if (!empty($_POST)) { foreach ($_POST as $key=>$value) { $_POST[$key] = stripslashes($_POST[$key]); $_POST[$key] = htmlspecialchars($_POST[$key],ENT_QUOTES); } } if (isset($_POST['send']) AND isset($_SESSION['msgCount'])) { if ($_SESSION['msgCount'] >= "3") $alert = "Only 3 messages can be s +ent per session."; if (empty($alert)) { $_SESSION['msgCount']++; putenv('TZ=EST5EDT'); // eastern time $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n" +; $message = "<table cellpadding='5' border='1'>"; foreach ($_POST as $key => $value) if (!preg_match("(^send)",$key)) { $value = wordwrap($value,65,"<br />"); $message .="<tr><td><b>$key</b></td><td>$value</td></tr>"; } $message .= "</table>"; $message .= "<br />Time of the message: ".date(" F d h:ia")."<br +/>"; $message .= "IP Address: ".$_SERVER['REMOTE_ADDR']."<br />"; $message .= "Hostname: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."< +br />"; $subject = $_SERVER['HTTP_HOST']." Message"; mail($emailAddress,$subject,$message,$headers); if (!empty($thankyouPage)) { header('location: '.$thankyouPage); die(); } unset($_POST); $alert = "Your enquiry has been sent, we will respond as soon as p +ossible."; } } if (!isset($_SESSION['msgCount'])) $_SESSION['msgCount'] = 0; ?> Hello, Have a question that i hope some one can help me answer. I have started creating a facebook app that will translate lovepoems. The problem im having is that facebook redirects everything wrong, which makes my life a living hell. So what i thought is it's possible to while submitting the form and the user gets redirected to the facebook allow app page, wait with submitting the form or maybe bring the post id with me and then post the content to the db liked to the post from a different page. simply so i don't have to make the accept form and then go to the actual content? So I'm using Wordpress as default CMS system if that helps. This is the code. Code: [Select] <?php /* Template Name: Febuary Love testing app */ ?> <SCRIPT LANGUAGE="JavaScript"> <!-- Original: Wayne Nolting (w.nolting@home.com) --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin function verify() { var themessage = "You are required to complete the following fields: "; if (document.form.title.value=="") { themessage = themessage + " - Title"; } if (document.form.description.value=="") { themessage = themessage + " - Poem"; } if (document.form.post_tags.value=="") { themessage = themessage + " - Keywords"; } //alert if fields are empty and cancel form submit if (themessage == "You are required to complete the following fields: ") { document.form.submit(); } else { alert(themessage); return false; } } // End --> </script> <?php add_filter('fb_php_sdk_load','your_filter'); function your_filter($array) { $array[] = '2.1.2'; //exact version number you need return $array; } $facebook = new Facebook(array( 'appId' => '179200268852090', 'secret' => '3b62bc6b207e4038aa56a28bfc5ed368', 'cookie' => true, )); $session = $facebook->getUser(); if (!empty($session)) { try{ $user = $facebook->getUser(); $user = $facebook->api('/me'); } catch (Exception $e){ } if (!empty($user)) { } else die ("An error occured"); } else{ $loginUrl = $facebook->getLoginUrl(array( 'canvas' => 1, 'fbconnect' => 0, 'scope' => 'offline_access, publish_stream' )); echo "<a href='".$loginUrl."'>Click </a> to add the Copypanther Facebook application"; } ?> <?php $user = $facebook->getUser(); if($user){ $access_token = $facebook->getAccessToken(); } ?> <?php if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == "new_post") { // Do some minor form validation to make sure there is content if (isset ($_POST['title'])) { $title = $_POST['title']; } else { echo 'Please enter the Poem name'; } if (isset ($_POST['description'])) { $description = $_POST['description']; } else { echo 'Please enter some notes'; } $tags = $_POST['post_tags']; $access_token = $_POST['access_token']; $user = $_POST['user']; // ADD THE FORM INPUT TO $new_post ARRAY $new_post = array( 'post_title' => $title, 'post_content' => $description, 'post_category' => array($_POST['cat']), // Usable for custom taxonomies too 'tags_input' => array($tags), 'post_status' => 'draft', // Choose: publish, preview, future, draft, etc. 'post_type' => 'post', //'post',page' or use a custom post type if you want to 'access_token' => $access_token, 'user' => $user, ); //SAVE THE POST $pid = wp_insert_post($new_post); add_post_meta($pid, 'access_token', $access_token, true); add_post_meta($pid, 'user', $user, true); //SET OUR TAGS UP PROPERLY wp_set_post_tags($pid, $_POST['post_tags']); //REDIRECT TO THE NEW POST ON SAVE $link = get_permalink( $pid ); wp_redirect('http://www.ngee.se'); } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM //POST THE POST YO do_action('wp_insert_post', 'wp_insert_post'); get_header(); ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div class="form-content"> <?php the_content(); ?> <!-- WINE RATING FORM --> <div class="wpcf7"> <h2>Share some February Love!</h2> <p>Although the 14th of February might and should be dedicated to your loved one, we think that friends, bosses and coworkers deserve some affection, too. So between the 1st and 13th of February we will translate a poem or message from you to them <em>for free</em></p> <form id="new_post" name="new_post" method="post" action="" class="wpcf7-form" enctype="multipart/form-data"> <!-- post name --> <fieldset name="name"> <label for="title">Love poem name:</label> <input type="text" id="title" value="" tabindex="5" name="title" /> </fieldset> <!-- post Category --> <fieldset class="category"> <label for="cat">Translate to:</label> <?php wp_dropdown_categories( 'tab_index=10&taxonomy=category&hide_empty=0' ); ?> </fieldset> <!-- post Content --> <fieldset class="content"> <label for="description">Love poem:</label> <textarea id="description" tabindex="15" name="description" cols="80" rows="10"></textarea> </fieldset> <!-- post tags --> <fieldset class="tags"> <label for="post_tags">Keywords (comma separated):</label> <input type="text" value="" tabindex="35" name="post_tags" id="post_tags" /> </fieldset> <SCRIPT LANGUAGE="JavaScript"> function testResults (form) { var TestVar = form.submit(); } </SCRIPT> <fieldset class="submit"> <input type=button value="Send" value="Send" tabindex="40" id="submit" name="submit" onclick="verify();"> </fieldset> <fieldset class="access_token"> <label for="access_token"></label> <input type="text" value="<?php echo $access_token;?>" id="access_token" name="access_token"/> </feildset> <fieldset class="user"> <label for="user"></label> <input type="text" value="<?php echo $user;?>" id="user" name="user" /> </feildset> <input type="hidden" name="action" value="new_post" /> <?php wp_nonce_field( 'new-post' ); ?> </form> </div> <!-- END WPCF7 --> <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-content --> </div><!-- #post-## --> <?php endwhile; // end of the loop. ?> <?php get_footer(); ?> Any one have any idea about how i can solve this problem ? Answers most appreciated! Best Regards GrundeLL EDIT *** I'm using facebook PHP SDK 1 Total number of likes work, but I'm guessing it can be done differently, any input would be appreciated. /controllers/indexController.php $posts = Post::find('all', [ 'limit' => 4, 'include' => ['likes'] ]); foreach ($posts as $post) { $post->assign_attribute('likeCount', count($post->likes)); } } /models/Post.php class Post extends ActiveRecord\Model { static $has_many = [ ['comments', 'class_name' => 'PostComments'], ['likes', 'class_name' => 'UserLikePosts'] ]; } /models/UserLikePosts.php class UserLikePosts extends ActiveRecord\Model { static $belongs_to = [ ['user'], ['post'] ]; }2 The big question is, how can I get a true/false for "if current user has liked post"? I was thinking something like this, but using vars won't work here, and I would have to use a ternary or a function call to do it like this as the session var might not be set (guest). class Post extends ActiveRecord\Model { static $has_many = [ ['comments'], ['likes', 'class_name' => 'UserLikePosts'], ['user_likes', 'class_name' => 'UserLikePosts', 'conditions' => ['user_id = ?', [$_SESSION['user']['id']]] ]; } Edited by JimL, 21 June 2014 - 03:36 PM. Hi, I'm working on a web application that will interact with an existing website from another company. On the other company's site, there will be a form (using POST) that has my web application as the action element. The user who clicked the submit button will be redirected to my site, where I need to receive the $_POST data from this form to process before redirecting into the web application. I have done work on the other side, using standard form posts to send data to another site, but I've never had to write the code for the receiving end. How do I receive the form data posted from the other website? Can I access the $_POST[''] array as I would with any normal same-site POST transaction? Please let me know if you need additional detail or if my question wasn't clear! I'm fast approaching deadlines and really appreciate your help! Thanks! Hi I have created several php scripts which adds a user to the database and allows them to login aswell. I want an email confirmation link in which the user has to click in order for them to get added to the database. Below is my code any help in what php I put in and where would be most helpful, thanks in advance. Chris *********************************************************************** mainregister.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Web Server</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="checkregister.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Member Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Register"></td> </tr> </table> </td> </form> </tr> </table> </body> </html> ****************************************************************************** checkregister.php <!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=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="webserver"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="INSERT INTO $tbl_name (username,password) VALUES('$myusername','$mypassword')"; $result=mysql_query($sql); echo "Registered to database"; ?> </body> </html> hi all, im working on a email send to de user who register on the website! now i get the email but its not email/html view and it gets in to the unwanted folder, also as i siad trust this emailadress! what do i wrong in the code?? the whole php file see //#### XXX ### where i need help! Code: [Select] <?php Session_start(); if(file_exists("support/functions_alg.php")) // user,pass and database file { include("support/functions_alg.php"); // database functions file } if($_REQUEST) { $email=$_REQUEST['email']; $pass=md5( $_REQUEST['pass'] ); $secc=md5( $_REQUEST['sec_code'] ); function check_code($secc) { if($secc == $_REQUEST['mdcode']) { return true; } else { return false; } } function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } if(check_email_address($email)) { if(check_code($secc)) { //$res=register($email,$pass,$name,$address,$huisnr,$zipcode,$plaats,$dob_year,$dob_month,$dob_date,$tel); $res=true; if($res==true) { // ##### XXX ##### //mail function /* subject */ $subject = "Activeer uw Profiel"; /* To send HTML mail, you can set the Content-type header. */ $headers = "MIME-Version: 1.0 \r\n"; $headers .= "Content-type: text/html; charset=utf-8 \r\n"; /* additional headers */ $headers .= "From: " . $mailme . " \r\n"; /* and now mail it */ $text = ' <html> <head> <title>Nieuw profiel</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> Activeer uw profiel op:<br><br> <a href="http://'.$_SERVER['SERVER_NAME'].'/?reg_result&activatie=true">Activeer</a>br><br> Veel plezier op onze website! </body> </html>'; $res = mail($email,$subject,$text,$headers); echo("<script>document.location.href='index.php?topic=reg_result&".$res."'</script>"); //header('location: "'.$_SERVER['HTTP_REFERER'].'?topic=reg_result&true"'); //###### XXXX ####### } else { echo "<table border=1 class=outer_tbl align=center width=50% style='border-collapse:collapse;'>"; echo "<tr><td align=center>"; echo "Fout tijdens registratie<br><a href='javascript:history.back();'>Klik hier</a> om opnieuw te proberen"; echo "</tr></td></table>"; } } else { echo("<script>document.location.href='".$_SERVER['HTTP_REFERER']."&error=code'</script>"); //header('location: "'.$_SERVER['HTTP_REFERER'].'&error=code"'); } } else { echo("<script>document.location.href='".$_SERVER['HTTP_REFERER']."&error=email'</script>"); //header('location: "'.$_SERVER['HTTP_REFERER'].'&error=email"'); } } ?> the recived email looks like : Content-type: text/html; charset=utf-8 From: info@pc-hulp-online.nl Return-Path: anonymous@server70.hosting2go.nl X-OriginalArrivalTime: 30 Apr 2012 10:47:41.0985 (UTC) FILETIME=[AB19D110:01CD26BE] <html> <head> <title>Nieuw profiel</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> Activeer uw profiel op:<br><br> <a href="http://nieuw.pc-hulp-online.nl/?reg_result&activatie=true">Activeer</a>br><br> Veel plezier op onze website! </body> </html> please help me!! thnx, Hi, ive been looking all over for a script to send an email once users on my site register their details, is this possible? all i want is it to send their username and password. Also the same sort of thing is needed for the "lost password" button? Any help suggested would be great, many thanks. Web Form/Registration: Code: [Select] <form action="sendAd.php" method="post"> <h4 class="style7">Type of company (Removal, Transport, Storage, Insurance, Local Area or Other):<br /> <input type="text" name="type"/> <br />Company name:<br /> <input type="text" name="company_name"/> <br /> Location:<br /> <input type="text" name="location"/> <br /> Six bullet point description of your company:<br /> <textarea rows="6" cols="21" name="description" ></textarea> </h4> <h4 class="style7"> <br /> <input name="submit" type="submit" id="submit" value="List your ad" /> </h4> <p> </p> </form> SendAd.php: Code: [Select] <?PHP $user_name = ""; $password = ""; $database = "removal2"; $server = "server"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); if ($db_found) { $SQL = "INSERT INTO ads (type, company_name, location, description) VALUES ('" .$type. "', '" .$company_name. "', '" .$location. "', '" .$description. "')"; $result = mysql_query($SQL); mysql_close($db_handle); header( 'Location: http://www.removalspace.com/advert-confirm.php' ); exit(); } else { print "Database NOT Found "; mysql_close($db_handle); } ?> MOD EDIT: code tags added. i use a user management system which can be download this from http://rapidshare.com/files/39584153...LL-DGT.zip.rar i also have a script which emails a link to the entered email address.... i want it to check if the entered email matches with the logged in users email on the database..... this email script can be downloaded from http://rapidbay.net/download/1364276...kurl-v1-7.html as im totally new to php i wud appriciate if u cud explain a lil bit.. pls help.... |