Skip to content

Instantly share code, notes, and snippets.

@brianyang
Created February 23, 2012 13:26
Show Gist options
  • Save brianyang/1892780 to your computer and use it in GitHub Desktop.
Save brianyang/1892780 to your computer and use it in GitHub Desktop.
indentify name from random string with F3
<F3:repeat group="{{@DB->result}}" value="{{@item}}">
<span>{{@item.site}}</span>
</F3:repeat>
$main->route('GET /v1/user/@rand',
function() {
$rand = F3::get('PARAMS["rand"]');
DB::sql("SELECT `site` FROM `hashReg` WHERE `key` = '$rand'");
echo Template::serve('identify-site.html');
}
);
-- --------------------------------------------------------
--
-- Table structure for table `hashReg`
--
CREATE TABLE IF NOT EXISTS `hashReg` (
`key` varchar(155) NOT NULL,
`site` varchar(255) NOT NULL,
KEY `key` (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `hashReg`
--
INSERT INTO `hashReg` (`key`, `site`) VALUES
('ha0okhj5kka', 'sitename.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment