Skip to content

Instantly share code, notes, and snippets.

@worenga
Forked from anonymous/dumb-comments
Created July 8, 2011 18:15
Show Gist options
  • Save worenga/1072424 to your computer and use it in GitHub Desktop.
Save worenga/1072424 to your computer and use it in GitHub Desktop.
// time to roll
// messy, but seems to work
// time for some action
// makin' stuff happen
// "I'm digging for fire" - Pixies
// An MVC without the V. Or with a small v. ;)
// TEMPORARY
// referencing wonkiness
// review when there is time
$aINDX =& $INDX;
// first year
$default['first_year'] = 1994;
$adm['adm_id'] = 1;
#defaults.php
// darn quotes
set_magic_quotes_runtime(0);
#db.mysql.php
function escape_str($str)
{
if (get_magic_quotes_gpc())
{
return $str;
}
//... alternatives..
// if logging in
if (isset($_POST['submitLogin']))
{
sleep(3); // obscure prevention of absuse
$clean['userid'] = getPOST('uid', null, 'password', 12);
$clean['password'] = md5(getPOST('pwd', null, 'password', 12));
$this->prefs = $OBJ->db->selectArray(PX.'users', $clean, 'record');
if ($this->prefs)
{
// create a new user hash upon login
$temp['user_hash'] = md5(time() . $clean['password'] . 'secret');
$OBJ->db->updateArray(PX.'users', $temp, "ID='".$this->prefs['ID']."'");
setcookie('ndxz_hash', $temp['user_hash'], time()+3600*24*2, '/');
setcookie('ndxz_access', $clean['password'], time()+3600*24*2, '/');
$this->settings();
return;
}
else
{
show_login('login err');
}
}
// clean up the uri
$uri = (MODREWRITE == false) ?
str_replace('/index.php?', '', $_SERVER['REQUEST_URI']) :
entry_uri($uri, $_SERVER['REQUEST_URI']);
// TEMPORARY
// what if it's more than one folder up?
$uri = str_replace($self, '', $uri);
$rs = $OBJ->db->fetchRecord("SELECT *
FROM ".PX."objects, ".PX."objects_prefs
WHERE url = '$uri'
AND status = '1'
AND object = obj_ref_type");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment