Skip to content

Instantly share code, notes, and snippets.

View VictorFursa's full-sized avatar
🙃
Focusing

Victor Fursa VictorFursa

🙃
Focusing
View GitHub Profile
<?php
class Db{
private $server = 'localhost';
private $userName = 'root';
private $passwrod = '';
private $select = 'catalog';
private $charset = "utf8";
private $sql = "";
function __construct(){
$this->sql();
<?php
header("Content-Type: text/html; charset=utf-8");
include_once("Db.php");
class GuestBook{
private $firstName;
private $email;
private $message;
function __construct($db,$firstName,$email,$message){
$this->db = $db;
$this->firstName = $firstName;
@VictorFursa
VictorFursa / error
Last active January 12, 2016 12:19
<?php
class Db{
private $server = 'localhost';
private $userName = 'root';
private $passwrod = '';
private $select = 'catalog';
private $charset = "utf8";
private $sql = "";
function __construct(){
mysql_connect($this->server, $this->userName,$this->passwrod);
<?php
header("Content-Type: text/html; charset=utf-8");
$connect = mysql_connect('localhost', 'root', '')
or die('Не удалось соединиться: ' . mysql_error());
mysql_select_db('alcoholic') or die('Не удалось выбрать базу данных');
mysql_set_charset("utf8");
if(isset ($_POST["submit"])) {
if(isset($_POST["yes"])){
$userName = $_POST["userName"];
$login = $_POST["login"];
и мвц
[22:53:44] Евгений Лопатенко: попроходи тесты
[22:53:45] Евгений Лопатенко: http://www.quizful.net/test/oop_php
[22:55:14] Евгений Лопатенко: http://www.quizful.net/test/oop_basics
[22:55:21] Евгений Лопатенко: вот с этого наверное начать нужно
[22:55:32] Евгений Лопатенко: прочитай еще раз теорию
среда, 13 января 2016 г.
[12:12:31] Евгений Лопатенко: в общем давай продолжим то задание. Нужно его до логического вида привести
[12:12:36] Евгений Лопатенко: у тебя сейчас 3 файла
[12:12:51] Евгений Лопатенко: 2 файлса с классами Db.php и GuestBook.php
<?php
include ("GuestBook.php");
$db = new Db();
$db->format($db->query("SELECT * FROM guest_book"));
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Гостевая книга</title>
<meta charset="UTF-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru" xml:lang="ru">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<?php
$urlOut = 'https://www.avito.ru/profile'; // Куда данные послать
$urlTo = 'https://www.avito.ru/profile/lDDDDDDDDDD?next=%2Fprofile'; // Куда данные послать
$login = 'Zir4onah'; // Логин
$password = '540919'; // Пароль
<?php
$username = 'Zir4onah';
$password = '540919zir';
$login_url = 'http://www.kinopoisk.ru/login';
$agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
$ch = curl_init(); //инициализация библиотеки
//указываем адрес страницы
curl_setopt($ch, CURLOPT_URL,$login_url);
//указываем заголовок User-Agent
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
<?php
header("Content-Type: text/html; charset=utf-8");
class Curl{
private $agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
private $curl;
function __construct($login_url){
$this->curl = curl_init($login_url);
curl_setopt($this->curl, CURLOPT_URL,$login_url); //указываем адрес страницы
curl_setopt($this->curl, CURLOPT_USERAGENT, $this->agent); //указываем заголовок User-Agent
<?php
include "Curl.php";
class Kinopoisk{
private $refer = 'http://www.kinopoisk.ru/';
private $loginUrl = "http://www.kinopoisk.ru/login/";
private $curl;
function __construct($username, $password){
$curl = new Curl($this->loginUrl);
$curl->setRefer($this->refer);