im trying to build a rss feed that will work with my software.
php code
<?php
$t = 15;
$nt = 15000;
$filename3 = "xrssdone.txt";
$content3 = file("xrssdone.txt");
$done = explode("|",$content3[0]);
$num = explode("showtopic=",$_GET["newlink"]);
$nummin = explode("&",$num[1]);
echo $nummin[0];
for ($i=0; $i<$nt; $i++) {
if ($nummin[0] == $done[$i]) {
$donebefore = "1";
break;
}
}
echo $donebefore;
if ($donebefore != "1") {
$newtitle = $_GET["newtitle"];
$newlink = $_GET["newlink"];
$newmsg = $_GET["newmsg"];
$begin = '<?xml version="1.0" encoding="ISO-8859-1" ?><rss version="2.0"><channel><title>Reptile Planet</title><link>http://herproom.5.forumer.com/index.php?</link><description>New Topics Reptile News</description>';
$newall = "<item><title>";
$newall .= $newtitle;
$newall .= "</title><link>";
$newall .= $newlink;
$newall .= "</link><description>";
$newall .= $newmsg;
$newall .= "</description></item>";
$newall2 = $newall."|||^^*^^|||";
$begin .= $newall;
$end = "</channel></rss>";
$filename = "xrss.xml";
$content = file("xrss.xml");
$filename2 = "xrssmsgs.txt";
$content2 = file("xrssmsgs.txt");
$cont2x = explode("|||^^*^^|||",$content2[0]);
$fp = fopen($filename,"w+");
fwrite($fp,$begin);
for ($i=0; $i<$t; $i++) {
fwrite($fp,$cont2x[$i]);
}
fwrite($fp,$end);
for ($i=0; $i<$t; $i++) {
$cont2x[$i] .= "|||^^*^^|||";
}
$fp2 = fopen($filename2,"w+");
fwrite($fp2,$newall2);
for ($i=0; $i<$t; $i++) {
fwrite($fp2,$cont2x[$i]);
}
for ($i=0; $i<$nt; $i++) {
if ($done[$i] == "" && $donethat != 1) {
$done[$i] .= $nummin[0];
$donethat = 1;
}
}
for ($i=0; $i<$nt; $i++) {
$done[$i] .= "|";
}
$fp3 = fopen($filename3,"w+");
for ($i=0; $i<$nt; $i++) {
fwrite($fp3,$done[$i]);
}
}
else {
echo "done";
}
?>
the three other files mentioned in it are hosted in the same root folder and are being written to. im using this javascript
function constrain(str,n){
if(str.length > n){
var s = str.substr(0, n);
var words = s.split(' ');
words[words.length-1] = '';
str = words.join(' ') + lm;
}
return str;
}
if (location.search.match("showtopic=")) {
var title = document.title;
var link = location.href;
var link2 = link.split("&");
var foruml = "";
var foruml2 = "";
var fixmsg = "";
var yes = 0;
var as3 = new Array();
var is3 = new Array();
var st3 = new Array();
var ss3 = new Array();
var fixmsg4 = new Array();
var fid = document.getElementById('navstrip');
foruml = fid.innerHTML.split("showforum=");
foruml2 = foruml[1].split('">');
for (i=0;i<forums.length;i++) {
if (foruml2[0] == forums[i]) {
yes = 1;
}
}
if (forums[0] == "0") {
yes = 1;
}
if (yes == 1) {
var x=document.getElementsByTagName('DIV');
for(i=0;i<x.length;i++) {
if(x[i].className=='postcolor') {
msg = x[i];
msg2 = msg.innerHTML.split("'");
for(c=0;c<msg2.length;c++) {
fixmsg += msg2[c];
}
as = fixmsg.match(/<a/i);
if (as != "null") {
as2 = fixmsg.split(/a>/i);
for (k=0; k<as2.length; k++) {
as3[k] = as2[k].replace(/<a.*<\//i, lr);
}
as4 = as3.join("");
fixmsg = as4;
}
fixmsg2 = fixmsg.replace(/<br>/ig, "<br />");
fixmsg = fixmsg2;
is = fixmsg.match(/<img/i);
if (is != "null") {
is2 = fixmsg.split(/">/i);
for (k=0; k<is2.length; k++) {
is3[k] = is2[k].replace(/<img.{5,}border="0/i, ir);
}
is4 = is3.join("");
fixmsg = is4;
}
fixmsg2 = fixmsg.split(/<!--endemo-->/i);
for (i=0; i<fixmsg2.length; i++) {
fixmsg3 = fixmsg2[i].replace(ir,"");
fixmsg4[i] = fixmsg3.replace(/<!--emo.*-->/i, "");
}
fixmsg = fixmsg4.join("");
fixmsg2 = fixmsg.split(/<!--emo.{2,5}-->/i);
fixmsg = fixmsg2.join("");
ss = fixmsg.match(/<span/i);
if (ss != "null") {
ss = fixmsg.replace(/;/ig, "<end>");
ss2 = ss.split(/nd>/i);
for (k=0; k<ss2.length; k++) {
ss3[k] = ss2[k].replace(/<span.*<e/i, "");
ss4 = ss3[k].replace(/<\/span>/ig,"");
ss3[k] = ss4;
}
ss4 = ss3.join("");
fixmsg = ss4;
}
fixmsg2 = constrain(fixmsg,1900);
fixmsg = fixmsg2;
document.write("<span style='display:none'><iframe border='0' height='1' width='1' src='"+xrssphp+"?newtitle="+title+"&newlink="+link2[0]+"&newmsg="+fixmsg+"'></iframe></span>");
break;
}
}
}
}
and
<script type="text/javascript">
var forums = new Array();
forums[0] = "25";
var rssphp = "http://free.hostultra.com/~inny/xrss.php";
var lr = "[link removed]";
var ir = "[image removed]";
var lm = "… Click link to view full post.";
</script>
what the hell is wrong?