PHP Classes

File: add.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   Searchy PHP Search Engine   add.php   Download  
File: add.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Searchy PHP Search Engine
Crawl, index and search multiple Web sites
Author: By
Last change:
Date: 1 year ago
Size: 3,774 bytes


Class file image Download

include_once 'config.php';

$db = new Database($config);
$se = new SearchEngine($db);

if (
$added = $se->addSite([
'title' => $_POST['title'],
'blurb' => $_POST['blurb'],
'keywords' => $_POST['keywords'],
'url' => $_POST['url']
<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Searchy - Home</title>
    <link href="" rel="stylesheet">
    <link rel="stylesheet" href="" />

    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <a class="navbar-brand" href="#">Searchy</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>

            <div class="collapse navbar-collapse" id="navbarColor02">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="index.php">Home</a>
                    <li class="nav-item">
                        <a class="nav-link active" href="add.php">Add Site</a>
                    <li class="nav-item">
                        <a class="nav-link" href="crawl.php">Crawl Site</a>

    <div class="container">
        <?php if (isset($added) && $added == false) : ?>
<div class="d-flex align-items-center justify-content-center mt-3">
                <div class="alert alert-danger">
                    <i class="fa-solid fa-circle-xmark"></i> Site already exist
        <?php elseif (isset($added) && $added == true) : ?>
<div class="d-flex align-items-center justify-content-center mt-3">
                <div class="alert alert-success">
                    <i class="fa-solid fa-circle-check"></i> Site Added
        <?php else : ?>
<?php endif; ?>
<div class="d-flex align-items-center justify-content-center pt-3">
            <div class="card border-dark mb-3" style="max-width: 20rem;">
                <div class="card-header">Add a Site</div>
                <div class="card-body">
                    <form method="POST">
                        <input class="form-control me-sm-2" type="text" name="title" placeholder="Website Title">
                        <textarea placeholder="Website Decription" name="blurb" class="form-control mt-3" cols="20" rows="5"></textarea>
                        <input class="form-control mt-3" type="text" name="keywords" placeholder="Website Keywords" />
                        <input type="url" name="url" class="form-control mt-3 mb-3" placeholder="Website URL">
                        <button class="btn btn-secondary" type="submit">Submit</button>

    <script src=""></script>
    <script src=""></script>