This topic is locked

Email based link

3/20/2009 9:46:50 AM
PHPRunner General questions
L
Lisa2006 author

Hi Forum,
I'd like to start by saying that the following is completely new to me and i would greatly appreciate any help.
In my project, I would like to send a link by email to the user.
i.e. 'http://www.mywebsite.com/orders_edit.php?editid=16';
Ordinarily, the user will login in to the site and navigate to the the orders menu and choose the appropriate record.
I need a way to allow the user to simply click on the email link and jump straight to the record.
How can i accomplish this
Thanks in advance
Lisa

T
thebwit 3/23/2009

Hi Forum,

I'd like to start by saying that the following is completely new to me and i would greatly appreciate any help.
In my project, I would like to send a link by email to the user.
i.e. 'http://www.mywebsite.com/orders_edit.php?editid=16';
Ordinarily, the user will login in to the site and navigate to the the orders menu and choose the appropriate record.
I need a way to allow the user to simply click on the email link and jump straight to the record.
How can i accomplish this
Thanks in advance
Lisa


Don't create a login page would be the only way around it. And that is something I wouldn't recommend doing for obvious security reasons.

Sergey Kornilov admin 3/23/2009

You have two options here

  1. Do not create a login page
  2. Generate a link with username/password in the URL and use one of edit page events (BeforeProcess) to authenticate the user.

    Not 100% secure as well but a bit better than no password at all.

L
Lisa2006 author 3/23/2009

Hi thebwit,
Thank you for your comment.
Reading various articles, I understand that I need to send an email link that has embedded login credentials.

Additionally my PHPR project would need to authenticate these credentials and if valid then send me to the requested page.
My problem is that i do not how to do this.
If anyone has done this and can supply some sample code and where to place this code in Events, I would be forever grateful.
Lisa

J
Jane 3/24/2009

Hi,
you can send link with credentials in your event.

Here is a sample link:

http://www.mywebsite.com/orders_edit.php?e...p;password=test
To create this link select username and password from database:

global $dal;

$rs = $dal->UserTableName->Query("UsernameField='".$_SESSION["UserID"]."'","");

$data = db_fetch_array($rs);

$str = "http://www.mywebsite.com/orders_edit.php?editid=16&username=".$_SESSION["UserID"]."&password=".$data["PasswordField"];


Then check passed variables in the Login page: Before process event, fill PHPRunner session variables and redirect to the correct page.

Here is the list with PHPRunner session variables:

http://www.xlinesoft.com/phprunner/docs/ph...n_variables.htm

S
Stoneman 3/24/2009

Am I missing something or isn't this handled automatically with this.
$_SESSION["MyURL"]

If user is trying to access one of password-protected pages directly i.e. pagename_edit.php?editid1=3 this page address is saved in $_SESSION["MyURL"] variable and user is redirected to the login page.
After successful login user will be redirected to that page.
I use this on my site all the time. If someone is logged in the page opens - if not they are presented with the log in window - after log in presto -desired page.