redarrow Posted September 3, 2006 Share Posted September 3, 2006 this will show the user profile and a img to the users email account.copy and past to testtest_result.php[code]<?php session_start();if($_POST['submit']){$to=$email;$subject = 'A profile sent to you from a friend';$message="<html><title>members profile</title><body><h1> members profile for $name</h1><br><br><b>username</b><br>$name<br><b>age</b><br>$age<br><b>members location</b><br>$location<br><b>members description</b><br>$description<br><br>$name likes this logo<br><img src='http://www.google.co.uk/intl/en_ALL/images/images_hp.gif'></img></html></body>";$headers = "From: Do not email back\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n";mail($to, $subject, $message, $headers); echo "profile sent to $email";}?>sending a profile to your friend <?php echo $name ?><form method="POST" action=""><br>please enter friends email address<br><input type="text" name="email"><br><input type="submit" name="submit" value="send this profile"><br></form>[/code]test.php[code]<?php session_start();$name="redarrow";$age="32";$location="london";$description="redarrow loves php";$name=$_SESSION['name']=$name;$age=$_SESSION['age']=$age;$location=$_SESSION['location']=$location;$description=$_SESSION['description']=$description;?><html><title>members profile</title><body><h1> members profile for <?php echo $name?></h1><br><br><b>username</b><br><?php echo $name?><br><b>age</b><br><?php echo $age ?><br><b>members location</b><br><?php echo $location?><br><b>members description</b><br><?php echo $description?><br><br><br><a href="test_result.php">email profile to friend</a></html></body>[/code] Quote Link to comment Share on other sites More sharing options...
lounger Posted September 3, 2006 Author Share Posted September 3, 2006 hi redarrow i tried the code but it leaves my gallery page blank? is there not a way i can just adapt the send page to friends script that i have posted in pastebin as i already have this script on my website and it works great except for sendind the wrong url? Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 3, 2006 Share Posted September 3, 2006 you have to save the two pages i posted as seprate pages test.php and test_result.php in the root directory and dont alter them.point you browser to the test.php then your see a profile with a link to send the profile to a email address you then goto test_result.php and then you emter your email address and then you get the profile what is set in the meesage varable on the mail code your also see an image that is from google try it works grate.when you got it going add it to your existing code and change what needs to be changed that easy.your existing code has got lot off flaws in it so you need to redesign it and this code that i have provided should do the trick trust me ok. Quote Link to comment Share on other sites More sharing options...
lounger Posted September 3, 2006 Author Share Posted September 3, 2006 hi redarrow i have this on my server and your right it works i get the google image but i need it to send a pic from my gallery section which has around 300 images in it how do i get it to do this for each image? Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 3, 2006 Share Posted September 3, 2006 you need to send them all at once to show in the email Quote Link to comment Share on other sites More sharing options...
lounger Posted September 3, 2006 Author Share Posted September 3, 2006 you mean i have to send all the images at once? Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 3, 2006 Share Posted September 3, 2006 i think your idear is inpossable as your email account will get ban 1 pic ok but 300 bad idear sorry.the best solution is to provide a link in the email to view the pics ok. Quote Link to comment Share on other sites More sharing options...
lounger Posted September 3, 2006 Author Share Posted September 3, 2006 i dont think you understand what i am saying i only need the script to send 1 pic at a time, but will it be able to send each pic on every page by picking up the image url or do i need to manually enter the image url myself for each pic? Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 3, 2006 Share Posted September 3, 2006 somethink like this ok.the id will be the members id and in the image database each image should have that users id to get that image ok also in the query limit it to 1 incase there more then one so the email only gets one ok..you need to setup the database entrys and the select statement and then try to display a users image with this code below before we go any futher.when you got that going then we can add it to the code i posted but not untill then ok.[code]<?php session_start();// we need session start at the top of page to get the users id// need database connection information$db=mysql_connect("localhost" "xxxxxx","xxxxxx");// need the correct database to usemysql_select_db("xxxxx",$db);// need to select the database that holds the images$query="select * from xxxxxx where id='$id' limit 1";// query the query$result=mysql_query($query);// a while loop to get the images from the database while loop set to $imagewhile($image=mysql_fetch_assoc($result)){// set image to the while loop the xxxx is the name of the database field that the select statement resides$image=$image['xxxx'];//make a friendly link to get the images$image_link="<img src='myurl/folder/$image'></img>";//echo the image out but only oneecho $image_link}?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.