Skip to content

Commit 75b07ab

Browse files
committed
mySQL
1 parent ee0b50a commit 75b07ab

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

berry/mysql/MySQLConnection.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class MySQLConnection
3737
* @param string $password is the user's password
3838
* @param string $charset is the the database charset
3939
*/
40-
public function __construct($serverIP, $database, $user, $password, $charset = "")
40+
public function __construct(string $serverIP, string $database, string $user, string $password, string $charset = "")
4141
{
4242
$this->fLink = new mysqli($serverIP, $user, $password, $database);
4343

@@ -53,17 +53,19 @@ public function __construct($serverIP, $database, $user, $password, $charset = "
5353
}
5454

5555
/**
56-
* Escapes special characters in a string for use in an SQL statement
56+
* Escapes special characters in a string for use in an SQL statement,
57+
* taking into account the current charset of the connection.
5758
* @param string $string is the string to escape
58-
* @return string string
59+
* @return the escaped string
5960
*/
60-
public function EscapeString($string)
61+
public function EscapeString(string $string)
6162
{
62-
return mysql_real_escape_string($string, $this->fLink);
63+
//return mysql_real_escape_string($string, $this->fLink);
64+
return mysqli_real_escape_string($this->fLink, $string);
6365
}
6466

6567
/**
66-
* Close MySQLConnection
68+
* Closes this MySQLConnection
6769
*/
6870
public function Close()
6971
{

berry/utils.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
2-
32
require_once(__DIR__ . "/utils/CrawlerDetector.php");
43

4+
$crawlerDetector = new CrawlerDetector();
5+
$crawlerName = $crawlerDetector->getCrawlerName();
6+
7+
if ($crawlerName != "")
8+
{
9+
print "Cralwer Detected: " . $crawlerDetector;
10+
}
511
?>

0 commit comments

Comments
 (0)