Re: Newbie question
| From: | Justin French | Date: | Fri, 02 May 2003 02:39:07 +0000 |
| Subject: | Re: Newbie question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146057@lists.php.net to get a copy of this message | ||
This simple test works for me, and could be easily transferred to what
you're doing (assuming PHP >= 4.1.0):
<?
setcookie("noFrames", 1);
if($_COOKIE['noFrames'])
{
echo "these are my links";
}
else
{
// no need for links
}
?>
So, I guess you need to show us your set cookie code, and even manually
confirm you ARE setting a cookie, and then bug track it down from there.
Are you setting it with PHP (which you can't do inside a <noframes> tag) or
with javascript?
Justin French
on 02/05/03 12:54 PM, Michael Lewis (michael@nichestaffing.com) wrote:
> On Thu, 2003-05-01 at 18:56, Justin French wrote:
>> on 02/05/03 11:36 AM, Michael Lewis (michael@nichestaffing.com) wrote:
>>
>> Try this:
>>
>> <?
>> if (stristr($_SERVER['HTTP_USER_AGENT'],'MSIE'))
>> {
>> ?>
>> MSIE CODE
>> <?
>> }
>> elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/5'))
>> {
>> ?>
>> Mozilla/5 code
>> <?
>> }
>> elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/4'))
>> {
>> ?>
>> Mozilla/4 code
>> <?
>> }
>> else
>> {
>> ?>
>> Generic Code
>> <?
>> }
>> ?>
>>
>>
>> In other words, the PHP syntax is:
>>
>> <?
>> if(...)
>> {
>> ...
>> }
>> elseif(...)
>> {
>> ...
>> }
>> else
>> {
>> ...
>> }
>> ?>
>>
>> ... and all you're doing is escaping in and out of PHP to avoid echo'ing
>> everything.
>>
>>
>> Justin French
>
> The code for the browser test that I mentioned works as is. The problem
> I'm having is testing for cookies. I am doing a new site for my church
> and I'm using frames. I wanted to see if I could set a cookie inside
> the <noframe> tag that I could test for on all the other pages to
> determine if I should display page links or not. In the framesets, all
> of the links are in the header and footer frames. If a user is not in
> frames, I want to display the links on the individual pages so they can
> navigate, but hide them if they are in frames. I tested your suggestion
> and it didn't error, but hides the links even if the cookie is set. The
> code is below.
>
> <?
> if (isset($NoFrames))
> {
> ?>
>
> <tr>
> <td valign="top" align="center"> </td>
> </tr>
> <tr>
> <td valign="middle" align="center">
> <font face="verdana,helvetica,arial,sans-serif"
> color="#cccccf"size="2"><b>
> <a href="main.php">Home Page</a> |
> <a href="believe.html">Who We Are</a> |
> <a href="coffee.html">Coffee House</a> |
> <a href="community.html">Outreaches</a><br><img
> src="trans.gif"
> width="200"
> height="3"><br>
> <a href="house.html">House Ministry</a> |
> <a href="calendar.html">Calendar</a> |
> <a href="getSaved.html">Get Saved</a> |
> <a href="index.html">Saturday Night Church</a>
> </b></font></td>
> </tr>
> <?
> }
> ?>
>
>
>>
>