lse123
01-29-2007, 08:18 PM
I must include any standard code when using cookies to a webpage[ http://www.paphoscarhire.com/reservations.htm ] , since cookies set in home-page[ http://www.paphoscarhire.com ] like
---------------------------------------------------------------
<?php
session_start( );
$affiliate = '10000'; //default value
if (isset($_COOKIE['aff']) && ($_COOKIE['aff'] != Null))
{
$affiliate = $_COOKIE['aff'];
}
else if (isset($_GET['aff']) && ($_GET['aff'] != Null)) {
$affiliate = $_GET['aff'];
setcookie("aff", $affiliate, time()+60*60*24*90); // 3 months
}
$_SESSION['affiliate'] = $affiliate ;
?>
---------------------------------------------------------------
or the small code
<script language="JavaScript">
<!--
var affiliate = <?= $affiliate ?>;
-->
</script>
------------------------------------------------------------
<input type="hidden" name="affiliate" value="<?= $affiliate ?>">
<script language="JavaScript">
<!--
document.write("You book through affiliate ID: " + affiliate )
-->
</script>
-------------------------------------------------------------
only is ok in a webpage [after the code in home-page] ? If I must include it to each webpage use cookies, which part of the page to insert this standard code ?
Tell me this for using PHP cookies and for using JS cookies ?
---------------------------------------------------------------
<?php
session_start( );
$affiliate = '10000'; //default value
if (isset($_COOKIE['aff']) && ($_COOKIE['aff'] != Null))
{
$affiliate = $_COOKIE['aff'];
}
else if (isset($_GET['aff']) && ($_GET['aff'] != Null)) {
$affiliate = $_GET['aff'];
setcookie("aff", $affiliate, time()+60*60*24*90); // 3 months
}
$_SESSION['affiliate'] = $affiliate ;
?>
---------------------------------------------------------------
or the small code
<script language="JavaScript">
<!--
var affiliate = <?= $affiliate ?>;
-->
</script>
------------------------------------------------------------
<input type="hidden" name="affiliate" value="<?= $affiliate ?>">
<script language="JavaScript">
<!--
document.write("You book through affiliate ID: " + affiliate )
-->
</script>
-------------------------------------------------------------
only is ok in a webpage [after the code in home-page] ? If I must include it to each webpage use cookies, which part of the page to insert this standard code ?
Tell me this for using PHP cookies and for using JS cookies ?