Example #1
1
 public function post_new()
 {
     $input = Input::all();
     //grab our input
     $rules = array('name' => 'required|alpha', 'lastName' => 'required|alpha', 'permit' => 'required|min:2', 'lot' => 'required|integer', 'msc' => 'integer', 'ticket' => 'required|min:2|numeric|unique:tickets,ticketID', 'fineAmt' => 'required|numeric', 'licensePlate' => 'required|alpha_num', 'licensePlateState' => 'required|max:2', 'dateIssued' => 'required', 'violations' => 'required', 'areaOfViolation' => 'required|alpha_num', 'appealLetter' => 'required|max:700');
     //validation rules
     $validation = Validator::make($input, $rules);
     //let's run the validator
     if ($validation->fails()) {
         return Redirect::to('appeal/new')->with_errors($validation);
     }
     //hashing the name of the file uploaded for security sake
     //then we'll be dropping it into the public/uploads file
     //get the file extension
     $extension = File::extension($input['appealLetter']['name']);
     //encrypt the file name
     $file = Crypter::encrypt($input['appealLetter']['name'] . time());
     //for when the crypter likes to put slashes in our scrambled filname
     $file = preg_replace('#/+#', '', $file);
     //concatenate extension and filename
     $filename = $file . "." . $extension;
     Input::upload('appealLetter', path('public') . 'uploads/', $filename);
     //format the fine amount in case someone screws it up
     $fineamt = number_format(Input::get('fineAmt'), 2, '.', '');
     //inserts the form data into the database assuming we pass validation
     Appeal::create(array('name' => Input::get('name'), 'lastName' => Input::get('lastName'), 'permitNumber' => Input::get('permit'), 'assignedLot' => Input::get('lot'), 'MSC' => Input::get('msc'), 'ticketID' => Input::get('ticket'), 'fineAmt' => $fineamt, 'licensePlate' => Str::upper(Input::get('licensePlate')), 'licensePlateState' => Input::get('licensePlateState'), 'dateIssued' => date('Y-m-d', strtotime(Input::get('dateIssued'))), 'violations' => Input::get('violations'), 'areaOfViolation' => Input::get('areaOfViolation'), 'letterlocation' => URL::to('uploads/' . $filename), 'CWID' => Session::get('cwid')));
     return Redirect::to('appeal/')->with('alertMessage', 'Appeal submitted successfully.');
 }
    /**
     * @param eZContentObjectTreeNode $node
     * @return array
     */
    public function getNodeUrl( &$node = null )
    {
        $merckIni = ExternalLinkHandlerBase::iniMerck();
        $action = $merckIni->variable( 'AlexandriaSettings' , 'Action' );
        $referer = $merckIni->variable( 'AlexandriaSettings' , 'Referer' );
        $uuid = MMUsers::getCurrentUserObject()->uuid;
        $baseUrl = $merckIni->variable( 'AlexandriaSettings' , 'BaseLoginUrl' );
        $url = $this->application()->applicationLocalized()->external_url;
        $requestTime = time();
        
        if ( !$uuid )
        {
            self::redirectToErrorPage();
        }
        
        $vectorShared = mcrypt_create_iv( Crypter::iv_size() );
        
        $params = array(
            'username' => $uuid,
            'referer' => $referer,
            'action' => $action,
            'request_time' => $requestTime,
            'URL' => $url
        );

        $encodeArray = json_encode( $params );
        $encodeArray = Crypter::pad( $encodeArray );
        $userEncrypt = Crypter::encrypt( $encodeArray, $vectorShared );
        
        $urlParams = array(
            'v'   =>  base64_encode( $vectorShared ),
            'val' =>  base64_encode( $userEncrypt )
        );
        
        return array( 'url' => $baseUrl, 'params' => $urlParams );
    }
Example #3
0
				<td>
					<input id="upload" type="file" name="file_upload" />

					<ul id="uploaded-attachments"></ul>
				</td>
			</tr>
			<tr>
				<th></th>
				<td><input type="submit" value="<?php 
echo __('tinyissue.create_issue');
?>
" class="button primary" /></td>
			</tr>
		</table>

		<?php 
echo Form::hidden('session', Crypter::encrypt(Auth::user()->id));
?>
		<?php 
echo Form::hidden('project_id', Project::current()->id);
?>
		<?php 
echo Form::hidden('token', md5(Project::current()->id . time() . \Auth::user()->id . rand(1, 100)));
?>
		<?php 
echo Form::token();
?>

	</form>

</div>
Example #4
0
 protected function encodeValue($value)
 {
     $value = \Crypter::encrypt($value);
     $value = str_replace(array('/', '+', '='), array('_', '-', ''), $value);
     return $value;
 }
Example #5
0
 /**
  * Set a cookie so that the user is "remembered".
  *
  * @param  string  $id
  * @return void
  */
 protected static function remember($id)
 {
     $recaller = Crypter::encrypt($id . '|' . Str::random(40));
     // This method assumes the "remember me" cookie should have the same
     // configuration as the session cookie. Since this cookie, like the
     // session cookie, should be kept very secure, it's probably safe.
     // to assume the cookie settings are the same.
     $config = Config::get('session');
     extract($config, EXTR_SKIP);
     $cookie = Config::get('auth.cookie');
     Cookie::forever($cookie, $recaller, $path, $domain, $secure);
 }
            $passmd5 = md5($pass);
            $result = mysql_query("INSERT INTO users(Login, Password, IP, Email, Balans, UserGroup, RegisterDate,Preferences) VALUES('{$login}','{$passmd5}','{$IP}','{$email}',1, {$usergroup}, NOW(),'')");
            if (!$result) {
                $errors .= "Ошибка при обработке запроса к MySQL. Обратитесь к <a href='mailto:macondos@inbox.ru'>администратору</a><br>";
                $errors .= mysql_errno() . ": " . mysql_error() . "\n";
            }
        }
    }
}
$crypter = new Crypter(MODE_ECB, 'blowfish', 'key52345346_change_it');
if (isset($_REQUEST['logon'])) {
    if (isset($_POST['login']) && isset($_POST['pass'])) {
        $_SESSION['login'] = $_POST['login'];
        $_SESSION['pass'] = $_POST['pass'];
        if (isset($_POST['remember'])) {
            setcookie("login", base64_encode($crypter->encrypt($_POST['login'])), time() + 1209600);
            setcookie("pass", base64_encode($crypter->encrypt($_POST['pass'])), time() + 1209600);
        }
    }
}
$login = isset($_SESSION['login']) ? $_SESSION['login'] : (isset($_COOKIE['login']) ? trim($crypter->decrypt(base64_decode($_COOKIE['login']))) : "");
$pass = isset($_SESSION['pass']) ? $_SESSION['pass'] : (isset($_COOKIE['pass']) ? trim($crypter->decrypt(base64_decode($_COOKIE['pass']))) : "");
$_SESSION['login'] = $login;
$_SESSION['pass'] = $pass;
$user = GetUserID($login, $pass);
$exit = isset($_GET['exit']) ? $_GET['exit'] : 0;
if (!$exit && !$user && !$login && !$pass && !isset($_REQUEST['register'])) {
    $login = "******";
    $pass = "******";
    $user = GetUserID($login, $pass);
    if ($user) {
Example #7
0
 /**
  * Store a user's token in a long-lived cookie.
  *
  * @param  string  $token
  * @return void
  */
 protected function remember($token)
 {
     $token = Crypter::encrypt($token . '|' . Str::random(40));
     $this->cookie($this->recaller(), $token, Cookie::forever);
 }
Example #8
0
 /**
  * Pasa de la clave de texto plano a una clave cifrada para guardar en la BD
  *
  */
 public function ensuciarClave($clave = '')
 {
     $crypt = new Crypter(sfConfig::get('app_general_cifrado_usuario'));
     if ($clave != "") {
         $this->setClavelimpia($clave);
         $otra_clave = $crypt->encrypt($clave);
         $this->setClave($otra_clave);
     } else {
         $otra_clave = $crypt->encrypt($this->getClavelimpia());
         $this->setClave($otra_clave);
     }
     return $otra_clave;
 }