How should I be reading this code?
<p>So I'm trying to read this legacy code - am I reading this wrong, or is the code repeating itself multiple times? It seems like it is assigning $cuid multiple different times in multiple different ways - is it getting different values somehow? The only two ways I can see are via cookie and via GET request.</p>

<pre><code>$id = "";
$cuid = "";
session_start();
if (isset($_SESSION['id'])) {
    $id = $_SESSION['id'];
    $cuid = $id;
    $valid_user = $_SESSION['valid_user'];
    $cuname = $_SESSION['cuname'];
    $website = $_SESSION['website'];
    $site = $website;
    $email_contact = $_SESSION['email_contact'];

}
$cuid = $_GET['cuid'];
include_once("dbfunctions.php");
if (isset($_SESSION['id']))  {
    $cuid = $_SESSION['id'];
} elseif (isset($cuid)) {
    $_SESSION['id'] = $cuid;
}
</code></pre>

<p>EDIT: Ok, now how would I have it use $_GET['cuid'], if $_GET['cuid'] had a value, no matter what. Basically, several sites use this, and we want a user to be able to navigate from several of them, and get a different logo each time, but if they don't navigate from other sites, to keep the same logo throughout their experience.</p>

<p>I would just check to see if $_GET['cuid'] had a value, and if it did, to do nothing else, correct, but if it did not, check for a $_SESSION['id']. Am I on the right path?</p>
