Hello!
I have a extended uFlex class that is registering a new user in a protected enviroment.
The class is derived from the class.iD.php example.
My problem is that I cannot connect with users that are beeing created by the registering form modified class. I have created a user with same pass like the admin user that could be logged onto the enviroment but error 7 still displays. If I use the admin user it works like a charm, when I try to log in with the demo user created by that extended class it does not work
Could some one tell me what is wrong?
Here is the derrived class:
<?php
//Class test
class iD extends uFlex {
var $queryCount = 0;
/*
* Declaring static variables
*/
static $count;
function __construct($start=true){
//Call the uFlex constructor
if(parent::__construct($start) === false) return false;
}
function start(){
$this->__construct();
}
//Get a user from the database
function getUser($id){
$sql = "SELECT * FROM {$this->opt['table_name']} WHERE user_id={$id}";
return $this->getRow(array("user_id" => $id));
}
function delete_user($id) {
$sql = "DELETE FROM {$this->opt['table_name']} WHERE user_id={$id}";
if ($this->check_sql($sql)) {
return 1;
} else {
return mysql_error();
}
}
//Update user from database
public function update_user($uid, $info){
$this->logger("update"); //Index for Errors and Reports
//Saves Updates Data in Class
$this->tmp_data = $info;
//Validate All Fields
if(!$this->validateAll())
return false; //There are validations error
//Built in actions for special fields
//Hash Password
if(isset($info['password'])){
$info['password'] = $this->hash_pass($info['password']);
}
//Check for Email in database
if(isset($info['email']))
if($this->check_field('email', $info['email'],"Adresa de email exista deja.")) return false;
//Check for errors
if($this->has_error()) return false;
//Prepare Info for SQL Insertion
$data = array();
$set = array();
foreach($info as $index => $val){
if(!preg_match("/2$/",$index)){ //Skips double fields
$set[] = "{$index}=:{$index}";
//For the statement
$data[$index] = $val;
}
}
$set = implode(", ",$set);
//Prepare User Update Query
$sql = "UPDATE :table SET $set
WHERE user_id={$uid}";
//Check for Changes
if($this->check_sql($sql, $data)){
$this->report("Information Updated");
$_SESSION['uFlex']['update'] = true;
return true;
}else{
$this->error(2);
return false;
}
}