added base class file for sql as well as updated users to use class

This commit is contained in:
Botanic 2013-06-05 23:19:40 -07:00
parent b4ec05e9b3
commit 1b276e849a
2 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,11 @@
<?php
class Sql{
public function db_query( $query, $values = array() )
{
echo "tst";
}
}

View file

@ -20,7 +20,7 @@ public function checkUser($username)
return "Username must be 5 or more characters."; return "Username must be 5 or more characters.";
} elseif (!preg_match('/^[a-z0-9\.]*$/', $username)) { } elseif (!preg_match('/^[a-z0-9\.]*$/', $username)) {
return "Username can only contain numbers and letters."; return "Username can only contain numbers and letters.";
} elseif (db_query("SELECT COUNT(*) FROM {users} WHERE name = :name", array( } elseif (sql::db_query("SELECT COUNT(*) FROM {users} WHERE name = :name", array(
':name' => $username ':name' => $username
))->fetchField()) { ))->fetchField()) {
return "Username " . $username . " is in use."; return "Username " . $username . " is in use.";