2 Replies Latest reply on Apr 2, 2008 4:09 PM by cgrray

    Login form not passing article id to article page

    cgrray
      I have a page that displays articles from a blog. Users have to click on a login link to post comments to the article. The link opens the login page and the article id is in the url of the login page (mysite.com/login.php?id_art=4) but when they login the article is not displayed on the article page. The comment insert form, which is set to showif the user is logged in does display. If I go back to the article menu and browse directly to it the comment insert form still showa and if I insert a comment, it shows up in the dtatbase from the user I logged in as. This is driving me nuts and any help would be greatly appreciated.
      the code for the login page is below.


        • 1. Re: Login form not passing article id to article page
          Level 1
          You can set the article id to a session variable and use that. This will only work single threaded (i.e., multiple separate logins to view multiple articles created before login will all go to the same article. Ideally you want to pass a $_GET (URL variable) parameter to the main login page and redirect to the appropriate page from your main login page.

          Otherwise adding some PHP to includes/tng/tNG_config.php and changing the values of $tNG_login_config_redirect_success and/or $tNG_login_config["redirect_success"]. You will need to use isset() a lot to write safe code and you need to be careful about preventing injection attacks.

          i.e.

          $input_integer_value = isset($_GET['some_integer_input']) ? (int)($_GET['some_integer_input']) : 0;

          You can then directly set new values for the login redirect at runtime. You just need to be careful with how you modify these automatic files or you can break them so adding code at the very bottom of the file might be wise with ADDT.
          • 2. Re: Login form not passing article id to article page
            cgrray Level 1
            Sean,
            Thanks for the reply. I'm not that good with php yet. I see the line in tNG_config.inc.php that redirects the user on successful login but i don't understand the code that you suggest I use.
            I've been building this blog based on the DW 8 and Interakt tutorial here

            http://www.interaktonline.com/Support/Articles/Details/Building+a+Blog%3A+User+Account+Man agement+Functionality.html?id_art=19

            and trying to adapt it to DW CS3 and ADDT.
            Anyway, if you can help more I appreciate it, otherwise I'll keep muddeling through.
            Thanks again.