update
This commit is contained in:
90
core/class/UserValidator.class.php
Normal file
90
core/class/UserValidator.class.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Description of UserValidator.class
|
||||
*
|
||||
* Rozszerzenie Validatora dla specyficznych danych
|
||||
*
|
||||
* @author KoPi
|
||||
*/
|
||||
abstract class UserValidator {
|
||||
|
||||
/**
|
||||
* funkcja sprawdzaja czy podane dane juz istnieja w tabeli uzytkownik
|
||||
*
|
||||
* @param string $login
|
||||
*
|
||||
* @return int $amout - ilosc powtarzajacych sie loginow
|
||||
*/
|
||||
|
||||
public function CheckLoginRepeat($login)
|
||||
{
|
||||
$db = Registry::Get('db');
|
||||
$sql = "SELECT count(login) FROM wp_preserve WHERE login=:01";
|
||||
|
||||
$stmt = $db->prepare($sql)
|
||||
->bindParam("01", mysql_escape_string(strip_tags($login)) )
|
||||
->execute();
|
||||
|
||||
$amout=$stmt->FetchRow();
|
||||
|
||||
return $amout[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* funkcja sprawdzaja czy podane dane juz istnieja w tabeli uzytkownik
|
||||
*
|
||||
* @param string $login
|
||||
*
|
||||
* @return int $amout - ilosc powtarzajacych sie emaili
|
||||
*/
|
||||
|
||||
public function CheckEmailRepeat($email)
|
||||
{
|
||||
$db = Registry::Get('db');
|
||||
$sql = "SELECT count(email) FROM wp_preserve WHERE email=:01";
|
||||
|
||||
$stmt = $db->prepare($sql)
|
||||
->bindParam("01", mysql_escape_string(strip_tags($email)) )
|
||||
->execute();
|
||||
|
||||
$amout=$stmt->FetchRow();
|
||||
|
||||
return $amout[0];
|
||||
}
|
||||
|
||||
public function CheckPassword($password,$hash)
|
||||
{
|
||||
// sprawdzanie czy haslo jest ok
|
||||
$db = Registry::Get('db');
|
||||
$sql="SELECT count(login) FROM wp_preserve WHERE hash=:01 AND passwd=:02";
|
||||
|
||||
$stmt = $db->prepare($sql)
|
||||
->bindParam("01",mysql_escape_string(strip_tags($hash)) )
|
||||
->bindParam("02",mysql_escape_string(strip_tags($password)) )
|
||||
->execute();
|
||||
|
||||
$amout=$stmt->FetchRow();
|
||||
|
||||
return $amout[0];
|
||||
}
|
||||
|
||||
public function ValidatePhotoForm(){
|
||||
|
||||
|
||||
if ( $this->IsEmpty('name', 'Pole zdjêcia jest puste.'))
|
||||
{
|
||||
$this->IsNotEqualValue('error', 0, 'Wyst±pi³ b³±d serwera.');
|
||||
if( $this->IsFile('tmp_name','Przes³anie pliku nie powio³o siê.'))
|
||||
{
|
||||
$this->IsGoodImageFormat('type','Format przesy³anego pliku nie jest poprawny.');
|
||||
}
|
||||
$this->IsWithinRange('size','Przesy³any plik jast za du¿y.',0,ALLOWED_FILE_SIZE);
|
||||
}
|
||||
return $this->GetErrorList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user