Этот коммит содержится в:
2017-01-25 19:08:19 +03:00
родитель 656c7455bf
Коммит de702d59a4
13 изменённых файлов: 476 добавлений и 23 удалений

Просмотреть файл

@@ -8,36 +8,139 @@
namespace PTEST\M;
use PFRM\Model;
class AdModel {
class AdModel extends Model{
protected $id;
protected $table_id;
protected $username;
protected $table_username;
protected $email;
protected $table_email;
protected $ip;
protected $table_homepage;
protected $browser;
protected $table_ip;
protected $text;
protected $table_browser;
protected $date;
protected $table_ptext;
function __construct() {
}
public function setUserName() {
protected $table_pdate;
/**
* @param $username
*
* @return bool|string
*/
public function setUserName( $username ) {
if ( preg_match( '/[a-z,\d]{3,}/i', $username ) ) {
$this->table_username = $username;
return true;
} else {
return "Только цифры и буквы латинского алфавита, минимум 3";
}
}
public function getUserName(){
return $this->username;
return $this->table_username;
}
/**
* @param mixed $email
*
* @return bool|string
*/
public function setEmail( $email ) {
if ( preg_match('/.+@.+\..+/i', $email ) ) {
$this->table_email = $email;
return true;
} else {
return "Введите коректный e-mail адрес";
}
}
/**
* @return mixed
*/
public function getEmail() {
return $this->email;
return $this->table_email;
}
/**
* @param mixed $homepage
*
* @return bool|string
*/
public function setHomepage( $homepage ) {
if ( preg_match('|https?://.*\..*|i', $homepage ) ) {
$this->table_homepage = $homepage;
return true;
} else {
return "Введите коректный адрес";
}
}
/**
* @return mixed
*/
public function getHomepage() {
return $this->table_homepage;
}
/**
* @param mixed $ip
*/
public function setIp( $ip ) {
$this->table_ip = $ip;
}
/**
* @return mixed
*/
public function getIp() {
return $this->table_ip;
}
/**
* @param mixed $browser
*/
public function setBrowser( $browser ) {
$this->table_browser = $browser;
}
/**
* @return mixed
*/
public function getBrowser() {
return $this->table_browser;
}
/**
* @param mixed $text
*/
public function setText( $text ) {
$this->table_ptext = strip_tags($text);
}
/**
* @return mixed
*/
public function getText() {
return $this->table_ptext;
}
/**
* @param mixed $date
*/
public function setDate( $date ) {
$this->table_pdate = $date;
}
/**
* @return mixed
*/
public function getDate() {
return $this->table_pdate;
}
}

Просмотреть файл

@@ -11,7 +11,9 @@ namespace PTEST\M;
class CAPTCHAModel {
public $code;
public function verify( $code ) {
return strtoupper( $code ) == $_SESSION['CAPTCHA'] ? true : "Неверный код с картинки";
}
public function getImage() {
global $app;
@@ -58,7 +60,7 @@ class CAPTCHAModel {
$image_data = ob_get_contents();
ob_end_clean();
$this->code = $captcha;
$_SESSION['CAPTCHA'] = $captcha;
return $image_data;
}