Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mbas-shortener
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mbas-shortener
Commits
0392f9d2
Commit
0392f9d2
authored
Jan 26, 2016
by
Vitalik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
parent
7dad536e
Pipeline
#170
skipped
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
helper.php
helper.php
+4
-1
install.php
install.php
+1
-1
No files found.
helper.php
View file @
0392f9d2
...
@@ -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
();
...
...
install.php
View file @
0392f9d2
...
@@ -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;"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment