| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.146.1.el8_10.x86_64 #1 SMP Tue Jul 21 15:46:30 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/cms.classicscash.com/htdocs/cms_admin/includes/ |
Upload File : |
<?php
//
// $Id: OneclickEncoding.php,v 1.2 2011-07-12 23:15:23 calebg Exp $
//
// Copyright (c) 2006 Accretive Technology Group, Inc. All rights reserved.
// For use only by Accretive Technology Group, its employees and contractors.
// DO NOT DISTRIBUTE.
//
// This library is used to encode and decode the email and password parameters
// for oneclick users. For increased user security, a user's email and password
// SHOULD NOT be passed in plaintext mode over insecure HTTP channels. These are
// time-based values and you must re-generate them every time a link is
// constructed.
//
// It is extremely important to use this library as stated. If the user's email
// address and password are incorrectly encoded, user account generation will
// not be completed because the receiving script will not be able to accurately
// decode the given parameters.
//
// THIS LIBRARY was written for PHP Version 4 or greater.
//
// NOTE- THIS LIB IS SHARED WITH AFFILIATES. ONLY PUT GENERIC FUNCTIONS
// NOTE- HERE THAT ARE OF INTEREST TO BOTH PARTIES.
//
//-----------------------------------------------------------
// FUNCTION:
// EncodeURLParameters
//
// PURPOSE:
// To encode user email addresses and passwords in a time-based, secure
// format.
//
// PARAMETERS:
// $email - (required)
// the user's email address
//
// $password - (required)
// the user's password
//
// $authkey - (required)
// an authentication key specific to each affliate
//
// $makeassoc - (optional)
// pass in this parameter as true if you want override the default behavior
// and return an associative array of values
//
// $urlencode - (optional)
// pass as true so the encrypted email and password are also urlencoded
//
// RETURNS:
// The default behavior is to return a url-encoded query string, for example:
// chksm=48BDA84&email=A5Y8%25KLIV5qn&pwd=yj-61&chksmv=1.5
//
// Otherwise, if $makeassoc was passed in as true, this function
// returns a url-encoded associative array with 3 items:
// a checksum value, the new email value, and the new password value.
//
// USAGE:
// Function call for a query string:
// $newvalues = EncodeURLParameters(
// 'someone@yahoo.com', 'password12345', 'authkey0983' );
//
// Function call for an array:
// $newvalues = EncodeURLParameters(
// 'someone@yahoo.com', 'password12345', 'authkey0983', 1 );
//
// EXAMPLE:
// require_once( '/your/library/path/OneclickEncoding.php' );
//
// $useremail = 'myemail@mysite.com';
// $userpassword = 'mypassword';
// $siteauthkey = 'authkey0983';
//
// $result = EncodeURLParameters( $useremail, $userpassword, $siteauthkey );
//
// header( 'Location: http://your/oneclick/url/oneclick.php?'
// . 'rid=99&site=1&pusr=paycomusername&mid=123456&co_code=n51&'
// . 'pi_code=smn51s2&' . $result );
// exit();
//
//-----------------------------------------------------------
function EncodeURLParameters( $email, $password, $authkey, $makeassoc = false, $urlencode = true )
{
$result = array ( 'chksm' => '', 'email' => '', 'pwd' => '', 'chksmv' => '' );
$email = strtolower($email);
$ver = '1.5';
$result['chksm'] = OneclickMD5Checksum( $authkey, $email, $password );
$result['email'] = OneclickEncode( $email, true, false, $ver );
$result['pwd'] = OneclickEncode( $password, true, false, $ver );
$result['chksmv'] = $ver;
if ( $urlencode )
{
$result['email'] = urlencode( $result['email'] );
$result['pwd'] = urlencode( $result['pwd'] );
}
if ( $makeassoc )
return $result;
$link = '';
foreach( $result as $k => $v )
$link .= "$k=$v&";
return rtrim( $link, '&' );
}
//*************************************************************
//*************************************************************
//* THE FOLLOWING FUNCTIONS ARE FOR INTERNAL USE ONLY *
//*************************************************************
//*************************************************************
function OneclickEncode( $str, $encode = true, $mday = false, $ver = 0 )
{
if( $mday === false )
$mday = gmdate( 'j' ); // month day, no leading zeros
$x = '' ;
for( $i = 0 ; $i < strlen( $str ) ; $i++ )
{
$shift = intval( ( $mday + $i ) * ( $encode ? 1 : -1 ) / 2 );
$orgval = translateChar( $str{$i}, false, $ver );
if ( $orgval === false )
{
$x .= $str{$i};
continue ;
}
if ( ($newval = translateChar( ($orgval+$shift), true, $ver )) !== false )
$x .= $newval;
else $x .= $str{$i};
}
return $x ;
}
function OneclickMD5Checksum( $authkey, $email, $pass, $timekey = false )
{
if( $timekey === false )
$timekey = gmdate( 'dz' ); // Month day and year day
$str = ":" . $authkey . ":"
. "<" . $email . ">"
. "[" . $pass . "]"
. "{" . $timekey . "}" ;
return md5( $str );
}
function translateChar( $c, $tostr, $ver )
{
$enclist = array (
64 => '.', 65 => 't', 66 => '@', 67 => 'x', 68 => 'c', 69 => 'O',
70 => '1', 71 => '!', 72 => 'A', 73 => '#', 74 => '4', 75 => '%',
76 => 'i', 77 => 'q', 78 => 'L', 79 => 'I', 80 => 's', 81 => '3',
82 => 'T', 83 => 'M', 84 => '^', 85 => '8', 86 => '&', 87 => 'v',
88 => 'w', 89 => 'n', 90 => 'f', 91 => 'm', 92 => 'r', 93 => '*',
94 => 'G', 95 => '-', 96 => 'U', 97 => 'Y', 98 => 'J', 99 => '2',
100 => ',', 101 => 'k', 102 => '0', 103 => 'V', 104 => '+', 105 => 'X',
106 => '_', 107 => 'D', 108 => 'a', 109 => 'C', 110 => '7', 111 => 'E',
112 => 'd', 113 => 'B', 114 => 'R', 115 => 'h', 116 => 'z', 117 => 'g',
118 => 'K', 119 => 'y', 120 => 'Z', 121 => 'e', 122 => 'u', 123 => 'H',
124 => 'b', 125 => 'o', 126 => 'N', 127 => '9', 128 => '$', 129 => 'j',
130 => '6', 131 => 'p', 132 => 'F', 133 => '5', 134 => 'P', 135 => 'l',
136 => 'W', 137 => 'Q', 138 => 'S',
);
$maxval = max( array_keys( $enclist ) );
$minval = min( array_keys( $enclist ) );
if ( $tostr )
{
if ( isset($enclist[$c]) ) return $enclist[$c];
// loop around to avoid going off the end of the array
$diff = $c - $maxval;
$testval = $minval + $diff;
if ( $ver == '1.5' ) $testval = $testval - 1;
if ( $diff > 0 && isset( $enclist[$testval] ) )
return $enclist[$testval];
// loop backwards to the end
$diff = $minval - $c;
$testval = $maxval - $diff;
if ( $ver == '1.5' ) $testval = $testval + 1;
if ( $diff > 0 && isset( $enclist[$testval] ) )
return $enclist[$testval];
return false;
}
else
{
$declist = array_flip($enclist);
if ( isset($declist[$c]) ) return $declist[$c];
return false;
}
}
/*
*/
function getAffilLink(){
/**
* set defaults
*/
$affilDefault = 'https://www.camsalllday.com/exports/tour_20/index.php?sort_language=en&cols=6&rows=3&df=4096';
$affilRedirect = 'http://processor.camsalllday.com/p/segpay/oneclick.php?rid=';
$RID = 8936;
$AUTH_KEY = 'ZbSXYHk5p8';
/**
* lookup user data
*/
$url = 'http://darkreachcash.com/api/member/details?';
$curl = curl_init();
$data = array(
'username' => $_SERVER["PHP_AUTH_USER"],
'full_info' => true,
#'ident_details' => true,
#'subscriptions' => true
);
$data_string = http_build_query($data);
$url = $url.$data_string;
/*
*/
$LOOKUP_RESULT = array();
$headers = array(
'api-key: cc3dfa237e95d3fa5974aaad7e660338',
'api-username: adanacmedia'
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
$resp = curl_exec($curl);
#$LOOKUP_RESULT["resp"] = $resp;
//dumps an associative array representation of the json
$LOOKUP_RESULT= json_decode($resp, true);
$FINAL_RESULT = array();
// Close request to clear up some resources
#$LOOKUP_RESULT["info"] = curl_getinfo($curl);
#$LOOKUP_RESULT["error"] = curl_error($curl);
curl_close($curl);
if(isset($LOOKUP_RESULT["memberidx"])){
$splitVal = explode(':',$LOOKUP_RESULT["memberidx"]);
if(
(isset($splitVal[1]) && is_numeric($splitVal[1]))
&&
(isset($splitVal[0]) && 'SEGPAY' == $splitVal[0]) // SEGPAY NATS
){
$FINAL_RESULT["MID"] = $splitVal[1];
}
}
#$FINAL_RESULT["email"] = '';
if(isset($LOOKUP_RESULT["email"])){
$FINAL_RESULT["email"] = $LOOKUP_RESULT["email"];
}
if(2 == count($FINAL_RESULT)){
$URI_DATA = EncodeURLParameters( $FINAL_RESULT["email"], $_SERVER['PHP_AUTH_PW'], $AUTH_KEY, $makeassoc = false, $urlencode = true );
/**
* we generate the full URL for the iframe with the encoded parameters
*/
$IFRAME_URL = $affilRedirect.$RID.'&mid='.$FINAL_RESULT["MID"].'&'.$URI_DATA;
}else{
$IFRAME_URL = $affilDefault;
}
/*
$FINAL_RESULT["raw"] = $resp;
$FINAL_RESULT["LOOKUP_RESULT"] = $LOOKUP_RESULT;
$FINAL_RESULT["IFRAME_URL"] = $IFRAME_URL;
return $FINAL_RESULT;
*/
return $IFRAME_URL;
}
?>