Jump to content

hchsk

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Everything posted by hchsk

  1. how can i fwrite an absolute path file within my website or write a relative path using something like $_SERVER['document_root'] but that seems to not work?
  2. hchsk

    includes

    and why might i get this error message when i attempt an absolute url? a relative path works when i call the page itself, not from an include Warning: fopen(http://www.lowersouthlounge.com/teambonuscheck.txt) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/.ibycusdryer/cyprinid/lowersouthlounge.com/scripts/report.php on line 39
  3. hchsk

    includes

    how can i include a .php file that needs to be executed and contains relative links, from a different folder, without that screwing up the relative links. (i say screwing up, it's doing what it's supposed to, but in this particular case is not what i want). can exec() be used to do this? i was confused by the php manual
  4. how can i stop my website from being stored in a browsers history. i do not want to disable the back button if possible, but simply to not leave an entry in the browser history
  5. why could this possibly be firing? $warningfeed = ''; foreach($info as $key => $value) { $inactive = (strtotime($value)+259200) - strtotime($nowpub); $inactive = Srtto2Time($inactive); $hold = intval($key) - 1; $warning = ''; if (($value == 3) && (intval($inactive[seconds]) > 0)) {$bits[$key-1] = 0;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) < 12) && ($bits[$hold] !== 1)) {$warning = 'Team ' . $key . ' is in danger of inactivity. Less than twelve hours left!'; $bits[$hold] = 1;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) < 1) && ($bits[$hold] !== 2)) {$warning = 'Team ' . $key . ' is in danger of inactivity. Less than one hour left!'; $bits[$hold] = 2;} if ((intval($inactive[seconds]) < 0) && ($bits[$hold] !== 3)) {$warning = 'Team ' . $key . ' has been declared inactive. Please contact a judge for shootout details.'; $bits[$hold] = 3;} ///////////////////////////////////////////////////////////////////////////////CHANGE TO TEAM NAMES HERE $category="allevents/team$key/"; //CREATE ITEM $warning if ($warning != '') { $warningfeed .= " <item> <title>Network Update</title> <category>$category</category> <link>http://lowersouthlounge.com/circle.php</link> <description>$warning $bits[$hold] | $inactive[days] | $inactive[hours] | $inactive[seconds]</description> <pubDate>$value</pubDate> </item>"; } } when print "$bits[$hold] | $inactive[days] | $inactive[hours] | $inactive[seconds]" == 3 | 0 | 0 | -11163 thanks so much
  6. i dont understand what the problem is. if its generateing that file, it is echoing them. no?
  7. the foreach loop below is adding to $warningfeed excessively. i have checked, the loop runs the correct number of times, 11. $info is an array of eleven date/times, which need to each be checked if the current date/time is x amount of time away from three days past the element date/time. if so, it should add an item to $warningfeed. Srtto2Time($inactive) correctly creates it's array. $nowpub is the current date/time. $bits is an array of inactivity status' between zero and three, which must be reset if the team is no longer inactive. $warningfeed = ''; foreach($info as $key => $value) { $inactive = (strtotime($value)+259200) - strtotime($nowpub); $inactive = Srtto2Time($inactive); $hold = $key+1; $warning = ''; if (($value == 3) && (intval($inactive[seconds]) > 0)) {$value = 0;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) < 12)) {$warning = 'Team ' . $hold . ' is in danger of inactivity. Less than twelve hours left!'; $bits[$key-1] += 1;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) < 1)) {$warning = 'Team ' . $hold . ' is in danger of inactivity. Less than one hour left!'; $bits[$key-1] += 1;} if (intval($inactive[seconds]) < 0) {$warning = 'Team ' . $hold . ' has been declared inactive. Please contact a judge for shootout details.'; $bits[$key-1] += 1;} ///////////////////////////////////////////////////////////////////////////////CHANGE TO TEAM NAMES HERE //CREATE ITEM $warning if ($warning != '') { $warningfeed .= $warningfeed . " <item> <title> Network Update</title> <category>$category</category> <link>http://website/circle.php</link> <description>$warning</description> <pubDate>$nowpub</pubDate> </item>"; } } any help, ideas, suggestions, would mean a lot. thanks for your time.
  8. ive discovered a new and much more pressing problem that perhaps you can help me with. i have a file updates.php, which is an rss page generated by php. Within updates.php, i need to add an item that contains a variable gathered by inactive() which comes from an included page inactivity.php. The problem is that the inactive() function needs to search the items of the rss generated by updates.php, and it uses the last pubDate of an item in a chosen category. as is, this creates a loop, that ruins not updates.php, which seems to independently time out and ignore that section of the script, but it ruins another page on my site, which creates individual, smaller feeds based off of the items in a chosen category of updates.php
  9. i know you did! im so sorry. and i fixed the 33. . . by switching the last to < as it should be rather than <= but now i get 22. . . which makes no sense. (intval($inactive[days]) == 0) is false! it ==2
  10. oh wow, silly mistake, somewhere along i had added the ../ that i should not have. thank you for pointing that out. but now it outputs 333333333333?
  11. i dont understand. my filepaths where? its already been demonstrated that all of the arrays are correctly filled, and i'm not overwriting the file yet, i'm just printing a variable! forget about all this code, even this does not work!! : foreach ($nodoubleiw as $key => $value) { $newnodoubleiw = 'whynot?'; } funny thing is that is does in the inline, test.php, but it fails in the rss.php but if i place $newnodoubleiw = 'aha'; right outside of the foeach loop, it works!
  12. i can by testing it outside of the rss with test.php and inline code (but there it works anyway). but i cant in the rss, because the rss will not display if the php prints improper format. but i can achieve what youre asking by assigning those dumps to vars and printing it within an item. the result of that is. . . nothing. it seems like the loop just isnt executing at all. i don't understand it.
  13. i dont think you need to worry about that right now, right now i just need the loop to work, and to be able to print $newnodoubleiw which should == 000000000000, and DOES when this is checked separately. what i will do once that works, is to delete the print command, and instead ////UPDATE NODOUBLEIW.TXT $myFile = "../nodoubleiw.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, $newnodoubleiw); which will overwrite nodoubleiw.txt with the new $newnodoubleiw nodoubleiw.txt is a flat file database that keeps track of inactivity statuses
  14. <?php //CHECK WHEN LAST MODIFIED AND ASSIGN TO VAR $lastmod = date("D, j M Y H:i:s", (filemtime("report.txt"))); $lastmod += 10000; //GET CURRENT DATE/TIME $now = date("D, j M Y H:i:s"); $ltime = time() + 3*60*60 ; $nowpub = date('D, j M Y H:i:s',$ltime); //GET LAST UPDATE $lastupdate = date("D, j M Y H:i:s", (filemtime("modifycheck.txt"))); //GET DIFFERENCE $lastissue = strtotime($now) - strtotime($lastupdate); //GET SCORES $filename = "scorestore.txt"; $score = file($filename); //GET COMMENT $filename = "comments.txt"; $comment = file($filename); //GET REPORT $filename = "report.txt"; $report = file($filename); echo <<<END <rss version="2.0"> <channel> <title>HCHSLive Network Feed</title> <link>http://www.lowersouthlounge.com</link> <pubDate>Wed, 29 Apr 2009 08:10:00 EST</pubDate> <description>HCHS Live Network</description> <language>en-us</language> <lastBuildDate>Wed, 29 Apr 2009 08:10:00 EST</lastBuildDate> <managingEditor>hchscontact@aol.com</managingEditor> <webMaster>hchscontact@aol.com</webMaster> <image> <title>HCHSLive Network Feed</title> <url>http://www.lowersouthlounge.com/favicon.ico</url> <link>http://lowersouthlounge.com</link> <width>16</width> <height>16</height> </image> END; ///////////////////////// ///////////////////////////////////////////////////////////////// FINISH ME! /////////////////////////////////// //INCLUDE INACTIVITY.PHP include("scripts/inactivity.php"); //OPEN NODOUBLEIW.TXT $myFile = "../nodoubleiw.txt"; $nodoubleiw = file($myFile); ////CHECK FOR INACTIVITY ///killinactivedoubles.txt == 000000000000 ///0 == none issued ///1 == 6hr issued ///2 == 1hr issued ///3 == inactivity issued ///change value of teams slot when issued (+=1) ///if not inactive reset value of teams slot $nodoubleiw = preg_split('//', $nodoubleiw[0], -1,PREG_SPLIT_NO_EMPTY); //this is not functioning -> troubleshoot $newnodoubleiw = ''; foreach ($nodoubleiw as $key => $value) { $search = 'team' . ($key+1); $inactive = inactive($search); $newval = intval($value); if ((intval($value) == 3) && (stristr($inactive, 'inactive') == false)) {$newval = 0;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 6)) {$warning = $team . 'is in danger of inactivity! Less than 6 hours left!'; $newval += 1;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 1)) {$warning = $team . 'is in danger of inactivity! Less than 1 hour left!'; $newval += 1;} if (intval($inactive[seconds]) <= 0) {$warning = $team . 'has been declared inactive. If you are the Captain of ' . $team . ', please contact a judge for information concerning your shootout.'; $newval += 1;} $newnodoubleiw .= $newval; } ////UPDATE NODOUBLEIW.TXT //$myFile = "../nodoubleiw.txt"; //$fh = fopen($myFile, 'w'); //fwrite($fh, $newnodoubleiw); ////CREATE WARNING TO BE APPENDED TO ADDFEED.TXT //$warning .= ' //<item> // <title>HCHSLive Network Update</title> // <category>inactivity</category> // <link>http://lowersouthlounge.com/circle.php</link> // <description>$warning</description> // <pubDate>$LASTEVENTTIME</pubDate> //</item>'; ////TWEET! //include("tweet.php"); //postToTwitter("HCHSLiveNetwork", "password", $newreport); ///////////////////////// ///////////////////////////////////////////////////////////////// FINISH ME! /////////////////////////////////// //SAVE OLDFEED AS $originalfeed $myFile = "addfeed.txt"; $fh = fopen($myFile, 'r'); $originalfeed = fread($fh, filesize($myFile)); fclose($fh); //CHECK IF NEW INFO if ($lastissue > 0){ //CREATE NEW ITEM for ( $counter = 0; $counter < count($report); $counter += 1 ) { //MAKE CATEGORY for ( $counter2 = 1; $counter2 <= 12; $counter2 += 1 ) { //////////////////////////////////////////////////////////////////CHANGE FUNCTION TO CHECK FOR TEAM NAMES $hold = 'team' . $counter2 . ' '; //SPACE CHECKS FOR ERRORS DUE TO DIGIT REPEAT AT 10+ if (stristr($report[$counter], $hold) != false) {$category = $category . trim($hold) . '/';} } $luck = rand(0, 34); if (trim($report[$counter]) !== '') { $newfeed = $newfeed . " <item> <title>HCHSLive Network Update</title> <category>$category</category> <link>http://lowersouthlounge.com/circle.php</link> <description>$report[$counter] $comment[$luck]</description> <pubDate>$nowpub</pubDate> </item>"; } } //OVERWRITE FILE, FIRST NEW ITEM THEN $originalfeed $myFile = "addfeed.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, " $warning $newfeed $originalfeed"); fclose($fh); //EMPTY REPORT.TXT $myFile = "report.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, ""); fclose($fh); //CHANGE modifycheck.txt $myFile = "modifycheck.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, "$now"); fclose($fh); } echo <<<END $newfeed $originalfeed <item> <title>RSS Feed Live!</title> <category>post</category> <link>http://lowersouthlounge.com</link> <description> HCHS Live Network RSS feed running! TIME STAMP: $lastmod $lastupdate $now || $newnodoubleiw </description> <pubDate>Mon, 27 Apr 2009 08:10:00 EDT</pubDate> </item> </channel> </rss> END; ?> is not printing $newnodoubleiw in the final item. eventually, instead of doing this, it will update the nodoubleiw.txt file instead of printing, but this is to make testing the code easier until it works ////UPDATE NODOUBLEIW.TXT //$myFile = "../nodoubleiw.txt"; //$fh = fopen($myFile, 'w'); //fwrite($fh, $newnodoubleiw);
  15. same result. both versions work in a normal html document with an inline php include and print $newnodoubleiw appended
  16. ahh, while that worked in a test.php i was using, it still breaks in the real page im using it in, that constructs an rss. maybe you could help find the error here as well? im going to post the full script, but it is clearly labeled, and the vast majority of it you can ignore. <?php //CHECK WHEN LAST MODIFIED AND ASSIGN TO VAR $lastmod = date("D, j M Y H:i:s", (filemtime("report.txt"))); $lastmod += 10000; //GET CURRENT DATE/TIME $now = date("D, j M Y H:i:s"); $ltime = time() + 3*60*60 ; $nowpub = date('D, j M Y H:i:s',$ltime); //GET LAST UPDATE $lastupdate = date("D, j M Y H:i:s", (filemtime("modifycheck.txt"))); //GET DIFFERENCE $lastissue = strtotime($now) - strtotime($lastupdate); //GET SCORES $filename = "scorestore.txt"; $score = file($filename); //GET COMMENT $filename = "comments.txt"; $comment = file($filename); //GET REPORT $filename = "report.txt"; $report = file($filename); echo <<<END <rss version="2.0"> <channel> <title>HCHSLive Network Feed</title> <link>http://www.lowersouthlounge.com</link> <pubDate>Wed, 29 Apr 2009 08:10:00 EST</pubDate> <description>HCHS Live Network</description> <language>en-us</language> <lastBuildDate>Wed, 29 Apr 2009 08:10:00 EST</lastBuildDate> <managingEditor>hchscontact@aol.com</managingEditor> <webMaster>hchscontact@aol.com</webMaster> <image> <title>HCHSLive Network Feed</title> <url>http://www.lowersouthlounge.com/favicon.ico</url> <link>http://lowersouthlounge.com</link> <width>16</width> <height>16</height> </image> END; ///////////////////////// ///////////////////////////////////////////////////////////////// FINISH ME! /////////////////////////////////// //INCLUDE INACTIVITY.PHP include("scripts/inactivity.php"); //OPEN NODOUBLEIW.TXT $myFile = "../nodoubleiw.txt"; $nodoubleiw = file($myFile); ////CHECK FOR INACTIVITY ///killinactivedoubles.txt == 000000000000 ///0 == none issued ///1 == 6hr issued ///2 == 1hr issued ///3 == inactivity issued ///change value of teams slot when issued (+=1) ///if not inactive reset value of teams slot $nodoubleiw = preg_split('//', $nodoubleiw[0], -1,PREG_SPLIT_NO_EMPTY); //this is not functioning -> troubleshoot $newnodoubleiw = ''; foreach ($nodoubleiw as $key => $value) { $search = 'team' . ($key+1); $inactive = inactive($search); if ((intval($value) == 3) && (stristr($inactive, 'inactive') == false)) {$nodoubleiw[$key] = 0;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 6)) {$warning = $team . 'is in danger of inactivity! Less than 6 hours left!'; $nodoubleiw[$key] += 1;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 1)) {$warning = $team . 'is in danger of inactivity! Less than 1 hour left!'; $nodoubleiw[$key] += 1;} if (intval($inactive[seconds]) <= 0) {$warning = $team . 'has been declared inactive. If you are the Captain of ' . $team . ', please contact a judge for information concerning your shootout.'; $value += 1;} $newnodoubleiw .= $nodoubleiw[$key]; } ////UPDATE NODOUBLEIW.TXT //$myFile = "../nodoubleiw.txt"; //$fh = fopen($myFile, 'w'); //fwrite($fh, $newnodoubleiw); ////CREATE WARNING TO BE APPENDED TO ADDFEED.TXT //$warning .= ' //<item> // <title>HCHSLive Network Update</title> // <category>inactivity</category> // <link>http://lowersouthlounge.com/circle.php</link> // <description>$warning</description> // <pubDate>$LASTEVENTTIME</pubDate> //</item>'; ////TWEET! //include("tweet.php"); //postToTwitter("HCHSLiveNetwork", "password", $newreport); ///////////////////////// ///////////////////////////////////////////////////////////////// FINISH ME! /////////////////////////////////// //SAVE OLDFEED AS $originalfeed $myFile = "addfeed.txt"; $fh = fopen($myFile, 'r'); $originalfeed = fread($fh, filesize($myFile)); fclose($fh); //CHECK IF NEW INFO if ($lastissue > 0){ //CREATE NEW ITEM for ( $counter = 0; $counter < count($report); $counter += 1 ) { //MAKE CATEGORY for ( $counter2 = 1; $counter2 <= 12; $counter2 += 1 ) { //////////////////////////////////////////////////////////////////CHANGE FUNCTION TO CHECK FOR TEAM NAMES $hold = 'team' . $counter2 . ' '; //SPACE CHECKS FOR ERRORS DUE TO DIGIT REPEAT AT 10+ if (stristr($report[$counter], $hold) != false) {$category = $category . trim($hold) . '/';} } $luck = rand(0, 34); if (trim($report[$counter]) !== '') { $newfeed = $newfeed . " <item> <title>HCHSLive Network Update</title> <category>$category</category> <link>http://lowersouthlounge.com/circle.php</link> <description>$report[$counter] $comment[$luck]</description> <pubDate>$nowpub</pubDate> </item>"; } } //OVERWRITE FILE, FIRST NEW ITEM THEN $originalfeed $myFile = "addfeed.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, " $warning $newfeed $originalfeed"); fclose($fh); //EMPTY REPORT.TXT $myFile = "report.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, ""); fclose($fh); //CHANGE modifycheck.txt $myFile = "modifycheck.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, "$now"); fclose($fh); } echo <<<END $newfeed $originalfeed <item> <title>RSS Feed Live!</title> <category>post</category> <link>http://lowersouthlounge.com</link> <description> HCHS Live Network RSS feed running! TIME STAMP: $lastmod $lastupdate $now || $newnodoubleiw </description> <pubDate>Mon, 27 Apr 2009 08:10:00 EDT</pubDate> </item> </channel> </rss> END; ?>
  17. haha, your script has a mistake in concatenating $value instead of $nodoubleiw[$key], but otherwise, works perfectly! thanks so much! lol, we were typing at the same time. i solved it slightly differently too. interesting. thanks again.
  18. that just broke it down into an array by character to allow the foreach to loop through it each time the loop hits $newnodoubleiw .= $value; it should be appending the $value from the foreach loop (possibly +=1 if a statement was true)
  19. right, so it should be the original value from //OPEN NODOUBLEIW.TXT $myFile = "../nodoubleiw.txt"; $nodoubleiw = file($myFile); which would be "0" and $newnodoubleiw should == 000000000000
  20. array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(15) ["display"]=> string(6) "2:18:8" } array(6) { ["years"]=> int(0) ["days"]=> float(2) ["hours"]=> float(18) ["minutes"]=> float( ["seconds"]=> float(14) ["display"]=> string(6) "2:18:8" }
  21. i think ken meant to look up concatenating strings?
  22. i tried this, still to a blank value of $newnodoubleiw foreach ($nodoubleiw as $key => $value) { $search = 'team' . ($key+1); $inactive = inactive($search); if ((intval($value) == 3) && (stristr($inactive, 'inactive') == false)) {$nodoubleiw[$key] = 0;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 6)) {$warning = $team . 'is in danger of inactivity! Less than 6 hours left!'; $nodoubleiw[$key] += 1;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 1)) {$warning = $team . 'is in danger of inactivity! Less than 1 hour left!'; $nodoubleiw[$key] += 1;} if (intval($inactive[seconds]) <= 0) {$warning = $team . 'has been declared inactive. If you are the Captain of ' . $team . ', please contact a judge for information concerning your shootout.'; $nodoubleiw[$key] += 1;} $newnodoubleiw .= $nodoubleiw[$key]; } thanks for the help
  23. first thing i did, but couldnt glean anything from it array(12) { [0]=> string(1) "0" [1]=> string(1) "0" [2]=> string(1) "0" [3]=> string(1) "0" [4]=> string(1) "0" [5]=> string(1) "0" [6]=> string(1) "0" [7]=> string(1) "0" [8]=> string(1) "0" [9]=> string(1) "0" [10]=> string(1) "0" [11]=> string(1) "0" }
×
×
  • 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.