Jump to content

PHP RSS


denoteone

Recommended Posts

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.