Error connecting to MySQL / PHP, possible user assembly

I am responsible for maintaining the learning management system, and this is a problem that I have encountered in the last few months.

One student (among thousands) claims that his essay materials are “eaten up” on a website. After submitting the form, he says that his essay has been replaced by the following text:

Warning: mysql_connect () [function.mysql-connect]: Lost connecting to MySQL server while reading initial communication package ", system Error: 111 in / home / web / solomon _1.3 / classes / db.class.php on line 84

Fatal error: error connecting to the database server: in / home / web / solomon _1.3 / classes / db.class.php on line 85

The previous warning and fatal error are stored in the database as its representation. But how could this be so, as the mistake clearly states that the connection cannot be made? The essay submission page is about as basic as it is: one connection to the database is made, form data is saved in the database, the user is redirected back to the submit page.

Lines 84-86 from db.class.php:

if (!($sql_id=mysql_connect($server, $user, $pwd,$new))){
    trigger_error("[Error connecting to database server]: {$sql_id}", E_USER_ERROR);
}

Note that the error reported by the student does not have square brackets around the Fatal Error description line, as shown in the PHP source file. These square brackets were added almost two months ago after the first error report with a student with the suspicion that he simply inserted an error line into the presentation field as a way to avoid work. I guess the 21st century version of “the dog ate my homework”.

. grep , , "", , .

, . , .

, - , , . - , , ?

+3
9

tpdi : .

, , , . , .

:
, , , , .

script , , , . , - , , , .

:
, , " " (tm). , , , , . ​​ (, , , ).

script , , script -. , script.

script:

84: if (!($sql_id=mysql_connect($server, $user, $pwd,$new))){
85:     trigger_error("[Error connecting to database server]: {$sql_id}", E_USER_ERROR);
86: }

, script ( 84), 85.
, ( 85), script MySQL.

, PHP- script MySQL.

MySQL , . , , .

, , , , PHP.

, :
, , - . script. script .

+2

, ?
, , ...

Exception-Driven Development

, - , , . .

+5

, - , c + p , . . 8).

, , , , . . display_errors php.ini log_errors. ( MySQL), , .

-, ? IP, , .

, , , , . trigger_error , , .

+5

dubio pro reo. ( -), .

, - , -, SQL .

+4

, ... .

. , , , , , .

, , , , , .

, - MySQL . , MySQL ( MySQL ). MySQl, , , ( ) /, , .

, , . , , - .

+4

, ? ( ), , , , script. , " ".

: , CD-R/RW , ?

+4

.

:

  • , -, .php ( , HTTP )
  • mysql_connect
0

PHP, , ?

, , . , , - .

0

? , , .

0

Source: https://habr.com/ru/post/1707259/


All Articles