#php

Пользователь

от norberto_thiel , в категории: PHP , 2 года назад
Нет ответов

Как делают валидацию на Codeigniter в PHP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$room=$this->input->post('room');
$broom=$this->input->post('broom');
$hall=$this->input->post('hall');
$troom=$this->input->post('troom');
$park=$this->input->post('park');
$floor=$this->input->post('floor');
$amen=str_replace("\'", "'", $this->input->post('amen'));
$rmark=str_replace("\'", "'", $this->input->post('rmark'));
$face=$this->input->post('face');
$leven=$this->input->post('leven');
$twel=$this->input->post('twel');


//$uid = $_SESSION['id'];
  $date=date('d-m-Y');


  if(empty($room))$room='0'; if(empty($broom))$broom='0'; if(empty($hall))$hall='0';if(empty($troom))$troom='0'; if(empty($floor))$floor='0';
if(empty($park))$park='Not updated'; if(empty($amen))$amen='Not updated'; if(empty($rmark))$rmark='Not updated'if(empty($l1))$l1='Not updated'; if(empty($l2))$l2='Not updated'; if(empty($face))$face='Not updated'if($ptype == 'Land' || $ptype == 'Commercial Property')$bhk=0;


if (empty($tit) || empty($loc) || empty($lmark) || empty($zone) || empty($area)|| empty($price) || empty($aa) || empty($ptype) || empty($pfrom) || empty($bank) || empty($nc) || empty($br))
{
$this->session->set_flashdata('field','*Please fill all the required fields');
redirect("edit_property/admin_edit/$id");
//redirect('edit_property');
}


Пользователь

от arlene , в категории: PHP , 2 года назад
Нет ответов

Когда реально очень нужен PHP язык

1
2
3
4
5
echo "<!DOCTYPE HTML>";
echo "<html>";
echo "<head>";
echo "<meta charset ='utf-8'>";
echo "<link rel='stylesheet' type='text/css' href='styles.css'>";


Пользователь

от laverna , в категории: PHP , 2 года назад
Нет ответов

Обернул встроенную функцию PHP в свою функцию, только зачем я так и не понял

1
2
3
function toinv($input){
    return intval($input);
}


Пользователь

от rex.langosh , в категории: PHP , 2 года назад
Нет ответов

Проверка доступа на странице в PHP 😁

1
2
3
4
if (!defined("IN_SCRIPT") || !isset($_SESSION['admin_user_id']) || !$_SESSION['admin_user_id'] || !isset($_SESSION['admin_username']) || !$_SESSION['admin_username']){
    header("Location: login.php?menu=$menu");
    die();
}


Пользователь

от janis , в категории: PHP , 2 года назад
Нет ответов

Как создать переменную в PHP? Легко 😘

1
2
3
4
5
6
7
8
public static function newVariable($key,$value){

    if (self::$variables==null){
        self::$variables=array();
    }

    self::$variables[$key]=$value;
}


Пользователь

от zoey_langosh , в категории: PHP , 2 года назад
Нет ответов

Шедевр на PHP который берет за душу 😗

1
2
3
4
5
6
7
if ($name==null && $item==null){
  return self::$collection;
}
  
if ($name==null){
  throw new Exception('Cannot save null list item');
}

Пользователь

от norberto_thiel , в категории: PHP , 2 года назад
Нет ответов

SQL injection в PHP реальный пример

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
$title=$_POST['title'];
$genre=$_POST['genre'];
$actor=$_POST['actor'];

mysqli_query($connect,"INSERT INTO movies(title,genre,actor)
				VALUES('$title','$genre','$actor')");
					
if(mysqli_affected_rows($connect) > 0){
	echo "<p>Movie Added</p>";
	echo "<a href='searchdisplay.php'>Search for movies!</a>";
} else {
	echo "Movie NOT Added<br />";
	echo mysqli_error ($connect);
}