Exemple #1
0
Fichier : edit.php Projet : g7o/sqw
    }
}
if ($connection) {
    switch ($code) {
        case 1:
            insertRegistration($connection, $vname, $nname, $uname, $sex, $mail, $birth, $street, $hnumber, $plz, $city, $country, $picture, $password_check, $password);
            break;
        case 2:
            changePassword($connection, $username, $pwOld, $pwNew, $pwNewChk);
            break;
        case 3:
            createNotice($connection, $title, $piece, $price, $minprice, $origPrice, $categories, $actors, $date, $shipping, $payment, $datei, $username, $location);
            break;
        case 4:
            confirm($connection, $token, $mail);
            break;
        case 5:
            updateNotice($connection, $title, $piece, $price, $minprice, $origPrice, $categories, $actors, $date, $shipping, $payment, $username, $location, $id);
            break;
        case 6:
            contactForm($connection, $name, $email, $betreff, $categories, $message);
            break;
        default:
            echo "Fehler";
            break;
    }
    mysqli_close($connection);
} else {
    mysqli_close($connection);
    echo "DB-Connection Failed";
}
$app->get('/work', function () use($app) {
    $app->render('work.twig');
})->name('work');
$app->get('/contact', function () use($app) {
    $app->render('contact.twig');
})->name('contact');
/* RICE HTML RENDER */
$app->get('/rice', function () use($app) {
    $app->render('../rice/index.html');
})->name('rice');
/* POST ROUTES */
$app->post('/contact', function () use($app) {
    contactForm($app);
});
$app->post('/', function () use($app) {
    contactForm($app);
});
$app->run();
//Contact Form Handling
function contactForm($app)
{
    // Retrieve Contact Form POST variables
    $name = $app->request->post('name');
    $email = $app->request->post('email');
    $message = $app->request->post('message');
    // Verify and clean POST variables
    if (!empty($name) && !empty($email) && !empty($message)) {
        $cleanName = filter_var($name, FILTER_SANITIZE_STRING);
        $cleanEmail = filter_var($email, FILTER_SANITIZE_EMAIL);
        $cleanMessage = filter_var($message, FILTER_SANITIZE_STRING);
    } else {
          <h3>Heading 1</h3>
          <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet 
        dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit 
        lobortis nisl ut aliquip ex ea commodo consequat.</p>
        </div>
        
        <div class="col-md-7">
          <?php 
echo displayPropertyDetail();
?>
       </div>
       
       <div class="col-md-3">
        <div>
        <?php 
echo contactForm();
?>
        </div>
        
        <h3>Heading 2</h3>
          <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet 
        dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit 
        lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit 
        esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim 
        qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
        
    </div> 
	</div>
    
    <hr>
	<footer>