|
| |
|
|
| |
для: loras
(05.05.2006 в 06:45)
| | | Как выглядит сообщение об ошибке для 5 строки? | |
| |
|
|
| |
|
|
| |
для: loras
(05.05.2006 в 06:44)
| | | вернее, ошибка теперь в 5 строчке | |
| |
|
|
| |
|
|
| |
для: targa
(05.05.2006 в 05:56)
| | | даже на сервер поставила. не работает
та же ошибка
черт | |
| |
|
|
| |
|
|
| |
для: loras
(05.05.2006 в 05:00)
| | | А аттач к моему предыдущему посту смотрели? | |
| |
|
|
| |
|
|
| |
для: targa
(05.05.2006 в 04:40)
| | | Спасибо, но сайт все равно не открывается
Черт | |
| |
|
|
| |
|
|
| |
для: loras
(05.05.2006 в 03:58)
| | | Честно не понял, что исправил. Но Error Parsing у меня пропал :)
Удивили лишние фигурные скобки
public function get(){
if(array_key_exists(self::$cookiename, $_COOKIE)){
$buffer=$this->_unpackage($_COOKIE[self::$cookiename]);
}else{
throw new Exception('Вы зашли не с того, компьютера');
}
}
|
Мне кажется лучше так
public function get()
{
if(array_key_exists(self::$cookiename, $_COOKIE)) $buffer=$this->_unpackage($_COOKIE[self::$cookiename]);
else throw new Exception('Âû çàøëè íå ñ òîãî, êîìïüþòåðà');
}
|
| |
| |
|
|
| |
|
|
| |
для: targa
(05.05.2006 в 03:27)
| | | Весь файл выглядит так
<?php
class Cookie{
private $validid;
private $created;
private $userid;
private $version;
private $td;
static $cypher='blowfish';
static $mode='cfb';
static $key='2sRD22342e1Vn#234w4dR2.34564gdYewafd';
static $cookiename='USERAUTH';
static $expiration='31536000';
static $path='/';
static $myversion='1';
static $glue='|';
public function __construct($validid){
//$this->td=mcrypt_module_open($cypher, '', $mode, '');
if($validid){
$this->validid=$validid;
}else{
throw new Exception();
}
}
public function get(){
if(array_key_exists(self::$cookiename, $_COOKIE)){
$buffer=$this->_unpackage($_COOKIE[self::$cookiename]);
}else{
throw new Exception('Вы зашли не с того, компьютера');
}
}
public function set(){
$cookie=$this->_package();
setcookie(self::$cookiename, $cookie, time() + self::$expiration, self::$path);
}
public function validate(){
if(!$this->version || !$this->created || !$this->userid){
throw new Exception();
}
if($this->version!=self::$myversion){
throw new Exception();
}
if($this->userid!=$this->validid){
throw new Exception('Вы зашли не с того, компьютера');
}
}
private function _package(){
$parts=array(self::$myversion, time(), $this->validid);
$cookie=implode(self::$glue, $parts);
return $this->_encrypt($cookie);
}
private function _unpackage($cookie){
$buffer=$this->_decrypt($cookie);
list($this->version, $this->created, $this->userid)=explode(self::$glue, $buffer);
if($this->version!=self::$myversion || !$this->created || !$this->userid){
throw new Exception();
}
}
private function _encrypt($plaintext){
/*$ivsize=mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($this->td, $this->key, $iv);
$crypttext=mcrypt_generic($this->td, $plaintext);
mcrypt_generic_deinit($this->td);*/
//////
$iv='';
$crypttext=$plaintext;
//////
return $iv.$crypttext;
}
private function _decrypt($crypttext){
/*$ivsize=mcrypt_get_iv_size($this->td);
$if=substr($crypttext, 0, $ivsize);
$crypttext=substr($this->td, $this->key, $iv);
$plaintext=mdecrypt_generic($this->td);*/
//////
$plaintext=$crypttext;
//////
return $plaintext;
}
private function _reissue(){
$this->created=time();
}
}
?> | |
| |
|
|
| |
|
|
| |
для: loras
(05.05.2006 в 03:13)
| | | Вроде как нехватает в конце заключительной фигурной скобки (класс закрыть. Ну и ?> в конце. | |
| |
|
|
| |
|
|
| | При открытии сайта выдается сообщение
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/l/xxxx/htdocs/xxxxx/classes/cookie.php5 on line 3
а вот начало вайла cookie.php5
<?php
class Cookie{
private $validid;
private $created;
private $userid;
private $version;
private $td;
static $cypher='blowfish';
static $mode='cfb';
static $key='2sRD22342e1Vn#234w4dR2.34564gdYewafd';
static $cookiename='USERAUTH';
static $expiration='31536000';
static $path='/';
static $myversion='1';
static $glue='|';
public function __construct($validid){
//$this->td=mcrypt_module_open($cypher, '', $mode, '');
if($validid){
$this->validid=$validid;
}else{
throw new Exception();
}
} | |
| |
|
|
|