Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/cliprepaid.php
<?
/*
phADADmin is developped under GPL Licence 2.0 :
http://www.gnu.org/licenses/gpl.txt or read LICENSE file.

Developed by : Toni de la Fuente (blyx) from Madrid and Alfacar (Granada), Spain  
For information : hide@address.com http://blyx.com
dsfdf
We are using Oreon for base code: http://www.oreon-project.org
We are using Dialup Admin for user management 
and many more things: http://www.freeradius.org
We are using PHPKI for Certificates management: http://phpki.sourceforge.org/ 

Thanks very much!!
*/
//header('Content-Type: text/plain');
include('config.inc.php');
include('./class/class.curl.php');
include('./class/class.phpmailer.php');
//include('./class/ConvertCharset.class.php');

// string from voicecom

//echo "extid=8921d996eb74d1fad4c6487bc3e8785b&amp;msisdn=359878188548&amp;shortcode=1916&amp;smtext=Luk899897&amp;dts=1179145482\n";

if (isset($_GET["useralias"]) && isset($_GET["password"])) {
//    echo "get => ".$_GET["password"]." ";
//    echo "get => ".$_GET["useralias"]."<br>\n";
//	"https://www.terraros.com/phpmyprepaid/phpmyprepaid.php";
    $submit_url = "https://localhost/phpmyprepaid/cliprepaid.php";
    foreach($_GET as $key => $value) {
	if (!($key == "useralias" || $key == "password"))
//    	    $submit_vars[$_GET["useralias"]."_".$key] = $value;
    	    $stack[$key] = $value;    	    
    }

    $submit_vars["query"] = $stack;

    $submit_vars["password"] = $_GET["password"];
    $submit_vars["useralias"] = $_GET["useralias"];
    $submit_vars["zeit"] = "4";
    $submit_vars["TimeToFinish"] = "True";
    $submit_vars["AnzahlSeiten"] = "1";
    $submit_vars["buttonID"] = "CR_Timed";
    $submit_vars["submit"] = "CREATE CARDS";
    //$snoopy->cert = "/usr/share/ssl/private/localhost.key";
//    $def_vars = get_defined_vars();
//    $this_header = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
//<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-gb\">
//<head>
//<TITLE>cliMyPrepaid ticket management</TITLE>
//<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"Cache-Control :no-cache, must-revalidate, post-check=0, pre-check=0; text/html; charset=iso-8859-1;\" >
//<META NAME=\"author\" CONTENT=\"Carl Peterson\">
//<link rel=\"icon\" href=\"/favicon.ico\" type=\"image/x-icon\">
//<link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\">
//<link rel=\"STYLESHEET\" type=\"text/css\" href=\"style/style.css\">
//<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"include/calendar/calendar-win2k-cold-1.css\" title=\"win2k-cold-1\" />
//</head>";
    $c = new curl($submit_url);
    $c->setopt(CURLOPT_SSL_VERIFYPEER, false);
    $c->setopt(CURLOPT_SSL_VERIFYHOST, false);


//    $c->parseHeader($this_header);
//    $c->setopt(CURLOPT_BINARYTRANSFER, true);
//    $c->setopt(CURLOPT_RETURNTRANSFER, true); in class
//    $c->setopt(CURLOPT_CRLF, true);
//    $c->setopt(CURLOPT_HEADER, true); in class
//    $c->setopt(CURLOPT_FOLLOWLOCATION, true);
//    $c->setopt(CURLOPT_ENCODING, "");
//    $c->setopt(CURLOPT_TRANSFERTEXT, true);
//    $c->setopt(CURLOPT_USERAGENT, "Mozzila/5.0");
    $c->setopt(CURLOPT_POST, true);
//    $c->setopt(CURLOPT_WRITEHEADER, "./logshead");
    //$c->setopt(CURLOPT_SSL_VERIFYPEER, true);
    //$c->setopt(CURLOPT_CAINFO, "/usr/share/ssl/certs/ca-bundle.crt");
    $c->setopt(CURLOPT_POSTFIELDS, $c->asPostString($submit_vars));
    $ret = $c->exec();    
    if ($theError = $c->hasError()){
        echo $theError;
        $c->close();
        exit();
        }
    else {
	$c->close();
	echo $ret;
//	$ret_array = preg_split("/\n/", $ret);;
//	echo $ret_array[1];
//	echo strpos($ret, "S");
//	echo $ret = preg_split("\x3F", $ret);
//	echo trim($ret,"\xEF\xBB\xBF\x3F\x09\n\t\r\0\x0B ");
	}
}
//echo print_r($_POST);
	Session::start();
	if (isset($_POST["disconnect"])) {
		$oreon = & $_SESSION["oreon"];
		Session::stop();
		Session::start();
		echo "is disconect";
	}
	if (isset($_SESSION["oreon"])) {	// already connected
		include("lang/en.php");
		$msg_error = $lang['already_logged'];
		unset($_SESSION["oreon"]);
		echo " already is connect";
	}
	else {
		if (isset($_POST["submit"])) {
//		echo "Submit";
			$oreon_db = new OreonDatabase($conf_pra['host'], $conf_pra['user'] ,$conf_pra['password'] ,$conf_pra['db'] );
			
			if (($user_id = $oreon_db->checkUser(addslashes($_POST["useralias"]), $_POST["password"]))) {
//				echo "user is checked";
				$user = new User($oreon_db->getUser($user_id));
				$_SESSION["oreon"] = new oreon($user, $oreon_db);
				system("echo \"[" . time() . "] LOGIN from ". $_SERVER["REMOTE_ADDR"] . ";;" . addslashes($_POST["useralias"]) . "\" >> ./include/log/" . date("Ymd") . ".txt");
				$_SESSION["oreon"]->add_new_session(session_id(), $_SESSION["oreon"]->user->get_id());
//				echo "Before submit";
				if (isset($_POST['submit'])) { // if they hit a submit button	
				
    				if(isset($_POST['buttonID'])) {
				    $buttonID = $_POST['buttonID'];
				    $_SESSION['button'] = $buttonID;
//				    echo "copy buttonID";
//				    echo "erase buttonID";
				}
				else{
				    die('A Submit button was pressed but no buttonID was sent');
				}
				}
//				include('submit.inc.php');

//				echo "after submit";
				if (!isset($_SESSION["oreon"])) Sesion::start();
//				echo "Session is open";
				$oreon = & $_SESSION["oreon"];
				include_once ("lang/" . $oreon->user->get_lang() . ".php");

				if (isset($oreon->optGen)){
				    $expire = $oreon->optGen->get_session_expire();
				    }
				    else
				    $expire = 0;
				$oreon->clean_session($expire);
				if ($oreon->check_if_session_ok()){
				    $oreon->update_current_session(session_id(), $p, $o);
				    $_SESSION['locID'] = "1";
				    $oreon->phpmyprepaid=$oreon->database->getphpmyprepaid($_SESSION['locID'] );
				    $_SESSION['LocName']=$oreon->phpmyprepaid['LocationName'];
				    $_SESSION['gatewayType']=$oreon->phpmyprepaid['gateway_type'];
				    $oreon->user->set_status(get_user_status_location($oreon->user, $_SESSION['locID']));
/*
include("head.cli.inc");
echo 
"<?xml version=\"1.0\" encoding=\"iso-8859-5\"?><!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<TITLE>PhpMyPrepaid ticket management</TITLE>
<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"Cache-Control :no-cache, must-revalidate, post-check=0, pre-check=0; text/html; charset=iso-8859-5;\" >
<META NAME=\"author\" CONTENT=\"Carl Peterson\">
<link rel=\"icon\" href=\"/favicon.ico\" type=\"image/x-icon\">
<link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\">
</head>
<body>";
*/
				    include_once ("include/configuration/".$_SESSION['gatewayType'].".attr");
				    include_once ("include/middlemans/".$_POST["useralias"].".php");
				    $middleman = new middlemans;
				    $middleman->init();
				    $middleman->reply();

//				    echo "Session is in not expiret<br>\n";
//				    $oreon->loadphpmyprepaid($_SESSION['locID']);
//				    echo "Load all configuration files<br>\n";
				    }
				else{
				    exit();
				    }

//				echo "Sesion is now open<br>\n";						    				    
				if($buttonID == "CR_Timed"){
				    $match=1;
				    include('include/account/getPrepaidCli.php');				    
				    }
//echo "</body>\n</html>";
				//header("Location: ./phpmyprepaid.php");
//				echo " session is close\n";

			}
			else
				system("echo \"[" . time() . "] Err LOGIN from ". $_SERVER["REMOTE_ADDR"] . ";;" . addslashes($_GET["useralias"]) . "\" >> ./include/log/" . date("Ymd") . ".txt");

		}
	}
	Session::stop();	
?>
Return current item: phpMyPrepaid