denoteone Posted March 11, 2008 Share Posted March 11, 2008 I want to make sure that my RSS page can only be accessed by some on that has there SESSION user set. For my other pages I check to make sure SESSION user is set if not redirect. Is it possible to do this with an XML page? the link to the RSS will be in the members area but I want to make sure nobody stumbles upon that is not logged in... Quote Link to comment Share on other sites More sharing options...
lemmin Posted March 11, 2008 Share Posted March 11, 2008 You could generate the XML using PHP. Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 11, 2008 Share Posted March 11, 2008 You could generate the XML using PHP. Right. Create a PHP page that checks the session first and then sets the header('Content-type: text/xml') so that readers will acknowledge the valid XML document. Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 11, 2008 Share Posted March 11, 2008 xml.php <?php // insert session check here header ("content-type: text/xml"); echo '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n"; ?> XML DATA GOES HERE Quote Link to comment Share on other sites More sharing options...
denoteone Posted March 11, 2008 Author Share Posted March 11, 2008 thanks everyone got it working that easy! While I have everyone here I would like to use PHP to track how many people subsribe to the RSS is this possible? At this point I am trying to code by hand so I am not using a RSS generator. Also I am not using a DB. I am thinking fopen but would like to get some feed back.....thanks again. Quote Link to comment Share on other sites More sharing options...
lemmin Posted March 11, 2008 Share Posted March 11, 2008 Using a database is always going to be the most efficient and, in the long-run, easiest, but if you don't want to go through the hassle, just saving a number in a text file would work. The easiest is to just use file_put_contents to put a number in a file and get it back with file_get_contents. Those functions would be more efficient than using fopen. Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 11, 2008 Share Posted March 11, 2008 thanks everyone got it working that easy! While I have everyone here I would like to use PHP to track how many people subsribe to the RSS is this possible? At this point I am trying to code by hand so I am not using a RSS generator. Also I am not using a DB. I am thinking fopen but would like to get some feed back.....thanks again. You won't know how many people subscribe since that is simply a local setting in their application. All you can do is do an IP tracking or other method of figuring out your unique visitors, but as far as subscriptions, that won't be possible. Quote Link to comment Share on other sites More sharing options...
denoteone Posted March 11, 2008 Author Share Posted March 11, 2008 Thanks again. i will worry about the counting shortly. But I am getting a "Live bookmark feed failed to load" is this because the file it is looking for is a .php extension? I am new to RSS feeds so maybe I am missing something here. I logged into the members area to see if the RSS would come up still saying it is not a valid URL. Quote Link to comment Share on other sites More sharing options...
denoteone Posted March 11, 2008 Author Share Posted March 11, 2008 Let me put that into questions. Will RSS readers understand the file if it is a .php? <?PHP session_start(); if(isset($_SESSION['user']) || isset($_SESSION['admin'])) { header ("content-type: text/xml"); echo '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n"; ?> <rss version="2.0"> <channel> XML RSS DATA GOES HERE. </channel> </rss>s <?PHP } else { print "<center>"; print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Logging In</center></td></tr>"; print "<tr class='forumrow'><td><center>"; print "Wrong username or password redirecting back to login page... <META HTTP-EQUIV = 'Refresh' Content = '2; URL =../stratalogin.php'></center>"; print "</td></tr></table></center>"; } ?> everytime the RSS reader goes to the .php it wont be able to read the content unless the session is set? Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 11, 2008 Share Posted March 11, 2008 How are you displaying this feed to the user? changes are, the session isn't making it to the rss.php file Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.