Page Administaration

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smmynjoroge
    New Member
    • Nov 2006
    • 1

    Page Administaration

    Hi am a newbie to php and am working on a website(for learning purposes) that allows people to submit their profiles, i need help on writing a php code that will send every user a link to the email address they use to register that will allow them to manage their profiles later, all help will be much appreciated
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You are in luck, I have just the code snippet you were looking for. This will send an email with the request to click on the included link. When the user does that, it will send him to the UpdateProfile.p hp script passing the userid as a GET parameter. Play with it.
    [php]<?php
    // some variables setup
    $userid = "YourUserId ";
    $to = "You@YourSite.c om";

    // setup the link-to information
    $url = "http://" . $_SERVER['HTTP_HOST'] .
    dirname($_SERVE R['PHP_SELF']) .
    "/update_profile. php?u=$userid";

    // the subject of your email message
    $subject = 'Update your profile';

    // the content of your email message
    $body = "Dear $userid,\n\n" .
    "I am happy to ...... blah blah, blah .....\n\n" .
    "If you want to change your profile, please use the following " .
    "link by either clicking on it here or by copying the content " .
    "of this link and paste its contents in the address box of " .
    "your browser.\n\n $url" .
    "\n\nKind regards,\nJohn Doe\n";
    // 4th header, not always mandatory depends on server
    $headers = "From: Me@MySite.com";

    // send the email message
    if (mail($to, $subject,$body, $headers))
    echo "Mail sent successfully";
    else
    echo "Error sending mail!";
    ?>[/php]
    Ronald :cool:

    Comment

    Working...