Advertisement
johnburn

Untitled

Mar 26th, 2012
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 59.57 KB | None | 0 0
  1. <?php
  2. function flush_now() {
  3.     @apache_setenv("no-gzip", 1);
  4.     @ini_set("output_buffering", 0);
  5.     @ini_set("zlib.output_compression", 0);
  6.     @ini_set("implicit_flush", 1);
  7.     $i = 0;
  8.     while ($i < ob_get_level()) {
  9.         ob_end_flush();
  10.         ++$i;
  11.     }
  12.     ob_implicit_flush(1);
  13.     return true;
  14. }
  15. $DIR = dirname(__FILE__);
  16. include ($DIR . "/includes/dbconfig.php");
  17. include_once (WORKDIR . "/includes/sessions.php");
  18. if (file_exists("psecure.php")) {
  19.     include ("psecure.php");
  20. }
  21. include_once (WORKDIR . "/config.php");
  22. nfr();
  23. include ($workdir . "/LoggedIn.php");
  24. if ($action == "login" && $_SESSION['LoggedIn'] != "1" || $_POST['LoggedIn'] || $_GET['LoggedIn'] || $_REQUEST['LoggedIn']) {
  25.     $LoggedIn = false;
  26.     $_SESSION['LoggedIn'] = false;
  27. }
  28. if ($LoggedIn == "1") {
  29.     if ($subaction == "") {
  30.         $subaction = $_GET['subaction'];
  31.     }
  32.     if ($subaction == "") {
  33.         $subaction = $_POST['subaction'];
  34.     }
  35.     if ($subaction && $subaction == "editpass.php") {
  36.         $subaction = "editprofile.php";
  37.         $qs = "editpass=1";
  38.     }
  39.     if (trim($subaction) != "" && file_exists(WORKDIR . "/" . trim($subaction))) {
  40.         ob_start();
  41.         header("Location: {$securebase}/" . strtolower(trim($subaction)) . "?" . $qs);
  42.         echo str_repeat(" ", 200) . "\n";
  43.         flush();
  44.         exit();
  45.     } else {
  46.         ob_start();
  47.         header("Location: {$securebase}/welcome.php");
  48.         echo str_repeat(" ", 200) . "\n";
  49.         flush();
  50.         exit();
  51.     }
  52. }
  53. $rtype = strip_tags(urldecode($rtype));
  54. $subaction = strip_tags(urldecode($subaction));
  55. if ($subaction == "") {
  56.     $subaction = $_GET['subaction'];
  57. }
  58. if ($subaction == "") {
  59.     $subaction = $_POST['subaction'];
  60. }
  61. if ($_COOKIE['LoggedIn'] || $_POST['LoggedIn'] || $_GET['LoggedIn'] || $_COOKIE['LoggedIn'] || $_POST['LoggedIn'] || $_GET['LoggedIn'] || $_COOKIE['apass'] || $_POST['apass'] || $_GET['apass'] || $_COOKIE['apass'] || $_POST['apass'] || $_GET['apass'] || $_COOKIE['adminflag'] || $_POST['adminflag'] || $_GET['adminflag'] || $_COOKIE['adminflag'] || $_POST['adminflag'] || $_GET['adminflag'] || $_COOKIE['debug'] || $_POST['debug'] || $_GET['debug'] || $_COOKIE['debug'] || $_POST['debug'] || $_GET['debug']) {
  62.     $ip = $_SERVER['REMOTE_ADDR'];
  63.     $host = gethostbyaddr($ip);
  64.     $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  65.     $admin = $adminmail;
  66.     $body = "IP:\t{$ip}\nHOST:\t{$host}\nURL:\t{$url}\nTIME:\t" . date("Y/m/d: h:i:s") . "\n";
  67.     @mail(@$admin, "Possible hacking on AWBS.", @$body, @"From: {$adminmail}\r\n");
  68.     print str_repeat(" ", 300) . "\n";
  69.     flush();
  70.     echo "\t <html><head><body><center><table bgcolor=#c0c0c0 border=1><tr><td align=center><h3><b><font color=RED><br>";
  71.     echo SECURITY;
  72.     echo "</font></b></h3></td></tr></table></center></body></html>\r\n\t ";
  73.     echo "\t ";
  74.     echo str_repeat(" ", 200) . "\n";
  75.     flush();
  76.     exit();
  77. }
  78. $help_id = sqlsingle("SELECT * FROM system_help WHERE page='uaLogIn.php'", "id");
  79. if ($help_id != "") {
  80.     include (WORKDIR . "/includes/open/help.php");
  81. }
  82. if (!function_exists("quote_smart")) {
  83.     function quote_smart($value) {
  84.         if (get_magic_quotes_gpc()) {
  85.             $value = stripslashes($value);
  86.         }
  87.         if (!is_numeric($value)) {
  88.             $value = "'" . mysql_real_escape_string($value) . "'";
  89.         }
  90.         return $value;
  91.     }
  92. }
  93. $lcount = $_SESSION['LCount'];
  94. $excessive_login = $_SESSION['excessive_login'];
  95. if ($excessive_login != "") {
  96.     $cdate = strtotime("now");
  97.     if ($excessive_login < $cdate) {
  98.         $_SESSION['LCount'] = 0;
  99.         $lcount = 0;
  100.         $_SESSION['excessive_login'] = 0;
  101.         $excessive_login = 0;
  102.     }
  103. }
  104. if ($excessive_login_count != "" && 0 < $excessive_login_count) {
  105.     $lcountmax = $excessive_login_count;
  106. } else {
  107.     $lcountmax = 3;
  108. }
  109. if ($lcountmax < $lcount) {
  110.     $cErrorMsg = EXCESSIVELOGIN;
  111.     $cErrorMsg = generate_dmsg($cErrorMsg, "error");
  112.     if ($timeout_count != "" && 0 < $timeout_count) {
  113.         $real_timeout_count = $timeout_count;
  114.     } else {
  115.         $real_timeout_count = 60;
  116.     }
  117.     if ($excessive_login == "" || $excessive_login == "0") {
  118.         $_SESSION['excessive_login'] = strtotime("+" . $real_timeout_count . " seconds");
  119.     }
  120. }
  121. foreach($_POST as $akey => $avalue) {
  122.     if (strstr($akey, "pcid") || strstr($akey, "pval")) {
  123.         $post_string.= "<input type=\"hidden\" name=\"{$akey}\" value=\"{$avalue}\">";
  124.     }
  125. }
  126. foreach($_GET as $akey => $avalue) {
  127.     if (strstr($akey, "pcid") || strstr($akey, "pval")) {
  128.         $post_string.= "<input type=\"hidden\" name=\"{$akey}\" value=\"{$avalue}\">";
  129.     }
  130. }
  131. if ($_GET['als'] && $disable_als != "1") {
  132.     $r_ip = $_SERVER['REMOTE_ADDR'];
  133.     $r_ip2 = $_SERVER['HTTP_CLIENT_IP'];
  134.     if ($r_ip2 == "") {
  135.         $r_ip2 = $_SERVER['HTTP_X_FORWARDED_FOR'];
  136.     }
  137.     if ($r_ip2 == "") {
  138.         $r_ip2 = $r_ip;
  139.     }
  140.     $p_s = base64_decode(trim(urldecode($_GET['als'])));
  141.     $p_s_arr = unserialize($p_s);
  142.     if ($p_s_arr['maccesskey'] != "" && 1 < strlen($p_s_arr['maccesskey'])) {
  143.         $akcheck = trim($p_s_arr['maccesskey']);
  144.     }
  145.     if ($p_s_arr['accesskey'] != "" && 1 < strlen($p_s_arr['accesskey'])) {
  146.         $akcheck = md5(trim($p_s_arr['accesskey']));
  147.     }
  148.     $privatekey = sqlsingle("select * from config where id='1'", "privatekey");
  149.     if (trim($privatekey) != $akcheck) {
  150.         $result = log_client_history("1", "System", "Login API Failed Authentication (bad key): IP: {$r_ip2}", "0");
  151.     } else {
  152.         $udate = trim($p_s_arr['udate']);
  153.         $now_date = strtotime("now");
  154.         $check_date = $now_date - $udate;
  155.         $c_d = mydate_diff($check_date);
  156.         if ($c_d[d] == 0 && $c_d[h] == 0) {
  157.             $action = "login";
  158.             $newuid = trim($p_s_arr['user']);
  159.             $password1 = trim($p_s_arr['pass']);
  160.             if ($password1 == "" && $p_s_arr['md5pass']) {
  161.                 $password1 = trim($p_s_arr['md5pass']);
  162.                 $md5pass = "1";
  163.             }
  164.             $subaction = trim($p_s_arr['subaction']);
  165.         }
  166.     }
  167. }
  168. if ($action == "login" && $LoggedIn != "1") {
  169.     if ($newuid == "" || $password1 == "") {
  170.         $fetch_em = array();
  171.         $fetch_em2 = array();
  172.         include (WORKDIR . "/includes/gparser.php");
  173.         $template->set_var("cErrorMsg", $cErrorMsg);
  174.         $template->set_var("post_string", $post_string);
  175.         $template->set_var("rtype", $rtype);
  176.         $template->set_var("subaction", $subaction);
  177.         $template->set_var("nameemail", $nameemail);
  178.         $template->set_var("namebundle", $namebundle);
  179.         $template->set_var("cTld", $cTld);
  180.         $template->set_var("cSld", $cSld);
  181.         $template->set_var("hiddeninc", $hiddeninc);
  182.         print $template->parse("aLogIn.php");
  183.         @ob_end_flush();
  184.         echo str_repeat(" ", 200) . "\n";
  185.         flush();
  186.         exit();
  187.     }
  188.     $newuid = mysql_real_escape_string($newuid);
  189.     $password1 = mysql_real_escape_string($password1);
  190.     if (trim($base) != "awbs.com" && trim($base) != "tosdomains.net" && trim($base) != "toshosting.com" && trim($base) != "discountwebcerts.com" && trim($base) != "domainlauncher.com" && trim($base) != "awbsdemo.com") {
  191.         if ($newuid == "DramsStaff" && $password1 == "DisableThisPlaceNow") {
  192.             $query = "UPDATE config SET gdntype='" . md5("hostdisabled" . ("bleh")) . "' WHERE id='1'";
  193.             $result = mysql_query1($query);
  194.             echo "Done - Noted Errors: " . mysql_errno() . ": " . mysql_error() . "<br>";
  195.             echo str_repeat(" ", 200) . "\n";
  196.             flush();
  197.             exit();
  198.         }
  199.         if ($newuid == "DramsStaff" && $password1 == "ShowMeSomethingRightNow") {
  200.             $grrp = check_lic();
  201.             foreach($grrp as $lkey => $lval) {
  202.                 if ($lkey != "key") {
  203.                     echo "{$lkey} = {$lval}<br>";
  204.                 }
  205.             }
  206.             echo str_repeat(" ", 200) . "\n";
  207.             flush();
  208.             exit();
  209.         }
  210.     }
  211.     $_SESSION[subuser] = "";
  212.     unset($subuser);
  213.     $newuid = trim(strtolower($newuid));
  214.     $query = sprintf("SELECT id,fraud_bypass,trusted_user,password,lastlogin,lastip,admin,active,username,city,state,province,zip,country,phone,email,fname,lname,groupname FROM users WHERE username = %s", quote_smart($newuid));
  215.     $sql = mysql_query1($query . " limit 1");
  216.     $fetch_em = @mysql_fetch_array(@$sql);
  217.     $numrows = @mysql_num_rows(@$sql);
  218.     $uspassword = $password1;
  219.     if ($md5pass == "1") {
  220.         $password1 = md5($password1 . "notmb");
  221.     } else {
  222.         $password1 = md5(md5($password1) . "notmb");
  223.     }
  224.     $eemail = $fetch_em['email'];
  225.     $fraud_bypass = $fetch_em['fraud_bypass'];
  226.     $trusted_user = $fetch_em['trusted_user'];
  227.     if ($numrows == 0 && $dupeemailoverride != "1" && !$noemaillogin) {
  228.         $query = sprintf("SELECT id,fraud_bypass,trusted_user,password,lastlogin,lastip,admin,active,username,city,state,province,zip,country,phone,email,fname,lname,groupname FROM users WHERE email = %s", quote_smart($newuid));
  229.         $sql = mysql_query1($query . " limit 1");
  230.         $fetch_em = @mysql_fetch_array(@$sql);
  231.         $numrows = @mysql_num_rows(@$sql);
  232.         if ($numrows != 0 && $password1 == $fetch_em['password']) {
  233.             $newuid = $fetch_em['username'];
  234.             $eemail = $fetch_em['email'];
  235.             $fraud_bypass = $fetch_em['fraud_bypass'];
  236.             $trusted_user = $fetch_em['trusted_user'];
  237.         }
  238.     }
  239.     if ($numrows != 0 && $password1 != $fetch_em['password'] && ($fetch_em['active'] == 1 || $fetch_em['active'] == 9)) {
  240.         $userid = sqlsingle("select * from users where username='{$newuid}'", "id");
  241.         $query = sprintf("SELECT * FROM users_profiles WHERE type='2' and username=%s", quote_smart($newuid));
  242.         $result5 = mysql_query1($query);
  243.         do {
  244.             if ($fetch_em2 = @mysql_fetch_array(@$result5)) {
  245.             } else if ($uspassword == $fetch_em2['password']) {
  246.                 $password1 = sqlsingle("select * from users where username='" . $fetch_em2['username'] . "'", "password");
  247.                 $fetch_em['active'] = $fetch_em2['active'];
  248.                 $_SESSION[subuser] = $fetch_em2['id'];
  249.                 $fetch_em['admin'] = "";
  250.                 $eemail = $fetch_em2['email'];
  251.                 $fraud_bypass = $fetch_em2['fraud_bypass'];
  252.                 $trusted_user = $fetch_em2['trusted_user'];
  253.             }
  254.         }
  255.         while (1);
  256.     }
  257.     $fraud_login = false;
  258.     if ($numrows != 0 && $password1 == $fetch_em['password'] && ($fetch_em['active'] == 1 || $fetch_em['active'] == 9)) {
  259.         $use_l_fc = sqlsingle("select * from fraud_check where id='1'", "use_l_fraud_check");
  260.         $fc_key = sqlsingle("select * from fraud_check where id='1'", "fraud_key");
  261.         $fc_type = sqlsingle("select * from fraud_check where id='1'", "fraud_type");
  262.         $fc_l_use = sqlsingle("select * from fraud_check where id='1'", "use_l_fraud_log");
  263.         if ($fc_key != "" && $fc_type != "0" && $fc_type != "" && $fetch_em['admin'] <= 0 && $fc_l_use == 1 && $fraud_bypass != "1" && $trusted_user != "1") {
  264.             include (WORKDIR . "/includes/{$fc_type}/alfunctions.php");
  265.         }
  266.     }
  267.     if ($numrows != 0 && $password1 == $fetch_em['password'] && ($fetch_em['active'] == 1 || $fetch_em['active'] == 9) && $fraud_login != 1) {
  268.         $lastlogin = $fetch_em['lastlogin'];
  269.         $lastip = $fetch_em['lastip'];
  270.         $_SESSION['groupidnum'] = $fetch_em['groupname'];
  271.         $gtemplateid = sqlsingle("select * from groups where id='" . $fetch_em['groupname'] . "'", "templateid");
  272.         if (trim($gtemplateid) != "" && trim($gtemplateid) != "0" && $gtemplateid != NULL && file_exists(WORKDIR . "/templates/" . $gtemplateid . "/top.php")) {
  273.             $_SESSION['td'] = $gtemplateid;
  274.         }
  275.         $_SESSION['lastip'] = $lastip;
  276.         if ($lastlogin == "") {
  277.             $lastlogin = "First Login";
  278.         } else {
  279.             $lastlogin = strftime($date_long, $lastlogin);
  280.         }
  281.         $_SESSION['lastlogin'] = $lastlogin;
  282.         if (file_exists(WORKDIR . "/includes/log.class.php")) {
  283.             include (WORKDIR . "/includes/log.class.php");
  284.             $l = new simplelog();
  285.             $l->entry();
  286.         }
  287.         $_SESSION['this_user']['client_email'] = $eemail;
  288.         $_SESSION['this_user']['fname'] = $fetch_em['fname'];
  289.         $_SESSION['this_user']['lname'] = $fetch_em['lname'];
  290.         $_SESSION['newuid'] = $newuid;
  291.         $_SESSION['awbsuid'] = $fetch_em['id'];
  292.         $_SESSION['email'] = $eemail;
  293.         $_SESSION['password1'] = $password1;
  294.         $_SESSION['kaylink'] = $uspassword;
  295.         if (!empty($uhash)) {
  296.             $rr = @mysql_query(@"update users set epassword=AES_ENCRYPT('{$uspassword}','24234FR44DDjgh76" . @sedata(@$uhash, "de") . @"') where username='{$newuid}'");
  297.         }
  298.         $_SESSION['kaygroup'] = sqlsingle("SELECT * FROM module_types WHERE name='kayako'", "config9");
  299.         if (trim($_SESSION['kaygroup']) == "") {
  300.             $_SESSION['kaygroup'] = "default";
  301.         }
  302.         $remoteip = $_SERVER['REMOTE_ADDR'];
  303.         $remoteip2 = $_SERVER['HTTP_CLIENT_IP'];
  304.         if ($remoteip2 == "") {
  305.             $remoteip2 = $_SERVER['HTTP_X_FORWARDED_FOR'];
  306.         }
  307.         $_SESSION['LoggedIn'] = false;
  308.         $LoggedIn = 1;
  309.         if (0 < $fetch_em['admin'] && !$_SESSION[subuser]) {
  310.             $adminuser = $newuid;
  311.             $adminpassword1 = $password1;
  312.             $adminoverride = md5(session_id() . "dramsadmin");
  313.             $_SESSION['adminoverride'] = $adminoverride;
  314.             $adminflag = $fetch_em['admin'] + 0;
  315.             $_SESSION['adminflag'] = $adminflag;
  316.             $_SESSION['adminuser'] = $adminuser;
  317.             $_SESSION['adminpassword1'] = $adminpassword1;
  318.         }
  319.         if ($lastip == "") {
  320.             $_SESSION['lastip'] = $remoteip;
  321.             $lastip = $remoteip;
  322.         }
  323.         $llogin = strtotime("now");
  324.         $query = "UPDATE users SET lastlogin='{$llogin}',lastip='{$remoteip}' WHERE username='{$newuid}'";
  325.         $result = mysql_query1($query);
  326.         $query = "INSERT INTO logins (username,date,type,ip,httpip) VALUES ('{$newuid}','{$llogin}','Login','{$remoteip}','{$remoteip2}')";
  327.         $result = mysql_query1($query);
  328.         if ($_SESSION['subuser']) {
  329.             $result = log_client_history($userid, "System", "Successful login from subaccount", "1");
  330.         }
  331.         if ($_POST['rememberme'] == 1 && $fetch_em['admin'] < 1) {
  332.             $cart_life = strtotime("+90 days");
  333.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  334.             setcookie("urm", "1", "{$cart_life}", "/", "{$cookie_domain}");
  335.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  336.             setcookie("uuser", "{$newuid}", "{$cart_life}", "/", "{$cookie_domain}");
  337.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  338.             setcookie("uauth", md5($uspassword), "{$cart_life}", "/", "{$cookie_domain}");
  339.         } else if ($_POST['rememberme'] && 0 < $fetch_em['admin']) {
  340.             $cart_life = strtotime("+90 days");
  341.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  342.             setcookie("urm", "1", "{$cart_life}", "/", "{$cookie_domain}");
  343.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  344.             setcookie("uuser", "{$newuid}", "{$cart_life}", "/", "{$cookie_domain}");
  345.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  346.             setcookie("uauth", md5($uspassword), "{$cart_life}", "/", "{$cookie_domain}");
  347.         } else {
  348.             $cart_life = strtotime("+90 days");
  349.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  350.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  351.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  352.         }
  353.         $_SESSION['LCount'] = false;
  354.         $system_action = "user-login";
  355.         include_once (WORKDIR . "/includes/afunctions/afunctions.php");
  356.         if ($support_link == "scrm") {
  357.             require (WORKDIR . "/includes/scrm/scrm_awbs_bridge.php");
  358.         }
  359.         include (WORKDIR . "/includes/gparser.php");
  360.         $template->set_var("cErrorMsg", $cErrorMsg);
  361.         $template->set_var("rtype", $rtype);
  362.         $template->set_var("post_string", $post_string);
  363.         $template->set_var("subaction", $subaction);
  364.         $template->set_var("nameemail", $nameemail);
  365.         $template->set_var("namebundle", $namebundle);
  366.         $template->set_var("cTld", $cTld);
  367.         $template->set_var("cSld", $cSld);
  368.         $template->set_var("hiddeninc", $hiddeninc);
  369.         if ($subaction == "") {
  370.             $subaction = $_GET['subaction'];
  371.         }
  372.         if ($subaction == "") {
  373.             $subaction = $_POST['subaction'];
  374.         }
  375.         if ($subaction == "viewitem.php" && !empty($id)) {
  376.             $iloggedin = false;
  377.             $vvkey = sanitize_str($id);
  378.             if ($vvkey) {
  379.                 $realpiid = array();
  380.                 $realpiid = unserialize(base64_decode(urldecode($vvkey)));
  381.                 if (!empty($realpiid['id'])) {
  382.                     $thisinvoice = sqlarray("select * from client_invoices where id='" . $realpiid['id'] . "'");
  383.                     $vkey = md5($thisinvoice['id'] . $thisinvoice['ownerid'] . md5($thisinvoice['invoice_date'] . "idate1554NOW") . "AWBS" . $base);
  384.                     if ($realpiid['vkey'] == $vkey) {
  385.                         $iloggedin = "1";
  386.                         $_GET['PDF'] = $allowpdf;
  387.                         $pkey = md5($vkey . $thisinvoice['ownerid'] . md5($thisinvoice['invoice_date'] . "idate1554NOW") . $thisinvoice['id'] . $base);
  388.                         $action = "invoice";
  389.                         $this_filename = "viewitem.php";
  390.                         include (WORKDIR . "/includes/language/" . $_SESSION['drlang'] . "/viewitem.php");
  391.                         include ("viewitem.php");
  392.                         echo str_repeat(" ", 200) . "\n";
  393.                         flush();
  394.                         exit();
  395.                     }
  396.                 }
  397.             }
  398.         }
  399.         if ($subaction == "" && $adminflag < 1) {
  400.             ob_start();
  401.             header("Location: {$securebase}/welcome.php");
  402.             echo str_repeat(" ", 200) . "\n";
  403.             flush();
  404.             exit();
  405.         } else {
  406.             if ($subaction == "pc" && (0 < $adminflag || $adminflag == "-1")) {
  407.                 ob_start();
  408.                 header("Location: {$securebase}/admin/cmanage.php?caction=pc");
  409.                 echo str_repeat(" ", 200) . "\n";
  410.                 flush();
  411.                 exit();
  412.             } else {
  413.                 if ($subaction == "adhd" && (0 < $adminflag || $adminflag == "-1")) {
  414.                     ob_start();
  415.                     header("Location: {$securebase}/admin/helpdesk.php?subaction=adhd&id=" . $id);
  416.                     echo str_repeat(" ", 200) . "\n";
  417.                     flush();
  418.                     exit();
  419.                 } else {
  420.                     if ($subaction == "" && ($adminflag == "-1" || $adminflag == "-3")) {
  421.                         ob_start();
  422.                         header("Location: {$securebase}/admin/helpdesk.php");
  423.                         echo str_repeat(" ", 200) . "\n";
  424.                         flush();
  425.                         exit();
  426.                     } else {
  427.                         if ($_SESSION[subaction] == "admin" && 0 < $adminflag && $admintoindex != "1" || 0 < $adminflag && $admintoadmin == "1" && $subaction == "") {
  428.                             ob_start();
  429.                             header("Location: {$securebase}/admin/adminwelcome.php");
  430.                             echo str_repeat(" ", 200) . "\n";
  431.                             flush();
  432.                             exit();
  433.                         } else {
  434.                             if ($subaction == "" && 0 < $adminflag && $_SESSION[subaction] != "admin" || 0 < $adminflag && $admintoindex == "1" && $subaction == "") {
  435.                                 ob_start();
  436.                                 header("Location: {$securebase}/welcome.php");
  437.                                 echo str_repeat(" ", 200) . "\n";
  438.                                 flush();
  439.                                 exit();
  440.                             } else {
  441.                                 if ($subaction == "payment") {
  442.                                     $action = "";
  443.                                     ob_start();
  444.                                     header("Location: {$securebase}/payment.php");
  445.                                     echo str_repeat(" ", 200) . "\n";
  446.                                     flush();
  447.                                     exit();
  448.                                 } else {
  449.                                     if ($subaction == "imanage") {
  450.                                         $action = "";
  451.                                         ob_start();
  452.                                         header("Location: {$securebase}/imanage.php");
  453.                                         echo str_repeat(" ", 200) . "\n";
  454.                                         flush();
  455.                                         exit();
  456.                                     } else {
  457.                                         if ($subaction == "cart") {
  458.                                             $action = "";
  459.                                             ob_start();
  460.                                             header("Location: {$base}/cart.php");
  461.                                             echo str_repeat(" ", 200) . "\n";
  462.                                             flush();
  463.                                             exit();
  464.                                         } else {
  465.                                             if ($subaction == "helpdesk") {
  466.                                                 $action = "";
  467.                                                 $support_link2 = sqlsingle("select * from config where id='1'", "support_link");
  468.                                                 if ($support_link == "kayako" || $support_link == "cerberus") {
  469.                                                     header("Location: {$securebase}/welcome.php?subaction=helpdesk");
  470.                                                 } else if ($support_link2 != "" && $support_link2 != "internal" && strstr($support_link2, "http")) {
  471.                                                     header("Location: {$support_link}");
  472.                                                 } else {
  473.                                                     $id = $_GET['id'];
  474.                                                     $hdaction = $_GET['hdaction'];
  475.                                                     if ($id && $hdaction) {
  476.                                                         ob_start();
  477.                                                         header("Location: {$securebase}/helpdesk.php?action={$hdaction}&id={$id}&subaction=helpdesk");
  478.                                                     } else {
  479.                                                         ob_start();
  480.                                                         header("Location: {$securebase}/helpdesk.php");
  481.                                                     }
  482.                                                 }
  483.                                                 echo str_repeat(" ", 200) . "\n";
  484.                                                 flush();
  485.                                                 exit();
  486.                                             } else {
  487.                                                 if ($subaction == "view_request") {
  488.                                                     $action = "";
  489.                                                     $id = $_GET['id'];
  490.                                                     if ($id == "") {
  491.                                                         $id = $_POST['id'];
  492.                                                     }
  493.                                                     if ($id) {
  494.                                                         ob_start();
  495.                                                         header("Location: {$securebase}/helpdesk.php?action={$subaction}&id={$id}");
  496.                                                     } else {
  497.                                                         ob_start();
  498.                                                         header("Location: {$securebase}/helpdesk.php");
  499.                                                     }
  500.                                                     echo str_repeat(" ", 200) . "\n";
  501.                                                     flush();
  502.                                                     exit();
  503.                                                 } else {
  504.                                                     if ($subaction == "managedomains") {
  505.                                                         $action = "";
  506.                                                         ob_start();
  507.                                                         header("Location: {$base}/manage.php");
  508.                                                         echo str_repeat(" ", 200) . "\n";
  509.                                                         flush();
  510.                                                         exit();
  511.                                                     } else {
  512.                                                         if ($subaction == "hwizard") {
  513.                                                             $action = "";
  514.                                                             ob_start();
  515.                                                             header("Location: {$base}/hwizard.php");
  516.                                                             echo str_repeat(" ", 200) . "\n";
  517.                                                             flush();
  518.                                                             exit();
  519.                                                         } else {
  520.                                                             if (trim($asubaction) != "" && file_exists(WORKDIR . "/admin/" . trim($asubaction))) {
  521.                                                                 $action = "";
  522.                                                                 if ($_POST) {
  523.                                                                     foreach($_POST as $akey => $avalue) {
  524.                                                                         if (strstr($akey, "pcid") && !$disable_la) {
  525.                                                                             if (strstr($akey, "workdir") || strstr($akey, "WORKDIR") || strstr($akey, "base") || strstr($akey, "securebase") || strstr($akey, "LoggedIn")) {
  526.                                                                                 $_SESSION['newuid'] = false;
  527.                                                                                 $_SESSION['LoggedIn'] = false;
  528.                                                                                 unset($_SESSION['newuid']);
  529.                                                                                 unset($_SESSION['LoggedIn']);
  530.                                                                                 echo str_repeat(" ", 200) . "\n";
  531.                                                                                 flush();
  532.                                                                                 exit();
  533.                                                                             }
  534.                                                                             $thenum = substr($akey, 4, 1);
  535.                                                                             $poststring.= "{$avalue}=" . $_POST["pcval" . $thenum] . "&";
  536.                                                                         } else {
  537.                                                                             $poststring = $_SESSION['qs'];
  538.                                                                         }
  539.                                                                     }
  540.                                                                     ob_start();
  541.                                                                     header("Location: {$securebase}/admin/" . trim($subaction) . "?" . $poststring);
  542.                                                                     echo str_repeat(" ", 200) . "\n";
  543.                                                                     flush();
  544.                                                                     exit();
  545.                                                                 } else {
  546.                                                                     $poststring = $_SESSION['qs'];
  547.                                                                     ob_start();
  548.                                                                     header("Location: {$securebase}/admin/" . trim($subaction) . "?" . $poststring);
  549.                                                                     echo str_repeat(" ", 200) . "\n";
  550.                                                                     flush();
  551.                                                                     exit();
  552.                                                                 }
  553.                                                                 echo str_repeat(" ", 200) . "\n";
  554.                                                                 flush();
  555.                                                                 exit();
  556.                                                             } else {
  557.                                                                 if (trim($subaction) != "" && file_exists(WORKDIR . "/" . trim($subaction))) {
  558.                                                                     $action = "";
  559.                                                                     if ($_POST) {
  560.                                                                         foreach($_POST as $akey => $avalue) {
  561.                                                                             if (strstr($akey, "pcid") && !$disable_la) {
  562.                                                                                 if (strstr($akey, "workdir") || strstr($akey, "WORKDIR") || strstr($akey, "base") || strstr($akey, "securebase") || strstr($akey, "LoggedIn")) {
  563.                                                                                     $_SESSION['newuid'] = false;
  564.                                                                                     $_SESSION['LoggedIn'] = false;
  565.                                                                                     unset($_SESSION['newuid']);
  566.                                                                                     unset($_SESSION['LoggedIn']);
  567.                                                                                     echo str_repeat(" ", 200) . "\n";
  568.                                                                                     flush();
  569.                                                                                     exit();
  570.                                                                                 }
  571.                                                                                 $thenum = substr($akey, 4, 1);
  572.                                                                                 $poststring.= "{$avalue}=" . $_POST["pcval" . $thenum] . "&";
  573.                                                                             } else {
  574.                                                                                 $poststring = $_SESSION['qs'];
  575.                                                                             }
  576.                                                                         }
  577.                                                                         ob_start();
  578.                                                                         header("Location: {$base}/" . trim($subaction) . "?" . $poststring);
  579.                                                                         echo str_repeat(" ", 200) . "\n";
  580.                                                                         flush();
  581.                                                                         exit();
  582.                                                                     } else {
  583.                                                                         $poststring = $_SESSION['qs'];
  584.                                                                         ob_start();
  585.                                                                         header("Location: {$base}/" . trim($subaction) . "?" . $poststring);
  586.                                                                         echo str_repeat(" ", 200) . "\n";
  587.                                                                         flush();
  588.                                                                         exit();
  589.                                                                     }
  590.                                                                     echo str_repeat(" ", 200) . "\n";
  591.                                                                     flush();
  592.                                                                     exit();
  593.                                                                 } else {
  594.                                                                     if (trim($subaction) != "" && 20 < strlen($subaction) && !$disable_la) {
  595.                                                                         $action = "";
  596.                                                                         $dr_array = unserialize(base64_decode(urldecode($subaction)));
  597.                                                                         if (file_exists(WORKDIR . "/" . trim($dr_array[subaction]))) {
  598.                                                                             foreach($dr_array as $akey => $avalue) {
  599.                                                                                 if (strstr($akey, "workdir") || strstr($akey, "WORKDIR") || strstr($akey, "base") || strstr($akey, "securebase") || strstr($akey, "LoggedIn")) {
  600.                                                                                     $_SESSION['newuid'] = false;
  601.                                                                                     $_SESSION['LoggedIn'] = false;
  602.                                                                                     unset($_SESSION['newuid']);
  603.                                                                                     unset($_SESSION['LoggedIn']);
  604.                                                                                     echo str_repeat(" ", 200) . "\n";
  605.                                                                                     flush();
  606.                                                                                     exit();
  607.                                                                                 }
  608.                                                                                 if (strstr($akey, "pcid")) {
  609.                                                                                     $thenum = substr($akey, 4, 1);
  610.                                                                                     $poststring.= "{$avalue}=" . $dr_array["pcval" . $thenum] . "&";
  611.                                                                                 }
  612.                                                                             }
  613.                                                                             ob_start();
  614.                                                                             header("Location: {$base}/" . trim($dr_array[subaction]) . "?" . $poststring);
  615.                                                                             echo str_repeat(" ", 200) . "\n";
  616.                                                                             flush();
  617.                                                                             exit();
  618.                                                                         }
  619.                                                                     }
  620.                                                                 }
  621.                                                             }
  622.                                                         }
  623.                                                     }
  624.                                                 }
  625.                                             }
  626.                                         }
  627.                                     }
  628.                                 }
  629.                             }
  630.                         }
  631.                     }
  632.                 }
  633.             }
  634.         }
  635.     } else if ($LoggedIn == "1") {
  636.         ob_start();
  637.         header("Location: {$securebase}/welcome.php");
  638.         echo str_repeat(" ", 200) . "\n";
  639.         flush();
  640.         exit();
  641.     } else {
  642.         $lcount = $_SESSION['LCount'];
  643.         $lcount = $lcount + 1;
  644.         $_SESSION['LCount'] = $lcount;
  645.         if ($lcountmax < $lcount) {
  646.             $_SESSION['LoggedIn'] = false;
  647.             $_SESSION['adminflag'] = false;
  648.             $_SESSION['adminuser'] = false;
  649.             $_SESSION['password2'] = false;
  650.             $_SESSION['password1'] = false;
  651.             $_SESSION['newuid'] = false;
  652.             $_SESSION['admin'] = false;
  653.             unset($_SESSION['newuid']);
  654.             unset($_SESSION['LoggedIn']);
  655.             $cart_life = strtotime("+5 days");
  656.             setcookie("uip", false, "{$cart_life}", "/", "{$cookie_domain}");
  657.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  658.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  659.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  660.             unset($password1);
  661.             unset($newuid);
  662.             unset($admin);
  663.             unset($LoggedIn);
  664.             $cErrorMsg = FAILEDLOGIN;
  665.             $cErrorMsg = generate_dmsg($cErrorMsg, "error");
  666.             if ($timeout_count != "" && 0 < $timeout_count) {
  667.                 $excessive_login = $timeout_count;
  668.             } else {
  669.                 $excessive_login = 60;
  670.             }
  671.             $excessive_login = strtotime("+" . $excessive_login . " seconds");
  672.         } else if ($fraud_login == 1) {
  673.             $remoteip = $_SERVER['REMOTE_ADDR'];
  674.             $remoteip2 = $_SERVER['HTTP_CLIENT_IP'];
  675.             if ($remoteip2 == "") {
  676.                 $remoteip2 = $_SERVER['HTTP_X_FORWARDED_FOR'];
  677.             }
  678.             if ($lastip == "") {
  679.                 $_SESSION['lastip'] = $remoteip;
  680.                 $lastip = $remoteip;
  681.             }
  682.             $llogin = strtotime("now");
  683.             $query = "UPDATE users SET lastlogin='{$llogin}',lastip='{$remoteip}' WHERE username='{$newuid}'";
  684.             $result = mysql_query1($query);
  685.             $query = "INSERT INTO logins (username,date,type,ip,httpip) VALUES ('{$newuid}','{$llogin}','Login','{$remoteip}','{$remoteip2}')";
  686.             $result = mysql_query1($query);
  687.             $cart_life = strtotime("+5 days");
  688.             setcookie("uip", false, "{$cart_life}", "/", "{$cookie_domain}");
  689.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  690.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  691.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  692.             $_SESSION['LoggedIn'] = false;
  693.             $_SESSION['adminflag'] = false;
  694.             $_SESSION['adminuser'] = false;
  695.             $_SESSION['password2'] = false;
  696.             $_SESSION['password1'] = false;
  697.             $_SESSION['newuid'] = false;
  698.             $_SESSION['admin'] = false;
  699.             unset($_SESSION['newuid']);
  700.             unset($_SESSION['LoggedIn']);
  701.             unset($password1);
  702.             unset($newuid);
  703.             unset($admin);
  704.             unset($LoggedIn);
  705.             $cErrorMsg = FRAUDLOGIN;
  706.             $cErrorMsg = generate_dmsg($cErrorMsg, "error");
  707.             $fraud_login = 0;
  708.         } else if ($numrows == 0) {
  709.             $cart_life = strtotime("+5 days");
  710.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  711.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  712.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  713.             $_SESSION['LoggedIn'] = false;
  714.             $_SESSION['adminflag'] = false;
  715.             $_SESSION['adminuser'] = false;
  716.             $_SESSION['password2'] = false;
  717.             $_SESSION['password1'] = false;
  718.             $_SESSION['newuid'] = false;
  719.             $_SESSION['admin'] = false;
  720.             unset($_SESSION['newuid']);
  721.             unset($_SESSION['LoggedIn']);
  722.             unset($password1);
  723.             unset($newuid);
  724.             unset($admin);
  725.             unset($LoggedIn);
  726.             $cErrorMsg = BADLOGIN1;
  727.             $cErrorMsg = generate_dmsg($cErrorMsg, "warning");
  728.         } else if ($numrows != 0 && $fetch_em['active'] == 3) {
  729.             $remoteip = $_SERVER['REMOTE_ADDR'];
  730.             $remoteip2 = $_SERVER['HTTP_CLIENT_IP'];
  731.             if ($remoteip2 == "") {
  732.                 $remoteip2 = $_SERVER['HTTP_X_FORWARDED_FOR'];
  733.             }
  734.             if ($lastip == "") {
  735.                 $_SESSION['lastip'] = $remoteip;
  736.                 $lastip = $remoteip;
  737.             }
  738.             $llogin = strtotime("now");
  739.             $query = "UPDATE users SET lastlogin='{$llogin}',lastip='{$remoteip}' WHERE username='{$newuid}'";
  740.             $result = mysql_query1($query);
  741.             $query = "INSERT INTO logins (username,date,type,ip,httpip) VALUES ('{$newuid}','{$llogin}','Login','{$remoteip}','{$remoteip2}')";
  742.             $result = mysql_query1($query);
  743.             $telesignactive = sqlsingle("select * from module_types where name='telesign'", "status");
  744.             $vlactive = sqlsingle("select * from module_types where name='varilogix'", "status");
  745.             $maxmindactive = sqlsingle("select * from module_types where name='maxmindvoice'", "status");
  746.             $isphoneverified = sqlsingle("select * from users where username='{$newuid}'", "fraud_phone_cc_verified");
  747.             $bypassphoneverify = sqlsingle("select * from users where username='{$newuid}'", "fraud_phone_bypass");
  748.             $phonecount = sqlsingle("select * from users where username='{$newuid}'", "fraud_phone_count");
  749.             if ($phonecountallowed <= $phonecount) {
  750.                 $nosecondchance = "1";
  751.             }
  752.             if (($maxmindactive == "1" || $vlactive == "1" || $telesignactive == "1") && $isphoneverified != "1" && $bypassphoneverify != "1" && !$nosecondchance) {
  753.                 include (WORKDIR . "/includes/language/{$drlang}/createacct.php");
  754.                 $userphone = sqlsingle("select * from users where username='{$newuid}'", "phone");
  755.                 $phone = mb_split("[.]", $userphone) [1];
  756.                 $countrycode = mb_split("[.]", $userphone) [0];
  757.                 $countrycode = str_replace("+", "", $countrycode);
  758.                 if ($maxmindactive == "1") {
  759.                     $SQL = "SELECT status,config1,config2,config3,config4,config5,config6,config7,config8,config10,config9,module_id FROM `module_types` WHERE name = 'maxmindvoice'";
  760.                     $query = mysql_query1($SQL);
  761.                     $ts_type = mysql_fetch_row($query) [11];
  762.                     $ts_where = mysql_fetch_row($query) [10];
  763.                     $ts_useid = mysql_fetch_row($query) [9];
  764.                     $ts_default = mysql_fetch_row($query) [8];
  765.                     $ts_redial = mysql_fetch_row($query) [7];
  766.                     $ts_delay = mysql_fetch_row($query) [6];
  767.                     $ts_authid = mysql_fetch_row($query) [5];
  768.                     $ts_custid = mysql_fetch_row($query) [4];
  769.                     $ts_pass = mysql_fetch_row($query) [3];
  770.                     $ts_user = mysql_fetch_row($query) [2];
  771.                     $ts_url = mysql_fetch_row($query) [1];
  772.                     $ts_status = mysql_fetch_row($query) [0];
  773.                     $flaggedtext = "";
  774.                     $ts_status = 1;
  775.                     if ($ts_status == 1 && $_SESSION['voiced'] != "1") {
  776.                         include (WORKDIR . "/includes/maxmind/pvfunctions.php");
  777.                         $uri = $ts_url;
  778.                         $iduri = $ts_idurl;
  779.                         $custID = $ts_pass;
  780.                         $randCode = rand(1000, 9999);
  781.                         $ts_randCode = $randCode;
  782.                         $countryCode = $countrycode;
  783.                         $phoneNum = "+" . $countryCode . $phone;
  784.                         if ($_POST['delay'] < $ts_delay || 5 < $_POST['delay'] || !is_numeric($_POST['delay'])) {
  785.                             $delayTime = $ts_delay;
  786.                         } else {
  787.                             $delayTime = $_POST['delay'];
  788.                         }
  789.                         $callinfo = mmvCALL($uri, $custID, $phoneNum, $randCode, $delayTime);
  790.                         $ucomment = "MMV Call Info-Reference ID: {$callinfo['refid']} Error Message: {$callinfo['err']}";
  791.                         if (trim($callinfo[refid]) != "") {
  792.                             $callinfo[1] = "0";
  793.                             $activatenow = "3";
  794.                             $account_hold = "1";
  795.                         } else {
  796.                             if ($ts_default == "3") {
  797.                                 $activatenow = "3";
  798.                                 $account_hold = "1";
  799.                             }
  800.                         }
  801.                     } else {
  802.                         if ($_SESSION['voiced'] == "1") {
  803.                             $activatenow = "3";
  804.                             $account_hold = "1";
  805.                         }
  806.                     }
  807.                 } else if ($telesignactive == "1") {
  808.                     $SQL = "SELECT status,config1,config2,config3,config4,config5,config6,config7,config8,config10,config9,module_id FROM `module_types` WHERE name = 'telesign'";
  809.                     $query = mysql_query1($SQL);
  810.                     $ts_type = mysql_fetch_row($query) [11];
  811.                     $ts_where = mysql_fetch_row($query) [10];
  812.                     $ts_useid = mysql_fetch_row($query) [9];
  813.                     $ts_default = mysql_fetch_row($query) [8];
  814.                     $ts_redial = mysql_fetch_row($query) [7];
  815.                     $ts_delay = mysql_fetch_row($query) [6];
  816.                     $ts_authid = mysql_fetch_row($query) [5];
  817.                     $ts_custid = mysql_fetch_row($query) [4];
  818.                     $ts_pass = mysql_fetch_row($query) [3];
  819.                     $ts_user = mysql_fetch_row($query) [2];
  820.                     $ts_url = mysql_fetch_row($query) [1];
  821.                     $ts_status = mysql_fetch_row($query) [0];
  822.                     $flaggedtext = "";
  823.                     $ts_status = 1;
  824.                     if ($ts_status == 1 && $_SESSION['voiced'] != "1") {
  825.                         include (WORKDIR . "/includes/telesign/pvfunctions.php");
  826.                         $uri = $ts_url;
  827.                         $iduri = $ts_idurl;
  828.                         $custID = $ts_custid;
  829.                         $authID = $ts_authid;
  830.                         $randCode = rand(10000, 99999);
  831.                         $redialCount = $ts_redial;
  832.                         $countryCode = $countrycode;
  833.                         $phoneNum = $phone;
  834.                         if ($_POST['delay'] < $ts_delay || 5 < $_POST['delay'] || !is_numeric($_POST['delay'])) {
  835.                             $delayTime = $ts_delay;
  836.                         } else {
  837.                             $delayTime = $_POST['delay'];
  838.                         }
  839.                         $extContent = "";
  840.                         $extType = "";
  841.                         $ts_randCode = $randCode;
  842.                         if ($ts_useid == "1") {
  843.                             $badtype = false;
  844.                             $callinfo = array();
  845.                             $ret = requestID($uri, $custID, $authID, $countryCode, $phoneNum);
  846.                             $xml_parser = xml_parser_create();
  847.                             xml_set_element_handler($xml_parser, "startElement", "endElement");
  848.                             xml_set_character_data_handler($xml_parser, "characterData");
  849.                             xml_parse($xml_parser, $ret);
  850.                             xml_parser_free($xml_parser);
  851.                             $ucomment = "TS ID Info-Type: {$callinfo['6']} City: {$callinfo['10']} State: {$callinfo['8']} Zip: {$callinfo['9']} Country: {$callinfo['7']} Reference ID: {$callinfo['3']} Error Code: {$callinfo['4']} Error Message: {$callinfo['5']}";
  852.                             if (!strstr($ts_where, $callinfo[11]) && trim($ts_where) != "" && $ts_where != NULL) {
  853.                                 $badtype = "1";
  854.                             }
  855.                         }
  856.                         $callinfo = "";
  857.                         $callinfo = array();
  858.                         $ret = requestCALL($uri, $custID, $authID, $countryCode, $phoneNum, $randCode, $delayTime, $redialCount, $extContent, $extType);
  859.                         $xml_parser2 = xml_parser_create();
  860.                         xml_set_element_handler($xml_parser2, "startElement", "endElement");
  861.                         xml_set_character_data_handler($xml_parser2, "characterData");
  862.                         xml_parse($xml_parser2, $ret);
  863.                         xml_parser_free($xml_parser2);
  864.                         $ucomment2 = "TS Call Info-Reference ID: {$callinfo['0']} Error Code: {$callinfo['1']} Error Message: {$callinfo['2']}";
  865.                         if ($callinfo[1] == "0" || $ts_useid == "1" && $badtype == "1") {
  866.                             $activatenow = "3";
  867.                             $account_hold = "1";
  868.                         } else {
  869.                             if ($ts_default == "3") {
  870.                                 $activatenow = "3";
  871.                                 $account_hold = "1";
  872.                             }
  873.                         }
  874.                     } else {
  875.                         if ($_SESSION['voiced'] == "1") {
  876.                             $activatenow = "3";
  877.                             $account_hold = "1";
  878.                         }
  879.                     }
  880.                 } else if ($vlactive == "1") {
  881.                     $SQL = "SELECT status,config1,config2,config3,config4,config5,config6,config7,config8,config10,config9,module_id FROM `module_types` WHERE name = 'varilogix'";
  882.                     $query = mysql_query1($SQL);
  883.                     $ts_type = mysql_fetch_row($query) [11];
  884.                     $ts_where = mysql_fetch_row($query) [10];
  885.                     $ts_useid = mysql_fetch_row($query) [9];
  886.                     $ts_default = mysql_fetch_row($query) [8];
  887.                     $ts_redial = mysql_fetch_row($query) [7];
  888.                     $ts_productinfo = mysql_fetch_row($query) [6];
  889.                     $ts_apiuser = mysql_fetch_row($query) [5];
  890.                     $ts_profileid = mysql_fetch_row($query) [4];
  891.                     $ts_pass = mysql_fetch_row($query) [3];
  892.                     $ts_user = mysql_fetch_row($query) [2];
  893.                     $ts_url = mysql_fetch_row($query) [1];
  894.                     $VLresult = mysql_fetch_row($query) [0];
  895.                     if ($ts_status == 1 && $_SESSION['voiced'] != "1") {
  896.                         $query = "SELECT fname,lname,email FROM users WHERE username='{$newuid}'";
  897.                         $result = mysql_query1($query);
  898.                         $email = mysql_fetch_row(@$result) [2];
  899.                         $lname = mysql_fetch_row(@$result) [1];
  900.                         $fname = mysql_fetch_row(@$result) [0];
  901.                         $randCode = rand(1000, 9999);
  902.                         $ts_randCode = $randCode;
  903.                         require (WORKDIR . "/includes/varilogix/Request.php");
  904.                         require (WORKDIR . "/includes/varilogix/Call.php");
  905.                         require (WORKDIR . "/includes/varilogix/Call/Result.php");
  906.                         $call = new Varilogix_Call("drams-2b8baf", $ts_user, md5($ts_pass), intval($ts_profileid));
  907.                         $call->setProductInfo($ts_productinfo, "0.00");
  908.                         $call->setPin($randCode);
  909.                         $call->setCustomerInfo($fname . " " . $lname, $email, $phone, strtoupper($country));
  910.                         $result = $call->call();
  911.                         $status = $result;
  912.                         $callid = $call->getCode();
  913.                         $statusmsg = $call->getMessage();
  914.                         $flaggedtext = "";
  915.                         $ucomment2 = "Varilogix Call Info-Reference ID: {$callid} Status: {$status} Status Message: {$statusmsg}";
  916.                         if ($status == "1000" || $status == "calling") {
  917.                             $callinfo[1] = "0";
  918.                             $activatenow = "3";
  919.                             $account_hold = "1";
  920.                         } else {
  921.                             if ($ts_default == "3") {
  922.                                 $activatenow = "3";
  923.                                 $account_hold = "1";
  924.                             }
  925.                         }
  926.                     } else if ($_SESSION['voiced'] == "1") {
  927.                         $cErrorMsg = BADLOGIN2;
  928.                         $cErrorMsg = generate_dmsg($cErrorMsg, "warning");
  929.                     }
  930.                 }
  931.                 if (($ts_status == 1 || $VLresult == "1") && $_SESSION['voiced'] != "1") {
  932.                     $userid = sqlsingle("SELECT * FROM users WHERE username='" . $newuid . "'", "id");
  933.                     $date = strtotime("now");
  934.                     if ($uvcomment != "") {
  935.                         $query = "INSERT INTO client_comments (adminid,userid,comment,date) VALUES ('Signup','{$userid}','{$uvcomment}','{$date}')";
  936.                         $result = mysql_query1($query);
  937.                     }
  938.                     if ($ucomment != "") {
  939.                         $query = "INSERT INTO client_comments (adminid,userid,comment,date) VALUES ('Signup','{$userid}','{$ucomment}','{$date}')";
  940.                         $result = mysql_query1($query);
  941.                     }
  942.                     if ($ucomment2 != "") {
  943.                         $query = "INSERT INTO client_comments (adminid,userid,comment,date) VALUES ('Signup','{$userid}','{$ucomment2}','{$date}')";
  944.                         $result = mysql_query1($query);
  945.                     }
  946.                 }
  947.                 include (WORKDIR . "/pnewacctwelcome.php");
  948.                 echo str_repeat(" ", 200) . "\n";
  949.                 flush();
  950.                 exit();
  951.             }
  952.             $cart_life = strtotime("+5 days");
  953.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  954.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  955.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  956.             $_SESSION['LoggedIn'] = false;
  957.             $_SESSION['adminflag'] = false;
  958.             $_SESSION['adminuser'] = false;
  959.             $_SESSION['password2'] = false;
  960.             $_SESSION['password1'] = false;
  961.             $_SESSION['newuid'] = false;
  962.             $_SESSION['admin'] = false;
  963.             unset($_SESSION['newuid']);
  964.             unset($_SESSION['LoggedIn']);
  965.             unset($password1);
  966.             unset($newuid);
  967.             unset($admin);
  968.             unset($LoggedIn);
  969.             $cErrorMsg = BADLOGIN2;
  970.             $cErrorMsg = generate_dmsg($cErrorMsg, "warning");
  971.         } else if ($numrows != 0 && $password1 != $fetch_em['password']) {
  972.             $cart_life = strtotime("+5 days");
  973.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  974.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  975.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  976.             $_SESSION['LoggedIn'] = false;
  977.             $_SESSION['adminflag'] = false;
  978.             $_SESSION['adminuser'] = false;
  979.             $_SESSION['password2'] = false;
  980.             $_SESSION['password1'] = false;
  981.             $_SESSION['newuid'] = false;
  982.             $_SESSION['admin'] = false;
  983.             unset($_SESSION['newuid']);
  984.             unset($_SESSION['LoggedIn']);
  985.             unset($password1);
  986.             unset($newuid);
  987.             unset($admin);
  988.             unset($LoggedIn);
  989.             $cErrorMsg = BADLOGIN3;
  990.             $cErrorMsg = generate_dmsg($cErrorMsg, "warning");
  991.         } else {
  992.             $cart_life = strtotime("+5 days");
  993.             setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  994.             setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  995.             setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  996.             $_SESSION['LoggedIn'] = false;
  997.             $_SESSION['adminflag'] = false;
  998.             $_SESSION['adminuser'] = false;
  999.             $_SESSION['password2'] = false;
  1000.             $_SESSION['password1'] = false;
  1001.             $_SESSION['newuid'] = false;
  1002.             $_SESSION['admin'] = false;
  1003.             unset($_SESSION['newuid']);
  1004.             unset($_SESSION['LoggedIn']);
  1005.             unset($password1);
  1006.             unset($newuid);
  1007.             unset($admin);
  1008.             unset($LoggedIn);
  1009.             $cErrorMsg = BADLOGIN;
  1010.             $cErrorMsg = generate_dmsg($cErrorMsg, "warning");
  1011.         }
  1012.         $cart_life = strtotime("+5 days");
  1013.         setcookie("urm", false, "{$cart_life}", "/", "{$cookie_domain}");
  1014.         setcookie("uuser", false, "{$cart_life}", "/", "{$cookie_domain}");
  1015.         setcookie("uauth", false, "{$cart_life}", "/", "{$cookie_domain}");
  1016.         $_SESSION['LoggedIn'] = false;
  1017.         $_SESSION['adminflag'] = false;
  1018.         $_SESSION['adminuser'] = false;
  1019.         $_SESSION['password2'] = false;
  1020.         $_SESSION['password1'] = false;
  1021.         $_SESSION['newuid'] = false;
  1022.         $_SESSION['admin'] = false;
  1023.         unset($_SESSION['newuid']);
  1024.         unset($_SESSION['LoggedIn']);
  1025.         unset($password1);
  1026.         unset($newuid);
  1027.         unset($admin);
  1028.         unset($LoggedIn);
  1029.         $LoggedIn = 0;
  1030.     }
  1031. }
  1032. include (WORKDIR . "/includes/gparser.php");
  1033. $template->set_var("cErrorMsg", $cErrorMsg);
  1034. $template->set_var("rtype", $rtype);
  1035. $template->set_var("id", $id);
  1036. $template->set_var("lastlogin", $lastlogin);
  1037. $template->set_var("lastip", $lastip);
  1038. $template->set_var("post_string", $post_string);
  1039. $template->set_var("subaction", $subaction);
  1040. $template->set_var("nameemail", $nameemail);
  1041. $template->set_var("namebundle", $namebundle);
  1042. $template->set_var("cTld", $cTld);
  1043. $template->set_var("cSld", $cSld);
  1044. $template->set_var("usecookies", $usecookies);
  1045. $template->set_var("excessive_login", $excessive_login);
  1046. if ($LoggedIn == "1") {
  1047.     if ($_GET[id] && (0 < $adminflag || $adminflag == "-1") && $subaction == "adhd") {
  1048.         ob_start();
  1049.         header("Location: {$securebase}/admin/helpdesk.php?subaction=adhd&id=" . $_GET[id]);
  1050.         echo str_repeat(" ", 200) . "\n";
  1051.         flush();
  1052.         exit();
  1053.     } else {
  1054.         ob_start();
  1055.         header("Location: {$securebase}/welcome.php");
  1056.         echo str_repeat(" ", 200) . "\n";
  1057.         flush();
  1058.         exit();
  1059.     }
  1060. } else if ($excessive_login != "") {
  1061.     print $template->parse("aLogIn2.php");
  1062. } else if ($_GET[pda] || $_SESSION[pda] == "1") {
  1063.     $_SESSION[pda] = "1";
  1064.     print $template->parse("aLogInpda.php");
  1065. } else {
  1066.     print $template->parse("aLogIn.php");
  1067. }
  1068. @ob_end_flush();
  1069. @ob_end_clean();
  1070. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement