Jump to content

hchsk

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Everything posted by hchsk

  1. typo in my copy & paste, but not in the real thing. $newnodoubleiw = $value; should be $newnodoubleiw .= $value; also, note, replacing the foreach loop with foreach ($nodoubleiw as $key => $value) { $newnodoubleiw = 'whyy'; } also returns a blank $newnodoubleiw. why could this be?
  2. hi, i can't seem to find the problem in this foreach loop. if anyone could help or give a suggestion, i'd really appreciate it, it's been endless trouble. as far as i can tell, the foreach loop isnt executing at all, even though its been given a valid array and format. the purpose of the code is to check if the time given by the function inactive() is in a certain range, if so, add an item to the rss page this code is within. but to also check it doesnt issue the same warning twice, and also to do this for multiple inactive($vars). $nodoubleiw == 000000000000 at the start, and should be updated every time something changes. (each digit represents a team, and their inactivity status, 1-3) //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 foreach ($nodoubleiw as $key => $value) { $search = 'team' . ($key+1); $inactive = inactive($search); if ((intval($value) == 3) && (stristr($inactive, 'inactive') == false)) {$value = 0;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 6)) {$warning = $team . 'is in danger of inactivity! Less than 6 hours left!'; $value += 1;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) <= 1)) {$warning = $team . 'is in danger of inactivity! Less than 1 hour left!'; $value += 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 = $value; } //UPDATE NODOUBLEIW.TXT $myFile = "../nodoubleiw.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, $newnodoubleiw);
  3. haha, definitely, thats probably a better idea anyway i suppose, thank you so much for doing this, while i'm delighted, i feel bad that you're handwriting so much just for me, you already have done a lot. i'm glad to help out as much as i can and im very grateful.
  4. yes definitely! haha. i know it's awful, i couldnt for my life figure out how to do it more efficiently, this is basically my first time really using php, and i just figure things out slowly with google. i wrote it before i wrote a full ranking function, which i ended up needing and writing/getting help with later. ok, so here's the goal: echo <<<END <div id=RANKING style="float:left;margin:10px;margin-top:-80;border-left:#b10961 solid 1px;width:110px;text-align:right;padding-right:10px;height:350px;"> <div style="color:purple;font-size:14;font-weight:bold;padding:5px;"> LEADING: </div> END; if (no scores yet) { echo <<<END <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;"> <i>No scores yet.</i><br> </div> END; } if (first place) { echo <<<END <div style="background-color: #b10961;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"> <b>First place!</b><br> </div> <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> Team $allfirstplaceteams <br> <i>with <b>$score[oftheseteams]</b> points</i><br> </div> END; } if (2teams or less in firstplace) { echo <<<END <div style="background-color: #B15E89;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"><b> if(twoteamsinfirstplace){$place = 'Third place!';} else {$place = 'Secondplace!'} echo $place.'</b><br></div>'; <div style="background-color: #f8f8f8;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> $allsecondplaceteams <br> <i>with <b>$score[oftheseteams]</b> points</i><br> </div> END; if (oneteaminfirst && oneteaminsecond) { echo <<<END <div style="background-color: #FE86C4;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"> <b>Third place!</b><br> </div> <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> allteamsinthird <br> <i>with <b>$score[oftheseteams]</b> points</i><br> </div> END; } no matter what: <br> <script type="text/javascript" src="scripts/clock.js"></script><div id="clockbox"></div> </div> a nightmare. thanks for helping here are the arrays i am starting with, and that should be enough to do what i need: $scores (team#-1=>score): Array ( [0] => 0 [1] => 12 [2] => 0 [3] => 7 [4] => 4 [5] => 2 [6] => 2 [7] => 0 [8] => 5 [9] => 7 [10] => 7 [11] => 7 ) $rank (team#=>place): Array ( [2] => 1st place [10] => tied for 2nd place [11] => tied for 2nd place [4] => 2nd place [12] => 2nd place [9] => 6th place [5] => 7th place [6] => tied for 8th place [7] => tied for 8th place [3] => unranked [1] => unranked [8] => unranked [0] => th place [13] => unranked )
  5. thanks! that did exactly what i asked for, and actually a little bit more, that i'm afraid i shouldv mentioned. the format i was using myself is important for the display i need to place it in, and the whole function gets more complicated i'll post the function i was using previously, but for 10 teams, and i now need it to work for 12, (and any that need to get added in the future) without problems <?php include("ranketc.php"); $filename = "scorestore.txt"; $score = file($filename); $first = ''; $second = ''; $third = ''; $fourth = ''; $tie = ''; $tie2 = ''; $tie3 = ''; $tie4 = ''; $which = ''; $nteams = count($score); for ( $counter = 0; $counter <= $nteams; $counter += 1 ) {$score[$counter] = intval($score[$counter]); } function doublemax($mylist){ $maxvalue=max($mylist); while(list($key,$value)=each($mylist)){ if($value==$maxvalue)$maxindex=$key; } return array("m"=>$maxvalue,"i"=>$maxindex += 1); } // ------------------------- GET RID OF ELIMINATED TEAMS $filename = "deathcount.txt"; $deathcount = file($filename); $deathcountarray = str_split($deathcount[0]); for ( $counter = 0; $counter <= $nteams; $counter += 1 ) { if ($deathcountarray[$counter] == 6) {$score[$counter] = 0;} } // ------------------------- first place!! $first = doublemax($score); // ------------------------- THREE WAY TIE? for ( $counter = 0; $counter <= $nteams; $counter += 1 ) {if ($score[$counter] == $first[m]) {$hold += 1;}} if ($hold==3) {$triptie = 1;} else {$triptie = 0;} // ------------------------- CHECK FOR TIE if($triptie == 1){$place = ' first,<br>second & third';} else {$place = ' first<br>& second';} for ( $counter = 0; $counter <= $nteams; $counter += 1 ) {if ($score[$counter] == $first[m]) {if ($tie == '') {$tie = ' <div style="background-color: #b10961;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding-left:5px;"> <b>TIED for' . $place . '!</b><br><br></div>'; $tiet2 = '<br> & Team ' . ($counter+=1); $hold = $counter -=1; $which = 1;} else {$tiet2 = $tiet2 . '<br> & Team ' . ($counter+=1);$which = false; $score[$hold] = 0;} } } if ($which == 1) {$tie = ''; $tiet2 = '';} // ------------------------- second place!! $score[($first[i]-=1)] = 0; $second = doublemax($score); // ------------------------- CHECK FOR TIE if($tie == ''){$place = ' second<br>& third';} else {$place = ' third';} for ( $counter = 0; $counter <= $nteams; $counter += 1 ) {if ($score[$counter] == $second[m]) {if ($tie2 == '') {$tie2 = ' <div style="background-color: #B15E89;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding-left:5px;"> <b>TIED for' . $place . '!</b><br><br></div>'; $tiet3 = '<br> & Team ' . ($counter+=1); $hold = $counter -=1; $which = 1;} else {$which = false; $score[$hold] = 0;} } } if ($which == 1) {$tie2 = ''; $tiet3 = '';} // ------------------------- third place!! $score[($second[i]-=1)] = 0; $third = doublemax($score); // ------------------------- CHECK FOR TIE for ( $counter = 0; $counter <= $nteams; $counter += 1 ) {if ($score[$counter] == $third[m]) {if ($tie3 == '') {$tie3 = ' <div style="background-color: #FE86C4;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding-left:5px;"> <b>TIED for third!</b><br><br></div>'; $tiet4 = '<br> & Team ' . ($counter+=1); $hold = $counter -=1; $which = 1;} else { if ( ($counter+=1) != $third[i] ) { $tiet4 = $tiet4 . '<br> & Team ' . (($counter+=1)-1);} $which = false; $score[$hold] = 0;} } } if ($which == 1) {$tie3 = ''; $tiet4 = '';} // who knows why, but it works $first[i] += 1; $second[i] += 1; echo <<<END <div id=RANKING style="float:left;margin:10px;margin-top:-80;border-left:#b10961 solid 1px;width:110px;text-align:right;padding-right:10px;height:350px;"> <div style="color:purple;font-size:14;font-weight:bold;padding:5px;"> LEADING: </div> END; if ($first[m] == 0) { echo <<<END <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;"> <i>No scores yet.</i><br> </div> END; } if ($first[m] != 0) { echo $tie; if ($tie == '') { echo <<<END <div style="background-color: #b10961;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"> <b>First place!</b><br> </div> END; } echo <<<END <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> Team $first[i] $tiet2 <br> <i>with <b>$first[m]</b> points</i><br> </div> END; } if (($second[m] != 0) && ($triptie != 1)) { echo $tie2; if ($tie2 == '') {echo <<<END <div style="background-color: #B15E89;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"><b> END; if ($tie == '') {$place = 'Second place!';} else {$place = 'Third place!';} echo $place.'</b><br></div>'; } echo <<<END <div style="background-color: #f8f8f8;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> Team $second[i] $tiet3 <br> <i>with <b>$second[m]</b> points</i><br> </div> END; } if (($third[m] != 0) && ($tie == '') && ($tie2 == '')) { echo $tie3; if ($tie3 == '') {echo <<<END <div style="background-color: #FE86C4;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"> <b>Third place!</b><br> </div> END; } echo <<<END <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> Team $third[i] $tiet4 <br> <i>with <b>$third[m]</b> points</i><br> </div> END; } echo <<<END <br> <script type="text/javascript" src="scripts/clock.js"></script><div id="clockbox"></div> </div> END; ?> and here is the function you gave me, but modified, and with some added to it that will not seem to function: <?php include("ranketc.php"); $placements = array( 'first' => array(), 'second' => array(), 'third' => array() ); foreach ($rank as $team => $place) { if (strpos($place, '1st') !== false) $placements['first'][] = $team; else if (strpos($place, '2nd') !== false) $placements['second'][] = $team; else if (strpos($place, '3rd') !== false) $placements['third'][] = $team; } foreach ($placements['first'] as $counter => $team) { $placements[$counter] = "Team $team"; } for($cntr=0;$cntr<count($placements['first']);$cntr++) { if ($cntr!==0){$displayfirst = $displayfirst . '<br>& Team ' . $placements['first'][$cntr];} else {$displayfirst = 'Team ' . $placements['first'][$cntr];} } $displayfirst = $displayfirst . "<br><i>with <b>" . $scores[$placements['first'][$cntr]] . "</b> points</i>"; for($cntr=0;$cntr<count($placements['second']);$cntr++) { if ($cntr!==0){$displaysecond = $displaysecond . '<br>& Team ' . $placements['second'][$cntr];} else {$displaysecond = 'Team ' . $placements['second'][$cntr];} } $displaysecond = $displaysecond . "<br><i>with <b>" . $scores[$placements['second'][$cntr]] . "</b> points</i>";; for($cntr=0;$cntr<count($placements['third']);$cntr++) { if ($cntr!==0){$displaythird = $displaythird . '<br>& Team ' . $placements['third'][$cntr];} else {$displaythird = 'Team ' . $placements['third'][$cntr];} } $displaythird = $displaythird . "<br><i>with <b>" . $scores[$placements['third'][$cntr]] . "</b> points</i>"; print $displayfirst; print '<br><br>'; print $displaysecond; print '<br><br>'; print $displaythird; //print $placements['first'][0] . $placements['first'][1]; ?>
  6. or, if someone might be better able to help me fix the script i wrote before, but formatted for 10 teams, and i now need to include 12, but when i thought i changed all i needed to, it malfunctioned. i was trying to rewrite a shorter version anyway, using rankings instead of checking the scores itself <?php $filename = "scorestore.txt"; $score = file($filename); for ( $counter = 0; $counter <= $nteams; $counter += 1 ) {$score[$counter] = intval($score[$counter]); } function doublemax($mylist){ $maxvalue=max($mylist); while(list($key,$value)=each($mylist)){ if($value==$maxvalue)$maxindex=$key; } return array("m"=>$maxvalue,"i"=>$maxindex += 1); } // ------------------------- GET RID OF ELIMINATED TEAMS $filename = "deathcount.txt"; $deathcount = file($filename); $deathcountarray = str_split($deathcount[0]); for ( $counter = 0; $counter <= 12; $counter += 1 ) { if ($deathcountarray[$counter] == 6) {$score[$counter] = 0;} } // ------------------------- first place!! $first = doublemax($score); // ------------------------- THREE WAY TIE? for ( $counter = 0; $counter <= 12; $counter += 1 ) {if ($score[$counter] == $first[m]) {$hold += 1;}} if ($hold==3) {$triptie = 1;} else {$triptie = 0;} // ------------------------- CHECK FOR TIE if($triptie == 1){$place = ' first,<br>second & third';} else {$place = ' first<br>& second';} for ( $counter = 0; $counter <= 12; $counter += 1 ) {if ($score[$counter] == $first[m]) {if ($tie == '') {$tie = ' <div style="background-color: #b10961;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding-left:5px;"> <b>TIED for' . $place . '!</b><br><br></div>'; $tiet2 = '<br> & Team ' . ($counter+=1); $hold = $counter -=1; $which = 1;} else {$tiet2 = $tiet2 . '<br> & Team ' . ($counter+=1);$which = false; $score[$hold] = 0;} } } if ($which == 1) {$tie = ''; $tiet2 = '';} // ------------------------- second place!! $score[($first[i]-=1)] = 0; $second = doublemax($score); // ------------------------- CHECK FOR TIE if($tie == ''){$place = ' second<br>& third';} else {$place = ' third';} for ( $counter = 0; $counter <= 12; $counter += 1 ) {if ($score[$counter] == $second[m]) {if ($tie2 == '') {$tie2 = ' <div style="background-color: #B15E89;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding-left:5px;"> <b>TIED for' . $place . '!</b><br><br></div>'; $tiet3 = '<br> & Team ' . ($counter+=1); $hold = $counter -=1; $which = 1;} else {$which = false; $score[$hold] = 0;} } } if ($which == 1) {$tie2 = ''; $tiet3 = '';} // ------------------------- third place!! $score[($second[i]-=1)] = 0; $third = doublemax($score); // ------------------------- CHECK FOR TIE for ( $counter = 0; $counter <= 12; $counter += 1 ) {if ($score[$counter] == $third[m]) {if ($tie3 == '') {$tie3 = ' <div style="background-color: #FE86C4;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding-left:5px;"> <b>TIED for third!</b><br><br></div>'; $tiet4 = '<br> & Team ' . ($counter+=1); $hold = $counter -=1; $which = 1;} else { if ( ($counter+=1) != $third[i] ) { $tiet4 = $tiet4 . '<br> & Team ' . (($counter+=1)-1);} $which = false; $score[$hold] = 0;} } } if ($which == 1) {$tie3 = ''; $tiet4 = '';} // who knows why, but it works $first[i] += 1; $second[i] += 1; echo <<<END <div id=RANKING style="float:left;margin:10px;margin-top:-80;border-left:#b10961 solid 1px;width:110px;text-align:right;padding-right:10px;height:350px;"> <div style="color:purple;font-size:14;font-weight:bold;padding:5px;"> LEADING: </div> END; if ($first[m] == 0) { echo <<<END <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;"> <i>No scores yet.</i><br> </div> END; } if ($first[m] != 0) { echo $tie; if ($tie == '') { echo <<<END <div style="background-color: #b10961;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"> <b>First place!</b><br> </div> END; } echo <<<END <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> Team $first[i] $tiet2 <br> <i>with <b>$first[m]</b> points</i><br> </div> END; } if (($second[m] != 0) && ($triptie != 1)) { echo $tie2; if ($tie2 == '') {echo <<<END <div style="background-color: #B15E89;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"><b> END; if ($tie == '') {$place = 'Second place!';} else {$place = 'Third place!';} echo $place.'</b><br></div>'; } echo <<<END <div style="background-color: #f8f8f8;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> Team $second[i] $tiet3 <br> <i>with <b>$second[m]</b> points</i><br> </div> END; } if (($third[m] != 0) && ($tie == '') && ($tie2 == '')) { echo $tie3; if ($tie3 == '') {echo <<<END <div style="background-color: #FE86C4;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;color:#ffffff;text-align:left;padding:5px;"> <b>Third place!</b><br> </div> END; } echo <<<END <div style="background-color: #dbd6e1;border-top: 1px solid #ffffff;border-bottom: 1px solid#ffffff;padding-right:5px;padding-bottom:10px;padding-top:5px;"> Team $third[i] $tiet4 <br> <i>with <b>$third[m]</b> points</i><br> </div> END; } echo <<<END <br> <script type="text/javascript" src="scripts/clock.js"></script><div id="clockbox"></div> </div> END; ?>
  7. hmm, removing the <sup> tags make the function work for the first place, but changes nothing with the second. it is interesting, that the tags do not appear in the array, but when $rank[$team] is printed to the webpage, the ordinals are raised.
  8. well, i thought that did it, but now it's not printing the double values, im very confused, i dont see a flaw in the logic ive used: // ------------------------- SET CONTENTS foreach ($rank as $team => $string) { if (strpos($rank[$team], '1<sup>st</sup>')!== false) { if ($firstplace == '') { $firstplace = "Team $team <br>" ; $pointsfirst = $scores[$team-1]; } else { $firstplace = "$firstplace & Team $team <br>" ; }} if (strpos($rank[$team], '2<sup>nd</sup>')!== false) { if ($secondplace == '') { $secondplace = "Team $team <br>" ; $pointssecond = $scores[$team-1];} else { $secondplace = "$secondplace & Team $team <br>" ; }} if (strpos($rank[$team], '3<sup>rd</sup>')!== false) { if ($thirdplace == '') { $thirdplace = "Team $team <br>" ; $pointsthird = $scores[$team-1]; } else { $thirdplace = "$thirdplace & Team $team <br>" ; }} } $firstplace = "$firstplace with <b>$pointsfirst</b> points <br>"; $secondplace = "$secondplace with <b>$pointssecond</b> points <br>"; $thirdplace = "$thirdplace with <b>$pointsthird</b> points <br>"; print $firstplace . '<br>' . $secondplace . '<br>' . $thirdplace; gets: with points with points Team 9 with 5 points
  9. how can i check the number of occurrences of an ampersand (&) in a string? count_chars seems to be what i'm looking for, but it returns an array that to be honest i dont entirely understand, i want an integer return perhaps somehow with regex?
  10. nevermind! success! thanks so much
  11. thanks, but i still only get: Team 12 with x points with x points
  12. can anyone help me find my problem? print_r($rank) == Array ( [12] => 1st place [11] => 2nd place [9] => 3rd place [5] => 4th place [7] => tied for 5th place [6] => tied for 5th place [4] => 7th place [2] => unranked [3] => unranked [10] => unranked [1] => unranked [8] => unranked [0] => th place [13] => unranked ) foreach ($rank as $team => $string) { if (strpos($rank[$team], '1<sup>st</sup>')) { if ($firstplace == '') { $firstplace = "Team $team <br>" ; } else { $firstplace = "$firstplace & Team $team <br>" ; }} if (strpos($rank[$team], '2<sup>nd</sup>')) { if ($secondplace == '') { $secondplace = "Team $team <br>" ; } else { $secondplace = "$secondplace & Team $team <br>" ; } } } $firstplace = "$firstplace with <b>x</b> points <br>"; $secondplace = "$secondplace with <b>x</b> points <br>"; gives: with x points with x points thanks for your time and help
  13. be more specific? would an rss work? thats very easy to add and can serve that function. in addition you can add posts dynamically via php, and include all of, or parts of the rss on pages of your website, by number of entries, or by category.
  14. is there any way that i can pass parameters to a function through ajax?
  15. i don't know if anyone has ever used the free DOTGO texting service, but by using an index.cmrl file on ANY website, texts sent to DOTCOM with the first word being your domain name, will automatically be responded to in a way you define within index.cmrl i have successfully integrated this into my website, with one exception, i cannot for my life figure out how to pass parameters from the text to an engine script. i have even copy and pasted their example exactly (with the obvious domain name/url modifications), and attempted to use both perl and php scrips, to no avail. can anyone help me figure out the problem? i get a 500 internal service error (or 404 not found, which cannot possibly be true, depending on what i'm trying), but the problem is caused by my use of the variable $param['password'] which is supposed to grab the parameter named "password", i have btw, tried using double quotes, and no quotes, as well as as i stated before, the exact script posted in http://dotgo.com/support/documentation/doc0005.1.0/html-1/ any help, suggestions, is as always appreciated, as is your time
  16. im sorry in advance, i wasnt sure where to post this. i don't know if anyone has ever used the free DOTGO texting service, but by using an index.cmrl file on ANY website, texts sent to DOTCOM with the first word being your domain name, will automatically be responded to in a way you define within index.cmrl i have successfully integrated this into my website, with one exception, i cannot for my life figure out how to pass parameters from the text to an engine script. i have even copy and pasted their example exactly (with the obvious domain name/url modifications), and attempted to use both perl and php scrips, to no avail. can anyone help me figure out the problem? i get a 500 internal service error (or 404 not found, which cannot possibly be true, depending on what i'm trying), but the problem is caused by my use of the variable $param['password'] which is supposed to grab the parameter named "password", i have btw, tried using double quotes, and no quotes, as well as as i stated before, the exact script posted in http://dotgo.com/support/documentation/doc0005.1.0/html-1/ any help, suggestions, is as always appreciated, as is your time
  17. ob_start hides the return value of the script no?
  18. both good points, i'll change them, although i'm not sure why i need the quotes? i suppose that's just a standards issue. but any ideas on how to solve the larger problem?
  19. this doesnt help your problem (which i guess is now solved anyway), but would you mind explaining how you continuously run the scraper without a cronjob? also, how are you using sleep to run continuously? won't that just work once? to simply delay the function x amount of time before execution?
  20. thats very odd, i'm not sure, theyre not in the script, when i posted it in the code tags the forum added those, here it is again outside of the tags: <?php //CONVERT SECONDS TO TIME function Sec2Time($time){ if(is_numeric($time)){ $value = array( "years" => 0, "days" => 0, "hours" => 0, "minutes" => 0, "seconds" => 0, ); if($time >= 31556926){ $value["years"] = floor($time/31556926); $time = ($time%31556926); } if($time >= 86400){ $value["days"] = floor($time/86400); $time = ($time%86400); } if($time >= 3600){ $value["hours"] = floor($time/3600); $time = ($time%3600); } if($time >= 60){ $value["minutes"] = floor($time/60); $time = ($time%60); } $value["seconds"] = floor($time); return (array) $value; }else{ return (bool) FALSE; } } /////////////////////////////////CALL FUNCTION: /////////////////////////////////inactive('team#'); function inactive($team) { $doc = new DomDocument; $doc->load('http://www.lowersouthlounge.com/updates.php'); $xpath = new DOMXPath($doc); $categories = $xpath->query("//item/category"); $pubDates = $xpath->query("//item/pubDate"); foreach ($pubDates as $pubDate) {$pub[] = $pubDate->nodeValue;} foreach ($categories as $categorie) {$category[] = $categorie->nodeValue;} $first = 1; for ($counter = 0; $counter <= count($category); $counter +=1){ if ((stristr($category[$counter], $team) != false) && ($first == 1)){ $lasteventtime = $pub[$counter]; $first = 0; $check = 1;} } //GET TIME NOW $ltime = time() + 3*60*60 ; $mytime = date('D, j M Y h:i:s',$ltime); //GET DIFFERENCE $inactive = (strtotime($lasteventtime)+259200) - strtotime($mytime); $inactive = Sec2Time($inactive); $inactive[display] = "$inactive[days]:$inactive[hours]:$inactive[minutes]"; if (intval($inactive[seconds]) < 0) {$inactive[display] = "<i>this team is inactive</i>";} if ($check != 1) {return 'error';} else {return $inactive;} } ?>
  21. ok, well i need this for several different scripts, but i'll give one example. heres a script i use to print a countdown to a date that changes, depending on the last post within a certain category on an RSS page: <?php //CONVERT SECONDS TO TIME function Sec2Time($time){ if(is_numeric($time)){ $value = array( "years" => 0, "days" => 0, "hours" => 0, "minutes" => 0, "seconds" => 0, ); if($time >= 31556926){ $value["years"] = floor($time/31556926); $time = ($time%31556926); } if($time >= 86400){ $value["days"] = floor($time/86400); $time = ($time%86400); } if($time >= 3600){ $value["hours"] = floor($time/3600); $time = ($time%3600); } if($time >= 60){ $value["minutes"] = floor($time/60); $time = ($time%60); } $value["seconds"] = floor($time); return (array) $value; }else{ return (bool) FALSE; } } /////////////////////////////////CALL FUNCTION: /////////////////////////////////inactive('team#'); function inactive($team) { $doc = new DomDocument; $doc->load('http://www.lowersouthlounge.com/updates.php'); $xpath = new DOMXPath($doc); $categories = $xpath->query("//item/category"); $pubDates = $xpath->query("//item/pubDate"); foreach ($pubDates as $pubDate) {$pub[] = $pubDate->nodeValue;} foreach ($categories as $categorie) {$category[] = $categorie->nodeValue;} $first = 1; for ($counter = 0; $counter <= count($category); $counter +=1){ if ((stristr($category[$counter], $team) != false) && ($first == 1)){ $lasteventtime = $pub[$counter]; $first = 0; $check = 1;} } //GET TIME NOW $ltime = time() + 3*60*60 ; $mytime = date('D, j M Y h:i:s',$ltime); //GET DIFFERENCE $inactive = (strtotime($lasteventtime)+259200) - strtotime($mytime); $inactive = Sec2Time($inactive); $inactive[display] = "$inactive[days]:$inactive[hours]:$inactive[minutes]"; if (intval($inactive[seconds]) < 0) {$inactive[display] = "<i>this team is inactive</i>";} if ($check != 1) {return 'error';} else {return $inactive;} } ?> now as you can see, it takes a parameter, $team, which is the category it searches for. now i need this script to serve two functions. i need to be able to include it in a page, and print the string $inactive[display] provided by the function when given different parameters at different points on the page. i also need it to supply the return value to another php script, but when it's included in the php script, it cant print out anything on it's own, i need to include the script, and when needed call the function with the tobedetermined parameter and get the return value. now that i'm typing and thinking about it more, i'm thinking about a solution that would just set a new variable $inactive[forscript], and repeatedly call the function with the different values before printing the variable $inactive[forscript], and that would contain what i needed. i'm not sure, but that might accomplish what i need. however, i would still like to find a way that i can do what i asked. /////i just remembered why the above solution does not work, look at my p.s. thanks again ps. i would like to use xml ajax to dynamically update every second the results of the functions i call and print within the website, this requires me to use a print or echo to display the result, but that will ruin my ability to access the function with different values via an include in the other script. but now that i'm thinking about THAT, that would still not work, because the echo for ajax.responseText would have to be echoed outside of the function, which ruins my ability to call the function with different parameters multiple times on a page
  22. how can ajax be used to get the return value of a php function, not the responseText?
  23. one problem i can think of, if this is a concern, is that depending on what the buttons do when clicked, say if they just bring you to a new page where the functions are done, then they could be bypassed by a multitude of methods, possibly including something as inane as an old bookmarked url. might it be a better method to check the date -= datejoined payStatus before the load of every page? and if you were going to hide them with javascript? theyd still be visible in the source, allowing for bypass that way, so check server side, paystatus = 1
×
×
  • 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.