Commit 0392f9d2 by Vitalik

Fix

parent 7dad536e
Pipeline #170 skipped
...@@ -119,12 +119,15 @@ function create($long_url) ...@@ -119,12 +119,15 @@ function create($long_url)
$short_url = md5($long_url); $short_url = md5($long_url);
$short_url = substr($short_url, 0, 8); $short_url = substr($short_url, 0, 8);
$created = date("Y-m-d H:i:s");
if (isset_url($short_url)) return false; if (isset_url($short_url)) return false;
$sql = "INSERT INTO links (long_url, short_url) $sql = "INSERT INTO links (long_url, short_url)
VALUES( VALUES(
'$long_url', '$long_url',
'$short_url' '$short_url',
'$created'
);"; );";
$db = connect_db(); $db = connect_db();
......
...@@ -32,7 +32,7 @@ $sql = "CREATE TABLE IF NOT EXISTS `{$config['database']}`.`links` ( ...@@ -32,7 +32,7 @@ $sql = "CREATE TABLE IF NOT EXISTS `{$config['database']}`.`links` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`long_url` text NOT NULL, `long_url` text NOT NULL,
`short_url` text NOT NULL, `short_url` text NOT NULL,
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `created` datetime NOT NULL,
`clicks` int(11) NOT NULL DEFAULT '0', `clicks` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment