PHP.SU

PHP, MySQL -
PHP.SU                                      

(6): [1] 2 3 4 5 6 »

>  : 86
karamba : 21 , 2016 - 19:50:59 • : • : -

: 18
: 4509
:
karamba :
? . . logAdd(), .
, , , 100000 , .



PHP:

  1. <?PHP
  2.  
  3. abstract class Super {
  4.         abstract function whoAmI();
  5. }
  6.  
  7. class A extends Super {
  8.         function whoAmI(){
  9.                 return "A";
  10.         }
  11. }
  12. class B extends Super {
  13.         function whoAmI(){
  14.                 return "B";
  15.         }
  16. }
  17.  
  18. $a = new A();
  19. $b = new B();
  20. $array = array($a,$b);
  21.  
  22. foreach ($array as &$value) {
  23.     echo $value->whoAmI();
  24. }
  25.  
  26. ?>


"AB", . .
karamba : 20 , 2016 - 09:17:32 • : • : -

: 18
: 4509
Viper :
karamba :
.
.

? ?
karamba : 19 , 2016 - 19:53:50 • : • : -

: 18
: 4509
Bio man :
__construct0 ?
karamba :
.
. , .
, -
https://www.youtube.com/user/pro100fox2/playlists


__construct0 ? . PHP .

? . . logAdd(), .
karamba : 19 , 2016 - 17:38:38 • : • : -

: 18
: 4509
, , .
, mysqli , PDO.
log , write, .
, ?
karamba : 19 , 2016 - 12:49:30 • : • : -

: 18
: 4509
Bio man :
karamba :
?

.
- Logger: .
- DBLogger: Logger .

DBLogger ( PDO) , PDO .
!


. , .
. , . , , , . ?
DBLogger PDO , , , . , PDO, .
? PDO ?

PHP:

  1. <?PHP
  2.  
  3. abstract class Logger {
  4.         abstract protected function logAdd($entry);
  5. }
  6.  
  7. class DBLogger extends Logger{
  8.  
  9.         private $DBH;
  10.  
  11.         function __construct() {
  12.         $a = func_get_args();
  13.         $i = func_num_args();
  14.         if (method_exists($this,$f='__construct'.$i)) {
  15.             call_user_func_array(array($this,$f),$a);
  16.         }
  17.     }
  18.  
  19.         private function __construct0() {
  20.                 try {
  21.                         $this->DBH = new PDO("mysql:host=localhost;dbname=log", 'root', '');
  22.                 }  
  23.                 catch(PDOException $e) {  
  24.                         echo $e->getMessage();  
  25.                 }
  26.         }
  27.  
  28.         private function __construct4($host,$dbname,$user,$pass) {
  29.                 try {  
  30.                         $this->DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
  31.                 }  
  32.                 catch(PDOException $e) {  
  33.                         echo $e->getMessage();  
  34.                 }
  35.         }
  36.  
  37.         function logAdd($entry) {
  38.                 $entry = date("Y-m-d H:i:s ").serialize($entry);
  39.                 try {
  40.                         $STH = $this->DBH->prepare("INSERT INTO log (log) values (?)");
  41.                         $STH->bindParam(1, $entry);
  42.                         $STH->execute();
  43.                 }
  44.                 catch(PDOException $e) {  
  45.                         echo $e->getMessage();  
  46.                 }
  47.         }
  48. }
  49.  
  50. $dbLog = new DBLogger();
  51. $dbLog->logAdd("I use OOP");
  52.  
  53. ?>
karamba : 16 , 2016 - 21:47:38 • : • : -

: 18
: 4509
. , . . ....
:
:
( ) .
- stdout, mysql, . ( )
- mysql,
- :
* ( YYYY-MM-DD HH:MM:SS)
* (, , , )
PHP .
- .
( ).

. MySQL

CODE (htmlphp):

  1. class LogDB {
  2.  
  3.         private $host = 'localhost';
  4.         private $database = 'log';
  5.         private $user = 'root';
  6.         private $password = '';
  7.  
  8.         function __construct() {
  9.         $a = func_get_args();
  10.         $i = func_num_args();
  11.         if (method_exists($this,$f='__construct'.$i)) {
  12.             call_user_func_array(array($this,$f),$a);
  13.         }
  14.     }
  15.  
  16.     private function __construct4($host,$database,$user,$password) {
  17.         $this->host = $host;
  18.         $this->database = $database;
  19.         $this->user = $user;
  20.         $this->password = $password;
  21.     }
  22.  
  23.  
  24.         public function logAdd($entry){
  25.  
  26.                 $entry = date("Y-m-d H:i:s ").serialize($entry);
  27.  
  28.                 $mysqli = new mysqli($this->host, $this->user, $this->password, $this->database);
  29.                 if ($mysqli->connect_error) {
  30.                 die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
  31.                 }
  32.  
  33.                 $mysqli->set_charset("utf8");
  34.                 $mysqli->query("insert into log (log) values('$entry')");
  35.                 if ($mysqli->errno) {
  36.                         die('INSERT Error (' . $mysqli->errno . ') ' . $mysqli->error);
  37.                 }
  38.  
  39.                 $mysqli->close();
  40.         }
  41. }


- . ? ,
karamba : 06 , 2015 - 15:25:10 • : NOT IN • : SQL

: 6
: 62
:
.
:
MariaDB: 10.0.22-MariaDB-0+deb8u1
PMA: 4.2.12deb2+deb8u1
PHP libmysql - 5.5.46
:
CODE (SQL):

  1. CREATE TABLE `category` (
  2.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  3.   `parent_category_id` int(10) UNSIGNED DEFAULT NULL,
  4.   `name` varchar(30) NOT NULL,
  5.   PRIMARY KEY (`id`)
  6. ) ENGINE=InnoDB

- .
, , PMA

. . XAMMP . NOT IN . , , .
karamba : 05 , 2015 - 22:17:34 • : NOT IN • : SQL

: 6
: 62
:
, , mysql -

, : https://mariadb[dot]com/kb/en/mariad[dot][dot][dot]queries-and-all/
:
NOT IN is an alias for <> ALL.


- - ?

SQL MySQL MariaDB. <> ALL .
:
NOT IN is an alias for <> ALL.
, NOT IN <> ALL.
SQL phpMyAdmin
karamba : 05 , 2015 - 19:55:48 • : NOT IN • : SQL

: 6
: 62
:
. MySQL, - ?

NOT IN (subquery) , <> ALL: http://dev.mysql.com/doc/refman/5.7/en/all-subqueries.html

: MariaDB
: 10.0.17-MariaDB - mariadb.org binary distribution
: 10
karamba : 04 , 2015 - 22:13:57 • : NOT IN • : SQL

: 6
: 62
,
2 .
. (near "NOT IN" at position 34)
. (near "(" at position 41)

CODE (SQL):

  1. SELECT * FROM `category` WHERE id NOT IN (SELECT `parent_category_id` FROM `category` WHERE `parent_category_id` IS NOT NULL)

NOT,
CODE (SQL):

  1. SELECT * FROM `category` WHERE id IN (SELECT `parent_category_id` FROM `category` WHERE `parent_category_id` IS NOT NULL)


CODE (SQL):

  1. SELECT * FROM `category` WHERE id NOT IN (1,2,3)
karamba : 17 , 2015 - 14:04:39 • : mail • :

: 0
: 208
mail (XAMPP for Windows 5.6.14)
php.ini:

:
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"


:
;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"


sendmail.ini:
:
; configuration for fake sendmail

; if this file doesn't exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail

[sendmail]

; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.

smtp_server=smtp.mail.ru

; smtp port (normally 25)

smtp_port=25

; SMTPS (SSL) support
; auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL

smtp_ssl=auto

; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify

default_domain=mail.ru

; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging

error_logfile=error.log

; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging

debug_logfile=debug.log

; if your smtp server requires authentication, modify the following two lines

auth_username=my.mail@mail.ru
auth_password=my.password

; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines. do not enable unless it is required.

;pop3_server=pop.mail.ru
;pop3_username=my.mail@mail.ru
;pop3_password=my.password

; force the sender to always be the following email address
; this will only affect the "MAIL FROM" command, it won't modify
; the "From: " header of the message content

force_sender=my.mail@mail.ru

; force the sender to always be the following email address
; this will only affect the "RCTP TO" command, it won't modify
; the "To: " header of the message content

force_recipient=

; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required

hostname=mail.ru


PHP:
PHP:

  1. <?PHP
  2.  
  3. $to  = 'karamba@mail.ru';
  4.  
  5. $subject = 'Theme of letter';
  6.  
  7. $message = 'Text of letter';
  8.  
  9.  
  10. if (mail($to, $subject, $message)) echo " ";
  11. else echo " ";
  12. ?>

, " "
debug.log:
:
15.11.17 14:43:41 ** Connecting to smtp.mail.ru:25
15.11.17 14:43:42 ** Authenticating as my.mail@mail.ru
15.11.17 14:43:42 ** Disconnecting from smtp.mail.ru:25
15.11.17 14:43:42 ** Connection Closed Gracefully.
15.11.17 14:44:37 ** --- MESSAGE BEGIN ---
15.11.17 14:44:37 ** To: karamba@mail.ru
15.11.17 14:44:37 ** Subject: Theme of letter
15.11.17 14:44:37 ** X-PHP-Originating-Script: 0:contact.php
15.11.17 14:44:37 **
15.11.17 14:44:37 ** Text of letter
15.11.17 14:44:37 ** --- MESSAGE END ---
15.11.17 14:44:39 ** Connecting to smtp.mail.ru:25
15.11.17 14:44:39 ** Connected.
15.11.17 14:44:39 << 220 smtp34.i.mail.ru ESMTP ready<EOL>
15.11.17 14:44:39 >> EHLO mail.ru<EOL>
15.11.17 14:44:39 << 250-smtp34.i.mail.ru<EOL>250-SIZE 73400320<EOL>250-8BITMIME<EOL>250-PIPELINING<EOL>250-AUTH PLAIN LOGIN XOAUTH2<EOL>250 STARTTLS<EOL>
15.11.17 14:44:39 ** Authenticating as my.mail@mail.ru
15.11.17 14:44:39 >> STARTTLS<EOL>
15.11.17 14:44:39 << 220 2.0.0 Start TLS<EOL>
15.11.17 14:44:39 >> QUIT<EOL>
15.11.17 14:44:39 <<  Q MVK$WSB& HaۄvQ ?a> ߵ(i M,2 9    00Πw:Z$0
 *H
 0D1 0 UUS10U

GeoTrust Inc.10UGeoTrust SSL CA - G20
150827000000Z
160826235959Z0r1 0 URU10URUSSIAN FEDERATION10
UMoscow10U
 LLC Mail.Ru1 0 U IT10U *.mail.ru0"0
 *H
  0
 ep_& b(= Q6֬82u+Oݫ;ྵbbxXrn4Q 5N_'zYGZ`t n!?)]DRS
C9KpEWbIF*)% #wŒ}r_5 KJ~LJ]g:ZT$!Zsio+!G<\N1f~%JD9 d7.mKYa 00U0 *.mail.rumail.ru0 U0 0U0+U$0"0 http://gb[dot]symcb[dot]com/gb[dot]crl0U 00g 00?+3https://www[dot]geotrust[dot]com/resources/repos[dot][dot][dot]al0A+05 3https://www.geotrust.com/resources/repository/legal0U%0++0U#0Js9[i\=dU0W+K0I0+0http://gb[dot]symcd[dot]com0&+[dot][dot][dot]ymcb[dot]com/gb[dot]crt0
 *H
  {noCX :Sj?93tIv6p8C|2e&zrPHq'Ν"r dk_3IlpgE[W31\rtsӫŭ5j!H ZƗ\,])98G;$vf&<Z}Z-G
Wz6ehTVZT벐'RE-@dBW;Aׁ[|-Y"⭢00$$$:ܟ
(O ]0Y0A:c0
 *H
 0B1 0 UUS10U

GeoTrust Inc.10UGeoTrust Global
15.11.17 14:44:39 ** Disconnected.
15.11.17 14:44:39 ** Disconnecting from smtp.mail.ru:25
15.11.17 14:44:39 ** Disconnected.
15.11.17 14:44:39 ** Disconnected.
15.11.17 14:44:39 ** Connection Closed Gracefully.

?
karamba : 28 , 2014 - 21:14:39 • : • : HTML, & CSS

: 2
: 755
HTML UTF-8
CODE (html):

  1. <meta http-equiv="content-type" content="text/html; charset=utf-8">

.

CODE (html):

  1. <meta http-equiv="content-type" content="text/html; charset=utf-8">

, ANSI, .
karamba : 28 , 2014 - 20:48:13 • : • : HTML, & CSS

: 2
: 755
jquery ( ).
Opera .
IE .
HTML utf-8.
utf-8 , . ?
karamba : 28 , 2012 - 11:57:19 • : xampp PostgreSQL • :

: 4
: 4702
caballero :
-

- . PATH

, . PostgreSQL .
karamba : 28 , 2012 - 10:46:46 • : xampp PostgreSQL • :

: 4
: 4702
PostgreSQL.
XAMPP 1.7.7 PHP 5.3.8.
postgresql-9.1.1-1.
PHP PostgreSQL:
CODE (html):

  1. Fatal error: Call to undefined function pg_connect()

c:\xampp\php\php.ini "extension=php_pgsql.dll"
, Apache.
...

(6): [1] 2 3 4 5 6 »
Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB