array( 'method' => 'POST', 'content' => $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; } session_start(); include('inc/config.php'); include('inc/php-captcha.inc.php'); if ($_GET['logout'] == 1) { setcookie ("musername", "", time() - 3600); setcookie ("mpassword", "", time() - 3600); } define('SALT', 'kiukhithere'); if (isset($_POST['password'])) { $password = $_POST['password']; $u1 = $_POST['username']; $p1 = sha1( SALT . $password ); setcookie("musername", $u1, $cookieTime); setcookie("mpassword", $p1, $cookieTime); $username = $u1; $encpass = $p1; } else { if (isset($_COOKIE['musername']) AND $_GET['logout'] <> 1) { $u1 = $_COOKIE['musername']; $p1 = $_COOKIE['mpassword']; $username = $u1; $encpass = $p1; } } if (isset($_SESSION['php_captcha'])) { $addcaptcha = "&captcha=".$_SESSION['php_captcha']; } $rand = rand(); $dom = $_SERVER['HTTP_HOST']; $link = $_SERVER['REQUEST_URI']; $pos = strpos($link,"?"); if ($pos !== FALSE) $link2 = str_replace("?","&",substr($link,$pos)); //else header('Location: index.php'); $p = $_GET['p']; if (strpos($p,"admin/") !== false) { $file = "admin/index.php"; if (isset($_POST['password']) OR (!isset($_SESSION['connected']) AND isset($_COOKIE['grusername']))) { if ($_SESSION['try'] > 6 AND isset($_POST['password'])) die("Trop d'essais, veuillez réessayer plus tard."); if (!isset($_POST['password'])) { $u1 = $_COOKIE['grusername']; $p1 = $_COOKIE['grpassword']; } else { $password = $_POST['password']; $u1 = $_POST['username']; $p1 = sha1( SALT . $password ); } $username = $u1; $encpass = $p1; $data= array(); $url = 'https://www.reservpro.com/cms/admin/veriflogin.php?u1='.$username.'&p1='.$encpass.'&cc='.$codeclient.'&dd='.$dom; $result = file_get_contents($url); if ($result == "1") { setcookie("connected", 1, $cookieTime); $_SESSION['connected'] = 1; setcookie("grusername", $u1, $cookieTime); setcookie("grpassword", $p1, $cookieTime); } else { $result = "2"; if(isset($_POST['password'])) $_SESSION['try'] = $_SESSION['try'] + 1; } } else { if (isset($_COOKIE['grusername'])) { $u1 = $_COOKIE['grusername']; $p1 = $_COOKIE['grpassword']; $username = $u1; $encpass = $p1; } } } else $file = "index.php"; if (strpos("/".$p,"/en/") !== false) $link2 .= "&lang=en"; elseif (strpos("/".$p,"/fr/") !== false) $link2 .= "&lang=fr"; $pos = strrpos($p,"/"); if ($pos !== false) $p = substr($p,$pos+1); if (isset($_GET['p'])) $link2 = "p=".$p.$link2; $link = "https://www.reservpro.com/cms/$file?".$link2.'&u1='.$username.'&p1='.$encpass."&cc=$codeclient&dd=$dom".$addcaptcha."&ver=3&query=".$_GET['p']."&session=".session_id(); $link = str_replace("??","?",$link); if (count($_POST)>0) { $data = http_build_query($_POST); $rand = rand(); echo do_post_request($link, $data); } else { echo file_get_contents($link); }