Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix vulnerabilities
- Loading branch information
1 parent
517589e
commit 196729c
Showing
9 changed files
with
243 additions
and
132 deletions.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,24 @@ | ||
| <?php | ||
| // Mot tapé par l'utilisateur | ||
| $q = $_GET['query']; | ||
| $table_name = $_GET['table_name']; | ||
|
|
||
| try { | ||
| $bdd = new PDO('mysql:host=localhost;dbname=lilac', 'root', 'root66'); | ||
| } catch(Exception $e) { | ||
| echo "Connection failed: " . $e->getMessage(); | ||
| exit('Impossible de se connecter à la base de données.'); | ||
| } | ||
| include("../../../include/config.php"); | ||
|
|
||
| // Requête SQL | ||
| $requete = "SELECT name FROM " . $table_name . " WHERE name LIKE '". $q ."%' LIMIT 0, 10"; | ||
| // Mot tapé par l'utilisateur | ||
| $q = $_GET['query']; | ||
| $table_name = $_GET['table_name']; | ||
|
|
||
| try { | ||
| $bdd = new PDO('mysql:host=localhost;dbname='.$database_lilac, $database_username, $database_password); | ||
| } catch(Exception $e) { | ||
| echo "Connection failed: " . $e->getMessage(); | ||
| exit('Impossible de se connecter à la base de données.'); | ||
| } | ||
|
|
||
| // Requête SQL | ||
| $requete = "SELECT name FROM " . $table_name . " WHERE name LIKE '". $q ."%' LIMIT 0, 10"; | ||
|
|
||
| foreach ($bdd->query($requete) as $row) { | ||
| $suggestions['suggestions'][] = $row['name']; | ||
| } | ||
| echo json_encode($suggestions); | ||
|
|
||
| foreach ($bdd->query($requete) as $row) { | ||
| $suggestions['suggestions'][] = $row['name']; | ||
| } | ||
| echo json_encode($suggestions); | ||
| ?> |
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
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
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
Oops, something went wrong.