You've already forked OpenShorte.old
Website refactored
Converted MySQLi Database.php class to PHP_PDO objects
This commit is contained in:
@@ -7,21 +7,17 @@
|
||||
$link_id = (int) $link_id;
|
||||
$database = new Database ( $GLOBALS [ 'config' ] [ 'db' ] );
|
||||
$database->connect ( );
|
||||
$database->prepare ( "SELECT links.URL FROM links WHERE links.ID = ?" );
|
||||
$parameters = [
|
||||
[ "i" ],
|
||||
[ &$link_id ],
|
||||
];
|
||||
$database->bind ( $parameters );
|
||||
$database->prepare ( "SELECT links.URL FROM links WHERE links.ID = :link_id" );
|
||||
$database->bind ( [ ':link_id' => $link_id ] );
|
||||
$database->execute ( );
|
||||
$result = $database->get_result ( );
|
||||
$row = $result->fetch_assoc ( );
|
||||
if ( ! $row ) {
|
||||
if ( $result->rowCount ( ) == 0 ) {
|
||||
http_response_code ( 404 );
|
||||
include ( $GLOBALS [ 'config' ] [ 'installation_path' ] . '/lib/errors/404.html' );
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$row = $result->fetchAll ( ) [ 0 ];
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
Reference in New Issue
Block a user