close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Redirect After Security LogIn not working

Thread began 1/17/2011 10:59 am by mrobben375515 | Last modified 1/18/2011 8:29 am by Jason Byrnes | 1731 views | 7 replies |

mrobben375515

Redirect After Security LogIn not working

I have set up a page where users can login and then be redirected to their school yearbook as a product. I have it setting a session variable "school_PID" but it doesn't work properly. It redirects to Products_Detail.php?ProductID= the first time because the session variable is not set. If you go back and login again then the session variable is set and it redirects properly. I checked the code and the session variable is set right before the redirect so I don't know why it's not functioning properly. I've attached the file, please take a look and see if you can see what's wrong. Thanks for your time.

Attached Files
order_school_yearbooks.zip
Sign in to reply to this post

Jason ByrnesWebAssist

thats not quite how the code works. That cosde is passing in variables to perform the authentication. The athentication happens inside of the $WA_Auth_Parameter function, you cant pass the $_SESSION['school_PID'] into the function, because it hasn't been set yet.
Try this instead, set the redirect for the authenticate user behavior to just go to Products_Detail.php, then add the following code at line 1:
<?php
if(!session_id()) session_start();
if((!isset($_GET['ProductID']) || $_GET['ProductID'] == "") && (isset($_SESSION['school_PID']))) {
$_GET['ProductID'] = $_SESSION['school_PID']
}
?>[/php]

Sign in to reply to this post

mrobben375515

Getting PHP error

I keep getting this error for the last "}".

Parse error: syntax error, unexpected '}' in /home/content/50/7015650/html/Products_Detail.php on line 6

I've attached the Products_detail.php page.

Attached Files
Products_Detail.zip
Sign in to reply to this post

Jason ByrnesWebAssist

ooops, forgot the last semi colon, change:
$_GET['ProductID'] = $_SESSION['school_PID']

to:
$_GET['ProductID'] = $_SESSION['school_PID'];

Sign in to reply to this post

mrobben375515

There's no error, but it doesn't pick up the session variable. It just goes to Products_detail.php with no extension for the product ID.

Sign in to reply to this post

Jason ByrnesWebAssist

does it show the correct record though?


it wont show the id in the query string, but it should be setting it correctly behind the scenes.

Sign in to reply to this post

mrobben375515

You're right, it is working. I had it pulling the wrong ID from the database so the product was showing up wrong. Thanks for the help

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...