Jump to content

Re: send page to friends help please


lounger

Recommended Posts

this will show the user profile and a img to the users email account.

copy and past to test

test_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]
Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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 use
mysql_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 $image
while($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 one
echo $image_link
}
?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.