예제 #1
0
파일: Sessionx.php 프로젝트: Anon215/movim
 public function init($user, $pass, $host)
 {
     $this->_host = $host;
     $this->_user = $user;
     $this->_password = $pass;
     $this->_resource = 'moxl' . \generateKey(6);
     $this->_start = date(DATE_ISO8601);
     $sd = new \Modl\SessionxDAO();
     $s = $this->inject();
     $sd->init($s);
 }
예제 #2
0
function foursquareEncrypt($plaintext)
{
    $key1 = generateKey();
    $key2 = generateKey();
    $upperLeft = "abcdefghiklmnopqrstuvwxyz";
    $upperRight = $key1;
    $lowerLeft = $key2;
    $lowerRight = "abcdefghiklmnopqrstuvwxyz";
    $_SESSION["key"] = $key1 . " " . $key2;
    return encode($plaintext, $upperLeft, $upperRight, $lowerLeft, $lowerRight);
}
예제 #3
0
파일: Action.php 프로젝트: movim/moxl
 public final function store()
 {
     $sess = \Session::start();
     // Generating the iq key.
     $id = \generateKey(6);
     $sess->set('id', $id);
     // We serialize the current object
     $obj = new \StdClass();
     $obj->type = get_class($this);
     $obj->object = serialize($this);
     $obj->time = time();
     //$_instances = $this->clean($_instances);
     $sess->set($id, $obj);
 }
예제 #4
0
파일: Action.php 프로젝트: Hywan/moxl
 public final function store()
 {
     $sess = \Session::start();
     //$_instances = $sess->get('xecinstances');
     // Set a new Id for the Iq request
     $session = \Sessionx::start();
     // Generating the iq key.
     $id = $session->id = \generateKey(6);
     // We serialize the current object
     $obj = new \StdClass();
     $obj->type = get_class($this);
     $obj->object = serialize($this);
     $obj->time = time();
     //$_instances = $this->clean($_instances);
     $sess->set($id, $obj);
 }
예제 #5
0
function playfairEncrypt($plaintext)
{
    $_SESSION["key"] = generateKey();
    return encode($plaintext, $_SESSION["key"]);
}
예제 #6
0
파일: Sessionx.php 프로젝트: Nyco/movim
 public function init($user, $pass, $host, $domain)
 {
     $this->_port = 5222;
     $this->_host = $host;
     $this->_domain = $domain;
     $this->_user = $user;
     $this->_password = $pass;
     $this->_resource = 'moxl' . \generateKey(6);
     $this->_start = date(DATE_ISO8601);
     $this->_rid = rand(1, 2048);
     $this->_id = 0;
     $sd = new modl\SessionxDAO();
     $s = $this->inject();
     $sd->init($s);
 }
예제 #7
0
function checkCredentials($username, $password)
{
    global $db;
    $query = $db->prepare("SELECT * FROM users WHERE username = :username AND password = SHA1(:password)");
    $query->execute(array(":username" => $username, ":password" => $password));
    if ($query->fetchObject()) {
        return true;
    } else {
        return false;
    }
}
function clearPrevious($username)
{
    global $db;
    $db->prepare("DELETE FROM keystbl WHERE user = :username")->execute(array(":username" => $username));
}
if (!isset($_POST["username"]) || !isset($_POST["password"])) {
    echo json_encode(array("text" => "INVALID_LOGIN"));
} else {
    $username = $_POST["username"];
    $password = $_POST["password"];
    if (!checkCredentials($username, $password)) {
        echo json_encode(array("text" => "INVALID_LOGIN"));
    } else {
        clearPrevious($username);
        $token = generateKey();
        echo json_encode(array("text" => "LOGIN_SUCCESSFUL", "token" => $token));
        $query = $db->prepare("INSERT INTO keystbl(user, token) VALUES (:user, :token)");
        $query->execute(array(":user" => $username, ":token" => $token));
    }
}
function register_first_user()
{
    global $wpdb;
    //get database table prefix
    $table_prefix = mlm_core_get_table_prefix();
    $error = '';
    $chk = 'error';
    //most outer if condition
    if (isset($_POST['submit'])) {
        $username = sanitize_text_field($_POST['username']);
        $password = sanitize_text_field($_POST['password']);
        $confirm_pass = sanitize_text_field($_POST['confirm_password']);
        $email = sanitize_text_field($_POST['email']);
        $confirm_email = sanitize_text_field($_POST['confirm_email']);
        $firstname = sanitize_text_field($_POST['first_name']);
        $lastname = sanitize_text_field($_POST['last_name']);
        //Add usernames we don't want used
        $invalid_usernames = array('admin');
        //Do username validation
        $username = sanitize_user($username);
        if (!validate_username($username) || in_array($username, $invalid_usernames)) {
            $error .= "\n Username is invalid.";
        }
        if (username_exists($username)) {
            $error .= "\n Username already exists.";
        }
        if (checkInputField($username)) {
            $error .= "\n Please enter your username.";
        }
        if (checkInputField($password)) {
            $error .= "\n Please enter your password.";
        }
        if (confirmPassword($password, $confirm_pass)) {
            $error .= "\n Please confirm your password.";
        }
        //Do e-mail address validation
        if (!is_email($email)) {
            $error .= "\n E-mail address is invalid.";
        }
        if (email_exists($email)) {
            $error .= "\n E-mail address is already in use.";
        }
        if (confirmEmail($email, $confirm_email)) {
            $error .= "\n Please confirm your email address.";
        }
        //generate random numeric key for new user registration
        $user_key = generateKey();
        // outer if condition
        if (empty($error)) {
            $user = array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'first_name' => $firstname, 'last_name' => $lastname, 'role' => 'mlm_user');
            // return the wp_users table inserted user's ID
            $user_id = wp_insert_user($user);
            /* Send e-mail to admin and new user - 
               You could create your own e-mail instead of using this function */
            wp_new_user_notification($user_id, $password);
            //insert the data into fa_user table
            $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t   \t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, leg, payment_status\n\t\t\t\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '0', '0', '0','1'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)";
            // if all data successfully inserted
            if ($wpdb->query($insert)) {
                $chk = '';
                //$msg = "<span style='color:green;'>Congratulations! You have successfully registered in the system.</span>";
            }
        }
        //end outer if condition
    }
    //end most outer if condition
    //if any error occoured
    if (!empty($error)) {
        $error = nl2br($error);
    }
    if ($chk != '') {
        include 'js-validation-file.html';
        ?>
        <div class='wrap'>
            <h2><?php 
        _e('Create First User in Network', 'binary-mlm-pro');
        ?>
</h2>
            <div class="notibar msginfo">
                <a class="close"></a>
                <p><?php 
        _e('In order to begin building your network you would need to register the First User of the network. All other users would be registered under this First User.', 'binary-mlm-pro');
        ?>
</p>
            </div>
            <?php 
        if ($error) {
            ?>
                <div class="notibar msgerror">
                    <a class="close"></a>
                    <p> <strong><?php 
            _e('Please Correct the following Error(s)', 'binary-mlm-pro');
            ?>
:</strong> <?php 
            _e($error);
            ?>
</p>
                </div>
            <?php 
        }
        ?>

            <p>&nbsp;</p>
            <form name="frm" method="post" action="" onSubmit="return adminFormValidation();">
                <table border="0" cellpadding="0" cellspacing="0" width="100%"  class="form-table">

                    <tr>
                        <th scope="row" class="admin-settings">
                            <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('create-first-user');">
                                <?php 
        _e('Create Username', 'binary-mlm-pro');
        ?>
 <span style="color:red;">*</span>: </a>
                        </th>
                        <td>
                            <input type="text" name="username" id="username" value="<?php 
        if (!empty($_POST['username'])) {
            _e(htmlentities($_POST['username']));
        }
        ?>
" maxlength="20" size="37">
                            <div class="toggle-visibility" id="create-first-user"><?php 
        _e('Please create the first user of the your network.', 'binary-mlm-pro');
        ?>
</div>
                        </td>
                    </tr>

                    <tr>
                        <th scope="row" class="admin-settings">
                            <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('create-password');"></a>
                            <?php 
        _e('Create Password', 'binary-mlm-pro');
        ?>
 <span style="color:red;">*</span>: </a>
                        </th>
                        <td><input type="password" name="password" id="password" maxlength="20" size="37" >
                            <div class="toggle-visibility" id="create-password"><?php 
        _e('Password length is atleast 6 char.', 'binary-mlm-pro');
        ?>
</div>
                        </td>
                    </tr>

                    <tr>
                        <th scope="row" class="admin-settings">
                            <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('confirm-password');">
                                <?php 
        _e('Confirm Password', 'binary-mlm-pro');
        ?>
 <span style="color:red;">*</span>: </a>
                        </th>
                        <td>
                            <input type="password" name="confirm_password" id="confirm_password" maxlength="20" size="37" >
                            <div class="toggle-visibility" id="confirm-password"><?php 
        _e('Please confirm your password.', 'binary-mlm-pro');
        ?>
</div>
                        </td>
                    </tr>

                    <tr>
                        <th scope="row" class="admin-settings">
                            <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('email-address');">
                                <?php 
        _e('Email Address', 'binary-mlm-pro');
        ?>
 <span style="color:red;">*</span>: </a>
                        </th>
                        <td>
                            <input type="text" name="email" id="email" value="<?php 
        if (!empty($_POST['email'])) {
            _e(htmlentities($_POST['email']));
        }
        ?>
"  size="37" >
                            <div class="toggle-visibility" id="email-address"><?php 
        _e('Please specify your email address.', 'binary-mlm-pro');
        ?>
</div>
                        </td>
                    </tr>

                    <tr>
                        <th>
                            <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('confirm-address');">
                                <?php 
        _e('Confirm Email Address', 'binary-mlm-pro');
        ?>
 <span style="color:red;">*</span>: </a>
                        </th>
                        <td>
                            <input type="text" name="confirm_email" id="confirm_email" value="<?php 
        if (!empty($_POST['confirm_email'])) {
            _e(htmlentities($_POST['confirm_email']));
        }
        ?>
" size="37" >
                            <div class="toggle-visibility" id="confirm-address"><?php 
        _e('Please confirm your email address.', 'binary-mlm-pro');
        ?>
</div>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('first-name');">
                                <?php 
        _e('First Name', 'binary-mlm-pro');
        ?>
 
                        </th>
                        <td>
                            <input type="text" name="first_name" id="first_name" value="<?php 
        if (!empty($_POST['first_name'])) {
            _e(htmlentities($_POST['first_name']));
        }
        ?>
" size="37" >
                            <div class="toggle-visibility" id="first-name"><?php 
        _e('Please enter your first name.', 'binary-mlm-pro');
        ?>
</div>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('last-name');">
                                <?php 
        _e('Last Name', 'binary-mlm-pro');
        ?>
  </a>
                        </th>
                        <td>
                            <input type="text" name="last_name" id="last_name" value="<?php 
        if (!empty($_POST['last_name'])) {
            _e(htmlentities($_POST['last_name']));
        }
        ?>
" size="37" >
                            <div class="toggle-visibility" id="last-name"><?php 
        _e('Please confirm your last name.', 'binary-mlm-pro');
        ?>
</div>
                        </td>
                    </tr>
                </table>
                <p class="submit">
                    <input type="submit" name="submit" id="submit" value="<?php 
        _e('Submit', 'binary-mlm-pro');
        ?>
" class='button-primary' onclick="needToConfirm = false;"/>
                </p>
            </form>
        </div>	
        <script language="JavaScript">
            populateArrays();
        </script>
        <?php 
    } else {
        _e("<script>window.location='admin.php?page=admin-settings&tab=general&msg=s'</script>");
    }
}
 } else {
     $leg = $_POST['leg'];
 }
 if ($leg != '0') {
     if ($leg != '1') {
         $error .= "\n You have enter a wrong placement.";
     }
 }
 //generate random numeric key for new user registration
 $user_key = generateKey();
 //if generated key is already exist in the DB then again re-generate key
 do {
     $check = mysql_fetch_array(mysql_query("SELECT COUNT(*) ck \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . WPMLM_TABLE_USER . " \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_key` = '" . $user_key . "'"));
     $flag = 1;
     if ($check['ck'] == 1) {
         $user_key = generateKey();
         $flag = 0;
     }
 } while ($flag == 0);
 //check parent key exist or not
 if (isset($_GET['k']) && $_GET['k'] != '') {
     if (!checkKey($_GET['k'])) {
         $error .= "\n Parent key does't exist.";
     }
     // check if the user can be added at the current position
     $checkallow = checkallowed($_GET['k'], $leg);
     if ($checkallow >= 1) {
         $error .= "\n You have enter a wrong placement.";
     }
 }
 // outer if condition
예제 #10
0
     }
     $content .= "</tr>";
 }
 $content .= "</tbody>\n\t\t</table>\n\t\t<br>\n\t\t<br>\n\t\t<b><u>Proceso de revisión:</u></b> " . $_POST[TER_procesorevision] . "<br>\n\t\t<b><u>Fecha estimada de firma:</u></b> " . $_POST[TER_fechafirma] . "<br>\n\t\t<b><u>Depósito de seriedad:</u></b> " . $_POST[TER_deposito] . "<br>\n\t\t<b><u>Referencia:</u></b> Puede realizar el depósito de seriedad con la referencia: " . $_POST[TER_referencia] . ", a la cuenta de Banorte: 0806433934, CLABE: 072225008064339344, a nombre de: Préstamo Empresarial Oportuno S.A. de C.V. SOFOM ENR.<br>\n\t\t<br>\n\t\t\n\t\t<nobreak>\n\t\t<table cellspacing='0' style='width: 100%; text-align: left;'>\n\t\t\t<tr>\n\t\t\t\t<td style='width:50%;'>\n\t\t\t\t\tAtentamente<br><br>\n\t\t\t\t\t" . $_POST[TER_remitente] . "<br>\n\t\t\t\t\t" . $_POST[TER_puesto] . "<br>\n\t\t\t\t\tPréstamo Empresarial Oportuno, S.A. de C.V., SOFOM, E.N.R.<br>\n\t\t\t\t</td>\n\t\t\t\t<td style='width:50%;'>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</nobreak>\n\t\t</page>";
 // convert to PDF
 require_once '../../html2pdf/html2pdf.class.php';
 try {
     $html2pdf = new HTML2PDF('P', 'Letter', 'es');
     $html2pdf->pdf->SetDisplayMode('fullpage');
     //$html2pdf->pdf->SetProtection(array('print'), 'spipu');
     $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
     $ruta = "../../expediente/";
     $nombreoriginal = "TC" . $date . "-" . strtoupper($myroworg[organizacion]);
     $nombre = "T" . time() . "C" . rand(100, 999) . rand(10, 99) . ".pdf";
     $html2pdf->Output($ruta . $nombre, 'F');
     $clavearchivo = generateKey();
     //Verificar si ya hay archivo de TERMINOS Y CONDICIONES generado
     $sqlfile = "SELECT * FROM archivos WHERE id_tipoarchivo='10' AND id_oportunidad='" . $_POST[oportunidad] . "'";
     $rsfile = mysql_query($sqlfile, $db);
     $rwfile = mysql_fetch_array($rsfile);
     $archivoanterior = "../../expediente/" . $rwfile[nombre];
     if ($rwfile) {
         //Obtener referencia anterior
         $sqref = "SELECT * FROM `referencias` WHERE asignada=1 AND descartado=0 AND clave_oportunidad='" . $myrowopt[clave_oportunidad] . "' ORDER BY fecha_asignacion ASC LIMIT 1";
         $rsref = mysql_query($sqlref, $db);
         $rwref = mysql_fetch_array($rsref);
         unlink($archivoanterior);
         //Borrar archivo anterior
         $sqlarchivo = "UPDATE `archivos` SET `nombre`='{$nombre}', `fecha_modificacion`=NOW(), `aprobado`='0' WHERE `id_archivo` = '" . $rwfile[id_archivo] . "'";
         //Actualizar registro
         $sqlhistorial = "INSERT INTO `historialarchivos`(`id_historialarchivo`, `clave_archivo`, `id_oportunidad`, `id_expediente`, `actividad`, `motivo`, `fecha_actividad`, `usuario`) VALUES (NULL, '{$rwfile['clave_archivo']}', '{$_POST['oportunidad']}','3','Reemplazado', '', NOW(),'{$claveagente}')";
예제 #11
0
<?php

include "DatabaseHandling.php";
$key = "";
$char = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$conn = openConnection();
$longlink = "{$_POST['urllink']}";
$key = checkForDuplicateLinks($longlink, $conn);
if ($key === NULL) {
    $key = generateKey(6);
    $finalKey = checkForDuplicateKeys($key, $conn);
    addDataToDatabase($key, $longlink, $conn);
}
$myfile = fopen("{$key}", "w") or die("Unable to open file!");
$myfileToRead = fopen("check.php", "r") or die("Unable to open file!");
$txt = fread($myfileToRead, filesize("check.php"));
fclose($myfileToRead);
fwrite($myfile, $txt);
fclose($myfile);
$conn->close();
//header( 'Location: http://kclproject.esy.es/shorten/');
예제 #12
0
$realm = !array_key_exists('realm', $_GET) ? $recruit_realm : urldecode($_GET['realm']);
$region = !array_key_exists('region', $_GET) ? $recriot_region : urldecode($_GET['region']);
// connect to mysql and select the database
$conn = mysql_connect(WHP_DB_HOST, WHP_DB_USER, WHP_DB_PASS) or die(mysql_error());
mysql_select_db(WHP_DB_NAME) or die(mysql_error());
if ($name == '') {
    print 'No name provided.';
    mysql_close($conn);
    exit;
}
if ($mode == '') {
    print 'No mode provided.';
    mysql_close($conn);
    exit;
}
$key = generateKey($name, $realm, $region);
if (trim($key) == '') {
    print 'Unique key not provided.';
    mysql_close($conn);
    exit;
}
if ($mode == 'gearlist') {
    $query = mysql_query("SELECT gearlist FROM " . WHP_DB_PREFIX . "recruit WHERE uniquekey='{$key}' AND cache > UNIX_TIMESTAMP(NOW()) - {$recruit_cache} LIMIT 1");
    list($list) = @mysql_fetch_array($query);
    if (mysql_num_rows($query) == 0 || trim($list) == '') {
        // nothing in the cache, so we need to query
        $xml_data = getXML(characterURL($name, $region, $realm));
        if (!($xml = @simplexml_load_string($xml_data, 'SimpleXMLElement'))) {
            print $language->words['invalid_xml'];
            mysql_close($conn);
            exit;
예제 #13
0
function hillEncrypt($plaintext)
{
    $sizeOfKey = rand(2, 9);
    $_SESSION["key"] = generateKey($sizeOfKey);
    return encode($plaintext, $_SESSION["key"], $sizeOfKey);
}
예제 #14
0
<?php

function generateKey($length = 10)
{
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
$rankey = generateKey();
echo $rankey;
$con = mysqli_connect("localhost", "cl10-admin-uzl", "supernova", "cl10-admin-uzl");
$sql = "INSERT INTO `user`(`emailid`,`pwd`,`key`) VALUES ('{$_POST['email']}','{$_POST['pwd']}','{$rankey}')";
if (!mysqli_query($con, $sql)) {
    echo "Could not enter data" . mysqli_error($con);
}
예제 #15
0
 function generate()
 {
     foreach ($this->arr as $l) {
         foreach ($this->regex as $key => $r) {
             if (preg_match($r, $l, $matches)) {
                 switch ($key) {
                     case 'sess_id':
                         $this->jingle->addAttribute('sid', $this->getSessionId());
                         break;
                     case 'media':
                         $this->content = $this->jingle->addChild('content');
                         $this->transport = $this->content->addChild('transport');
                         $this->transport->addAttribute('xmlns', "urn:xmpp:jingle:transports:ice-udp:1");
                         $this->content->addAttribute('creator', 'initiator');
                         // TODO à fixer !
                         $this->content->addAttribute('name', $matches[1]);
                         // The description node
                         if ($this->action != 'transport-info') {
                             $description = $this->content->addChild('description');
                             $description->addAttribute('xmlns', "urn:xmpp:jingle:apps:rtp:1");
                             $description->addAttribute('media', $matches[1]);
                         }
                         if (!empty($this->global_fingerprint)) {
                             $fingerprint = $this->transport->addChild('fingerprint', $this->global_fingerprint['fingerprint']);
                             $this->transport->addAttribute('pwd', $this->global_fingerprint['pwd']);
                             $this->transport->addAttribute('ufrag', $this->global_fingerprint['ufrag']);
                             $fingerprint->addAttribute('xmlns', "urn:xmpp:jingle:apps:dtls:0");
                             $fingerprint->addAttribute('hash', $this->global_fingerprint['hash']);
                         }
                         break;
                     case 'bandwidth':
                         $bandwidth = $description->addChild('bandwidth');
                         $bandwidth->addAttribute('type', $matches[1]);
                         $bandwidth->addAttribute('value', $matches[2]);
                         break;
                     case 'rtpmap':
                         $payloadtype = $description->addChild('payload-type');
                         $payloadtype->addAttribute('id', $matches[1]);
                         $payloadtype->addAttribute('name', $matches[3]);
                         if (isset($matches[4])) {
                             $payloadtype->addAttribute('clockrate', $matches[5]);
                         }
                         if (isset($matches[7])) {
                             $payloadtype->addAttribute('channels', $matches[7]);
                         }
                         break;
                         // http://xmpp.org/extensions/xep-0167.html#format
                     // http://xmpp.org/extensions/xep-0167.html#format
                     case 'fmtp':
                         // This work only if fmtp is added just after
                         // the correspondant rtpmap
                         if ($matches[1] == $payloadtype->attributes()->id) {
                             $params = explode(';', $matches[2]);
                             foreach ($params as $value) {
                                 $p = explode('=', trim($value));
                                 $parameter = $payloadtype->addChild('parameter');
                                 if (count($p) == 1) {
                                     $parameter->addAttribute('value', $p[0]);
                                 } else {
                                     $parameter->addAttribute('name', $p[0]);
                                     $parameter->addAttribute('value', $p[1]);
                                 }
                             }
                         }
                         break;
                     case 'rtcp_fb':
                         if ($matches[1] == '*') {
                             $rtcpfp = $description->addChild('rtcp-fb');
                         } else {
                             $rtcpfp = $payloadtype->addChild('rtcp-fb');
                         }
                         $rtcpfp->addAttribute('xmlns', "urn:xmpp:jingle:apps:rtp:rtcp-fb:0");
                         $rtcpfp->addAttribute('id', $matches[1]);
                         $rtcpfp->addAttribute('type', $matches[2]);
                         if (isset($matches[4])) {
                             $rtcpfp->addAttribute('subtype', $matches[4]);
                         }
                         break;
                     case 'rtcp_fb_trr_int':
                         $rtcpfp = $payloadtype->addChild('rtcp-fb-trr-int');
                         $rtcpfp->addAttribute('xmlns', "urn:xmpp:jingle:apps:rtp:rtcp-fb:0");
                         $rtcpfp->addAttribute('id', $matches[1]);
                         $rtcpfp->addAttribute('value', $matches[2]);
                         break;
                         // http://xmpp.org/extensions/xep-0167.html#srtp
                     // http://xmpp.org/extensions/xep-0167.html#srtp
                     case 'crypto':
                         $encryption = $description->addChild('encryption');
                         $crypto = $encryption->addChild('crypto');
                         $crypto->addAttribute('crypto-suite', $matches[2]);
                         $crypto->addAttribute('key-params', $matches[3]);
                         $crypto->addAttribute('tag', $matches[1]);
                         if (isset($matches[5])) {
                             $crypto->addAttribute('session-params', $matches[5]);
                         }
                         break;
                         // http://xmpp.org/extensions/xep-0262.html
                     // http://xmpp.org/extensions/xep-0262.html
                     case 'zrtp_hash':
                         $zrtphash = $encryption->addChild('zrtp-hash', $matches[2]);
                         $zrtphash->addAttribute('xmlns', "urn:xmpp:jingle:apps:rtp:zrtp:1");
                         $zrtphash->addAttribute('version', $matches[1]);
                         break;
                     case 'rtcp_mux':
                         $description->addChild('rtcp-mux');
                         break;
                         // http://xmpp.org/extensions/xep-0294.html
                     // http://xmpp.org/extensions/xep-0294.html
                     case 'extmap':
                         $rtphdrext = $description->addChild('rtp-hdrext');
                         $rtphdrext->addAttribute('xmlns', "urn:xmpp:jingle:apps:rtp:rtp-hdrext:0");
                         $rtphdrext->addAttribute('id', $matches[1]);
                         $rtphdrext->addAttribute('uri', $matches[4]);
                         if (isset($matches[3]) && $matches[3] != '') {
                             $rtphdrext->addAttribute('senders', $matches[3]);
                         }
                         break;
                         // http://xmpp.org/extensions/inbox/jingle-source.html
                     // http://xmpp.org/extensions/inbox/jingle-source.html
                     case 'ssrc':
                         if (!$description->source) {
                             $ssrc = $description->addChild('source');
                             $ssrc->addAttribute('xmlns', "urn:xmpp:jingle:apps:rtp:ssma:0");
                             $ssrc->addAttribute('id', $matches[1]);
                         }
                         $param = $ssrc->addChild('parameter');
                         $param->addAttribute('name', $matches[2]);
                         $param->addAttribute('value', $matches[4]);
                         break;
                     case 'ptime':
                         $description->addAttribute('ptime', $matches[1]);
                         break;
                     case 'maxptime':
                         $description->addAttribute('maxptime', $matches[1]);
                         break;
                         // http://xmpp.org/extensions/xep-0338.html
                     // http://xmpp.org/extensions/xep-0338.html
                     case 'group':
                         $group = $this->jingle->addChild('group');
                         $group->addAttribute('xmlns', "urn:xmpp:jingle:apps:grouping:0");
                         $group->addAttribute('semantics', $matches[1]);
                         $params = explode(' ', $matches[2]);
                         foreach ($params as $value) {
                             $content = $group->addChild('content');
                             $content->addAttribute('name', trim($value));
                         }
                         break;
                         // http://xmpp.org/extensions/xep-0320.html
                     // http://xmpp.org/extensions/xep-0320.html
                     case 'fingerprint':
                         if ($this->content == null) {
                             $this->global_fingerprint['fingerprint'] = $matches[2];
                             $this->global_fingerprint['hash'] = $matches[1];
                         } else {
                             $fingerprint = $this->transport->addChild('fingerprint', $matches[2]);
                             $fingerprint->addAttribute('xmlns', "urn:xmpp:jingle:apps:dtls:0");
                             $fingerprint->addAttribute('hash', $matches[1]);
                         }
                         break;
                         // http://xmpp.org/extensions/inbox/jingle-dtls.html
                     // http://xmpp.org/extensions/inbox/jingle-dtls.html
                     case 'sctpmap':
                         $sctpmap = $this->transport->addChild('sctpmap');
                         $sctpmap->addAttribute('xmlns', "urn:xmpp:jingle:transports:dtls-sctp:1");
                         $sctpmap->addAttribute('number', $matches[1]);
                         $sctpmap->addAttribute('protocol', $matches[2]);
                         $sctpmap->addAttribute('streams', $matches[3]);
                         break;
                     case 'setup':
                         if ($this->content != null) {
                             $fingerprint->addAttribute('setup', $matches[1]);
                         }
                         break;
                     case 'pwd':
                         if ($this->content == null) {
                             $this->global_fingerprint['pwd'] = $matches[1];
                         } else {
                             $this->transport->addAttribute('pwd', $matches[1]);
                         }
                         break;
                     case 'ufrag':
                         if ($this->content == null) {
                             $this->global_fingerprint['ufrag'] = $matches[1];
                         } else {
                             $this->transport->addAttribute('ufrag', $matches[1]);
                         }
                         break;
                     case 'candidate':
                         $generation = "0";
                         $network = "0";
                         $id = generateKey(10);
                         if ($key = array_search("generation", $matches)) {
                             $generation = $matches[$key + 1];
                         }
                         if ($key = array_search("network", $matches)) {
                             $network = $matches[$key + 1];
                         }
                         if ($key = array_search("id", $matches)) {
                             $id = $matches[$key + 1];
                         }
                         if (isset($matches[11]) && isset($matches[13])) {
                             $reladdr = $matches[11];
                             $relport = $matches[13];
                         } else {
                             $reladdr = $relport = null;
                         }
                         $candidate = $this->transport->addChild('candidate');
                         $candidate->addAttribute('component', $matches[2]);
                         $candidate->addAttribute('foundation', $matches[1]);
                         $candidate->addAttribute('generation', $generation);
                         $candidate->addAttribute('id', $id);
                         $candidate->addAttribute('ip', $matches[5]);
                         $candidate->addAttribute('network', $network);
                         $candidate->addAttribute('port', $matches[6]);
                         $candidate->addAttribute('priority', $matches[4]);
                         $candidate->addAttribute('protocol', $matches[3]);
                         $candidate->addAttribute('type', $matches[8]);
                         if ($reladdr) {
                             $candidate->addAttribute('rel-addr', $reladdr);
                             $candidate->addAttribute('rel-port', $relport);
                         }
                         break;
                 }
             }
         }
     }
     // We reindent properly the Jingle package
     $xml = $this->jingle->asXML();
     $doc = new \DOMDocument();
     $doc->loadXML($xml);
     $doc->formatOutput = true;
     return substr($doc->saveXML(), strpos($doc->saveXML(), "\n") + 1);
 }
예제 #16
0
function join_network_page()
{
    global $wpdb, $current_user;
    $user_id = $current_user->ID;
    $table_prefix = mlm_core_get_table_prefix();
    $error = '';
    $chk = 'error';
    global $current_user;
    get_currentuserinfo();
    if (!empty($_GET['sp_name'])) {
        $sp_name = $_GET['sp_name'];
        ?>
        <script>$.cookie('s_name', '<?php 
        echo $sp_name;
        ?>
', {path: '/'});</script>

        <?php 
        //setcookie("s_name", $sp_name);
    } else {
        if (!empty($_GET['sp'])) {
            $sp_name = getusernamebykey($_GET['sp']);
            ?>
        <script>$.cookie('s_name', '<?php 
            echo $sp_name;
            ?>
', {path: '/'});</script>

        <?php 
        } else {
            $sp_name = $_COOKIE["s_name"];
        }
    }
    /*     * ****date format ***** */
    $date_format = get_option('date_format');
    $time_format = get_option('time_format');
    /*     * ****** end******* */
    $mlm_general_settings = get_option('wp_mlm_general_settings');
    $mlm_no_of_level = $mlm_general_settings['mlm-level'];
    $mlm_pay_settings = get_option('wp_mlm_payment_settings');
    $mlm_method = get_option('wp_mlm_payment_method');
    if (isset($_REQUEST['sp_name']) && $_REQUEST['sp_name'] != '') {
        //$sponsorName = getusernamebykey($_REQUEST['sp']);
        $sponsorName = $_REQUEST['sp_name'];
        if (isset($sponsorName) && $sponsorName != '') {
            $readonly_sponsor = 'readonly';
            $sponsor_name = $sponsorName;
        }
    } else {
        if (isset($_COOKIE["s_name"]) && $_COOKIE["s_name"] != '') {
            $readonly_sponsor = 'readonly';
            $sponsor_name = $_COOKIE["s_name"];
        } else {
            if (isset($_REQUEST['sp']) && $_REQUEST['sp'] != '') {
                //$sponsorName = getusernamebykey($_REQUEST['sp']);
                $sponsorName = getusernamebykey($_REQUEST['sp']);
                if (isset($sponsorName) && $sponsorName != '') {
                    $readonly_sponsor = 'readonly';
                    $sponsor_name = $sponsorName;
                }
            } else {
                $readonly_sponsor = '';
            }
        }
    }
    //most outer if condition
    if (isset($_POST['submit'])) {
        $sponsor = sanitize_text_field($_POST['sponsor']);
        if (empty($sponsor)) {
            $sponsor = $wpdb->get_var("select `username` FROM {$table_prefix}mlm_users order by id asc limit 1");
        }
        $firstname = sanitize_text_field($_POST['firstname']);
        $lastname = sanitize_text_field($_POST['lastname']);
        $email = sanitize_text_field($_POST['email']);
        /*         * ***** check for the epin field ***** */
        if (isset($_POST['epin']) && !empty($_POST['epin'])) {
            $epin = sanitize_text_field($_POST['epin']);
        } else {
            if (isset($_POST['epin']) && empty($_POST['epin'])) {
                $epin = '';
            }
        }
        /*         * ***** check for the epin field ***** */
        /* $address1 = sanitize_text_field( $_POST['address1'] );
                  $address2 = sanitize_text_field( $_POST['address2'] );
        
                  $city = sanitize_text_field( $_POST['city'] );
                  $state = sanitize_text_field( $_POST['state'] );
                  $postalcode = sanitize_text_field( $_POST['postalcode'] );
                  $telephone = sanitize_text_field( $_POST['telephone'] );
                  $dob = sanitize_text_field( $_POST['dob'] ); */
        //Add usernames we don't want used
        $invalid_usernames = array('admin');
        //Do username validation
        $sql = "SELECT COUNT(*) num, `user_key` \n\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\tWHERE `username` = '" . $sponsor . "'";
        //Case If User is not fill the Sponser field
        $intro = $wpdb->get_row($sql);
        if (checkInputField($firstname)) {
            $error .= "\n Please enter your first name.";
        }
        if (checkInputField($lastname)) {
            $error .= "\n Please enter your last name.";
        }
        if (checkInputField($email)) {
            $error .= "\n Please enter your email address.";
        }
        /*         * ***** check for the epin field ***** */
        if (isset($epin) && !empty($epin)) {
            if (epin_exists($epin)) {
                $error .= "\n ePin already issued or wrong ePin.";
            }
        }
        if ($mlm_general_settings['sol_payment'] == 1) {
            if (isset($_POST['epin']) && empty($_POST['epin'])) {
                $error .= "\n Please enter your ePin.";
            }
        }
        /*         * ***** check for the epin field ***** */
        /* if ( checkInputField($address1) ) 
                  $error .= "\n Please enter your address.";
        
                  if ( checkInputField($city) )
                  $error .= "\n Please enter your city.";
        
                  if ( checkInputField($state) )
                  $error .= "\n Please enter your state.";
        
                  if ( checkInputField($postalcode) )
                  $error .= "\n Please enter your postal code.";
        
                  if ( checkInputField($telephone) )
                  $error .= "\n Please enter your contact number.";
        
                  if ( checkInputField($dob) )
                  $error .= "\n Please enter your date of birth."; */
        //generate random numeric key for new user registration
        $user_key = generateKey();
        //if generated key is already exist in the DB then again re-generate key
        do {
            $check = $wpdb->get_var("SELECT COUNT(*) ck \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_key` = '" . $user_key . "'");
            $flag = 1;
            if ($check == 1) {
                $user_key = generateKey();
                $flag = 0;
            }
        } while ($flag == 0);
        // outer if condition
        if (empty($error)) {
            // inner if condition
            if ($intro->num == 1) {
                $sponsor = $intro->user_key;
                $parent_key = $sponsor;
                // return the wp_users table inserted user's ID
                wp_update_user(array('ID' => $user_id, 'role' => 'mlm_user'));
                $username = $current_user->user_login;
                //get the selected country name from the country table
                $country = $_POST['country'];
                $sql = "SELECT name \n\t\t\t\t\t\tFROM {$table_prefix}mlm_country\n\t\t\t\t\t\tWHERE id = '" . $country . "'";
                $country1 = $wpdb->get_var($sql);
                //insert the registration form data into user_meta table
                $user = array('ID' => $user_id, 'first_name' => $firstname, 'last_name' => $lastname, 'user_email' => $email, 'role' => 'mlm_user');
                // return the wp_users table inserted user's ID
                $user_id = wp_update_user($user);
                /* add_user_meta( $user_id, 'user_address1', $address1, FALSE );  
                   add_user_meta( $user_id, 'user_address2', $address2, FALSE );
                   add_user_meta( $user_id, 'user_city', $city, FALSE );
                   add_user_meta( $user_id, 'user_state', $state, FALSE );
                   add_user_meta( $user_id, 'user_country', $country1, FALSE );
                   add_user_meta( $user_id, 'user_postalcode', $postalcode, FALSE );
                   add_user_meta( $user_id, 'user_telephone', $telephone, FALSE );
                   add_user_meta( $user_id, 'user_dob', $dob, FALSE); */
                //get the selected country name from the country table
                if (!empty($epin)) {
                    $pointResult = mysql_query("select point_status from {$table_prefix}mlm_epins where epin_no = '{$epin}'");
                    $pointStatus = mysql_fetch_row($pointResult);
                    // to epin point status 1
                    if ($pointStatus[0] == '1') {
                        $paymentStatus = '1';
                    } else {
                        if ($pointStatus[0] == '0') {
                            $paymentStatus = '2';
                        }
                    }
                } else {
                    // to non epin
                    $paymentStatus = '0';
                }
                //insert the data into fa_user table
                $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t   (\n\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, payment_status\n\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '" . $parent_key . "', '" . $sponsor . "','" . $paymentStatus . "'\n\t\t\t\t\t\t\t)";
                $wpdb->query($insert);
                //hierarchy code for genology
                InsertHierarchy($user_key, $sponsor);
                if (isset($epin) && !empty($epin)) {
                    $sql = "update {$table_prefix}mlm_epins set user_key='{$user_key}', date_used=now(), status=1 where epin_no ='{$epin}' ";
                    // Update epin according user_key (19-07-2013)
                    mysql_query($sql);
                    if ($paymentStatus == 1) {
                        UserStatusUpdate($user_id);
                    }
                }
                $chk = '';
                $msg = "<span style='color:green;'>Congratulations! You have successfully Join MLM</span>";
                $check_paid = $wpdb->get_var("SELECT payment_status FROM {$table_prefix}mlm_users WHERE user_id = '" . $user_id . "'");
                if ($check_paid == '0') {
                    PayNowOptions($user_id, 'join_net');
                }
            } else {
                $error = "\n Sponsor does not exist in the system.";
            }
        }
        //end inner if condition
    }
    //end outer if condition
    // }
    //if any error occoured
    if (!empty($error)) {
        $error = nl2br($error);
    }
    if ($chk != '') {
        //include 'js-validation-file.html';
        ?>
        <script type="text/javascript">
            var popup1, popup2, splofferpopup1;
            var bas_cal, dp_cal1, dp_cal2, ms_cal; // declare the calendars as global variables 
            window.onload = function() {
                dp_cal1 = new Epoch('dp_cal1', 'popup', document.getElementById('dob'));
            };

            function checkReferrerAvailability(str)
            {
                if (isSpclChar(str, 'sponsor') == false)
                {
                    document.getElementById('sponsor').focus();
                    return false;
                }
                var xmlhttp;

                if (str != "") {

                    if (window.XMLHttpRequest)
                    {// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp = new XMLHttpRequest();
                    }
                    else
                    {// code for IE6, IE5
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange = function()
                    {
                        if (xmlhttp.status == 200 && xmlhttp.readyState == 4)
                        {
                            document.getElementById("check_referrer").innerHTML = xmlhttp.responseText;
                        }
                    }
                    xmlhttp.open("GET", "<?php 
        echo MLM_PLUGIN_URL . 'ajax/check_username.php';
        ?>
" + "?action=sponsor&q=" + str, true);
                    xmlhttp.send();

                }
            }
        </script>		

        <?php 
        if ($current_user->roles[0] == 'mlm_user') {
            echo "Your are already a MLM user";
        } else {
            $fname = get_user_meta($user_id, 'first_name', true);
            $lname = get_user_meta($user_id, 'last_name', true);
            $u_email = $current_user->user_email;
            ?>
            <span style='color:red;'><?php 
            echo $error;
            ?>
</span>
            <?php 
            if (isset($msg) && $msg != "") {
                echo $msg;
            }
            ?>
	
            <form name="frm" method="post" action="" onSubmit="return JoinNetworkformValidation();">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">


                    <tr><td colspan="2">&nbsp;</td></tr>

                    <tr>
                        <td><?php 
            _e('First Name', 'unilevel-mlm-pro');
            ?>
 <span style="color:red;">*</span> :</td>
                        <td><input type="text" name="firstname" id="firstname" value="<?php 
            if (!empty($fname)) {
                _e(htmlentities($fname));
            } elseif (!empty($_POST['firstname'])) {
                _e(htmlentities($_POST['firstname']));
            }
            ?>
" maxlength="20" size="37" onBlur="return checkname(this.value, 'firstname');" ></td>
                    </tr>

                    <tr><td colspan="2">&nbsp;</td></tr>

                    <tr>
                        <td><?php 
            _e('Last Name', 'unilevel-mlm-pro');
            ?>
 <span style="color:red;">*</span> :</td>
                        <td><input type="text" name="lastname" id="lastname" value="<?php 
            if (!empty($lname)) {
                _e(htmlentities($lname));
            } elseif (!empty($_POST['lastname'])) {
                _e(htmlentities($_POST['lastname']));
            }
            ?>
" maxlength="20" size="37" onBlur="return checkname(this.value, 'lastname');"></td>
                    </tr>
                    <tr><td colspan="2">&nbsp;</td></tr>


                    <tr>
                        <td><?php 
            _e('Email', 'unilevel-mlm-pro');
            ?>
 <span style="color:red;">*</span> :</td>
                        <td><input type="text" name="email" id="email" value="<?php 
            if (!empty($u_email)) {
                _e(htmlentities($u_email));
            } elseif (!empty($_POST['email'])) {
                _e(htmlentities($_POST['email']));
            }
            ?>
"  size="37" ></td>
                    </tr>

                    <tr><td colspan="2">&nbsp;</td></tr>

                    <tr>
            <?php 
            if (isset($sponsor_name) && $sponsor_name != '') {
                $spon = $sponsor_name;
            } else {
                if (isset($_POST['sponsor'])) {
                    $spon = htmlentities($_POST['sponsor']);
                }
            }
            ?>
                        <td><?php 
            _e('Sponsor Name', 'unilevel-mlm-pro');
            ?>
 <span style="color:red;">*</span> :</td>
                        <td>
                            <input type="text" name="sponsor" id="sponsor" value="<?php 
            if (!empty($spon)) {
                _e($spon);
            }
            ?>
" maxlength="20" size="37" onBlur="checkReferrerAvailability(this.value);" <?php 
            echo $readonly_sponsor;
            ?>
>
                            <br /><div id="check_referrer"></div>
                        </td>
                    </tr>
            <?php 
            if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1' && isset($mlm_general_settings['sol_payment']) && $mlm_general_settings['sol_payment'] == '1') {
                ?>
                        <tr><td colspan="2">&nbsp;</td></tr>
                        <tr>
                            <td><?php 
                _e('Enter ePin', 'unilevel-mlm-pro');
                ?>
<span style="color:red;">*</span> :</td>
                            <td><input type="text" name="epin" id="epin" value="<?php 
                if (!empty($_POST['epin'])) {
                    _e(htmlentities($_POST['epin']));
                }
                ?>
" maxlength="20" size="37" onBlur="checkePinAvailability(this.value);"><br /><div id="check_epin"></div></td>
                        </tr>
            <?php 
            } else {
                if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1') {
                    ?>
                        <tr><td colspan="2">&nbsp;</td></tr>
                        <tr>
                            <td><?php 
                    _e('Enter ePin', 'unilevel-mlm-pro');
                    ?>
 :</td>
                            <td><input type="text" name="epin" id="epin" value="<?php 
                    if (!empty($_POST['epin'])) {
                        _e(htmlentities($_POST['epin']));
                    }
                    ?>
" maxlength="20" size="37" onBlur="checkePinAvailability1(this.value);"><br /><div id="check_epin"></div></td>
                        </tr>
            <?php 
                }
            }
            ?>
                    <tr><td colspan="2">&nbsp;</td></tr>
                    <tr>
                        <td colspan="2"><input type="submit" name="submit" id="submit" value="<?php 
            _e('Submit', 'unilevel-mlm-pro');
            ?>
" /></td>
                    </tr>
                </table>
            </form>
            <?php 
        }
    } else {
        _e($msg);
    }
}
예제 #17
0
function railfenceEncrypt($plaintext)
{
    $_SESSION["key"] = generateKey();
    return encode($plaintext, $_SESSION["key"]);
}
예제 #18
0
function bitwiseEncrypt($plaintext)
{
    $_SESSION["key"] = generateKey(strlen($plaintext));
    return encode($plaintext, $_SESSION["key"]);
}
예제 #19
0
파일: roster.php 프로젝트: Clausi/tenebrae
<?php

define('IN_PHPBB', true);
$phpbb_root_path = defined('PHPBB_ROOT_PATH') ? PHPBB_ROOT_PATH : './../../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include $phpbb_root_path . 'common.' . $phpEx;
include $phpbb_root_path . 'guild/includes/constants.' . $phpEx;
include $phpbb_root_path . 'guild/includes/functions.' . $phpEx;
include $phpbb_root_path . 'guild/includes/wowarmoryapi.' . $phpEx;
$armory = new BattlenetArmory($GuildRegion, $GuildRealm);
$armory->setLocale($armoryLocale);
$armory->UTF8(TRUE);
$guild = $armory->getGuild($GuildName);
$members = $guild->getMembers();
// echo "<pre>";
// print_r($members);
// echo "</pre>";
if (!is_array($members)) {
    trigger_error("No roster array, armory not reachable", E_USER_ERROR);
    exit;
}
foreach ($members as $char) {
    $character = $char['character'];
    $query = "INSERT INTO\n\t\t\t\t\t" . $TableNames['roster'] . "\n\t\t\t\tSET\n\t\t\t\t\tuniquekey = '" . generateKey($character['name'], $db->sql_escape($character['realm']), "EU") . "',\n\t\t\t\t\tname = '" . $db->sql_escape($character['name']) . "',\n\t\t\t\t\trealm = '" . $db->sql_escape($character['realm']) . "',\n\t\t\t\t\tbattlegroup = '" . $db->sql_escape($character['battlegroup']) . "',\n\t\t\t\t\tguild = '" . $db->sql_escape($character['guild']) . "',\n\t\t\t\t\tguildRealm = '" . $db->sql_escape($character['guildRealm']) . "',\n\t\t\t\t\trank = '" . $char['rank'] . "',\n\t\t\t\t\tclass = '" . $character['class'] . "', \n\t\t\t\t\trace = '" . $character['race'] . "',\n\t\t\t\t\tgender = '" . $character['gender'] . "',\n\t\t\t\t\tlevel = '" . $character['level'] . "',\n\t\t\t\t\tachievementPoints = '" . $character['achievementPoints'] . "',\n\t\t\t\t\tthumbnail = '" . $db->sql_escape($character['thumbnail']) . "',\n\t\t\t\t\tthumbnailURL = '" . $db->sql_escape($character['thumbnailURL']) . "',\n\t\t\t\t\tactive = '1',\n\t\t\t\t\tfirstseen = NOW(),\n\t\t\t\t\tcache = NOW()\n\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t\trealm = '" . $db->sql_escape($character['realm']) . "',\n\t\t\t\t\tbattlegroup = '" . $db->sql_escape($character['battlegroup']) . "',\n\t\t\t\t\tguild = '" . $db->sql_escape($character['guild']) . "',\n\t\t\t\t\tguildRealm = '" . $db->sql_escape($character['guildRealm']) . "',\n\t\t\t\t\trank = '" . $char['rank'] . "',\n\t\t\t\t\tclass = '" . $character['class'] . "', \n\t\t\t\t\trace = '" . $character['race'] . "',\n\t\t\t\t\tgender = '" . $character['gender'] . "',\n\t\t\t\t\tlevel = '" . $character['level'] . "',\n\t\t\t\t\tachievementPoints = '" . $character['achievementPoints'] . "',\n\t\t\t\t\tthumbnail = '" . $db->sql_escape($character['thumbnail']) . "',\n\t\t\t\t\tthumbnailURL = '" . $db->sql_escape($character['thumbnailURL']) . "',\n\t\t\t\t\tactive = '1',\n\t\t\t\t\tcache = NOW()\n\t\t\t\t";
    $result = $db->sql_query($query);
}
$db->sql_freeresult($result);
// Deactivate characters not seen last 12 hours
$query = "UPDATE " . $TableNames['roster'] . " SET active = 0 WHERE cache < DATE_SUB(NOW(),INTERVAL 12 HOUR)";
$result = $db->sql_query($query);
예제 #20
0
     }
     $nombrecompleto = $_POST[CONapellido] . " " . $_POST[CONnombre];
     $fechanacimiento = $Anio . "-" . $_POST[CONdianac] . "-" . $_POST[CONmesnac];
     $sql = "UPDATE `contactos` SET `apellidos` = '{$_POST['CONapellido']}', `nombre` = '{$_POST['CONnombre']}', `nombre_completo` = '{$nombrecompleto}', `rep_legal`='{$_POST['CONrep_legal']}', `tipo_persona`='{$_POST['tipo_persona']}', `fecha_nacimiento` = '{$fechanacimiento}', `dia_cumpleanios` = '{$_POST['CONdianac']}', `mes_cumpleanios` = '{$_POST['CONmesnac']}', `puesto` = '{$_POST['CONpuesto']}', `telefono_oficina` = '{$_POST['CONdirecto']}', `telefono_celular` = '{$_POST['CONcelular']}', `titulo`='{$_POST['CONtitulo']}', `modifico` = '{$claveagente}', `fecha_modificacion` = NOW(), `hora_modificacion` = NOW() WHERE `id_contacto` = {$_POST['id']}";
     //echo $sql;
     //Actualizar Email
     if ($_POST[e]) {
         $sqlmail = "UPDATE `correos` SET `correo` = '{$_POST['CONemail']}' WHERE `id_correo` = {$_POST['e']}";
     } else {
         if ($_POST[CONemail]) {
             $sqlmail = "INSERT INTO `correos` (`id_correo`, `tipo_registro`, `clave_registro`, `tipo_correo`, `correo`, `capturo`, `fecha_captura`, `hora_captura`, `modifico`, `fecha_modificacion`, `hora_modificacion`, `observaciones`) VALUES (NULL, 'C', '{$clavecontacto}', 'Trabajo', '{$_POST['CONemail']}', '{$claveagente}', NOW(), NOW(), '{$claveagente}', NOW(), NOW(), '')";
         } else {
         }
     }
 } elseif ($_POST[operacion] == 'I') {
     $clavecontacto = generateKey();
     $nombrecompleto = $_POST[CONapellido] . " " . $_POST[CONnombre];
     $fechanacimiento = $Anio . "-" . $_POST[CONdianac] . "-" . $_POST[CONmesnac];
     $roles = $_POST[CONrep_legal];
     $rol = "";
     $sqlrelacion = "INSERT INTO `relaciones`(`id_relacion`, `clave_organizacion`, `clave_relacion`, `clave_contacto`, `id_rol`, `rol`, `usuario_captura`, `fecha_captura`) VALUES ";
     for ($i = 0; $i < count($roles); $i++) {
         $sqlrol = "SELECT * FROM roles WHERE id_rol = '" . $roles[$i] . "'";
         $resultrol = mysql_query($sqlrol, $db);
         $myrowrol = mysql_fetch_array($resultrol);
         $rol .= $roles[$i];
         $sqlrelacion .= "(NULL,'{$_POST['organizacion']}','{$clavecontacto}','{$_POST['organizacion']}','{$roles[$i]}','{$myrowrol['rol']}','{$claveagente}',NOW())";
         if ($i < count($roles) - 1) {
             $sqlrelacion .= ",";
         }
     }
예제 #21
0
         $sqlorganizaciones = "INSERT INTO `organizaciones` (`id_organizacion` , `clave_organizacion` , `tipo_registro` , `organizacion` , `clave_unica` , `fecha_fundacion` ,`procedencia` , `tipo_organizacion` , `clave_agente` , `giro` , `estatus` , `logo` , `capturo` , `fecha_captura` , `hora_captura` , `modifico` , `fecha_modificacion` , `hora_modificiacion` , `usuario_ultimo_contacto` , `fecha_ultimo_contacto` , `hora_ultimo_contacto`, `observaciones`, `tipo_persona`, `clave_web`, `forma_contacto`,`asignado`) VALUES \n\t(NULL , '{$claverelacion}', 'O', '{$organizacion}', '', '', '', 'Garante', '{$claveagente}', '', '1', '', '{$claveagente}', NOW(), NOW(), '{$claveagente}', NOW(), NOW(), '{$claveagente}', NOW(), NOW(), '', 'Moral', '', '', '1')";
         $sqlrelacion = "INSERT INTO `relaciones`(`id_relacion`, `clave_organizacion`, `clave_contacto`, `clave_relacion`, `id_rol`, `rol`, `usuario_captura`, `fecha_captura`,`clave_oportunidad`) VALUES (NULL,'{$claveorganizacion}','','{$claverelacion}','3','Garante','{$claveagente}',NOW(),'{$myrowopt['clave_oportunidad']}')";
         $sqlgarante = "DELETE FROM `relaciones` WHERE `id_relacion`='" . $rwrelacion[id_relacion] . "'";
         if ($_POST[nombre_moral_legal] || $_POST[apellido_moral_legal]) {
             $clavelegal = generateKey();
             $nombrecompletolegal = $_POST[nombre_moral_legal] . " " . $_POST[apellido_moral_legal];
             $sqllegal = "INSERT INTO `contactos` (`id_contacto`, `clave_contacto`, `tipo_registro`, `clave_unica`, `clave_organizacion`, `organizacion`, `apellidos`, `nombre`, `nombre_completo`, `rep_legal`, `tipo_persona`, `genero`, `edad`, `fecha_nacimiento`, `dia_cumpleanios`, `mes_cumpleanios`, `ocupacion`, `puesto`, `telefono_casa`, `telefono_oficina`, `telefono_celular`, `telefono_otro1`, `telefono_otro2`, `titulo`, `rfc`, `curp`, `procedencia`, `escolaridad`, `estado_civil`, `potencial`, `tipo_contacto`, `clave_agente`, `estatus`, `aprobado`, `capturo`, `fecha_captura`, `hora_captura`, `modifico`, `fecha_modificacion`, `hora_modificacion`, `usuario_ultimo_contacto`, `fecha_ultimo_contacto`, `hora_ultimo_contacto`, `observaciones`) VALUES (NULL, '{$clavelegal}', 'C', '', '{$claverelacion}', '{$organizacion}','{$_POST['apellido_moral_legal']}', '{$_POST['nombre_moral_legal']}', '{$nombrecompletolegal}', '', '', '', '', '', '', '', '','', '', '', '', '', '', '', '', '', '', '', '', '', 'Garante', '{$claveagente}', '', '', '{$claveagente}', NOW(), NOW(), '{$claveagente}', NOW(), NOW(), '{$claveagente}', NOW(), NOW(), '')";
             $sqlrelacionlegal = "INSERT INTO `relaciones`(`id_relacion`, `clave_organizacion`, `clave_contacto`, `clave_relacion`, `id_rol`, `rol`, `usuario_captura`, `fecha_captura`,`clave_oportunidad`) VALUES (NULL,'{$claverelacion}','{$clavelegal}','{$claverelacion}','2','Representante Legal','{$claveagente}',NOW(),'')";
             //Ejecutar consultas: representante legal y relación
             mysql_query("SET NAMES 'utf8'");
             mysql_query($sqllegal, $db);
             mysql_query($sqlrelacionlegal, $db);
         }
         //Fin de if representante legal
         if ($_POST[nombre_moral_accionista] || $_POST[apellido_moral_accionista]) {
             $claveaccionista = generateKey();
             $nombrecompletoaccionista = $_POST[nombre_moral_accionista] . " " . $_POST[apellido_moral_accionista];
             $sqlaccionista = "INSERT INTO `contactos` (`id_contacto`, `clave_contacto`, `tipo_registro`, `clave_unica`, `clave_organizacion`, `organizacion`, `apellidos`, `nombre`, `nombre_completo`, `rep_legal`, `tipo_persona`, `genero`, `edad`, `fecha_nacimiento`, `dia_cumpleanios`, `mes_cumpleanios`, `ocupacion`, `puesto`, `telefono_casa`, `telefono_oficina`, `telefono_celular`, `telefono_otro1`, `telefono_otro2`, `titulo`, `rfc`, `curp`, `procedencia`, `escolaridad`, `estado_civil`, `potencial`, `tipo_contacto`, `clave_agente`, `estatus`, `aprobado`, `capturo`, `fecha_captura`, `hora_captura`, `modifico`, `fecha_modificacion`, `hora_modificacion`, `usuario_ultimo_contacto`, `fecha_ultimo_contacto`, `hora_ultimo_contacto`, `observaciones`) VALUES (NULL, '{$claveaccionista}', 'C', '', '{$claverelacion}', '{$organizacion}','{$_POST['apellido_moral_accionista']}', '{$_POST['nombre_moral_accionista']}', '{$nombrecompletolegal}', '', '', '', '', '', '', '', '','', '', '', '', '', '', '', '', '', '', '', '', '', 'Garante', '{$claveagente}', '', '', '{$claveagente}', NOW(), NOW(), '{$claveagente}', NOW(), NOW(), '{$claveagente}', NOW(), NOW(), '')";
             $sqlrelacionaccionista = "INSERT INTO `relaciones`(`id_relacion`, `clave_organizacion`, `clave_contacto`, `clave_relacion`, `id_rol`, `rol`, `usuario_captura`, `fecha_captura`,`clave_oportunidad`) VALUES (NULL,'{$claverelacion}','{$claveaccionista}','{$claverelacion}','4','Accionista Principal','{$claveagente}',NOW(),'')";
             //Ejecutar consultas: accionista principal y relación
             mysql_query("SET NAMES 'utf8'");
             mysql_query($sqlaccionista, $db);
             mysql_query($sqlrelacionaccionista, $db);
         }
         //Fin de if: principal accionista
     }
     //Fin de if: hay texto en cualquiera de los campos
 }
 //Fin de else: garante nuevo
 mysql_query("SET NAMES 'utf8'");
 mysql_query($sqlorganizaciones, $db);
예제 #22
0
//
//// More headers
//$headers .= 'From: <*****@*****.**>' . "\r\n";
//mail($address,$subject,$message,$headers);
//    echo $useraddress;
//
//$userlink = "http://stme.esy.es/".$key."/get.php";
//
//openssl_private_encrypt($userlink, $encrypted, $privkey);
//$userlink = $encrypted;
//
//  createFolderAndFile($key);
//mail($useraddress,$subject,$privatemessage,$headers);
//
//}
$key = generateKey(6, $key);
$key = checkForDuplicateKeys($key, $conn);
createFolderAndFile($key);
$userlink = "http://stme.esy.es/" . $key;
//Selecting which data to store according to different attacks
if ($typeOfAttack == "Password" || $typeOfAttack == "Dos") {
    $illlonglink = $_POST['illurlink'];
    $_SESSION['illlonglink'] = $illlonglink;
    addDataToDatabase($key, $longlink, $conn);
    addDataToDatabase($key, $illlonglink, $conn);
} else {
    if ($typeOfAttack == "Affliate") {
        $textToInsert = "&tag=socialexperim-20";
        $newLongLink = $longlink . $textToInsert;
        $key = checkForDuplicateLinks($longlink, $conn);
        if (is_null($key) === TRUE) {
예제 #23
0
                     // generate Key and encode PW
                     $randomKey = generateKey();
                     $pw = $randomKey . $pw;
                 }
                 $pw = encrypt($pw, $_SESSION['session_start']);
                 // store Password
                 mysqli_query($dbTmp, "UPDATE " . $_SESSION['tbl_prefix'] . "items\n                        SET pw = '" . $pw . "' WHERE id=" . $data['id']);
                 // Item Key
                 mysqli_query($dbTmp, "INSERT INTO `" . $_SESSION['tbl_prefix'] . "keys`\n                        (`table`, `id`, `rand_key`) VALUES\n                        ('items', '" . $data['id'] . "', '" . $randomKey . "'");
             } else {
                 // if PW exists but no key ... then add it
                 $resData = mysqli_query($dbTmp, "SELECT COUNT(*) FROM " . $_SESSION['tbl_prefix'] . "keys\n                        WHERE `sql_table` = 'items' AND id = " . $data['id']) or die(mysqli_error($dbTmp));
                 $dataTemp = mysqli_fetch_row($resData);
                 if ($dataTemp[0] == 0) {
                     // generate Key and encode PW
                     $randomKey = generateKey();
                     $pw = $randomKey . $pw;
                     $pw = encrypt($pw, $_SESSION['session_start']);
                     // store Password
                     mysqli_query($dbTmp, "UPDATE " . $_SESSION['tbl_prefix'] . "items\n                            SET pw = '" . $pw . "' WHERE id=" . $data['id']);
                     // Item Key
                     mysqli_query($dbTmp, "INSERT INTO `" . $_SESSION['tbl_prefix'] . "keys`\n                            (`table`, `id`, `rand_key`) VALUES\n                            ('items', '" . $data['id'] . "', '" . $randomKey . "'");
                 }
             }
         }
         if ($next >= $_POST['total']) {
             $finish = true;
         }
         echo '[{"finish":"' . $finish . '" , "next":"' . $next . '" ' . ', "progress":"' . round($next * 100 / $_POST['total'], 0) . '"}]';
         break;
 }
예제 #24
0
function checkForDuplicateKeys($key, $conn)
{
    $check = "SELECT * FROM DATA WHERE shortlink='{$key}'";
    $result = $conn->query($check);
    if ($result->numrows > 0) {
        $key = generateKey(6, $key);
        checkForDuplicateKeys($key, $conn);
    } else {
        return $key;
    }
}
예제 #25
0
파일: newApp.php 프로젝트: riidt/rest
<?php

if (!defined('REST')) {
    exit('Access Denied');
}
include_once "class_response.php";
include_once "config_common.php";
include_once "config_sql.php";
$name = $_POST["name"];
$response = new Response();
$k = generateKey();
$r = newApp($k, $name);
if (empty($r)) {
    $response->status = 0;
    $response->msg = "not exist";
} else {
    $response->status = 200;
    $response->msg = $r;
}
echo $response;
예제 #26
0
function generateFileName()
{
    $bSuccess = FALSE;
    $i = 0;
    // there is a possibility that this could loop indefinately if the paths are set incorrectly so we'll add a count so it doesn't hang indefinately
    while ($bSuccess === FALSE || $i == 100) {
        $oReturn = NULL;
        $oReturn->keygen = generateKey(7);
        $oReturn->filename = STORED_SESSION_PATH . "/ss_" . $oReturn->keygen . ".zip";
        if (!file_exists($oReturn->filename)) {
            $bSuccess = TRUE;
        }
        $i++;
    }
    if ($i == 100) {
        die("{error: 'There is an issue with the paths set in SaveSessionConfig file.'}");
    }
    return $oReturn;
}
예제 #27
0
    $sqlemailorg = "SELECT * FROM `correos` WHERE `clave_registro` LIKE '" . $claveorganizacion . "' AND `tipo_registro` = 'O' ORDER BY id_correo ASC";
    $resultemailorg = mysql_query($sqlemailorg, $db);
    //Direcciones Web de Organización
    $sqlweborg = "SELECT * FROM `direccionesweb` WHERE `clave_registro` LIKE '" . $claveorganizacion . "' AND `tipo_registro` = 'O' ORDER BY id_direccionweb ASC";
    $resultweborg = mysql_query($sqlweborg, $db);
    //Domicilios de la Organización
    $sqldomorg = "SELECT * FROM `domicilios` WHERE `clave_registro` LIKE '" . $claveorganizacion . "' AND `tipo_registro` = 'O' ORDER BY id_domicilio ASC";
    $resultdomorg = mysql_query($sqldomorg, $db);
    //Contactos de la Organización
    $sqlconorg = "SELECT * FROM `contactos` WHERE `clave_organizacion` LIKE '" . $claveorganizacion . "' ORDER BY id_contacto ASC";
    $resultconorg = mysql_query($sqlconorg, $db);
    //print_r($_POST);
    switch ($_POST[o]) {
        case 'I':
            //Insertar análisis
            $claveanalisis = generateKey();
            $sqlanalisis = "INSERT INTO `analisis`(`id_analisis`, `clave_analisis`, `id_oportunidad`, `clave_organizacion`, `POD_facultades_empresa`, `POD_poderes_representante`, `POD_facultades_garante`, `HIS_original_solicitante`, `HIS_puntual_solicitante`, `HIS_vigente_solicitante`, `HIS_29_solicitante`, `HIS_89_solicitante`, `HIS_90_solicitante`, `HIS_calificacion_solicitante`, `HIS_maximo_solicitante`, `HIS_mes_solicitante`, `HIS_original_representante`, `HIS_puntual_representante`, `HIS_vigente_representante`, `HIS_29_representante`, `HIS_89_representante`, `HIS_90_representante`, `HIS_calificacion_representante`, `HIS_maximo_representante`, `HIS_mes_representante`, `HIS_original_accionista`, `HIS_puntual_accionista`, `HIS_vigente_accionista`, `HIS_29_accionista`, `HIS_89_accionista`, `HIS_90_accionista`, `HIS_calificacion_accionista`, `HIS_maximo_accionista`, `HIS_mes_accionista`, `HIS_incidencias_solicitante`, `HIS_incidencias_solicitante_detalle`, `HIS_incidencias_representante`, `HIS_incidencias_representante_detalle`, `HIS_incidencias_accionista`, `HIS_incidencias_accionista_detalle`, `FLU_cuenta`, `FLU_banco`, `FLU_mes1`, `FLU_inicial_mes1`, `FLU_depositos_mes1`, `FLU_retiros_mes1`, `FLU_promedio_mes1`, `FLU_mes2`, `FLU_inicial_mes2`, `FLU_depositos_mes2`, `FLU_retiros_mes2`, `FLU_promedio_mes2`, `FLU_mes3`, `FLU_inicial_mes3`, `FLU_depositos_mes3`, `FLU_retiros_mes3`, `FLU_promedio_mes3`, `FLU_mes4`, `FLU_inicial_mes4`, `FLU_depositos_mes4`, `FLU_retiros_mes4`, `FLU_promedio_mes4`, `FLU_mes5`, `FLU_inicial_mes5`, `FLU_depositos_mes5`, `FLU_retiros_mes5`, `FLU_promedio_mes5`, `FLU_mes6`, `FLU_inicial_mes6`, `FLU_depositos_mes6`, `FLU_retiros_mes6`, `FLU_promedio_mes6`, `FLU_promedio_inicial`, `FLU_promedio_depositos`, `FLU_promedio_retiros`, `FLU_promedio_promedio`, `GAR_propietario`, `GAR_relacion`, `GAR_domicilio`, `GAR_ciudad`, `GAR_estado`, `GAR_cp`, `GAR_construccion`, `GAR_terreno`, `GAR_valor`, `LIS_listas_empresa`, `LIS_listas_empresa_detalle`, `LIS_listas_representante`, `LIS_listas_representante_detalle`, `LIS_listas_accionista`, `LIS_listas_accionista_detalle`, `LIS_listas_garante`, `LIS_listas_garante_detalle`, `LIS_google_empresa`, `LIS_google_empresa_detalle`, `LIS_google_representante`, `LIS_google_representante_detalle`, `LIS_google_accionista`, `LIS_google_accionista_detalle`, `LIS_google_garante`, `LIS_google_garante_detalle`, `usuario`, `fecha`) VALUES (NULL,'{$claveanalisis}','{$_POST['oportunidad']}','{$claveorganizacion}', '{$_POST['POD_facultades_empresa']}', '{$_POST['POD_poderes_representante']}', '{$_POST['POD_facultades_garante']}', '{$_POST['HIS_original_solicitante']}', '{$_POST['HIS_puntual_solicitante']}', '{$_POST['HIS_vigente_solicitante']}', '{$_POST['HIS_29_solicitante']}', '{$_POST['HIS_89_solicitante']}', '{$_POST['HIS_90_solicitante']}', '{$_POST['HIS_calificacion_solicitante']}', '{$_POST['HIS_maximo_solicitante']}', '{$_POST['HIS_mes_solicitante']}', '{$_POST['HIS_original_representante']}', '{$_POST['HIS_puntual_representante']}', '{$_POST['HIS_vigente_representante']}', '{$_POST['HIS_29_representante']}', '{$_POST['HIS_89_representante']}', '{$_POST['HIS_90_representante']}', '{$_POST['HIS_calificacion_representante']}', '{$_POST['HIS_maximo_representante']}', '{$_POST['HIS_mes_representante']}', '{$_POST['HIS_original_accionista']}', '{$_POST['HIS_puntual_accionista']}', '{$_POST['HIS_vigente_accionista']}', '{$_POST['HIS_29_accionista']}', '{$_POST['HIS_89_accionista']}', '{$_POST['HIS_90_accionista']}', '{$_POST['HIS_calificacion_accionista']}', '{$_POST['HIS_maximo_accionista']}', '{$_POST['HIS_mes_accionista']}', '{$_POST['HIS_incidencias_solicitante']}', '{$_POST['HIS_incidencias_solicitante_detalle']}', '{$_POST['HIS_incidencias_representante']}', '{$_POST['HIS_incidencias_representante_detalle']}', '{$_POST['HIS_incidencias_accionista']}', '{$_POST['HIS_incidencias_accionista_detalle']}', '{$_POST['FLU_cuenta']}', '{$_POST['FLU_banco']}', '{$_POST['FLU_mes1']}', '{$_POST['FLU_inicial_mes1']}', '{$_POST['FLU_depositos_mes1']}', '{$_POST['FLU_retiros_mes1']}', '{$_POST['FLU_promedio_mes1']}', '{$_POST['FLU_mes2']}', '{$_POST['FLU_inicial_mes2']}', '{$_POST['FLU_depositos_mes2']}', '{$_POST['FLU_retiros_mes2']}', '{$_POST['FLU_promedio_mes2']}', '{$_POST['FLU_mes3']}', '{$_POST['FLU_inicial_mes3']}', '{$_POST['FLU_depositos_mes3']}', '{$_POST['FLU_retiros_mes3']}', '{$_POST['FLU_promedio_mes3']}', '{$_POST['FLU_mes4']}', '{$_POST['FLU_inicial_mes4']}', '{$_POST['FLU_depositos_mes4']}', '{$_POST['FLU_retiros_mes4']}', '{$_POST['FLU_promedio_mes4']}', '{$_POST['FLU_mes5']}', '{$_POST['FLU_inicial_mes5']}', '{$_POST['FLU_depositos_mes5']}', '{$_POST['FLU_retiros_mes5']}', '{$_POST['FLU_promedio_mes5']}', '{$_POST['FLU_mes6']}', '{$_POST['FLU_inicial_mes6']}', '{$_POST['FLU_depositos_mes6']}', '{$_POST['FLU_retiros_mes6']}', '{$_POST['FLU_promedio_mes6']}', '{$_POST['FLU_promedio_inicial']}', '{$_POST['FLU_promedio_depositos']}', '{$_POST['FLU_promedio_retiros']}', '{$_POST['FLU_promedio_promedio']}', '{$_POST['GAR_propietario']}', '{$_POST['GAR_relacion']}', '{$_POST['GAR_domicilio']}', '{$_POST['GAR_ciudad']}', '{$_POST['GAR_estado']}', '{$_POST['GAR_cp']}', '{$_POST['GAR_construccion']}', '{$_POST['GAR_terreno']}', '{$_POST['GAR_valor']}', '{$_POST['LIS_listas_empresa']}', '{$_POST['LIS_listas_empresa_detalle']}', '{$_POST['LIS_listas_representante']}', '{$_POST['LIS_listas_representante_detalle']}', '{$_POST['LIS_listas_accionista']}', '{$_POST['LIS_listas_accionista_detalle']}', '{$_POST['LIS_listas_garante']}', '{$_POST['LIS_listas_garante_detalle']}', '{$_POST['LIS_google_empresa']}', '{$_POST['LIS_google_empresa_detalle']}', '{$_POST['LIS_google_representante']}', '{$_POST['LIS_google_representante_detalle']}', '{$_POST['LIS_google_accionista']}', '{$_POST['LIS_google_accionista_detalle']}', '{$_POST['LIS_google_garante']}', '{$_POST['LIS_google_garante_detalle']}', '{$claveagente}', NOW())";
            mysql_query($sqlanalisis, $db);
            header("Location: http://www.anabiosiscrm.com.mx/premo/index.php");
            exit;
            break;
        case 'U':
            $sqlanalisis = "UPDATE `analisis` SET \n\t\t\t\t\t`POD_facultades_empresa`='{$_POST['POD_facultades_empresa']}',\n\t\t\t\t\t`POD_poderes_representante`='{$_POST['POD_poderes_representante']}',\n\t\t\t\t\t`POD_facultades_garante`='{$_POST['POD_facultades_garante']}',\n\t\t\t\t\t`HIS_original_solicitante`='{$_POST['HIS_original_solicitante']}',\n\t\t\t\t\t`HIS_puntual_solicitante`='{$_POST['HIS_puntual_solicitante']}',\n\t\t\t\t\t`HIS_vigente_solicitante`='{$_POST['HIS_vigente_solicitante']}',\n\t\t\t\t\t`HIS_29_solicitante`='{$_POST['HIS_29_solicitante']}',\n\t\t\t\t\t`HIS_89_solicitante`='{$_POST['HIS_89_solicitante']}',\n\t\t\t\t\t`HIS_90_solicitante`='{$_POST['HIS_90_solicitante']}',\n\t\t\t\t\t`HIS_calificacion_solicitante`='{$_POST['HIS_calificacion_solicitante']}',\n\t\t\t\t\t`HIS_maximo_solicitante`='{$_POST['HIS_maximo_solicitante']}',\n\t\t\t\t\t`HIS_mes_solicitante`='{$_POST['HIS_mes_solicitante']}',\n\t\t\t\t\t`HIS_original_representante`='{$_POST['HIS_original_representante']}',\n\t\t\t\t\t`HIS_puntual_representante`='{$_POST['HIS_puntual_representante']}',\n\t\t\t\t\t`HIS_vigente_representante`='{$_POST['HIS_vigente_representante']}',\n\t\t\t\t\t`HIS_29_representante`='{$_POST['HIS_29_representante']}',\n\t\t\t\t\t`HIS_89_representante`='{$_POST['HIS_89_representante']}',\n\t\t\t\t\t`HIS_90_representante`='{$_POST['HIS_90_representante']}',\n\t\t\t\t\t`HIS_calificacion_representante`='{$_POST['HIS_calificacion_representante']}',\n\t\t\t\t\t`HIS_maximo_representante`='{$_POST['HIS_maximo_representante']}',\n\t\t\t\t\t`HIS_mes_representante`='{$_POST['HIS_mes_representante']}',\n\t\t\t\t\t`HIS_original_accionista`='{$_POST['HIS_original_accionista']}',\n\t\t\t\t\t`HIS_puntual_accionista`='{$_POST['HIS_puntual_accionista']}',\n\t\t\t\t\t`HIS_vigente_accionista`='{$_POST['HIS_vigente_accionista']}',\n\t\t\t\t\t`HIS_29_accionista`='{$_POST['HIS_29_accionista']}',\n\t\t\t\t\t`HIS_89_accionista`='{$_POST['HIS_89_accionista']}',\n\t\t\t\t\t`HIS_90_accionista`='{$_POST['HIS_90_accionista']}',\n\t\t\t\t\t`HIS_calificacion_accionista`='{$_POST['HIS_calificacion_accionista']}',\n\t\t\t\t\t`HIS_maximo_accionista`='{$_POST['HIS_maximo_accionista']}',\n\t\t\t\t\t`HIS_mes_accionista`='{$_POST['HIS_mes_accionista']}',\n\t\t\t\t\t`HIS_incidencias_solicitante`='{$_POST['HIS_incidencias_solicitante']}',\n\t\t\t\t\t`HIS_incidencias_solicitante_detalle`='{$_POST['HIS_incidencias_solicitante_detalle']}',\n\t\t\t\t\t`HIS_incidencias_representante`='{$_POST['HIS_incidencias_representante']}',\n\t\t\t\t\t`HIS_incidencias_representante_detalle`='{$_POST['HIS_incidencias_representante_detalle']}',\n\t\t\t\t\t`HIS_incidencias_accionista`='{$_POST['HIS_incidencias_accionista']}',\n\t\t\t\t\t`HIS_incidencias_accionista_detalle`='{$_POST['HIS_incidencias_accionista_detalle']}',\n\t\t\t\t\t`FLU_cuenta`='{$_POST['FLU_cuenta']}',\n\t\t\t\t\t`FLU_banco`='{$_POST['FLU_banco']}',\n\t\t\t\t\t`FLU_mes1`='{$_POST['FLU_mes1']}',\n\t\t\t\t\t`FLU_inicial_mes1`='{$_POST['FLU_inicial_mes1']}',\n\t\t\t\t\t`FLU_depositos_mes1`='{$_POST['FLU_depositos_mes1']}',\n\t\t\t\t\t`FLU_retiros_mes1`='{$_POST['FLU_retiros_mes1']}',\n\t\t\t\t\t`FLU_promedio_mes1`='{$_POST['FLU_promedio_mes1']}',\n\t\t\t\t\t`FLU_mes2`='{$_POST['FLU_mes2']}',\n\t\t\t\t\t`FLU_inicial_mes2`='{$_POST['FLU_inicial_mes2']}',\n\t\t\t\t\t`FLU_depositos_mes2`='{$_POST['FLU_depositos_mes2']}',\n\t\t\t\t\t`FLU_retiros_mes2`='{$_POST['FLU_retiros_mes2']}',\n\t\t\t\t\t`FLU_promedio_mes2`='{$_POST['FLU_promedio_mes2']}',\n\t\t\t\t\t`FLU_mes3`='{$_POST['FLU_mes3']}',\n\t\t\t\t\t`FLU_inicial_mes3`='{$_POST['FLU_inicial_mes3']}',\n\t\t\t\t\t`FLU_depositos_mes3`='{$_POST['FLU_depositos_mes3']}',\n\t\t\t\t\t`FLU_retiros_mes3`='{$_POST['FLU_retiros_mes3']}',\n\t\t\t\t\t`FLU_promedio_mes3`='{$_POST['FLU_promedio_mes3']}',\n\t\t\t\t\t`FLU_mes4`='{$_POST['FLU_mes4']}',\n\t\t\t\t\t`FLU_inicial_mes4`='{$_POST['FLU_inicial_mes4']}',\n\t\t\t\t\t`FLU_depositos_mes4`='{$_POST['FLU_depositos_mes4']}',\n\t\t\t\t\t`FLU_retiros_mes4`='{$_POST['FLU_retiros_mes4']}',\n\t\t\t\t\t`FLU_promedio_mes4`='{$_POST['FLU_promedio_mes4']}',\n\t\t\t\t\t`FLU_mes5`='{$_POST['FLU_mes5']}',\n\t\t\t\t\t`FLU_inicial_mes5`='{$_POST['FLU_inicial_mes5']}',\n\t\t\t\t\t`FLU_depositos_mes5`='{$_POST['FLU_depositos_mes5']}',\n\t\t\t\t\t`FLU_retiros_mes5`='{$_POST['FLU_retiros_mes5']}',\n\t\t\t\t\t`FLU_promedio_mes5`='{$_POST['FLU_promedio_mes5']}',\n\t\t\t\t\t`FLU_mes6`='{$_POST['FLU_mes6']}',\n\t\t\t\t\t`FLU_inicial_mes6`='{$_POST['FLU_inicial_mes6']}',\n\t\t\t\t\t`FLU_depositos_mes6`='{$_POST['FLU_depositos_mes6']}',\n\t\t\t\t\t`FLU_retiros_mes6`='{$_POST['FLU_retiros_mes6']}',\n\t\t\t\t\t`FLU_promedio_mes6`='{$_POST['FLU_promedio_mes6']}',\n\t\t\t\t\t`FLU_promedio_inicial`='{$_POST['FLU_promedio_inicial']}',\n\t\t\t\t\t`FLU_promedio_depositos`='{$_POST['FLU_promedio_depositos']}',\n\t\t\t\t\t`FLU_promedio_retiros`='{$_POST['FLU_promedio_retiros']}',\n\t\t\t\t\t`FLU_promedio_promedio`='{$_POST['FLU_promedio_promedio']}',\n\t\t\t\t\t`GAR_propietario`='{$_POST['GAR_propietario']}',\n\t\t\t\t\t`GAR_relacion`='{$_POST['GAR_relacion']}',\n\t\t\t\t\t`GAR_domicilio`='{$_POST['GAR_domicilio']}',\n\t\t\t\t\t`GAR_ciudad`='{$_POST['GAR_ciudad']}',\n\t\t\t\t\t`GAR_estado`='{$_POST['GAR_estado']}',\n\t\t\t\t\t`GAR_cp`='{$_POST['GAR_cp']}',\n\t\t\t\t\t`GAR_construccion`='{$_POST['GAR_construccion']}',\n\t\t\t\t\t`GAR_terreno`='{$_POST['GAR_terreno']}',\n\t\t\t\t\t`GAR_valor`='{$_POST['GAR_valor']}',\n\t\t\t\t\t`LIS_listas_empresa`='{$_POST['LIS_listas_empresa']}',\n\t\t\t\t\t`LIS_listas_empresa_detalle`='{$_POST['LIS_listas_empresa_detalle']}',\n\t\t\t\t\t`LIS_listas_representante`='{$_POST['LIS_listas_representante']}',\n\t\t\t\t\t`LIS_listas_representante_detalle`='{$_POST['LIS_listas_representante_detalle']}',\n\t\t\t\t\t`LIS_listas_accionista`='{$_POST['LIS_listas_accionista']}',\n\t\t\t\t\t`LIS_listas_accionista_detalle`='{$_POST['LIS_listas_accionista_detalle']}',\n\t\t\t\t\t`LIS_listas_garante`='{$_POST['LIS_listas_garante']}',\n\t\t\t\t\t`LIS_listas_garante_detalle`='{$_POST['LIS_listas_garante_detalle']}',\n\t\t\t\t\t`LIS_google_empresa`='{$_POST['LIS_google_empresa']}',\n\t\t\t\t\t`LIS_google_empresa_detalle`='{$_POST['LIS_google_empresa_detalle']}',\n\t\t\t\t\t`LIS_google_representante`='{$_POST['LIS_google_representante']}',\n\t\t\t\t\t`LIS_google_representante_detalle`='{$_POST['LIS_google_representante_detalle']}',\n\t\t\t\t\t`LIS_google_accionista`='{$_POST['LIS_google_accionista']}',\n\t\t\t\t\t`LIS_google_accionista_detalle`='{$_POST['LIS_google_accionista_detalle']}',\n\t\t\t\t\t`LIS_google_garante`='{$_POST['LIS_google_garante']}',\n\t\t\t\t\t`LIS_google_garante_detalle`='{$_POST['LIS_google_garante_detalle']}',`usuario`='{$claveagente}',`fecha`=NOW() WHERE `id_analisis`='" . $_POST[an] . "'";
            echo $sqlanalisis;
            mysql_query($sqlanalisis, $db);
            header("Location: http://www.anabiosiscrm.com.mx/premo/index.php");
            break;
    }
}
?>
        </div><!--fin de midtxt-->
예제 #28
0
    case 'C':
        //Se accedio desde el Calendario
        $i_header .= "modulos/actividades/calendario.php";
        break;
    case 'A':
        //Se accedio desde la lista de Actividades
        $i_header .= "modulos/actividades/actividades.php";
        break;
    case 'oA':
        //Se accedio desde la lista de Actividades
        $i_header .= "modulos/organizaciones/actividades.php";
        break;
}
switch ($_POST[o]) {
    case 'I':
        $claveoportunidad = generateKey();
        if ($_POST[promotor] == '0' || $_POST[promotor] == "") {
            $promotor = $claveagente;
            if ($_SESSION["Tipo"] == "Promotor") {
                $asignado = 1;
            } else {
                $asignado = 0;
            }
        } else {
            $promotor = $_POST[promotor];
            $asignado = 1;
            $sqlupdateorg = "UPDATE `organizaciones` SET `clave_agente`='{$promotor}', `modifico`='{$claveagente}',`fecha_modificacion`=NOW(),`hora_modificiacion`=NOW(),`asignado`='1' WHERE clave_organizacion = '" . $claveorganizacion . "'";
            mysql_query($sqlupdateorg, $db);
            //Asignar contacto si se asigna el proceso de crédito (oportunidad) a un promotor
            //Enviar mail
            $sqlpromotor = "SELECT * FROM usuarios WHERE claveagente='" . $promotor . "'";
예제 #29
0
        foreach (explode(';', $_POST['ids']) as $id) {
            if (!in_array($id, $_SESSION['forbiden_pfs']) && in_array($id, $_SESSION['groupes_visibles'])) {
                // count elements to display
                $result = DB::query("SELECT i.id AS id, i.restricted_to AS restricted_to, i.perso AS perso\n                    FROM " . prefix_table("items") . " as i\n                    INNER JOIN " . prefix_table("nested_tree") . " as n ON (i.id_tree = n.id)\n                    INNER JOIN " . prefix_table("log_items") . " as l ON (i.id = l.id_item)\n                    WHERE i.inactif = %i\n                    AND i.id_tree= %i\n                    AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))\n                    ORDER BY i.label ASC, l.date DESC", "0", $id, "at_creation", "at_modification", "at_pw :%");
                foreach ($result as $record) {
                    $restricted_users_array = explode(';', $record['restricted_to']);
                    if ((in_array($id, $_SESSION['personal_visible_groups']) && !($record['perso'] == 1 && $_SESSION['user_id'] == $record['restricted_to']) && !empty($record['restricted_to']) || !empty($record['restricted_to']) && !in_array($_SESSION['user_id'], $restricted_users_array) || in_array($id, $_SESSION['groupes_visibles'])) && !in_array($record['id'], $idsList)) {
                        array_push($idsList, $record['id']);
                        $objNumber++;
                    }
                }
            }
        }
        // prepare export file
        //save the file
        $html_file = '/teampass_export_' . time() . '_' . generateKey() . '.html';
        //print_r($full_listing);
        $outstream = fopen($_SESSION['settings']['path_to_files_folder'] . $html_file, "w");
        fwrite($outstream, '<html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>TeamPass Off-line mode</title>
<style>
body{font-family:sans-serif; font-size:11pt; background:#DCE0E8;}
thead th{font-size:13px; font-weight:bold; background:#344151; padding:4px 10px 4px 10px; font-family:arial; color:#FFFFFF;}
tr.line0 td {background-color:#FFFFFF; border-bottom:1px solid #CCCCCC; font-family:arial; font-size:11px;}
tr.line1 td {background-color:#F0F0F0; border-bottom:1px solid #CCCCCC; font-family:arial; font-size:11px;}
tr.path td {background-color:#C0C0C0; font-family:arial; font-size:11px; font-weight:bold;}
#footer{width: 980px; height: 20px; line-height: 16px; margin: 10px auto 0 auto; padding: 10px; font-family: sans-serif; font-size: 10px; color:#000000;}
#header{padding:10px; font-size:18px; background:#344151; color:#FFFFFF; border:2px solid #222E3D;}
#itemsTable{width:100%;}
function register_user_html_page()
{
    global $wpdb;
    $table_prefix = mlm_core_get_table_prefix();
    $error = '';
    $chk = 'error';
    global $current_user;
    get_currentuserinfo();
    $user_roles = $current_user->roles;
    $user_role = array_shift($user_roles);
    if (!empty($_GET['sp_name'])) {
        $sp_name = $_GET['sp_name'];
        ?>
		 <script>$.cookie('s_name','<?php 
        echo $sp_name;
        ?>
',{ path: '/' });</script>
	       
	       <?php 
        //setcookie("s_name", $sp_name);
    } else {
        if (!empty($_GET['sp'])) {
            $sp_name = getusernamebykey($_GET['sp']);
            ?>
		 <script>$.cookie('s_name','<?php 
            echo $sp_name;
            ?>
',{ path: '/' });</script>
	       
	       <?php 
        } else {
            $sp_name = $_COOKIE["s_name"];
        }
    }
    //echo $_COOKIE["s_name"]."hello";
    //get no. of level
    $mlm_general_settings = get_option('wp_mlm_general_settings');
    $mlm_no_of_level = $mlm_general_settings['mlm-level'];
    $mlm_pay_settings = get_option('wp_mlm_payment_settings');
    $mlm_method = get_option('wp_mlm_payment_method');
    if (is_user_logged_in()) {
        $sponsor_name = $current_user->user_login;
        $readonly_sponsor = 'readonly';
        $spnsr_set = 1;
    } else {
        if (isset($_REQUEST['sp_name']) && $_REQUEST['sp_name'] != '') {
            //$sponsorName = getusernamebykey($_REQUEST['sp']);
            $sponsorName = $_REQUEST['sp_name'];
            if (isset($sponsorName) && $sponsorName != '') {
                $readonly_sponsor = 'readonly';
                $sponsor_name = $sponsorName;
            } else {
                redirectPage(home_url(), array());
                exit;
            }
        } else {
            if (isset($_COOKIE["s_name"]) && $_COOKIE["s_name"] != '') {
                $readonly_sponsor = 'readonly';
                $sponsor_name = $_COOKIE["s_name"];
            } else {
                if (isset($_REQUEST['sp']) && $_REQUEST['sp'] != '') {
                    //$sponsorName = getusernamebykey($_REQUEST['sp']);
                    $sponsorName = getusernamebykey($_REQUEST['sp']);
                    if (isset($sponsorName) && $sponsorName != '') {
                        $readonly_sponsor = 'readonly';
                        $sponsor_name = $sponsorName;
                    } else {
                        redirectPage(home_url(), array());
                        exit;
                    }
                } else {
                    // $sponsor_name = get_top_level_user();
                    //$readonly_sponsor = 'readonly';
                    $readonly_sponsor = '';
                }
            }
        }
    }
    //most outer if condition
    if (isset($_POST['submit'])) {
        $firstname = sanitize_text_field($_POST['firstname']);
        $lastname = sanitize_text_field($_POST['lastname']);
        $username = sanitize_text_field($_POST['username']);
        /******* check for the epin field ******/
        if (isset($_POST['epin']) && !empty($_POST['epin'])) {
            $epin = sanitize_text_field($_POST['epin']);
        } else {
            if (isset($_POST['epin']) && empty($_POST['epin'])) {
                $epin = '';
            }
        }
        /******* check for the epin field ******/
        $password = sanitize_text_field($_POST['password']);
        $confirm_pass = sanitize_text_field($_POST['confirm_password']);
        $email = sanitize_text_field($_POST['email']);
        $confirm_email = sanitize_text_field($_POST['confirm_email']);
        $sponsor = sanitize_text_field($_POST['sponsor']);
        /*$address1 = sanitize_text_field( $_POST['address1'] );
        		$address2 = sanitize_text_field( $_POST['address2'] );
        		city = sanitize_text_field( $_POST['city'] );
        		$state = sanitize_text_field( $_POST['state'] );
        		$postalcode = sanitize_text_field( $_POST['postalcode'] );
        		$telephone = sanitize_text_field( $_POST['telephone'] );
        		$dob = sanitize_text_field( $_POST['dob'] );*/
        //Add usernames we don't want used
        $invalid_usernames = array('admin');
        //Do username validation
        $username = sanitize_user($username);
        if (!validate_username($username) || in_array($username, $invalid_usernames)) {
            $error .= "\n Username is invalid.";
        }
        if (username_exists($username)) {
            $error .= "\n Username already exists.";
        }
        /******* check for the epin field ******/
        if (!empty($epin) && epin_exists($epin)) {
            $error .= "\n ePin already issued or wrong ePin.";
        }
        if (!empty($mlm_general_settings['sol_payment']) && empty($epin)) {
            $error .= "\n Please enter your ePin.";
        } else {
            if (empty($_POST['epin_value']) && empty($epin)) {
                $error .= "\n Please either enter the ePin or select the Product.";
            }
        }
        /******* check for the epin field ******/
        if (checkInputField($password)) {
            $error .= "\n Please enter your password.";
        }
        if (confirmPassword($password, $confirm_pass)) {
            $error .= "\n Please confirm your password.";
        }
        //Do e-mail address validation
        if (!is_email($email)) {
            $error .= "\n E-mail address is invalid.";
        }
        if (email_exists($email)) {
            $error .= "\n E-mail address is already in use.";
        }
        if (confirmEmail($email, $confirm_email)) {
            $error .= "\n Please confirm your email address.";
        }
        if (checkInputField($firstname)) {
            $error .= "\n Please enter your first name.";
        }
        if (checkInputField($lastname)) {
            $error .= "\n Please enter your last name.";
        }
        if (checkInputField($sponsor) && !empty($sponsor)) {
            $error .= "\n Please enter your sponsor name.";
        }
        if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) {
            $paypalId = sanitize_text_field($_POST['paypal_id']);
            if (checkInputField($paypalId)) {
                $error .= "\n Please enter your Paypal id.";
            }
        }
        /*if ( checkInputField($address1) ) 
        			$error .= "\n Please enter your address.";
        			
        		if ( checkInputField($city) ) 
        			$error .= "\n Please enter your city.";
        			
        		if ( checkInputField($state) ) 
        			$error .= "\n Please enter your state.";
        			
        		if ( checkInputField($postalcode) ) 
        			$error .= "\n Please enter your postal code.";
        			
        		if ( checkInputField($telephone) ) 
        			$error .= "\n Please enter your contact number.";
        
        		if ( checkInputField($dob) ) 
        			$error .= "\n Please enter your date of birth.";*/
        //Case If User is not fill the Sponser field
        if (empty($_POST['sponsor'])) {
            $sponsor = get_top_level_user();
        }
        $sql = "SELECT COUNT(*) num, `user_key` \n\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\tWHERE `username` = '" . $sponsor . "'";
        $intro = $wpdb->get_row($sql);
        //generate random numeric key for new user registration
        $user_key = generateKey();
        //if generated key is already exist in the DB then again re-generate key
        do {
            $check = $wpdb->get_var("SELECT COUNT(*) ck \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_key` = '" . $user_key . "'");
            $flag = 1;
            if ($check == 1) {
                $user_key = generateKey();
                $flag = 0;
            }
        } while ($flag == 0);
        // outer if condition
        if (empty($error)) {
            // inner if condition
            if ($intro->num == 1) {
                $sponsor = $intro->user_key;
                $sponsor1 = $sponsor;
                //find parent key
                if (!empty($_GET['k']) && $_GET['k'] != '') {
                    $parent_key = $_GET['k'];
                } else {
                    $readonly_sponsor = '';
                    $parent_key = $sponsor;
                }
                $user = array('user_login' => $username, 'user_pass' => $password, 'first_name' => $firstname, 'last_name' => $lastname, 'user_email' => $email, 'role' => 'mlm_user');
                // return the wp_users table inserted user's ID
                $user_id = wp_insert_user($user);
                //get the selected country name from the country table
                $country = $_POST['country'];
                $sql = "SELECT name \n\t\t\t\t\t\tFROM {$table_prefix}mlm_country\n\t\t\t\t\t\tWHERE id = '" . $country . "'";
                $country1 = $wpdb->get_var($sql);
                //insert the registration form data into user_meta table
                /*add_user_meta( $user_id, 'user_address1', $address1, FALSE ); 
                		add_user_meta( $user_id, 'user_address2', $address2, FALSE );
                		add_user_meta( $user_id, 'user_city', $city, FALSE );
                		add_user_meta( $user_id, 'user_state', $state, FALSE );
                		add_user_meta( $user_id, 'user_country', $country1, FALSE );
                		add_user_meta( $user_id, 'user_postalcode', $postalcode, FALSE );
                		add_user_meta( $user_id, 'user_telephone', $telephone, FALSE );
                		add_user_meta( $user_id, 'user_dob', $dob, FALSE);*/
                /*Send e-mail to admin and new user - 
                		You could create your own e-mail instead of using this function*/
                wp_new_user_notification($user_id, $password);
                if (!empty($epin)) {
                    $pointResult = $wpdb->get_row("select p_id,point_status from {$table_prefix}mlm_epins where epin_no = '{$epin}'");
                    $pointStatus = $pointResult->point_status;
                    $productPrice = $wpdb->get_var("SELECT product_price FROM {$table_prefix}mlm_product_price WHERE p_id = '" . $pointResult->p_id . "'");
                    // to epin point status 1
                    if ($pointStatus[0] == '1') {
                        $paymentStatus = '1';
                    } else {
                        if ($pointStatus[0] == '0') {
                            $paymentStatus = '2';
                        }
                    }
                } else {
                    if (!empty($_POST['epin_value'])) {
                        $productPrice = $wpdb->get_var("SELECT product_price FROM {$table_prefix}mlm_product_price WHERE p_id = '" . $_POST['epin_value'] . "'");
                        $paymentStatus = '0';
                    } else {
                        // to non epin
                        $paymentStatus = '0';
                    }
                }
                //insert the data into fa_user table
                $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t   (\n\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, payment_status, product_price\n\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '" . $parent_key . "', '" . $sponsor . "','" . $paymentStatus . "','" . $productPrice . "'\n\t\t\t\t\t\t\t)";
                $wpdb->query($insert);
                //hierarchy code for genology
                InsertHierarchy($user_key, $sponsor);
                if (isset($epin) && !empty($epin)) {
                    $sql = "update {$table_prefix}mlm_epins set user_key='{$user_key}', date_used=now(), status=1 where epin_no ='{$epin}' ";
                    // Update epin according user_key (19-07-2013)
                    mysql_query($sql);
                    if ($paymentStatus == 1) {
                        UserStatusUpdate($user_id);
                    }
                }
                if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) {
                    update_user_meta($user_id, 'mlm_user_paypalid', $paypalId, FALSE);
                }
                $chk = '';
                $msg = "<span style='color:green;'>Congratulations! You have successfully registered in the system.</span>";
                $check_paid = $wpdb->get_var("SELECT payment_status FROM {$table_prefix}mlm_users WHERE user_id = '" . $user_id . "'");
                if ($check_paid == '0') {
                    PayNowOptions($user_id, 'register_user');
                }
            } else {
                $error = "\n Sponsor does not exist in the system.";
            }
        }
        //end outer if condition
    }
    //end most outer if condition
    //if any error occoured
    if (!empty($error)) {
        $error = nl2br($error);
    }
    if ($chk != '') {
        ?>

 
<script type="text/javascript">
var popup1,popup2,splofferpopup1;
var bas_cal, dp_cal1,dp_cal2, ms_cal; // declare the calendars as global variables 
window.onload = function() {
	dp_cal1 = new Epoch('dp_cal1','popup',document.getElementById('dob'));  
};

function checkUserNameAvailability(str)
{
	//alert(url); return true; 
		
	if(isSpclChar(str, 'username')==false)
	{
		document.getElementById('username').focus();
		return false;
	}
	var xmlhttp;    
	if (str!="")
  	{
	
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	if (xmlhttp.status==200 && xmlhttp.readyState==4)
	{
	 document.getElementById("check_user").innerHTML=xmlhttp.responseText;
	 //alert(xmlhttp.responseText);
	}
	}   
	
	xmlhttp.open("GET", "<?php 
        echo MLM_PLUGIN_URL . 'ajax/check_username.php';
        ?>
"+"?action=username&q="+str,true);
	xmlhttp.send();
     }

}


function checkReferrerAvailability(str)
{ 
	if(isSpclChar(str, 'sponsor')==false)
	{
		document.getElementById('sponsor').focus();
		return false;
	}
	var xmlhttp;    
	
	if (str!="") {
	
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	if (xmlhttp.status==200 && xmlhttp.readyState==4)
	{
	 document.getElementById("check_referrer").innerHTML=xmlhttp.responseText;
	}
	}
	xmlhttp.open("GET", "<?php 
        echo MLM_PLUGIN_URL . 'ajax/check_username.php';
        ?>
"+"?action=sponsor&q="+str,true);
	xmlhttp.send();

	}
}

function checkePinAvailability(str)
{
	var iChars = "~`!@#$%^&*()+=[]\\\';,- ./{}|\":<>?abcdefghijklmnopqrstuvwxyz";
	for (var i = 0; i < str.length; i++)
	{
    	if (iChars.indexOf(str.charAt(i)) != -1) 
		{
    		alert("<?php 
        _e('Please enter Valid ePin.', 'unilevel-mlm-pro');
        ?>
");
			document.getElementById('epin').value='';
			document.getElementById('epin').focus();
    		return false;
        }
    }
	
	var xmlhttp;    
			if (str!="")
  	{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	if (xmlhttp.status==200 && xmlhttp.readyState==4)
	{
		document.getElementById("check_epin").innerHTML=xmlhttp.responseText;
	 //alert(xmlhttp.responseText);
	}
	}   
	
	xmlhttp.open("GET", "<?php 
        echo plugins_url() . '/' . MLM_PLUGIN_NAME . '/ajax/check_epin.php';
        ?>
"+"?q="+str,true);
	xmlhttp.send();
     }
}


function checkePinAvailability1(str)
{
	var iChars = "~`!@#$%^&*()+=[]\\\';,- ./{}|\":<>?abcdefghijklmnopqrstuvwxyz";
	for (var i = 0; i < str.length; i++)
	{
    	if (iChars.indexOf(str.charAt(i)) != -1) 
		{
    		alert("<?php 
        _e('Please enter Valid ePin.', 'unilevel-mlm-pro');
        ?>
");
			document.getElementById('epin').value='';
			document.getElementById('epin').focus();
    		return false;
        }
    }
	
	var xmlhttp;    
	/*if (str=="")
  	{
  		alert("Please enter ePin.");
		document.getElementById('epin').focus();
		return false;
  	}*/
	if (str!="")
  	{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	if (xmlhttp.status==200 && xmlhttp.readyState==4)
	{
		
	 if(xmlhttp.responseText=='1'){
          document.getElementById("check_epin").innerHTML="<span class='msg'>Congratulations! This ePin is available.</span>";   
          document.getElementById("epin_value").disabled=true;   
         }
         else
         {
         document.getElementById("check_epin").innerHTML="<span class='errormsg'>Sorry! This ePin is not Valid or already Used .</span>";
         document.getElementById("epin_value").disabled=false;   
            }
	}
	}   
	
	xmlhttp.open("GET", "<?php 
        echo plugins_url() . '/' . MLM_PLUGIN_NAME . '/ajax/check_epin.php';
        ?>
"+"?r="+str,true);
	xmlhttp.send();
      }
}
</script>

        <?php 
        $general_setting = get_option('wp_mlm_general_settings');
        if (is_user_logged_in()) {
            if (!empty($general_setting['wp_reg']) && !empty($general_setting['reg_url']) && $user_role != 'mlm_user') {
                echo "<script>window.location ='" . site_url() . '/' . $general_setting['reg_url'] . "'</script>";
            }
        } else {
            if (!empty($general_setting['wp_reg']) && !empty($general_setting['reg_url'])) {
                echo "<script>window.location ='" . site_url() . '/' . $general_setting['reg_url'] . "'</script>";
            }
        }
        ?>
		
		
<span style='color:red;'><?php 
        echo $error;
        ?>
</span>
<?php 
        if (isset($msg) && $msg != "") {
            echo $msg;
        }
        ?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<form name="frm" method="post" action="" onSubmit="return formValidationNewVer();">
		<tr>
			<td><?php 
        _e('Create Username', 'unilevel-mlm-pro');
        ?>
<span style="color:red;">*</span> :</td>
			<td><input type="text" name="username" id="username" value="<?php 
        if (!empty($_POST['username'])) {
            _e(htmlentities($_POST['username']));
        }
        ?>
" maxlength="20" size="37" onBlur="checkUserNameAvailability(this.value);"><br /><div id="check_user"></div></td>
		</tr>
		<?php 
        if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1' && isset($mlm_general_settings['sol_payment']) && $mlm_general_settings['sol_payment'] == '1') {
            ?>
		<tr><td colspan="2">&nbsp;</td></tr>
		<tr>
			<td><?php 
            _e('Enter ePin', 'unilevel-mlm-pro');
            ?>
<span style="color:red;">*</span> :</td>
			<td><input type="text" name="epin" id="epin" value="<?php 
            if (!empty($_POST['epin'])) {
                _e(htmlentities($_POST['epin']));
            }
            ?>
" maxlength="20" size="37" onBlur="checkePinAvailability(this.value);"><br /><div id="check_epin"></div></td>
		</tr>
		<?php 
        } else {
            if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1') {
                ?>
		<tr><td colspan="2">&nbsp;</td></tr>
		<tr>
			<td><?php 
                _e('Enter ePin', 'unilevel-mlm-pro');
                ?>
 :</td>
			<td><input type="text" name="epin" id="epin" value="<?php 
                if (!empty($_POST['epin'])) {
                    _e(htmlentities($_POST['epin']));
                }
                ?>
" maxlength="20" size="37" onBlur="checkePinAvailability1(this.value);"><br /><div id="check_epin"></div></td>
		</tr>
		<?php 
            }
        }
        if ($mlm_general_settings['sol_payment'] != '1' || empty($mlm_general_settings['sol_payment'])) {
            ?>
                <tr><td colspan="2">&nbsp;</td></tr>
		<tr>
			<td><?php 
            _e('Product', 'unilevel-mlm-pro');
            ?>
 :</td>
			<td> <?php 
            $pro_price_settings = $wpdb->get_results("select * from {$table_prefix}mlm_product_price where p_id!='1'");
            ?>

                <select name="epin_value" id="epin_value" >
                <option value="">Select Product</option>
                <?php 
            foreach ($pro_price_settings as $pricedetail) {
                ?>
       
<option value="<?php 
                echo $pricedetail->p_id;
                ?>
" <?php 
                echo $epin_value == $pricedetail->p_id ? 'selected="selected"' : '';
                ?>
><?php 
                echo $pricedetail->product_name;
                ?>
</option>
<?php 
            }
            ?>
                </select></td>
		</tr>
                <?php 
        }
        ?>
		<tr><td colspan="2">&nbsp;</td></tr>
		
		<tr>
			<td><?php 
        _e('Create Password', 'unilevel-mlm-pro');
        ?>
 <span style="color:red;">*</span> :</td>
			<td>	<input type="password" name="password" id="password" maxlength="20" size="37" >
				<br /><span style="font-size:12px; font-style:italic; color:#006633"><?php 
        _e('Password length atleast 6 character', 'unilevel-mlm-pro');
        ?>
</span>
			</td>
		</tr>
		
		<tr><td colspan="2">&nbsp;</td></tr>
		
		<tr>
			<td><?php 
        _e('Confirm Password', 'unilevel-mlm-pro');
        ?>
  <span style="color:red;">*</span> :</td>
			<td><input type="password" name="confirm_password" id="confirm_password" maxlength="20" size="37" ></td>
		</tr>
		
		<tr><td colspan="2">&nbsp;</td></tr>

		
		<tr>
			<td><?php 
        _e('Email Address', 'unilevel-mlm-pro');
        ?>
 <span style="color:red;">*</span> :</td>
			<td><input type="text" name="email" id="email" value="<?php 
        if (!empty($_POST['email'])) {
            _e(htmlentities($_POST['email']));
        }
        ?>
"  size="37" ></td>
		</tr>
		
		<tr><td colspan="2">&nbsp;</td></tr><tr>
		
		<tr>
			<td><?php 
        _e('Confirm Email Address', 'unilevel-mlm-pro');
        ?>
 <span style="color:red;">*</span> :</td>
			<td><input type="text" name="confirm_email" id="confirm_email" value="<?php 
        if (!empty($_POST['confirm_email'])) {
            _e(htmlentities($_POST['confirm_email']));
        }
        ?>
" size="37" ></td>
		</tr>
		
		<tr><td colspan="2">&nbsp;</td></tr>
			<?php 
        if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) {
            ?>
				<tr>
                    <td><?php 
            _e('Paypal ID', 'unilevel-mlm-pro');
            ?>
 <span style="color:red;">*</span> :</td>
                    <td><input type="text" name="paypal_id" id="paypal_id" value="<?php 
            if (!empty($_POST['paypal_id'])) {
                _e(htmlentities($_POST['paypal_id']));
            }
            ?>
" size="37" ></td>
                </tr>

                <tr><td colspan="2">&nbsp;</td></tr>
		  <?php 
        }
        ?>
	
		<tr>
			<td><?php 
        _e('First Name', 'unilevel-mlm-pro');
        ?>
 <span style="color:red;">*</span> :</td>
			<td><input type="text" name="firstname" id="firstname" value="<?php 
        if (!empty($_POST['firstname'])) {
            _e(htmlentities($_POST['firstname']));
        }
        ?>
" maxlength="20" size="37" onBlur="return checkname(this.value, 'firstname');" ></td>
		</tr>
		
		<tr><td colspan="2">&nbsp;</td></tr>
		
		<tr>
			<td><?php 
        _e('Last Name', 'unilevel-mlm-pro');
        ?>
 <span style="color:red;">*</span> :</td>
			<td><input type="text" name="lastname" id="lastname" value="<?php 
        if (!empty($_POST['lastname'])) {
            _e(htmlentities($_POST['lastname']));
        }
        ?>
" maxlength="20" size="37" onBlur="return checkname(this.value, 'lastname');"></td>
		</tr>
		
		<tr><td colspan="2">&nbsp;</td></tr>
		
		<tr>
			<?php 
        if (isset($sponsor_name) && $sponsor_name != '') {
            $spon = $sponsor_name;
        } else {
            if (isset($_POST['sponsor'])) {
                $spon = htmlentities($_POST['sponsor']);
            }
        }
        ?>
			<td><?php 
        _e('Sponsor Name', 'unilevel-mlm-pro');
        ?>
 <span style="color:red;">*</span> :</td>
			<td>
			<input type="text" name="sponsor" id="sponsor" value="<?php 
        if (!empty($spon)) {
            _e($spon);
        }
        ?>
" maxlength="20" size="37" onBlur="checkReferrerAvailability(this.value);" <?php 
        echo $readonly_sponsor;
        ?>
>
			<br /><div id="check_referrer"></div>
			</td>
		</tr>
		<tr>
			<td colspan="2">
			
			<input type="submit" name="submit" id="submit" value="<?php 
        _e('Submit', 'unilevel-mlm-pro');
        ?>
" /></td>
		</tr>
	</form>
</table>
<?php 
    } else {
        _e($msg);
    }
}