Skip to content

Commit

Permalink
Merge pull request #4 from crispytx/b
Browse files Browse the repository at this point in the history
B
  • Loading branch information
crispytx committed May 30, 2016
2 parents f02c051 + f37fa4a commit fcdc368
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions searchresults.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@
</head>
<body>
<?php
$queryText = $_POST['queryText'];
$queryTextArray = explode(" ", $queryText);
$numberOfKeywords = count($queryTextArray);
for ($x = 0; $x < $numberOfKeywords; $x++) {
$queryTextArray[$x] = filter_var($queryTextArray[$x], FILTER_SANITIZE_STRING);
}



$MySQL = new mysqli('localhost', 'USERNAME', 'PASSWORD', 'DATABASE');
$queryText = $_POST['queryText'];
$queryTextClean = preg_replace("/[^a-zA-Z0-9\s]/", "", $queryText); // strip potentially malicious code
$queryTextArray = explode(" ", $queryTextClean);
$numberOfKeywords = count($queryTextArray);
for ($i = 0; $i < $numberOfKeywords; $i++) {
if ($queryTextArray[$i] == "") {
continue;
}
$SQL = "SELECT domain FROM keywordTable WHERE (keywordOne = '{$queryTextArray[$i]}' OR
keywordTwo = '{$queryTextArray[$i]}' OR
keywordThree = '{$queryTextArray[$i]}' OR
Expand Down

0 comments on commit fcdc368

Please sign in to comment.