This topic is locked

Providing Access To Web Applications Via An Unique Link

11/30/2022 8:17:53 PM
PHPRunner General questions
A
Ace Drummond author

I am following the youtube video on this same topic "Providing Access To Web Applications Via An Unique Link"

I have a MySql table I am working with called 'members' that has a key field called 'seq' (defined as int(9) ) It is the only key on this table.

In the example on the youtube video it links to a 'list' of a record.

In my case I want to link to an 'edit' of a record.

My table has a hash field named rl (defined as varchar(100)) that I have populated with a has a value in it that I pre-populated before testing.

I generate the link to the right screen and it has the right hash value from the rl field. example: (url deleted for security)/update_my_profile_edit.php?rl=5ao8juyw3xg4tksg0u4uqk5b6zc50lsbfeicf58loajbnwkb46

When I submit this link I get the list page with 3 other members listed.

I've displayed the values after I execute the select and $records["seq"] contains the value '24' which is the correct table entry.

Why would the $pageObject take me to the list page?

I guess I am missing sometihng??

This is my code:

/ if there is an ?rl value it can be a guest - if no ?rl value stop the process

if (Security::isGuest() && !postvalue("rl") )
{
echo 'Link is REQUIRED!';
exit;
}
// retrieve the record with the unique hash value in rl field

if (postvalue("rl") )
{
$data["rl"] = postvalue("rl");

$rs = DB::Select("members", $data);
$records = $rs->fetchAssoc();

// if record not found

if (!$records)
{
echo "Member Record Not Found!";
exit;
}

// record found then retrieve the page with the record identified by hash

$keys = array();
$keys["seq"] = $records["seq"];
$pageObject->setKeys($keys);
A
Ace Drummond author 12/1/2022

It took a lot of effort but I figured this issue out.

  1. In the <guest> permissions I had both list and edit specified so that was why I went to list version.
  2. .The table used member profile update screen was not members but a work table with a different name and the 3 members that showed up in the list were present there.

So now I can simply populate the work table before I display the member.

The other thing that happens is when I update a record shown the program return to check for the "rl" variable and it is not present - so I need to direct areound that.

Problems like this not easy - I think the <guest> permissions issue sent me down the wrong path, but now I am exprienced!

PHPRunner is really a great platform and I am very pleased while, of course, learning more all the time.

admin 12/1/2022

Just wanted to say that you can create a user group with specific rights and then use Security API function loginAs to log the user in with required permissions.

A
Ace Drummond author 12/1/2022

I got it all to work kind of following the example in the video.

I had to place my code in event: Before Process to get it to work, but work it does now!

A
Ace Drummond author 12/7/2022

The one issue I have not yet resolved is how to manage the 'CANCEL' button.

The submit works fine.

I want to close the window when cancel is used in the case where this is a guest transaction.

admin 12/7/2022

I guess you can simply remove the standard button and add your own button that will do the job.