# PHP cookie check before xml

**URL:** <https://forum.kirupa.com/t/php-cookie-check-before-xml/143881>\
**Category:** Uncategorized\
**Created:** [April 9, 2005, 5:30pm UTC](https://forum.kirupa.com/t/php-cookie-check-before-xml/143881 "2005-04-09T17:30:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaid\_W1red](https://avatars.discourse-cdn.com/v4/letter/z/cab0a1/32.png) [@Zaid\_W1red](https://forum.kirupa.com/u/Zaid_W1red)\
**Post date:** [April 9, 2005, 5:30pm UTC](https://forum.kirupa.com/t/php-cookie-check-before-xml/143881/1 "2005-04-09T17:30:10Z")

</div>

[font=Verdana, Helvetica, sans-serif][size=2]Hi folks,  
Im trying to use a PHP cookie check to determine the out put of an xml file:  
[/size][/font][indent]\<FONT color=#000000\>\<FONT face=Arial size=1\>

```php

<?PHP 
//BEGIN PAGE PROTECTIO 
session_start(); 
header("Cache-control: private"); 
if (isset($_COOKIE['w1redname']) && isset($_COOKIE['w1redpass'])&& isset($_COOKIE['w1redid'])){ 
$_SESSION['username'] = $_COOKIE['w1redname']; 
$_SESSION['ident'] = $_COOKIE['w1redid']; 
$_SESSION['guideuser'] = "false"; 
$userloggedin = "true"; 
session_register(userloggedin); 
session_register(guideuser); 
} 
//ENDPAGE PROTECTION 
include('includes/dbconnect.php'); 
$select = 'SELECT * FROM tracks ORDER BY playlist ASC'; 
$result = mysql_query($select); 
echo('<?xml version="1.0" ?>' . "
"); 
echo(' <songs>' . "
"); 
WHILE($r = mysql_fetch_array($result)){ 
$artist = $r['artist']; 
$title = $r['title']; 
$album = $r['album']; 
if(session_is_registered(userloggedin)){ 
$lyrics = $r['lyrics']; 
$maxplaytime = $r['playtime']; 
}else{ 
$lyrics = "Please visit the back stage area and register in order to enjoy full length audio, and access to lyrics."; 
$maxplaytime = "60000"; 
} 
$album = $r['album']; 
$playtime = $r['playtime']; 
$filesize = $r['filesize']; 
$url = "audiofiles/".$r['url']; 
?> 
<song artist="<?echo $artist?>" title="<?echo $title?>" album="<?echo $album?>" playtime="<?echo $playtime?>" filesize="<?echo $filesize?>" lyrics="<?echo $lyrics?>" url="<?echo $url?>" maxplaytime="<?echo $maxplaytime?>"/> 
<? 
} 
echo('</songs>'."
"); 
?> 

```

[/indent][font=Verdana, Helvetica, sans-serif][size=2]

The page protection section works just fine on other documents but not here…does anyone have any ideas?[/size][/font]
