<?php
$cookie_file = './cookie.txt';
function connect(){
$username = "UTB_User";
$password = "UTB_PASSWORD";
$loginUrl = 'http://uptobox.com/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginUrl);
curl_setopt($ch,CURLOPT_HEADER,false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,false);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
// ENABLE HTTP POST
curl_setopt($ch, CURLOPT_POST, true);
//Set the post parameters
curl_setopt($ch, CURLOPT_POSTFIELDS, 'login='.$username.'&password='.$password.'&redirect=http://uptobox.com/&op=login&x=12&y=6');
//Handle cookies for the login
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
$store = curl_exec($ch);
}
function recup_lien($lien){
$cur = curl_init();
curl_setopt($cur, CURLOPT_URL, $lien);
curl_setopt($cur,CURLOPT_HEADER,true);
curl_setopt($cur,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cur,CURLOPT_FOLLOWLOCATION,false);
curl_setopt($cur, CURLOPT_NOBODY, true);
curl_setopt($cur, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($cur, CURLOPT_COOKIEFILE, "cookie.txt");
$link = curl_exec($cur);
if (preg_match('#Location: #Ui', $link, $lien)) {
$car = explode(' ', $link);
$lien = preg_replace("(\r\n|\n|\r)",' ',$car[11]);
$lien = explode(' ', $lien);
$lien = $lien[0];
return $lien;
}
curl_close($cur);
}
?>
<div class="blocktable">
<h2><span>Regarder un film sur Real-Univers</span></h2>
<div class="box">
<div class="inbox">
<?php
if(isset($_GET['id']) && $_GET['id'] == intval($_GET['id'])) {
$id = $_GET['id'];
$result = $db->query('SELECT * FROM '.$db->prefix.'posts WHERE id = '.$id);
$is = $db->fetch_assoc($result);
if(preg_match_all("#http\:\/\/(www\.|)uptobox\.com\/[a-zA-Z0-9]{12}#", $is['message'], $lien)){
connect();
if(count($lien[0]) == 1){
$link = recup_lien($lien[0][0]);
if (substr($link, -3) != 'rar' && substr($link, -3) != 'zip') {
?>
<div class="player">
<embed type="application/x-vlc-plugin" name="VLC" autoplay="no" loop="no" volume="100" width="955" height="537" target="<?php echo $link ?>">
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
}
}else{
header('Location: index.php');
}
?>