/**
  * Checks whether the form builder is validated after validation.
  *
  * @access    private
  * @return    boolean
  *
  * @author Etienne de Longeaux <*****@*****.**>
  * @since 2012-09-11
  */
 private function isSubmitted()
 {
     if ($this->getName() == $this->_id_form) {
         if ($this->getTypeForm() == "zend") {
             $form_instance = $this->container->get('request')->query->get('form_instance');
             if ($form_instance) {
                 $instance = App_Tools_Post::get('form_instance');
                 if ($this->_session->_isValidInstance($instance)) {
                     // IMPORTANT :: permet d'éviter qu'une instance soit utilisé par un robot pour lancer x fois un même formulaire
                     $this->_session->_removeInstance($instance);
                     return true;
                 }
             }
             return false;
         } elseif ($this->getTypeForm() == "symfony") {
             $request = $this->container->get('request');
             if ($request->getMethod() == 'POST') {
                 // we apply the pre event bind request
                 $this->preEventBindRequest();
                 // we bind the form
                 $this->_form->bind($request);
                 if ($this->_form->isValid()) {
                     return true;
                 } else {
                     return false;
                 }
             }
             return false;
         }
     }
     return false;
 }
Esempio n. 2
0
 public function updatePassword()
 {
     if (!isset($this->clean->password) || !isValid($this->clean->password, 'password')) {
         $this->data['message'] = reset(array_values(formatErrors(602)));
     } else {
         // Check current password
         $current_password = isset($this->clean->current_password) ? $this->clean->current_password : null;
         $res = $this->user->read($this->user_id, 1, 1, 'email,password');
         if (!isset($res->password)) {
             $this->data['message'] = 'We could not verify your current password.';
         } elseif (verifyHash($current_password, $res->password) != $res->password) {
             $this->data['message'] = 'Your current password does not match what we have on record.';
         } else {
             $password = generateHash($this->clean->password);
             $user = $this->user->update($this->user_id, array('password' => $password));
             if (isset($user->password) && $user->password == $password) {
                 $this->data['success'] = true;
                 // Send email
                 $this->load->library('email');
                 $this->email->initialize();
                 $sent = $this->email->updatePassword($user->email);
             } else {
                 $this->data['message'] = 'Your password could not be updated at this time. Please try again.';
             }
         }
     }
     $this->renderJSON();
 }
Esempio n. 3
0
function nextValidPass($pass)
{
    do {
        $pass = nextPass($pass);
    } while (!isValid($pass));
    return $pass;
}
Esempio n. 4
0
function getNext($input)
{
    $next = $input;
    do {
        $next = increment($next);
        while (($validLen = strcspn($next, 'iol')) !== strlen($next)) {
            $next = increment(substr($next, 0, $validLen + 1)) . substr($next, $validLen + 1);
        }
    } while (!isValid($next));
    return $next;
}
Esempio n. 5
0
function login($account, $passwordhash)
{
    if (isValid($account, $passwordhash)) {
        session_reset();
        session_regenerate_id(true);
        $_SESSION["account"] = $account;
        $_SESSION["passwordhash"] = $passwordhash;
        return true;
    } else {
        return false;
    }
}
Esempio n. 6
0
function generatePassword($password)
{
    $passwordLength = strlen($password);
    while (true) {
        $password++;
        if (strlen($password) > $passwordLength) {
            break;
        }
        if (isValid($password)) {
            return $password;
        }
    }
    return false;
}
Esempio n. 7
0
function valid_link()
{
    $CI =& get_instance();
    $token = $CI->config->item('token');
    if (!validateSignature($token)) {
        exit('签名验证失败');
    }
    if (isValid()) {
        // 网址接入验证
        exit($_GET['echostr']);
    }
    if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
        exit('缺少数据');
    }
}
Esempio n. 8
0
function modulus($a, $b)
{
    $validated = isValid($a, $b);
    if ($validated === true) {
        if ($b === 0) {
            echo "DIVIDE-ERROR:\$b cannot be zero" . PHP_EOL;
        } else {
            $c = $a % $b;
            echo "Calculated Power Level = {$c}" . PHP_EOL;
            return $c;
        }
    } else {
        echo $validated;
    }
}
Esempio n. 9
0
 public function init()
 {
     $reply_to = new Zend_Form_Element_Text('reply_to');
     $reply_to->setLabel('Reply To')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $html_signature = new Zend_Form_Element_Text('html_signature');
     $html_signature->setLabel('Html Signature')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $primary_phone = new Zend_Form_Element_Text('primary_phone');
     $primary_phone->setLabel('Primary Phone')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator(new Zend_Validate_Digits(isValid("+1234567890")));
     $cell_phone = new Zend_Form_Element_Text('cell_phone');
     $cell_phone->setLabel('Cell Phone')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator(new Zend_Validate_Digits(isValid("+1234567890")));
     $fax = new Zend_Form_Element_Text('fax');
     $fax->setLabel('Fax')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $company = new Zend_Form_Element_Text('company');
     $company->setLabel('Company')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $address = new Zend_Form_Element_Text('address');
     $address->setLabel('Address')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $address2 = new Zend_Form_Element_Text('address2');
     $address2->setLabel('Address2')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $city = new Zend_Form_Element_Text('city');
     $city->setLabel('City')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $state = new Zend_Form_Element_Text('state');
     $state->setLabel('State')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $zip = new Zend_Form_Element_Text('zip');
     $zip->setLabel('Zip')->setAttribs(array('style' => 'width:150px !important;'))->setRequired(true)->addValidator(new Zend_Validate_Digits(isValid("1234567890")));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setAttribs(array('style' => 'width:350px !important;'))->setRequired(true)->addValidator('EmailAddress', TRUE);
     $report_template_id = new Zend_Form_Element_Select('report_template_id');
     $report_template_id->setLabel('Report Template')->setRequired(true)->setMultiOptions(Jameen_ReportsTemplates::getMultiList());
     $followup_template_id = new Zend_Form_Element_Select('followup_template_id');
     $followup_template_id->setLabel('Followup Template')->setRequired(true)->setMultiOptions(Jameen_FollowupemailTemplates::getMultiList());
     $followup_enabled = new Zend_Form_Element_MultiCheckbox('followup_enabled');
     $followup_enabled->setLabel('Followup Enabled')->setRequired(true)->setAttribs(array('style' => 'width:53px !important;'))->addMultiOptions(array('checkedValue' => false));
     $sms_enabled = new Zend_Form_Element_MultiCheckbox('sms_enabled');
     $sms_enabled->setLabel('Sms Enabled')->setRequired(true)->setAttribs(array('style' => 'width:53px !important;'))->addMultiOptions(array('checkedValue' => false));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('submit');
     $this->addElements(array($reply_to, $html_signature, $primary_phone, $cell_phone, $fax, $company, $address, $address2, $city, $state, $zip, $email, $report_template_id, $followup_template_id, $followup_enabled, $sms_enabled));
     /*
     $this->setElementDecorators(array(
        	array('ViewHelper'),
     	array('Label'),
     	array('Errors', array('class'=>'error')),
     )); 
     */
     $this->setElementDecorators(array('ViewHelper', array(array('wrapperField' => 'HtmlTag'), array('tag' => 'div', 'class' => 'controls cont')), array('Label', array('placement' => 'prepend', 'class' => 'control-label'))));
     $this->setAttribs(array('action' => ''));
 }
Esempio n. 10
0
    function index()
    {
        if (FW_CONFIGS == false) {
            $base_url = substr(__DIR__, 0, -19);
            $base_url = substr($base_url, strrpos($base_url, '/'), 20);
            $base_url .= '/';
            if ($this->input->isPost()) {
                //Validate form
                $this->load->helper("_config");
                $errors = isValid($this->input->getPostVariable());
                if (count($errors) == 0) {
                    $config = new Document($this->configPath, "all_config.inc.php");
                    $dbConfig = new Document($this->dbConfigPath, "db_config.inc.php");
                    $configString = $config->read();
                    $dbConfigString = $dbConfig->read();
                    foreach ($this->input->getPostVariable() as $field => $value) {
                        if (in_array($field, array("productTitle", "baseUrl", "productVersion", "mandrillKey", "productStage"))) {
                            $configString = str_replace("**" . $field . "**", $value, $configString);
                        } elseif ($field == "db_prefix" or $field == "DB_PREFIX") {
                            $dbConfigString = str_replace("**" . $field . "**", "_" . $value, $dbConfigString);
                        } else {
                            $dbConfigString = str_replace("**" . $field . "**", $value, $dbConfigString);
                        }
                    }
                    $config->write($configString);
                    $dbConfig->write($dbConfigString);
                    //Update config Framework
                    $fr = new Document(__DIR__ . '/../initialize', '_all_config.inc.php');
                    $fr->replace('
	define("FW_CONFIGS", false);', 'define("FW_CONFIGS", true);');
                    //Require the files again, since the settings are changed
                    include $this->configPath . '/all_config.inc.php';
                    include $this->dbConfigPath . '/db_config.inc.php';
                    //Load the view
                    $this->load->view("_config", array("form" => false));
                } else {
                    $this->load->view("_config", array("base_url" => $base_url, "form" => true, "errors" => $errors, "post" => $this->input->getPostVariable()));
                }
            } else {
                $this->load->view("_config", array("base_url" => $base_url, "form" => true));
            }
        } else {
            $fof = new FourOhFour("You are somewhere you should not be");
        }
    }
Esempio n. 11
0
function update_recipes_request()
{
    if (!empty($_POST["id"])) {
        $post_id = $_POST["id"];
        $post = get_post($post_id);
        $url = post_permalink($post_id);
        $ingredients = get_post_meta($post_id, 'RECIPE_META_ingredients', true);
        $nutrition_facts = process_request($ingredients);
        if (isValid($nutrition_facts)) {
            if (!add_post_meta($post_id, META_KEY, $nutrition_facts, true)) {
                update_post_meta($post_id, META_KEY, $nutrition_facts);
            }
            echo json_encode(array('ID' => $post->ID, 'post_title' => $post->post_title, 'url' => $url, 'success' => true, 'error' => false, 'message' => 'Update successful.'));
        } else {
            echo json_encode(array('ID' => $post->ID, 'post_title' => $post->post_title, 'url' => $url, 'success' => false, 'error' => true, 'message' => 'Update unsuccessful.'));
        }
    }
    die;
}
Esempio n. 12
0
function validate($options = array(), $data_types = array(), $required = array())
{
    $meets_reqs = true;
    $errors = array();
    //Check required fields
    if (!empty($required)) {
        foreach ($required as $column) {
            if (!isset($options[$column]) || $options[$column] == '') {
                $errors[$column] = ucwords(strtolower(str_replace('_', ' ', $column))) . ' is required.';
            }
        }
    }
    // Check data type requirements
    if (!empty($data_types)) {
        foreach ($data_types as $column => $type) {
            if (isset($options[$column]) && !isValid($options[$column], $type)) {
                $errors[$column] = ucwords(strtolower(str_replace('_', ' ', $column))) . ' is not valid.';
            }
        }
    }
    return !empty($errors) ? array(601 => $errors) : true;
}
Esempio n. 13
0
function findStartFinish($start, $finish = null)
{
    $start = trim(urldecode($start));
    $start = isValid($start, 'date') === false && isValid($start, 'year') === false ? preg_replace('/\\b\\-\\b/', ' ', $start) : $start;
    $finish = trim(urldecode($finish));
    $finish = isValid($finish, 'date') === false && isValid($finish, 'year') === false ? preg_replace('/\\b\\-\\b/', ' ', $finish) : $finish;
    // check for single year
    if (isValid($start, 'year') === true && isValid($finish, 'year') !== true) {
        $finish = $start . '-12-31';
        $start = $start . '-01-01';
    } elseif (isValid($start, 'year') === true && isValid($finish, 'year') === true) {
        $finish = $finish > $start ? $finish - 1 . '-12-31' : $finish . '-12-31';
        $start = $start . '-01-01';
    } elseif (isValid($start, 'date') === true && isValid($finish, 'date') !== true) {
        $finish = $start;
    }
    /*print strtotime($start) . "<BR>";
      print date('Y-m-d', strtotime($start)) . "<BR>";
      print $finish . "<BR>";
      print strtotime($finish) . "<BR>";
      print date('Y-m-d', strtotime($finish)) . "<BR>";*/
    // Figure start/finish timestamps
    // If empty, assign to today
    $start = strtotime($start);
    $start = empty($start) ? strtotime('today') : $start;
    $finish = strtotime($finish);
    $finish = empty($finish) ? $start : $finish;
    //print date('Y-m-d', $start) . "<BR>";
    //print date('Y-m-d', $finish) . '<BR><br>';
    // Fix ordering if need be
    if ($start > $finish) {
        $s = $start;
        $finish = $start;
        $start = $s;
    }
    // Return
    return array('start' => date('Y-m-d', $start), 'finish' => date('Y-m-d', $finish));
}
Esempio n. 14
0
 public function create($options = array())
 {
     if (!isValid($options['email'], 'email')) {
         return formatErrors(604);
     }
     if (!isValid($options['password'], 'password')) {
         return formatErrors(602);
     }
     // Make sure email does not exist already
     $total = $this->count("email = '" . $options['email'] . "'");
     if ($total > 0) {
         return formatErrors(603);
     }
     // If you made it this far, we need to add the record to the DB
     $options['password'] = generateHash($options['password']);
     $options['created_on'] = date("Y-m-d H:i:s");
     // Create user token
     do {
         $options['user_token'] = generateToken(30) . md5(time());
         $total = $this->count("user_token = '" . $options['user_token'] . "'");
         // If by some freak chance there is a collision
         // Report it
         if ($total > 0) {
             log_message('debug', 'User token collision detected on key of `' . $options['user_token'] . '`');
         }
     } while ($total > 0);
     // Add record
     $q = $this->db->insert_string('users', $options);
     $res = $this->db->query($q);
     // Check for errors
     $this->sendException();
     if ($res === true) {
         $user_id = $this->db->insert_id();
         return $this->read($user_id);
     } else {
         return formatErrors(500);
     }
 }
Esempio n. 15
0
            return false;
        }
        if (!$has3Consecutive) {
            if (ord($char) - ord($prev) === 1) {
                $numConsecutive++;
                if ($numConsecutive >= 3) {
                    $has3Consecutive = true;
                }
            } else {
                $numConsecutive = 1;
            }
        }
        if ($numPairs < 2) {
            if ($char === $prev) {
                $numRepeats++;
                if ($numRepeats % 2 === 1) {
                    $numPairs++;
                }
            } else {
                $numRepeats = 0;
            }
        }
        $prev = $char;
    }
    return $has3Consecutive && $numPairs >= 2;
}
$output = increment($input);
while (!isValid($output)) {
    $output = increment($output);
}
echo 'Answer: ' . $output . PHP_EOL;
Esempio n. 16
0
	}
</style>

<body>
<?php 
function isValid($username, $password)
{
    if (mb_strlen($username, "UTF-8") > 3 && mb_strlen($password, "UTF-8") > 3) {
        return true;
    }
    return false;
}
if (isset($_POST["check"]) && $_POST["check"] == "1") {
    $username = $_POST["username"];
    $pass = $_POST["pass"];
    $isValid = isValid($username, $pass);
    if ($isValid) {
        $servername = "localhost";
        $sqlUsername = "******";
        $password = "******";
        $dbname = "activeusers";
        $connection = new mysqli($servername, $sqlUsername, $password, $dbname);
        if ($connection->connect_error) {
            die("Невъзможно свързване със сървър: " . $connection->connect_error);
        }
        $connection->set_charset("utf8");
        $passwordHash = md5($pass);
        $sql = "SELECT COUNT(*) AS UsersCount FROM users " . "WHERE Username='******' AND Password='******'";
        $queryReselt = $connection->query($sql);
        $row = $queryReselt->fetch_assoc();
        if ($row["UsersCount"] == 1) {
Esempio n. 17
0
## SCRIVO L'ebXML SBUSTATO
$log->writeLogFile("RECEIVED:", 1);
$log->writeLogFile($ebxml_STRING, 0);
### SCRIVO L'ebXML DA VALIDARE (urn:uuid: ---> urn-uuid-)
$ebxml_STRING_VALIDATION = adjustURN_UUIDs($ebxml_STRING);
if ($save_files) {
    writeTmpFiles($ebxml_STRING_VALIDATION, $idfile . "-ebxml_for_validation.xml");
}
$schema = 'schemas3/lcm.xsd';
$isValid = isValid($ebxml_STRING_VALIDATION, $schema);
if ($isValid) {
    writeTimeFile($idfile . "--Repository: Ho superato la prima validazione dell'ebxml");
}
## Qui valido l'ebxml con gli schemi più restrittivi v2 trasformati in v3
$schema2 = 'schemas3/lcm3.xsd';
$isValid2 = isValid($ebxml_STRING_VALIDATION, $schema2);
if ($isValid2) {
    writeTimeFile($idfile . "--Repository: Ho superato la seconda validazione dell'ebxml");
}
$connessione = connectDB();
##################################################################
### QUI SONO SICURO CHE IL METADATA E' VALIDO RISPETTO ALLO SCHEMA
############################################################
### OTTENGO L'OGGETTO DOM RELATIVO ALL'ebXML
$dom_ebXML = domxml_open_mem($ebxml_STRING);
##################################################################
#### SECONDA COSA: DEVO VALIDARE XDSSubmissionSet.sourceId
$SourceId_valid = validate_XDSSubmissionSetSourceId($dom_ebXML, $connessione);
if (!$SourceId_valid) {
    writeTimeFile($idfile . "--Repository: XDSSubmissionSetSourceId valido");
}
Esempio n. 18
0
<?php

$password = '******';
$password++;
while (!isValid($password)) {
    $password++;
}
// Part one
echo 'Part one: ' . $password . '
';
$password++;
while (!isValid($password)) {
    $password++;
}
// Part two
echo 'Part two: ' . $password . '
';
function isValid($password)
{
    $letters = str_split($password);
    if (!empty(array_intersect($letters, ['i', 'o', 'l']))) {
        return false;
    }
    $has3Letters = false;
    $hasPairs = false;
    $lastPair = null;
    $count = count($letters);
    for ($i = 0; $i < $count - 2; $i++) {
        $firstPlus2 = $letters[$i];
        $firstPlus2++;
        $firstPlus2++;
Esempio n. 19
0
<?php

/**
 * Created by PhpStorm.
 * User: Liu
 * Date: 10/6/2015
 * Time: 1:23 AM
 */
$username = $_POST["username"];
$password = $_POST["password"];
$authority = "student";
$password = passport_encrypt($password);
$flag = isValid($username, $password, $authority);
//echo 1;
echo $username;
if ($flag == true) {
    //echo 1;
    session_start();
    $_SESSION["sid"] = $username;
    //header
    header("location:student/view/displayStudentProfile.php");
} else {
    //header
    //echo $username;
}
function isValid($username, $password, $authority)
{
    $con = mysql_connect("localhost:3306", "root", "5656123ljx");
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
Esempio n. 20
0
    $inizioAdhocQueryRequest = "<AdhocQueryRequest";
    $fineAdhocQueryRequest = "</AdhocQueryRequest>";
    $ebxml_STRING = substr($ebxml_imbustato_soap_STRING, strpos($ebxml_imbustato_soap_STRING, $inizioAdhocQueryRequest), strlen($ebxml_imbustato_soap_STRING) - strlen(substr($ebxml_imbustato_soap_STRING, strpos($ebxml_imbustato_soap_STRING, $fineAdhocQueryRequest) + strlen($fineAdhocQueryRequest))));
    $ebxml_STRING = str_replace(substr($ebxml_imbustato_soap_STRING, strpos($ebxml_imbustato_soap_STRING, $fineAdhocQueryRequest) + strlen($fineAdhocQueryRequest)), "", $ebxml_STRING);
} else {
    $inizioAdhocQueryRequest = "<{$namespacequery}:AdhocQueryRequest";
    $fineAdhocQueryRequest = "</{$namespacequery}:AdhocQueryRequest>";
    $ebxml_STRING = substr($ebxml_imbustato_soap_STRING, strpos($ebxml_imbustato_soap_STRING, $inizioAdhocQueryRequest), strlen($ebxml_imbustato_soap_STRING) - strlen(substr($ebxml_imbustato_soap_STRING, strpos($ebxml_imbustato_soap_STRING, $fineAdhocQueryRequest) + strlen($fineAdhocQueryRequest))));
    $ebxml_STRING = str_replace(substr($ebxml_imbustato_soap_STRING, strpos($ebxml_imbustato_soap_STRING, $fineAdhocQueryRequest) + strlen($fineAdhocQueryRequest)), "", $ebxml_STRING);
}
###################################################################################
$error_code = array();
$failure_response = array();
####### VALIDAZIONE DELL'ebXML SECONDO LO SCHEMA
$schema = 'schemas3/query.xsd';
$isValid = isValid($ebxml_STRING, $schema);
if ($isValid) {
    writeTimeFile($idfile . "--StoredQuery: Il metadata e' valido");
}
//Creo la query dalle StoredQuery
require_once 'lib/createQueryfromStoredQuery.php';
//Se trovo almeno un errore
if (count($error_code) > 0) {
    $SOAPED_failure_response = makeSoapedFailureStoredQueryResponse($failure_response, $error_code, $Action, $MessageID);
    ### SCRIVO LA RISPOSTA IN UN FILE
    $file_input = $idfile . "-SOAPED_failure_response.xml";
    writeTmpQueryFiles($SOAPED_failure_response, $file_input, true);
    SendResponseFile($tmpQueryService_path . $file_input);
    //SendResponse($SOAPED_failure_response,"application/soap+xml",(string)filesize($tmpQueryService_path.$idfile."-SOAPED_failure_response.xml"));
    exit;
}
Esempio n. 21
0
							<div class="col-sm-12 controls">
								<button type="submit" class="btn btn-primary pull-right" value="Register" ><i class="fa fa-pencil-square-o"></i> Register</button>    
								<?php 
if (!isset($_GET['mobile'])) {
    ?>
<a href="/" class="btn btn-primary pull-right" value="Register" ><i class="fa fa-ban"></i> Cancel</a><?php 
}
?>
    								
							</div>
						</div>
					</form>
					
					<?php 
if (isset($_POST['username']) && isset($_POST['g-recaptcha-response'])) {
    if (isValid()) {
        if (strlen($_POST['username']) >= 8) {
            if (strlen($_POST['phone']) == countDigits($_POST['phone'])) {
                $con = mysqli_connect("localhost", "root", "PASS", "secure_login");
                if (mysqli_connect_errno()) {
                    die('Could not connect: ' . mysqli_connect_error());
                }
                $result = mysqli_query($con, "SELECT username FROM members WHERE username='******'username'] . "'");
                if (mysqli_num_rows($result) == 0) {
                    $result = mysqli_query($con, "SELECT email FROM members WHERE email='" . strtolower($_POST['email']) . "'");
                    if (mysqli_num_rows($result) == 0) {
                        mysqli_query($con, "INSERT INTO members (username, password, email, phone, salt, recoveryid, recoveryValid) VALUES ('" . $_POST['username'] . "','" . strtoupper(getSalt()) . "','" . strtolower($_POST['email']) . "','" . $_POST['phone'] . "','" . strtoupper(getSalt()) . "','" . generateRandomString(16) . "','" . date("d/m/Y") . "')");
                        send_mail();
                        mysqli_close($con);
                        $pieces = explode("@", $_POST['email']);
                        echo "Thank you for your registration. <br/>";
Esempio n. 22
0
{
    if (isset($_SESSION["isLoggedin"]) && strlen($_SESSION["username"])) {
        return true;
    } else {
        return false;
    }
}
if (isset($_SESSION["isLoggedin"]) && strlen($_SESSION["username"])) {
    redirect("m3p2account.php");
    exit;
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        // replace below with your code...
        $uv = new UsernameValidator();
        $username = '';
        if ($uv = isValid($_POST['username'])) {
            $username = $_POST['username'];
        }
        // if(isset($_SESSION["isLoggedin"]) && strlen($_SESSION["password"])) {
        //     redirect("account.php");
        //     exit();
        // } else {
        //     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        //     // replace below with your code...
        //         $pv = new PasswordValidator();
        //         $password='';
        //         if($uv=isValid($_POST['password'])) {
        //             $username = $_POST['password'];
        //         }
        // die('Recursive Submission');
    }
function isValid($appQ, $fbQ) {
	foreach($appQ as $count => $question) {
		if (!isset($_POST["q".$count]))
			return false;
	}
	foreach($fbQ as $count => $question) {
		if (!isset($_POST["fb".$count]))
			return false;
	}
	return isset($_POST["rushEmail"]) && isset($_POST["gpa"]);
}

$no_error = false;

if (isValid($appQuestions, $feedbackQuestions)) {
	
	include("../db/credentials.php");
	
	// Create connection
	$conn = new mysqli($hostname, $username, $password, $dbname);
	// Check connection
	if ($conn->connect_error) {
		die("Connection failed: " . $conn->connect_error);
	} 

	$sql = "INSERT INTO $rushTableApps (email, gpa";
	foreach($appQuestions as $key => $question) {
		$sql .= ", q" . $key;
	}
	foreach($feedbackQuestions as $key => $question) {
require '../auth/pbkdf2.php';
function isValid()
{
    try {
        $url = 'https://www.google.com/recaptcha/api/siteverify';
        $data = array('secret' => RECAPTCHA_PRIVATE_KEY, 'response' => $_POST['g-recaptcha-response'], 'remoteip' => $_SERVER['REMOTE_ADDR']);
        $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data)));
        $context = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
        return json_decode($result)->success;
    } catch (Exception $e) {
        return null;
    }
}
if (RECAPTCHA_PUBLIC_KEY !== '%recaptcha_public%' && RECAPTCHA_PUBLIC_KEY !== '(optional)') {
    if (!isValid()) {
        // What happens when the CAPTCHA was entered incorrectly
        $response = array("error" => true, "message" => "ReCAPTCHA thinks you're a robot. Please check the box.");
        echo json_encode($response);
        die;
    }
}
//check for email uniqueness
$q = $dbh->prepare("SELECT * FROM cm_users WHERE email = ?");
$q->bindParam(1, $_POST['email']);
$q->execute();
$count = $q->rowCount();
if ($count > 0) {
    $response = array('error' => true, 'message' => 'There is already a user on this system with the email address ' . $_POST['email'] . '.  Perhaps you already have an account?');
    echo json_encode($response);
    die;
Esempio n. 25
0
     writeTmpFiles($ebxml_imbustato_soap, $idfile . "-ebxml_imbustato_soap.xml");
 }
 #### ebXML
 $dom_SOAP_ebXML = domxml_open_mem($ebxml_imbustato_soap);
 $root_SOAP_ebXML = $dom_SOAP_ebXML->document_element();
 $dom_SOAP_ebXML_node_array = $root_SOAP_ebXML->get_elements_by_tagname("SubmitObjectsRequest");
 for ($i = 0; $i < count($dom_SOAP_ebXML_node_array); $i++) {
     $node = $dom_SOAP_ebXML_node_array[$i];
     $ebxml_STRING = $dom_SOAP_ebXML->dump_node($node);
 }
 ## SCRIVO L'ebXML SBUSTATO
 $log->writeLogFile("RECEIVED:", 1);
 $log->writeLogFile($ebxml_STRING, 0);
 ### SCRIVO L'ebXML DA VALIDARE (urn:uuid: ---> urn-uuid-)
 $ebxml_STRING_VALIDATION = adjustURN_UUIDs($ebxml_STRING);
 $isValid = isValid($ebxml_STRING_VALIDATION);
 if ($isValid) {
     writeTimeFile($idfile . "--Repository: Ho superato la validazione dell'ebxml");
 }
 $connessione = connectDB();
 ##################################################################
 ### QUI SONO SICURO CHE IL METADATA E' VALIDO RISPETTO ALLO SCHEMA
 ############################################################
 ### OTTENGO L'OGGETTO DOM RELATIVO ALL'ebXML
 $dom_ebXML = domxml_open_mem($ebxml_STRING);
 ##################################################################
 #### SECONDA COSA: DEVO VALIDARE XDSSubmissionSet.sourceId
 $SourceId_valid = validate_XDSSubmissionSetSourceId($dom_ebXML, $connessione);
 if (!$SourceId_valid) {
     writeTimeFile($idfile . "--Repository: XDSSubmissionSetSourceId valido");
 }
Esempio n. 26
0
$activar_botones = true;

// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2007 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of supportpro supportdesk                 |
// +----------------------------------------------------------------------+
// | Authors: roshith<*****@*****.**>             		              |
// |          										                      |
// +----------------------------------------------------------------------+

require_once("../includes/decode.php");

if(!isValid(1)) {
    echo("<script>window.location.href='../invalidkey.php'</script>");
    exit();
}
//warning message before 10 days
if($glob_date_check == "Y") {
    echo("<script>alert('" . MESSAGE_LICENCE_EXPIRE . $glob_date_days . MESSAGE_LICENSE_DAYS . "');</script>");
}
//end warning

$var_staffid =   $_SESSION["sess_staffid"];
$fld_arr     =   $_SESSION["sess_fieldlist"];
$fld_prio    =   $_SESSION["sess_priority"];


$var_next_limitvalue = $_GET["limitval"];
Esempio n. 27
0
    case 'del_vendor':
        if (isValid('vendor_id')) {
            if ($ds->isUsed('keywords', 'vendorid', $_POST['vendor_id'])) {
                $error_message = 'Вендор указан в ключевых словах групп. Невозможно удалить.';
            } else {
                del_vendor($_POST['vendor_id']);
            }
        }
        break;
    case 'add_vendor':
        if (isValid('new_vendor_name')) {
            if ($ds->isUsed('vendors', 'name', $_POST['new_vendor_name'])) {
                $error_message = 'Вендор с названием "' . $_POST['new_vendor_name'] . '" уже существует. Невозможно добавить.';
            } else {
                add_vendor($_POST['new_vendor_name']);
            }
        }
        break;
    case 'rename_vendor':
        if (isValid('change_vendor_name', 'vendor_id')) {
            if ($ds->isUsed('vendors', 'name', $_POST['change_vendor_name'])) {
                $error_message = 'Вендор с названием "' . $_POST['change_vendor_name'] . '" уже существует. Невозможно переименовать.';
            } else {
                rename_vendor($_POST['vendor_id'], $_POST['change_vendor_name']);
            }
        }
        break;
    default:
        echo "{$case}\n";
        break;
}
Esempio n. 28
0
if (empty($_POST['recaptcha'])) {
    $obj = array('status' => 'warning', 'libelle' => $lang->formMessageNotARobot);
    die(json_encode($obj));
}
// Checks params are not empty
if (empty($_POST['prenom']) || empty($_POST['nom']) || empty($_POST['email']) || empty($_POST['message'])) {
    $obj = array('status' => 'warning', 'libelle' => $lang->formMessageFieldsMissing);
    die(json_encode($obj));
}
// Checks message field contain less or equal 1000 characters
if (strlen($_POST['message']) > 1000) {
    $obj = array('status' => 'warning', 'libelle' => $lang->formMessageFieldsTooLong);
    die(json_encode($obj));
}
// Check recaptcha is valid
if (!isValid($app, $logger, $_POST['recaptcha'])) {
    $obj = array('status' => 'danger', 'libelle' => $lang->formMessageRobotNotGood);
    die(json_encode($obj));
}
// If no errors, send a mail and show the result message to the user
sendMail($render, $app, $mailer, $logger, $_POST['prenom'], $_POST['nom'], $_POST['email'], nl2br(htmlspecialchars($_POST['message'])));
$obj = array('status' => 'success', 'libelle' => $lang->formMessageSuccess);
die(json_encode($obj));
/**
* Functions
*/
function isValid($app, $logger, $code)
{
    if (empty($code)) {
        return false;
        // Si aucun code n'est entré, on ne cherche pas plus loin
Esempio n. 29
0
<?php

$password = '******';
// part 1 input
//$password = '******';     // part 1 solution => input part 2
$threeLetterIncrease = generateThreeLetterIncrease();
while (!isValid(++$password)) {
}
echo "password: {$password}\n";
/**
 * Generates an array of all tree letter increases; abc, bcd, ...
 * Could be replace with a static array of these
 *
 * @return array
 */
function generateThreeLetterIncrease()
{
    $alphabeth = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
    $result = [];
    for ($i = 0; $i < count($alphabeth) - 2; $i++) {
        $result[$alphabeth[$i] . $alphabeth[$i + 1] . $alphabeth[$i + 2]] = true;
    }
    return $result;
}
/**
 * Check if a password is valid
 *
 * @param string $password
 * @return bool
 */
function isValid($password)
                $AD_HOST = $var_row["vLookUpValue"];
                break;
            case "AD_USER_DIR":
                $AD_USER_DIR = $var_row["vLookUpValue"];
                break;
            case "PostTicketBeforeLogin":
                $PostTicketBeforeLogin = $var_row["vLookUpValue"];
                break;
            case "HomeFooterContent":
                $HomeFooterContent = $var_row["vLookUpValue"];
                break;
        }
    }
}
/*...........Section for active directoryy variables......................*/
if (!isValid(0)) {
    echo "<script>window.location.href='invalidkey.php'</script>";
    exit;
}
$sql = "Select vLookUpName,vLookUpValue from sptbl_lookup WHERE vLookUpName IN('LangChoice',\n                                'DefaultLang','HelpdeskTitle','Logourl','logactivity','MaxPostsPerPage','OldestMessageFirst')";
$rs = executeSelect($sql, $conn);
if (mysql_num_rows($rs) > 0) {
    while ($row = mysql_fetch_array($rs)) {
        switch ($row["vLookUpName"]) {
            case "LangChoice":
                $_SESSION["sess_langchoice"] = $row["vLookUpValue"];
                break;
            case "DefaultLang":
                $_SESSION["sess_defaultlang"] = $row["vLookUpValue"];
                break;
            case "HelpdeskTitle":