92 lines
2 KiB
PHP
92 lines
2 KiB
PHP
<?php
|
|
include_once('class.Database.php');
|
|
class User extends database
|
|
{
|
|
public $id;
|
|
public $screen_name;
|
|
public $name;
|
|
public $profile_image_url;
|
|
public $location;
|
|
public $created_at;
|
|
public $friends_count;
|
|
public $followers_count;
|
|
public $statuses_count;
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
$this->id = '';
|
|
$this->screen_name = '';
|
|
$this->name = '';
|
|
$this->profile_image_url='';
|
|
$this->location='';
|
|
$this->created_at='';
|
|
$this->friends_count='';
|
|
$this->followers_count='';
|
|
$this->statuses_count='';
|
|
}
|
|
|
|
public function addUserAccount()
|
|
{
|
|
$qry="INSERT INTO users
|
|
SET
|
|
user_id='".$this->id."',
|
|
screen_name='".$this->screen_name."',
|
|
name='".$this->name."',
|
|
profile_image_url='".$this->profile_image_url."',
|
|
location='".$this->location."',
|
|
created_at='".$this->created_at."',
|
|
followers_count='".$this->followers_count."',
|
|
friends_count='".$this->friends_count."',
|
|
statuses_count='".$this->statuses_count."'";
|
|
|
|
parent::executeQuery($qry);
|
|
}
|
|
|
|
public function updateUserAccount()
|
|
{
|
|
$qry="UPDATE users
|
|
SET
|
|
screen_name='".$this->screen_name."',
|
|
name='".$this->name."',
|
|
profile_image_url='".$this->profile_image_url."',
|
|
location='".$this->location."',
|
|
created_at='".$this->created_at."',
|
|
followers_count='".$this->followers_count."',
|
|
friends_count='".$this->friends_count."',
|
|
statuses_count='".$this->statuses_count."'
|
|
WHERE user_id='".$this->id."'";
|
|
|
|
parent::executeQuery($qry);
|
|
}
|
|
|
|
public function checkUserExist($name)
|
|
{
|
|
$qry="SELECT COUNT(*) AS Count FROM users WHERE screen_name='$name'";
|
|
|
|
parent::executeQuery($qry);
|
|
$qryRes=parent::asObject();
|
|
|
|
if($qryRes[0]->Count>0)
|
|
{
|
|
return FALSE;
|
|
}
|
|
else
|
|
{
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
public function getAllUserNames()
|
|
{
|
|
$qry="SELECT user_id,screen_name FROM users";
|
|
parent::executeQuery($qry);
|
|
$qryRes=parent::asObject();
|
|
|
|
if($qryRes)
|
|
{
|
|
return $qryRes;
|
|
}
|
|
}
|
|
}
|
|
?>
|