This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Оригинал кода | |
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $path)) { | |
return 0; | |
} | |
$path = $glavurl . $path; | |
$size = getimagesize($path); | |
$image[0] = $size[0]; | |
$image[1] = $size[1]; | |
$image[2] = $path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Что плохого в каждом из этих двух кусков кода? | |
//Первый: | |
$sql = "SELECT * FROM banners WHERE status_ban != 'Del'"; | |
$result = mysql_query($sql, $con) or die (mysql_error()); | |
$count = mysql_num_rows($result); | |
//Примечание: $result более нигде не используется. | |
//Второй: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Дана форма: | |
?> | |
<form> | |
<input type="text" name="alpha" value=""/> | |
<input type="text" name="beta" value=""/> | |
<input type="text" name="gamma" value=""/> | |
</form> | |
<?php | |
//На страницу с этой формой могут поступать значения через POST и GET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Принимаем на веру, что есть класс работы с БД $SQL, где: | |
//getOne() – получение первого единичного значения из запроса | |
//query() – выполнение запроса к базе | |
//Получение массива данных из файла дампа | |
$data = file(__DIR__ . "/dump.txt", FILE_IGNORE_NEW_LINES); | |
//Можно получить текущее максимальное значение ID из базы. А можно принять на веру, что это 1. | |
$verim = true; |