EsOne Posted January 6, 2010 Share Posted January 6, 2010 Okay, I have the following function saved in it's own file. <?php function Tank(){ $ids=file('momos.txt'); $limit=sizeof($ids); $start=$_GET['start']; if(!$start){ $start=1; } $start=intval($start)-1; if($start>1){ if($start-16<1){ echo "<a href=\"?start=1\">Prevous Page</a> "; } else{ echo "<a href=\"?start=".($start-14)."\">Prevous Page</a> "; } } else{ echo "<a onclick=\"getLastPage(this);\" href=\"?start=?\">Prevous Page</a> "; } if($start/15==round($start/15)){ echo "<a href=\"?start=".($start+1)."\">".($start/15+1)."</a> "; } else{ echo "<a href=\"?start=".($start+1)."\" title=\"Current page minus 1 is not a multiple of 15.\">IDK</a> "; } if($start+16>$limit){ echo "<a href=\"?start=1\">Next Page</a>"; } else{ echo "<a href=\"?start=".($start+16)."\">Next Page</a>"; } echo "<table cellpadding=\"1\" cellspacing=\"1\" border=\"1\" width=\"55%\" align=\"center\" bgcolor=\"#000000\"><tbody>"; for($i=$start;$i<$start+15;$i++){ if($i<$limit){ $data=explode("|~|",$ids[$i]); if($i/2==round($i/2)){ $color="#835a17"; } else{ $color="#fbbe67"; } echo '<tr bgcolor="'.$color.'">'.checkTank($data[0],$data[1],$data[2])."</tr>"; } } echo "</tbody></table><p id=\"pages\">"; for($i=0;$i<$limit;$i+=15){ echo "<a href=\"?start=".($i+1)."\">".($i/15+1)."</a> "; } echo "</p>"; } ?> In another fil, I am trying to call that fuction up, and used the include as follows: <? include ("http://dolphinmania.pandaandpenguin.com/secure/include.test.php"); Tank(); ?> Normally it would work, as there are other functions in the SAME page as where I made Tank() at that bring back no errors. This brings back "Fatal error: Call to undefined function Tank() in /home/content/e/s/o/esone/html/dolphinmania/secure/index.php on line 45" If I include the php where that is at, why is it still insisting it is an undefined function? Quote Link to comment https://forums.phpfreaks.com/topic/187381-include-not-working-right/ Share on other sites More sharing options...
trq Posted January 6, 2010 Share Posted January 6, 2010 Including a file via a url will only include the output of the script, not any variables, functions or classes. You need to include files via a system file path. Quote Link to comment https://forums.phpfreaks.com/topic/187381-include-not-working-right/#findComment-989476 Share on other sites More sharing options...
EsOne Posted January 6, 2010 Author Share Posted January 6, 2010 Including a file via a url will only include the output of the script, not any variables, functions or classes. You need to include files via a system file path. Ohhhh. LOL Is there anyway I could do that? I am making something for someone to use on their own server, but I want the code to stay unseen. That way it can not be copied. Quote Link to comment https://forums.phpfreaks.com/topic/187381-include-not-working-right/#findComment-989477 Share on other sites More sharing options...
trq Posted January 6, 2010 Share Posted January 6, 2010 Nope. No way. This would open huge security holes. I would be able to include functions / object from any site I liked if this where the case. Depending on what it is you are doing exactly you could write an API of sorts and your client could make requests to your server, but this doesn't really sound like what your looking for. Quote Link to comment https://forums.phpfreaks.com/topic/187381-include-not-working-right/#findComment-989479 Share on other sites More sharing options...
EsOne Posted January 6, 2010 Author Share Posted January 6, 2010 The main thing I am worried about is the text file that my function is pulling from: <?php function Tank(){ $ids=file('momos.txt'); $limit=sizeof($ids); $start=$_GET['start']; if(!$start){ $start=1; } $start=intval($start)-1; if($start>1){ if($start-16<1){ echo "<a href=\"?start=1\">Prevous Page</a> "; } else{ echo "<a href=\"?start=".($start-14)."\">Prevous Page</a> "; } } else{ echo "<a onclick=\"getLastPage(this);\" href=\"?start=?\">Prevous Page</a> "; } if($start/15==round($start/15)){ echo "<a href=\"?start=".($start+1)."\">".($start/15+1)."</a> "; } else{ echo "<a href=\"?start=".($start+1)."\" title=\"Current page minus 1 is not a multiple of 15.\">IDK</a> "; } if($start+16>$limit){ echo "<a href=\"?start=1\">Next Page</a>"; } else{ echo "<a href=\"?start=".($start+16)."\">Next Page</a>"; } echo "<table cellpadding=\"1\" cellspacing=\"1\" border=\"1\" width=\"55%\" align=\"center\" bgcolor=\"#000000\"><tbody>"; for($i=$start;$i<$start+15;$i++){ if($i<$limit){ $data=explode("|~|",$ids[$i]); if($i/2==round($i/2)){ $color="#835a17"; } else{ $color="#fbbe67"; } echo '<tr bgcolor="'.$color.'">'.checkTank($data[0],$data[1],$data[2])."</tr>"; } } echo "</tbody></table><p id=\"pages\">"; for($i=0;$i<$limit;$i+=15){ echo "<a href=\"?start=".($i+1)."\">".($i/15+1)."</a> "; } echo "</p>"; } ?> I want the file momos.txt to be pulled from my server to look for the information Quote Link to comment https://forums.phpfreaks.com/topic/187381-include-not-working-right/#findComment-989481 Share on other sites More sharing options...
trq Posted January 6, 2010 Share Posted January 6, 2010 That can be done. Still though, if you put it somewhere its accessible, its no longer secure. Nothing stopping anyone looking at it. Quote Link to comment https://forums.phpfreaks.com/topic/187381-include-not-working-right/#findComment-989492 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.