Add files via upload

This commit is contained in:
wibyweb 2023-03-20 02:20:11 -04:00 committed by GitHub
parent 43d6a4c3fa
commit 179f5da88b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 40 deletions

View file

@ -81,6 +81,11 @@
<label for="updatable">updatable (0 for no, or integer value 1-6, 1 is default):</label>
<textarea id="updatable" name="updatable"></textarea>
</div>
<div>
<label for="shard">shard (leave blank if not using shards, otherwise indicate a shard number):</label>
<textarea id="shard" name="shard"></textarea>
</div>
<div><input type="submit" value="Submit"/></div>

View file

@ -8,16 +8,10 @@
}
if (!isset($_POST['url']))
{
include 'form.html.php';
}
else
{
}else{
$link = mysqli_connect('localhost', 'crawler', 'seekout');
if (!$link)
@ -43,49 +37,62 @@
$url = mysqli_real_escape_string($link, $_POST['url']);
$url = str_replace("''", "%27", $url);
// $url = str_replace("\'", "\'\'", $_POST['url']);
// $url = str_replace("\"", "\"\"", $url);
$title = mysqli_real_escape_string($link, $_POST['title']);
// $title = str_replace("\'", "\'\'", $_POST['title']);
// $title = str_replace("\"", "\"\"", $title);
$tags = mysqli_real_escape_string($link, $_POST['tags']);
// $tags = str_replace("\'", "\'\'", $_POST['tags']);
// $tags = str_replace("\"", "\"\"", $tags);
$description = mysqli_real_escape_string($link, $_POST['description']);
// $description = str_replace("\'", "\'\'", $_POST['description']);
// $description = str_replace("\"", "\"\"", $description);
$body = mysqli_real_escape_string($link, $_POST['body']);
// $body = str_replace("\'", "\'\'", $_POST['body']);
// $body = str_replace("\"", "\"\"", $body);
$http = mysqli_real_escape_string($link, $_POST['http']);
// $http = str_replace("\'", "\'\'", $_POST['http']);
// $http = str_replace("\"", "\"\"", $http);
$surprise = mysqli_real_escape_string($link, $_POST['surprise']);
// $surprise = str_replace("\'", "\'\'", $_POST['surprise']);
// $surprise = str_replace("\"", "\"\"", $surprise);
$worksafe = mysqli_real_escape_string($link, $_POST['worksafe']);
// $worksafe = str_replace("\'", "\'\'", $_POST['worksafe']);
// $worksafe = str_replace("\"", "\"\"", $worksafe);
$enable = mysqli_real_escape_string($link, $_POST['enable']);
// $enable = str_replace("\'", "\'\'", $_POST['enable']);
// $enable = str_replace("\"", "\"\"", $enable);
$updatable = mysqli_real_escape_string($link, $_POST['updatable']);
// $updatable = str_replace("\'", "\'\'", $_POST['updatable']);
// $updatable = str_replace("\"", "\"\"", $updatable);
$shard = mysqli_real_escape_string($link, $_POST['shard']);
$sql = "INSERT INTO windex (url,title,tags,description,body,http,surprise,worksafe,enable,updatable,approver)
if($shard == ""){
$sql = "INSERT INTO windex (url,title,tags,description,body,http,surprise,worksafe,enable,updatable,approver)
VALUES ('".$url."','".$title."','".$tags."','".$description."','".$body."','".$http."','".$surprise."','".$worksafe."','".$enable."','".$updatable."','".$_SESSION["user"]."')";
if (!mysqli_query($link, $sql))
{
$error = 'Error fetching index: ' . mysqli_error($link);
include 'error.html.php';
exit();
if (!mysqli_query($link, $sql))
{
$error = 'Error fetching index: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
}else{
$sql = "INSERT INTO windex (url,title,tags,description,body,http,surprise,worksafe,enable,updatable,shard,approver)
VALUES ('".$url."','".$title."','".$tags."','".$description."','".$body."','".$http."','".$surprise."','".$worksafe."','".$enable."','".$updatable."','".$shard."','".$_SESSION["user"]."')";
if (!mysqli_query($link, $sql))
{
$error = 'Error fetching index: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
$result = mysqli_query($link,"SELECT id FROM windex WHERE url = '".$url."'");
if ($result === false)
{
$error = 'Error: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
while($row = mysqli_fetch_array($result))
{
$idArray[] = $row['id'];
}
$id = $idArray[0];
$sql = "INSERT INTO ws$shard (id,url,title,tags,description,body,http,surprise,worksafe,enable,updatable,shard,approver)
VALUES ('".$id."','".$url."','".$title."','".$tags."','".$description."','".$body."','".$http."','".$surprise."','".$worksafe."','".$enable."','".$updatable."','".$shard."','".$_SESSION["user"]."')";
if (!mysqli_query($link, $sql))
{
$error = 'Error fetching index: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
}
$output = 'No errors '.
$url . ' ' .
$output = 'No errors '.
$url . ' ' .
$title . ' ' .
$tags . ' ' .
$description . ' ' .
@ -93,8 +100,9 @@
$http . ' ' .
$surprise . ' ' .
$worksafe . ' ' .
$enable . ' ' .
$updatable;
$enable . ' ' .
$updatable . ' ' .
$shard;
include 'insert.html.php';
}