-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed out the favicon for one not containing gemerson (just a trial…
… at this point), fleshed some tricks to enable copying of the link, unfortunately it's looking like we're probably going to have to use flash, furthered the MVC cause, as well as moved some layout stuff out into separate stylesheets, also added forced line breaks on recents page.
- Loading branch information
Benjamin
committed
Feb 11, 2009
1 parent
b166f0f
commit b6b435b
Showing
17 changed files
with
178 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
<?php | ||
require("library.php"); | ||
require("models/library.php"); | ||
|
||
//do our search | ||
$query = "SELECT url FROM urls where id = " . hexdec($_REQUEST["hash"]) . ";"; | ||
|
||
$result = mysql_query($query) or die('Query failed: ' . mysql_error()); | ||
$resultArray = mysql_fetch_assoc($result); | ||
|
||
//cleanup our URL | ||
$url = stripslashes($resultArray["url"]); | ||
$url = getLink($_REQUEST["hash"]); | ||
|
||
//check for attempt at making a loop, this is the only hardcoded url in the project | ||
if (!(preg_match("/gemerit\.com\/[0-9abcdef]+$/", $url))) | ||
header( 'Location: ' . $url, true); | ||
else | ||
echo($url); | ||
mysql_close($link); | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
$DB_USER = "database username"; | ||
$DB_PASS = "super secret password"; | ||
$DB_HOST = "database server"; | ||
$DB_NAME = "database name"; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<? | ||
function dbConnect() { | ||
require("config.php"); | ||
|
||
$link = mysql_connect($DB_HOST, $DB_USER, $DB_PASS) | ||
or die('Could not connect: ' . mysql_error()); | ||
mysql_select_db($DB_NAME) | ||
or die('Could not select database'); | ||
return $link; | ||
} | ||
|
||
function dbDisconnect($link) { | ||
mysql_close($link); | ||
} | ||
|
||
// | ||
// Create Link function | ||
// | ||
function createLink($url) { | ||
$link = dbConnect(); | ||
|
||
//attempt to retrieve the item | ||
$query = "SELECT id FROM urls where url = '" . | ||
addslashes($url) . "';"; | ||
$result = mysql_query($query) or die('Query failed: ' . mysql_error()); | ||
|
||
//if it's not there we need to insert and retrieve | ||
if (mysql_num_rows($result) == 0) | ||
{ | ||
//insert | ||
$query = "INSERT INTO urls (url) VALUES ('" . | ||
addslashes($url) . "');"; | ||
mysql_query($query) or die('Query failed: ' . mysql_error()); | ||
|
||
//get back the thing we just inserted | ||
$query = "SELECT id FROM urls where url = '" . | ||
addslashes($url) . "';"; | ||
$result = mysql_query($query) or die('Query failed: ' . mysql_error()); | ||
} | ||
|
||
//get results in easy to use array format | ||
$resultArray = mysql_fetch_assoc($result); | ||
|
||
dbDisconnect($link); | ||
return dechex($resultArray["id"]); | ||
} | ||
|
||
// | ||
// Get Link function | ||
// | ||
function getLink($hash) { | ||
$link = dbConnect(); | ||
|
||
//do our search | ||
$query = "SELECT url FROM urls where id = " . hexdec($hash) . ";"; | ||
|
||
$result = mysql_query($query) or die('Query failed: ' . mysql_error()); | ||
$resultArray = mysql_fetch_assoc($result); | ||
|
||
//cleanup our URL | ||
$url = stripslashes($resultArray["url"]); | ||
|
||
dbDisconnect($link); | ||
return $url; | ||
} | ||
|
||
// | ||
// Get Recent Links function | ||
// | ||
function getRecents($count) { | ||
$link = dbConnect(); | ||
|
||
$recentShortens = array(); | ||
|
||
$query = "SELECT id, url FROM urls ORDER BY id DESC LIMIT " . $count . ";"; | ||
$result = mysql_query($query) or die('Query failed: ' . mysql_error()); | ||
|
||
$i = 0; | ||
while ($resultArray = mysql_fetch_array($result, MYSQL_ASSOC)) { | ||
$recentShortens[$i] = $resultArray; | ||
//add the hash too. | ||
$recentShortens[$i]["hash"] = dechex($resultArray["id"]); | ||
$i++; | ||
} | ||
|
||
dbDisconnect($link); | ||
return $recentShortens; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
<?php /* controller/model */ ?> | ||
<?php | ||
require("library.php"); | ||
require("models/library.php"); | ||
|
||
$query = "SELECT id, url FROM urls ORDER BY id DESC LIMIT 20;"; | ||
$result = mysql_query($query) or die('Query failed: ' . mysql_error()); | ||
$recents = getRecents(20); | ||
|
||
//push to view | ||
require("views/recents.php"); | ||
|
||
mysql_close($link); | ||
?> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
html, body { | ||
font-size: 1.0em; | ||
font-family: Helvetica, Verdana, Arial, sans-serif; | ||
} | ||
|
||
a, a:visited { | ||
font-weight: 900; | ||
color: #676767; | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
color: #666; | ||
text-decoration: underline; | ||
} | ||
|
||
div.container { | ||
text-align: center; | ||
max-width: 600px; | ||
margin-top: 30px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
div.explanations h2, div.explanations p { | ||
text-align: left; | ||
} | ||
|
||
div.urlSection input[type="text"] { | ||
color: #676767; | ||
font-size: 18pt; | ||
padding: 0.2em 0.4em 0.2em 0.4em; | ||
width: 100%; | ||
} | ||
|
||
div.urlSection input[type="submit"]{ | ||
font-size: 18pt; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
table.results { | ||
vertical-align: middle; | ||
border-spacing: 2px 2px; | ||
border-color: gray; | ||
border-collapse: separate; | ||
} | ||
|
||
td.id { | ||
text-align: center; | ||
min-width: 75px; | ||
} |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters