This topic is locked
[SOLVED]

 session username while copying a record

12/22/2010 5:14:34 PM
ASPRunnerPro General questions
author

I scan plans and put them online temporarily instead of emailing large files around. I want people to be able to copy the record to their own list if they want to keep the project online for awhile.
I have a no security site that I email them a link to their record. I have the copy to MyPlan button that sends them to the login for the secure site, they login, and it makes the copy of the record but I can't get the username from their login into the same record as the as they are copying. this seems so simple but I've run out of ideas. I am using the username as the advanced security setting so that people can only see their own projects.
here is my code, please somebody help!

  1. you can create this button using custom event ("Insert PHP code" snippet

    on the Visual Editor tab).

    Here is a sample:

    ----------------------------

    if (@$_REQUEST["editid1"])

    echo "<input type=button class=button value=\"Copy record\" onclick=\"window.location.href='login.php?record=".$_REQUEST["editid1"]."';\">";

    ----------------------------
    Save passed value in the session variable in the "Login page: Before

    process" event:

    ----------------------------

    if (@$_REQUEST["record"])$_SESSION["record"] = $_REQUEST["record"];

    ----------------------------

    Then you can select this record from database and save it in another table

    in the "After successful login" event.

    ----------------------------
    if (@$_SESSION["record"])

    {

    $StrSave = "insert into projects (folder, projectname, projectID) select '".$username."', '".$username."',projectID from projects where ID= ".$SESSION["record"];

    CustomQuery($StrSave);

    }
    ____


    Somehow I think I need a (@$_SESSION["UserID"])in here but I don't know where.

L
larry.dompierre 12/23/2010



I scan plans and put them online temporarily instead of emailing large files around. I want people to be able to copy the record to their own list if they want to keep the project online for awhile.
I have a no security site that I email them a link to their record. I have the copy to MyPlan button that sends them to the login for the secure site, they login, and it makes the copy of the record but I can't get the username from their login into the same record as the as they are copying. this seems so simple but I've run out of ideas. I am using the username as the advanced security setting so that people can only see their own projects.
here is my code, please somebody help!

  1. you can create this button using custom event ("Insert PHP code" snippet

    on the Visual Editor tab).

    Here is a sample:

    ----------------------------

    if (@$_REQUEST["editid1"])

    echo "<input type=button class=button value=\"Copy record\" onclick=\"window.location.href='login.php?record=".$_REQUEST["editid1"]."';\">";

    ----------------------------
    Save passed value in the session variable in the "Login page: Before

    process" event:

    ----------------------------

    if (@$_REQUEST["record"])$_SESSION["record"] = $_REQUEST["record"];

    ----------------------------

    Then you can select this record from database and save it in another table

    in the "After successful login" event.

    ----------------------------
    if (@$_SESSION["record"])

    {

    $StrSave = "insert into projects (folder, projectname, projectID) select '".$username."', '".$username."',projectID from projects where ID= ".$SESSION["record"];

    CustomQuery($StrSave);

    }
    ____


    Somehow I think I need a (@$_SESSION["UserID"])in here but I don't know where.


This is PHP, maybe put it in the PHP forum. I don't know PHP, but if your session variable can be added on login, that's a good place to add the username. Another thing you could do is create a custom upload page where you can auto email a link to one of your contacts. That could insert a temporary login and generate a temporary password . DOn't know if that helps, just brainstorming work arounds. But stick with your PHP code, I just don't know how to read about it and haven't worked on it ever.
Good luck