Jump to content

Caion

Members
  • Posts

    20
  • Joined

  • Last visited

Caion's Achievements

Apprentice

Apprentice (3/14)

  • First Post
  • Collaborator
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. http://news.com.com/New+worm+targets+Linux...38475&subj=news As this can possibly effect Total Choice's servers I feel this is relevant.
  2. By the way. Feeds generated by this script register as fully valid on Feed Validator.
  3. You're absolutely right! What I was trying to do was create a PHP script that can create a customized RSS feed on the fly, depending on what the browser has in its query string. I ran into several problems, but managed to solve them with the help of my two biggest assets: coffee and google. Here's the code I wrote: ><?php header('Content-type: application/xml'); if ($_POST["id"]) $id = $_POST["id"]; else if ($_GET["id"]) $id = $_GET["id"]; if ($_POST["synch"]) $synch = $_POST["synch"]; else if ($_GET["synch"]) $synch = $_GET["synch"]; if ($_POST["data"]) $data = $_POST["data"]; else if ($_GET["data"]) $data = $_GET["data"]; $day = $id/214746; $month = $synch/8562; $year = $data/634; $date2 = "$year-$month-$day"; $date1 = date("Y-m-d"); $dateOne = explode("-",$date1); $dateTwo = explode("-",$date2); $dateOne = (Mktime(00, 00, 00, $dateOne[1], $dateOne[2], $dateOne[0])); $dateTwo = (Mktime(00, 00, 00, $dateTwo[1], $dateTwo[2], $dateTwo[0])); $numberOfDays = round(($dateOne - $dateTwo) / 86400); if ($numberOfDays < 0) $numberOfDays = $numberOfDays * -1; if ($id == 0) $numberOfDays = -1; if ($data == 0) $numberOfDays = -1; if ($synch == 0) $numberOfDays = -1; if ($numberOfDays >=0) readfile('http://www.mysite.net/rss/header.txt'); if ($numberOfDays >=0) readfile('http://www.mysite.net/rss/feed1.txt'); if ($numberOfDays >= 1) readfile('http://www.mysite.net/rss/feed2.txt'); if ($numberOfDays >= 2) readfile('http://www.mysite.net/rss/feed3.txt'); if ($numberOfDays >= 3) readfile('http://www.mysite.net/rss/feed4.txt'); if ($numberOfDays >=0) readfile('http://www.mysite.net/rss/footer.txt'); ?> This script does a few things. 1. It reads the exact date in which you first subscribed to the feed. This information is read from the query string, which is automatically generated by the server when you browse the site which contains the feed link. 2. It compares the subscribed date to the present date 3. It then delivers content depending on how many days have passed. The problem I was having (getting the script to be recognized as a valid RSS feed) was because the server has php scripts under a certain mime type (the mime type for any RSS feed needs to be "application/xml" so even though the content of the feed itself was valid it was being treated as an html document, not an xml document, and I couldn't change the mime type for php files across the whole site using cPanel (doing that would break the whole website, turning it into one big xml error message). As you can see, I fixed that. The .txt files referenced in the script contain the actual feed information. header.txt and footer.txt contain the info for the feed itself and feed1.txt - feed4.txt contain the separate items in the feed. I'm thinking of modding the script to recognize more times. Currently this script only reads days but, Ideally, I'd like it to also recognize minutes and hours. This is an experiment I'm working on for my site. I intend to create content (namely, stories) where you'll be able to subscribe to the content, and the information in the feed will be sent to you depending on how long you stay subscribed. For example: if I had a book online one could subscribe to the book and receive the separate chapters in his RSS reader, in order, according to a set interval. It could be one chapter a day, or one chapter every few hours, or whatever.
  4. There's no longer a need for a reply. After working at for a while I managed to find the solution on my own.
  5. Here is one example of the implementation I am talking about. http://www.archive.org/services/collection-rss.php As you can see, this is a working RSS feed. And, since it's PHP. you can do have it do things you can't normally do in a plain XML file (for example, you could subscribe to a specific category by adding a category string to the URL, if that were allowed). The feed I'm trying to create requires that same kind of functionality. At present, my browser displays a blank screen when I attempt to use my own "rss.php" file, and all RSS readers see it as invalid.
  6. I'm trying to create a custom RSS feed for my website using PHP and I've hit a snag. The script I'm using generates valid RSS feeds (I've tested them) and they do work perfectly when I run one such feed as an .XML file, but my situation requires that they run as a .PHP file. I know this is possible because I have visited several sites that do this. They have a .PHP file that serves as a valid RSS feed. How do I do this?
  7. One other thing. The script now works fine, but I haven't had any luck finding instructions on how to check for and allow a blank referer.
  8. Just tried it out and it worked perfectly. Thanks!
  9. Correct me if I'm misunderstanding, but your first suggestion doesn't seem viable due to the fact that videos.inc is a random file who's value changes every few hours. I have my site set up so that the directory my video files are stored in shifts, then the videos.inc file is updated to reflect that shift. All hyper links leading to the file make use of an <?php include> to update the link presented to the visitor on demand. I'm aware I can just post the plain link to the file on the site, but I've been getting complaints and suggestions from visitors that they'd like to be able to directly dowload the media files with one click, thus the download.php script. I tried using $randdir = file('videos.inc')[0]; and it was unsuccessful.
  10. I'm trying to construct a download.php file to allow direct downloads of the media files on my site with an url that looks like this: "http://www.my-site.com/download.php?file=sample.mov" There's one error that I need help with. First, here's the code I'm using. ><?php $file = $_GET['file']; $dirpath = '/path/to/public_html/'; $randdir = file ('videos.inc'); $trailslash = '/'; $directory = $dirpath . $randdir . $trailslash; $download = $directory . $file; if(!file_exists($download)) { echo 'The file you requested could not be found on this server. Please click back and try again'; } else { header('Content-Type: application/x-download'); header('Content-Disposition: attachment; filename=' . $file); print file_get_contents($download); } ?> I'm trying to get the $randdir array to equal the directory named in the videos.inc file. But the code, as it's written here, causes the error message to display. Also, when I input the actual name of the directory into the $randdir array it works as normal. The directory my files are stored in changes every few hours (a measure to combat hotlinkers), so I really need the mentioned array to equal what's written in the named file and work properly in the script. Lastly, I'd like to know if it's possible to make the script so that it will only function if the person running it came from my site. Thanks.
  11. I was thinking that maybe it got created when you first tried to run it (the script wasn't uploaded in ASCII mode, and you received the 500 Internal Server Error). I was going to suggest that you delete the file and see if it comes back. Glad to hear that it's working now! <{POST_SNAPBACK}> You have been a big help. I thank you and Pendragon for taking the time to assist me.
  12. I'm not sure what caused the error I mentioned above, but it seems it's not doing that anymore. I can only assume that the strange file in my directory was the result of something I did earlier. I modified the script to get rid of the line break, and now it works perfectly. I'm setting up a cron job for the script now. Thanks a bunch!
  13. Here is an example of how my directory listing looks. It appears as an actual file in my directory. just like that.
  14. I checked everything again, and I found the problem. It was a silly mistake on my part. When I uploaded the file in my FTP program I forgot to switch it to ascii mode, so it uploaded the script in binary mode. I just tested the script and it worked. However there does appear to be a couple of bugs in the script. 1. In addition to altering the randomlink.inc file it creates a file named "/home/CpanelName/public_html/randomlink.inc" in the directory. 2. When the script alters the randomlink.inc file it includes a line break at the end, so a link that would look like this. Looks like this. Some of my links are in Javascript popups so this prevents them from working. Thanks.
  15. I'm getting an error with your script when I try to test it. I've renamed the variables as specified and installed the script, but when I try to run it from my browser I get an internal server error. I double checked my file and directory names and they are all correct. I also tried renaming the cgi file into a php file, and when I tried to run it like that I got a different error message which said this. (note, I've changed my actual cpanel name to "CpanelName" for the sake of this post).
×
×
  • Create New...