Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I assign a variable php redirect based on the initial url input after a user has accepted terms/responsibility message?
    primarykey
    data
    text
    <p>see: <a href="http://www.eat-drink-etc.com/" rel="nofollow">http://www.eat-drink-etc.com/</a></p> <p>I have this code in the header of all the sites' pages:</p> <pre><code>&lt;?php session_start(); if (!isset($_SESSION['responsibility'])) { //echo '{redirect="responsibility/message"}'; echo "&lt;script type='text/javascript'&gt;window.location = '{site_url}responsibility/message'&lt;/script&gt;"; }?&gt; </code></pre> <p>Redirecting to mydomain/responsibility/message if the user is a first time (or hasn't visited recently) visitor to the site.</p> <p>In the message page I have the following:</p> <pre><code>&lt;?php session_start(); /*if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } $_SESSION = array();*/?&gt; </code></pre> <p> <pre><code>function setcookielive($name, $value='', $expire=0, $path='', $domain='', $secure=false, $httponly=false) { //set a cookie as usual, but ALSO add it to $_COOKIE so the current page load has access $_COOKIE[$name] = $value; return setcookie($name,$value,$expire,$path,$domain,$secure,$httponly); } if(isset($_POST['set'])) { if(isset($_POST['remember'])) { /*if(setcookielive("responsibility", "confirmed", time()+60*60*24*30*24, "/")) { }*/ $_SESSION['responsibility'] = 'confirmed'; echo '{redirect="/"}'; } else { /*if(setcookielive("responsibility", "confirmed", time()+60*60*24, "/")) { }*/ $_SESSION['responsibility'] = 'confirmed'; echo '{redirect="/"}'; } }?&gt; </code></pre> <p>The page uses a from input to enter the site:</p> <pre><code>&lt;form method="post" action=""&gt; &lt;input type="hidden" name="set" value="set" /&gt; &lt;input type="hidden" name="remember" value="true" /&gt; &lt;input type="image" src="{site_url}images/elements/enter-btn.png" width="95" height="26" alt="Enter" value="Enter" /&gt; &lt;/form&gt; </code></pre> <p>Example: if a user goes to <a href="http://www.eat-drink-etc.com/articles/fi_europe_ni_2011" rel="nofollow">http://www.eat-drink-etc.com/articles/fi_europe_ni_2011</a> they will be redirected to the responsibility/message page. When enter is clicked the user is taken to the home page. (as specified)</p> <p>How do I redirect to the originally targeted url??? eg. ../articles/fi_europe_ni_2011</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload