close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Trouble setting a Cookie

Thread began 7/24/2009 3:42 pm by bjgarner241692 | Last modified 7/24/2009 4:13 pm by Ray Borduin | 3986 views | 7 replies |

bjgarner241692

Trouble setting a Cookie

I want to check for a cookie and set it if it does not exist.

The only Trigger options I have are:

Any form post
Before Page Load
Current page submit
Button Submit pressed

I'm trying to catch the referrer, so none of these will work because it will change with every single page load.

Sign in to reply to this post

bjgarner241692

Forgot to post the code I am using:
<?php
if ("" == "") {
setcookie("Referrer", "".((isset($_SERVER["HTTP_REFERER"]))?$_SERVER["HTTP_REFERER"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}
?>

I know I just need something in the if (""=="") spot but I am not familiar enough with php yet to figure it out.

Sign in to reply to this post

Ray BorduinWebAssist

That is an editable list, so you can use a custom trigger to be whatever you want. Just design it so that the value you enter for the trigger is empty if you don't want it to fire.

Sign in to reply to this post

Ray BorduinWebAssist

Describe when exactly you would want to set it? Only if it isn't already set? Only for a specific referrer?

Sign in to reply to this post

bjgarner241692

I want it set on the first visit to the site, and to remain persistent from page to page and on subsequent visits for 30 days.

thanks,
Bart

Sign in to reply to this post

Ray BorduinWebAssist

Then use the trigger:

<?php echo(isset($_COOKIE['Referrer'])?$_COOKIE['Referrer']:""); ?>

it would add code like:
if ((isset($_COOKIE['Referrer'])?$_COOKIE['Referrer']:"") == "") {

which would only set the cookie if it didn't already exist and it looks like you are already setting it for 30 days.

Sign in to reply to this post

bjgarner241692

Thank you, I'm sure that will work fine.
I was just struggling with syntax.

Is this something that could be added in a future rev? Seems like this is a pretty common use of cookies and it is included in the choices for setting a Session value.

Sign in to reply to this post

Ray BorduinWebAssist

It is a possible addition... we do have the equivalent for session variables so it would seem logical. However as far as I know you are the first to ask for it, so either people aren't doing it as often as you think or the feature may not be necessary since they are figuring it out on their own.

We could address it, but their might be bigger fish to fry.

Sign in to reply to this post

bjgarner241692

This post has been deleted.

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...