Ejemplo n.º 1
0
 public static function generate($_asJson = true)
 {
     $result = array();
     $publicKey = sha1(mt_rand_str(40));
     $privateKey = sha1(mt_rand_str(40));
     #if(CWM_API::IsTokenValid($tokenValue)) {
     if (isUserLoggedIn()) {
         $result = array('public' => $publicKey, 'private' => $privateKey);
     }
     if ($_asJson) {
         $result = CWM_API::getAsJson($result);
     }
     return $result;
 }
Ejemplo n.º 2
0
    die('ERROR: No parameters passed');
}
// Check if a connection was established
if (!$conn) {
    die("No connection");
}
//CHECK
$query = "select username,id from tbl_users where username = :user";
$stmt = $conn->prepare($query);
$stmt->bindParam(':user', $user);
$stmt->execute();
$userRec = $stmt->fetch();
//Check if user exists
if ($userRec != null) {
    // $resetToken = mt_rand_str(32);
    $resetToken = mt_rand_str(4);
    $query2 = "update tbl_users_mobile set resetToken = :token where user_id = :user";
    $stmt3 = $conn->prepare($query2);
    $stmt3->bindParam(':token', $resetToken);
    $stmt3->bindParam(':user', $userRec['id']);
    $stmt3->execute();
    //Get Questions
    $querySelectQuestions = "select profile_value from tbl_user_profiles where user_id = '" . $userRec['id'] . "' and profile_key like 'profile.question%' order by profile_key asc";
    $stmt2 = $conn->prepare($querySelectQuestions);
    $stmt2->execute();
    $questions = $stmt2->fetchAll();
    $querySelectAnswers = "select profile_value from tbl_user_profiles where user_id = '" . $userRec['id'] . "' and profile_key like 'profile.answer%' order by profile_key asc";
    $stmt4 = $conn->prepare($querySelectAnswers);
    $stmt4->execute();
    $answers = $stmt4->fetchAll();
    $ret['q1']['qs_text'] = $questions[0]['profile_value'];
Ejemplo n.º 3
0
 $CategoryName = $allPostVars['CategoryName'];
 $CategoryDescription = $allPostVars['CategoryDescription'];
 $CategoryLogo = "";
 $CategoryIsActive = $allPostVars['CategoryIsActive'];
 $db = getDB();
 $output_dir = "public/category-images/";
 if (!is_dir($output_dir)) {
     mkdir($output_dir, 0777, true);
 }
 $imgs = array();
 if (isset($_FILES['CategoryLogo'])) {
     $files = $_FILES['CategoryLogo'];
     $ImageName = str_replace(' ', '-', strtolower($files['name']));
     $ImageExt = substr($ImageName, strrpos($ImageName, '.'));
     $ImageExt = str_replace('.', '', $ImageExt);
     $name = 'img' . mt_rand_str(3, 'TUVWXYZ256ABCDEFGH34IJKLMN789OPQR01S') . date('Ymd') . '' . '.' . $ImageExt;
     $CategoryLogo = $name;
     if (move_uploaded_file($files['tmp_name'], $output_dir . $name) === true) {
         $imgs[] = array("status" => "success", "code" => 1, 'url' => $output_dir . $name);
     }
 }
 $QueryLogo = "";
 if ($CategoryLogo != "") {
     $QueryLogo = " CategoryLogo=:CategoryLogo,";
 }
 $sth = $db->prepare("UPDATE productcategory \n            SET CategoryCompanyID = :CategoryCompanyID, CategoryName=:CategoryName,CategoryDescription=:CategoryDescription," . $QueryLogo . " CategoryIsActive=:CategoryIsActive\n            WHERE CategoryID = :CategoryID");
 $sth->bindParam(':CategoryCompanyID', $CategoryCompanyID);
 $sth->bindParam(':CategoryName', $CategoryName);
 $sth->bindParam(':CategoryDescription', $CategoryDescription);
 if ($CategoryLogo != "") {
     $sth->bindParam(':CategoryLogo', $CategoryLogo);
Ejemplo n.º 4
0
function generate_opendb_cookie()
{
    if (function_exists('openssl_random_pseudo_bytes')) {
        return sha1(openssl_random_pseudo_bytes(1024));
    } else {
        return mt_rand_str(40);
    }
}
Ejemplo n.º 5
0
<?php

require_once '../../../../core/dirHandler.php';
require_once $GLOBALS['dirLibs'] . '/external/meekrodb.2.2.class.php';
require_once $GLOBALS['dirCore'] . '/dbConfig.inc.php';
require_once $GLOBALS['dirCore'] . '/config.inc.php';
require_once $GLOBALS['dirCore'] . '/common.inc.php';
require_once $GLOBALS['dirLibs'] . '/internal/ide/compileLib.inc.php';
$compileLib = new CompileLib();
$randomHashUrl = mt_rand_str(11, '0123456789abcdefghijklmnoprstuvwqxyzABCDEFGHIJKLMNOPRSTUVWQXYZ');
$language = $_POST['language'];
$content = $_POST['content'];
$theme = $_POST['theme'];
$templateData = $compileLib->extractProject($language, $randomHashUrl);
if (strlen($content) == 0) {
    $content = $templateData;
}
/*if(strlen($content) == 0) {
		$content = $compileLib->getFile($language);
	}*/
DB::insert('CWM_SourceDraft', array('Id' => 0, 'Content' => $content, 'Language' => $language, 'Url' => $randomHashUrl, 'Theme' => $theme));
echo $randomHashUrl;
 /**
  * Generate a security token
  *
  * @return string the security token
  */
 private static function generateSecurityToken($len = 64)
 {
     return mt_rand_str($len);
 }
Ejemplo n.º 7
0
                        </div>
                      </div>
				   <div class="row">
                          <div class="input-field col s12">
                            <button class="btn cyan waves-effect waves-light right" type="button" name="action" onclick="confirmBooking();">Confirm & Pay
                              <i class="mdi-content-send right"></i>
                            </button>
                          </div>
                        </div>
                </form>
                  </div>
                </div>
              </div>
				</div>	
			<input type="hidden" id="iBookingCode" value="<?php 
echo mt_rand_str(6, 'TUVWXYZ256ABCDEFGH34IJKLMN789OPQR01S');
?>
" />
			  
				</div>
                <!--end container-->
            </section>
            <!-- END CONTENT -->
<?php 
include_once "footer.php";
?>
<script type="text/javascript" src="<?php 
echo PUBLIC_ROOT;
?>
js/customer/booknow.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"></script>
Ejemplo n.º 8
0
<?php

function mt_rand_str($l, $c = 'ABCDEFGHIJKLMNOPQRSTYVWXYZabcdefghijklmnopqrstuvwxyz1234567890')
{
    for ($s = '', $cl = strlen($c) - 1, $i = 0; $i < $l; $s .= $c[mt_rand(0, $cl)], ++$i) {
    }
    return $s;
}
//echo mt_rand_str(8); // Something like mp2tmpsw
echo mt_rand_str(10);
// Something like B9CD0F