Page 1 of 1

Call code from URL

Posted: Sat Apr 05, 2008 6:18 pm
by mofle
I have this code:

Code: Select all

 
//Forces a recheck of every torrent
//Way number two (faster)
$utorrent = new uTorrent();
$torrents = array();
//collects an array containing every hash
foreach($utorrent->getTorrents() as $torrent) {
    $torrents[] = $torrent[UTORRENT_TORRENT_HASH];
}
//rechecks every torrent
$utorrent->recheck($torrents);
 
How can i make it run when i click on a link?


<a href=" ??? ">Link</a>


Thanks for your help ;)

Re: Call code from URL

Posted: Sat Apr 05, 2008 9:20 pm
by Chris Corbyn
Put the code in a PHP file and link to it?

Re: Call code from URL

Posted: Sun Apr 06, 2008 4:22 am
by mofle
I was thinking more like this or something:


<a href="?action=recheckall">Recheck all</a>

Code: Select all

 
if ($_GET["action"]=="recheckall")
 
 
//Forces a recheck of every torrent
//Way number two (faster)
$utorrent = new uTorrent();
$torrents = array();
//collects an array containing every hash
foreach($utorrent->getTorrents() as $torrent) {
    $torrents[] = $torrent[UTORRENT_TORRENT_HASH];
}
//rechecks every torrent
$utorrent->recheck($torrents);