I have set up a blog page on our site. I created an Add Blog page for engineers to enter the blog info. They choose who to send the info. in an email to have it approved. When the approver receives the email, there is a link they can click on to edit that blog info. When they click update, it approves the blog entry just entered and displays it on the Blog page. I also set up a login page that the engineers and approvers must log into before they can get to the add blog page or edit blog page. I have this working fine to get to the add blog page, but I'm having problems with the edit page. How can I get the link in the email to work correctly to get to the edit page, but having to login first? I've set this code on the add and edit pages:
<cfset MyHost = CGI.Server_Name>
<CFIF CGI.HTTP_Referer does not contain "#MyHost#">
<cflocation url="../Blog_Login/login.cfm" addtoken="No">
This code will not allow someone to just type in the direct link and use these pages. It re-directs them to a login page first. Is there a different way I should be using to get to the login page instead of this code? Once logged in, then they can go to these pages.So when the link in the email is clicked, it re-directs to the login page, but I can't get the login button to go to the edit page because it has to go to a specific edit page with the correct BlogID so it updates the correct information just entered.I can get the link to work in the email just fine without going to the login page. Here's what I'm doing:
This is from the Add page after the engineer adds their info. and it gets emailed to the approver:
<cfif Users_Email is not "">
SUBJECT="Update Blog Entry">
An engineer has uploaded a new Blog entry. Please edit this and approve it. Follow this link:
This is on the login page. I thought I would need to say that the BlogID needs to be defined in order to go to the validate page.
<cfinput type="button" name="submitBtn" onclick="applogin()" value="Approver Login">
<cfif isDefined("form.BlogID") and form.BlogID>
<input type="hidden" name="BlogID" value="#BlogID#">
This is on the validate page that directs the user to the correct page after they login. I kept the Add page in here to so you can see how that one works fine, but the Edit page doesn't. I could not get the relative path to work at all.
<cfif isDefined("form.eng_login") and form.eng_login>
<cflocation url="../blog/add_blog.cfm" addtoken="No">
<cfelseif isDefined("form.app_login") and form.app_login>
<cflocation url="http://www.ironwoodelectronics.com/blog/edit_blog.cfm?BlogID=#BlogID#" addtoken="No">
Then it should just go to the edit page to update the information.
<CFQUERY NAME="ShowBlog" DATASOURCE="#application.DataSource#">
SELECT BlogID, Blog_Date, Blog_Info, Blog_Image, Blog_Approval_Initials, Approved_entry
<CFQUERY NAME="ShowBlogInitials" Datasource="#application.DataSource#">
where Blog_Initials = 'true'
Order by Initials
Then the items to edit are displayed.
I tried to not include all the code, so hopefully this is enough. If you would need all the pages to see this, I could email them to anyone that could help me. Thanks for your help in advance.