public function showWelcome()
 {
     $message = '';
     //getting a flash message when a new chat room is created
     if (Session::has('message')) {
         $message = Session::get('message', 'default');
         Session::forget('message');
     }
     if (Auth::user()) {
         $chat_rooms = $this->getJoinedChatRooms();
         $unread_messages_counts = $this->getUnreadMessagesCount($chat_rooms);
         $online_members_per_room = $this->getOnlineMembers($chat_rooms);
         $available_chat_rooms = $this->getAvailableChatRooms();
         $invited_chatrooms = $this->getInvitedChatRoomDetails();
         $registered = Online::registered()->distinct('user_id')->get();
         $online_users = '';
         foreach ($registered as $register) {
             $online_users[] = $register->user_id;
         }
         //$online_users = array_unique($online_users);			var_dump($online_users);die();
         $user_names = User::select('first_name')->whereIn('id', array_unique($online_users))->lists('first_name');
         return View::make('home', array('chatrooms' => $chat_rooms, 'online_members' => $online_members_per_room, 'user_names' => $user_names, 'message' => $message, 'available_chat_rooms' => $available_chat_rooms, 'unread_messages_counts' => $unread_messages_counts, 'invited_chatrooms' => $invited_chatrooms));
     } else {
         Online::updateCurrent();
     }
     return View::make('home');
 }
Example #2
0
 public function destroy($id)
 {
     if (Auth::user()->is_admin) {
         $count = 0;
         $grupo = Group::find($id);
         $users = User::select('group_ids')->get();
         foreach ($users as $key => $user) {
             $u = $user->group_ids;
             $uarray = explode(',', $u);
             if (in_array($id, $uarray, true)) {
                 $count = $count + 1;
             }
         }
         if ($count > 0) {
             $field = $count == 1 ? ' ' : 's';
             $field2 = $count == 1 ? ' pertenece' : ' pertenecen';
             $message = $count . " Usuario" . $field . $field2 . " al grupo " . $grupo->name;
             Session::flash('error', $message);
             return Redirect::to('grupos/' . $id);
         } else {
             $grupo->delete();
             $message = "Grupo Eliminado con éxito";
             Session::flash('message', $message);
             return Redirect::to('grupos');
         }
     }
 }
 public function store()
 {
     $verification = User::select('verification')->where('email', Input::get('email'))->first()->toArray();
     $verification = $verification['verification'];
     if ($verification != '') {
         echo "NOT VALID PLZ VERIFY";
         return Redirect::back()->withInput();
     }
     $curCount = User::select('count')->where('email', Input::get('email'))->first()->toArray();
     $curCount = $curCount['count'];
     if ($curCount >= 3) {
         echo "LOCKED <br />";
         $newPass = '******';
         User::where('email', Input::get('email'))->update(array('password' => Hash::make($newPass)));
         Mail::send('emails.emailBreak', array('code' => $newPass, 'email' => Input::get('email')), function ($message) {
             $message->to('*****@*****.**', 'Jan Ycasas')->subject('ACCOUNT LOCKED!');
         });
         return Redirect::back()->withInput();
     }
     // only pass the email address and the password; nothing else
     if (Auth::attempt(Input::only('email', 'password'), true)) {
         User::where('email', Input::get('email'))->update(array('count' => 0));
         /* WORKING WITHOUT COOKIES
          * return Redirect::to('/profile');
          */
         setcookie('email', Input::get('email'), time() + 86400 * 30, "/");
         return Redirect::to('/profile');
     }
     echo "INVALID LOGIN ";
     $curCount = $curCount + 1;
     User::where('email', Input::get('email'))->update(array('count' => $curCount));
     return Redirect::back()->withInput();
 }
Example #4
0
 public static function selectByUser($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM user_info WHERE user_id = :user_id;";
         $query = $connection->prepare($sql);
         $query->bindParam(':user_id', $id, PDO::PARAM_INT);
         $query->execute();
         if ($query->rowCount() < 1) {
             return null;
         }
         $row = $query->fetch(PDO::FETCH_ASSOC);
         $userInfo = new UserInfo();
         $userInfo->Id = (int) $row['id'];
         $userInfo->Email = $row['info_email'];
         $userInfo->Telephone = $row['info_telephone'];
         $userInfo->User = User::select($row['user_id']);
         return $userInfo;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
Example #5
0
 private function login()
 {
     if (isset($this->username) && isset($this->password)) {
         $this->user = User::select("username = '******'");
         if (sizeof($this->user) > 0) {
             $this->user = $this->user[0];
             $this->user = new User($this->user);
             if ($this->password == $this->user->getPassword()) {
                 $_SESSION['username'] = $this->username;
                 $_SESSION['password'] = $this->password;
                 if ($this->isAdmin != 0) {
                     if ($this->user->isAdmin()) {
                         $this->isLogedin = true;
                     } else {
                         $this->isLogedin = false;
                     }
                 } else {
                     $this->isLogedin = true;
                 }
             } else {
                 $this->isLogedin = false;
             }
         } else {
             $this->isLogedin = false;
         }
     } else {
         $this->isLogedin = false;
     }
 }
Example #6
0
 public static function selectByUser($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM user_online WHERE user_id = :user_id;";
         $query = $connection->prepare($sql);
         $query->bindParam(':user_id', $id, PDO::PARAM_INT);
         $query->execute();
         if ($query->rowCount() < 1) {
             Flight::notFound("user_id not found");
         }
         $row = $query->fetch(PDO::FETCH_ASSOC);
         $userOnline = new UserOnline();
         $userOnline->Id = (int) $row['id'];
         $userOnline->User = User::select($row['user_id']);
         $userOnline->Dt = $row['online_dt'];
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
 public function postHistory()
 {
     $postdata = file_get_contents("php://input");
     if (!empty($postdata)) {
         $currentUserId = Input::get('currentUserId');
         $currentUserIdPk = Input::get('currentUserIdPk');
         $prodCode = Input::get('prodCode');
         $clientIp = Input::get('clientIp');
         $limit = Input::get('limit');
         $usercount = User::select('UD_USER_ID', 'UD_USER_TYPE')->where('UD_USER_ID', '=', $currentUserId)->get();
         if (count($usercount) > 0) {
             if ($usercount[0]->UD_USER_TYPE == 'SA' || $usercount[0]->UD_USER_TYPE == 'SAS') {
                 $panc = Recharge::where('rd_prod_code', '=', $prodCode)->get();
                 if (count($panc) > 0) {
                     return Response::json($panc);
                 } else {
                     return Response::json(array('status' => 'failure', 'message' => 'You Din"t Create Any Pan card till Now'));
                 }
             }
         } else {
             return Response::json(array('status' => 'failure', 'message' => 'You can"t Access the Pan Card'));
         }
     } else {
         return Response::json(array('status' => 'failure', 'message' => 'You Don"t have any coupon to register pancard'));
     }
 }
Example #8
0
 public static function getNameFromEmail($email)
 {
     $user = User::where('email', $email)->pluck('first_name');
     $retry = User::select('first_name', 'last_name')->where('email', $email)->get();
     // $user = '******'.' '.'last_name';
     return $user;
 }
 /**
  *  @SWG\Operation(
  *      partial="usuarios.store",
  *      summary="Guarda un usuario",
  *      type="users",
  * *     @SWG\Parameter(
  *       name="body",
  *       description="Objeto Usuario que se necesita para guardar",
  *       required=true,
  *       type="User",
  *       paramType="body",
  *       allowMultiple=false
  *     ),
  *  )
  */
 public function store()
 {
     log::info("creacion usuario");
     $data = Input::all();
     $nombre = isset($data['usuario']['nombre']) ? $data['usuario']['nombre'] : '';
     $ap = isset($data['usuario']['apellido_paterno']) ? $data['usuario']['apellido_paterno'] : '';
     $am = isset($data['usuario']['apellido_materno']) ? $data['usuario']['apellido_materno'] : '';
     $id_tipo_donador = isset($data['usuario']['id_tipo_donador']) ? $data['usuario']['id_tipo_donador'] : '';
     $donacion = isset($data['usuario']['donacion_info']) ? $data['usuario']['donacion_info'] : '';
     $username = isset($data['usuario']['username']) ? $data['usuario']['username'] : '';
     $password = isset($data['usuario']['password']) ? $data['usuario']['password'] : '';
     log::info(var_export($data, true));
     //die();
     if (!$data['usuario']) {
         return false;
     }
     $usuario = User::select('username')->where('username', '=', $data['usuario']['username'])->first();
     if (count($usuario) > 0) {
         return Response::json(array('error' => "500", 'error_message' => "Ya existe un usuario con esta cuenta"));
     } else {
         DB::beginTransaction();
         try {
             $usuarioInfo = new UserInfo();
             $usuarioInfo->nombre = trim($nombre);
             $usuarioInfo->apellido_paterno = trim($ap);
             $usuarioInfo->apellido_materno = trim($am);
             $usuarioInfo->id_tipo_donador = trim($id_tipo_donador);
             $usuarioInfo->donacion_info = trim($donacion);
             $usuarioInfo->save();
             log::info("inseted");
             log::info($usuarioInfo);
             if ($data['usuario']['contacto']) {
                 $usuario = UserInfo::find($usuarioInfo->id_usuario_info);
                 $arrContactos = array();
                 log::info("find");
                 log::info($usuario);
                 log::info("contacto");
                 log::info($usuario->contactos);
                 $usuario->contactos()->detach();
                 if ($data['usuario']['contacto'] && is_array($data['usuario']['contacto'])) {
                     foreach ($data['usuario']['contacto'] as $value) {
                         $arrContactos[] = array('id_tipo_contacto' => $value['tipo'], 'dato' => $value['valor']);
                     }
                 }
                 $usuario->contactos()->attach($arrContactos);
             }
             $login = new User();
             $login->username = trim($username);
             $login->password = md5(trim($password));
             $login->id_usuario_info = $usuarioInfo->id_usuario_info;
             $login->save();
             DB::commit();
             return Response::json(array('error' => "200", 'error_message' => 'Se han guardado los datos'));
         } catch (Exception $ex) {
             return Response::json(array('error' => "500", 'error_message' => $ex->getMessage()));
             DB::rollback();
         }
     }
 }
Example #10
0
 public function postLists()
 {
     User::onlyHas('user-view');
     $jqgrid = new jQgrid(User::getTableName());
     return $jqgrid->populate(function ($start, $limit) {
         return User::select(User::getField('id'), User::getField('username'), User::getField('email'))->skip($start)->take($limit)->get();
     });
 }
 static function loadUserByPasswordResetHash($hash)
 {
     $userObj = new User();
     $userObj->select($hash, 'passwordResetHash');
     if (!$userObj->ok()) {
         return false;
     }
     return $userObj;
 }
 public function getDatatable()
 {
     $query = User::select('first_name', 'last_login', 'id')->get();
     return Datatable::collection($query)->addColumn('last_login', function ($model) {
         return date('M j, Y h:i A', strtotime($model->last_login));
     })->addColumn('id', function ($model) {
         return '<a href="/users/' . $model->id . '">view</a>';
     })->searchColumns('name', 'last_login')->orderColumns('name', 'last_login')->make();
 }
Example #13
0
 public function index()
 {
     $config = Registry::getConfig();
     $pag['total'] = 0;
     $pag['limit'] = $_REQUEST['limit'] ? $_REQUEST['limit'] : $config->get("defaultLimit");
     $pag['limitStart'] = $_REQUEST['limitStart'];
     $this->setData("results", User::select($_REQUEST, $pag['limit'], $pag['limitStart'], $pag['total']));
     $this->setData("pag", $pag);
     $html = $this->view("views.list");
     $this->render($html);
 }
Example #14
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = User::select('userId')->get();
     // $user = $users->collapse();
     return $users;
     return;
     foreach ($users as $key => $value) {
         # code...
     }
     $tracker = Tracker::orderBy('Id', 'desc')->first();
     return $tracker;
 }
Example #15
0
function user_post($where = array())
{
    $user = new User("t_users");
    $result = $user->select();
    foreach ($result as $u) {
        if ($where['email'] == $u['email']) {
            return array("fail" => "This account already exists");
        }
    }
    $user->insert($where);
    return;
}
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // list of users that created tasks
     $users = User::select([DB::RAW("DISTINCT users.id"), "users.firstname", "users.lastname", "users.email"])->join("tasks", "tasks.author_id", "=", "users.id")->whereNotNull("users.email")->whereRaw("tasks.deadline_at < NOW()")->take(100)->get();
     foreach ($users as $user) {
         $missedTasks = Task::select(["tasks.id", "tasks.name", "tasks.deadline_at"])->where("tasks.author_id", $user->id)->whereRaw("tasks.deadline_at < NOW()")->orderBy("tasks.deadline_at")->take(100)->get();
         if (count($missedTasks) == 0) {
             continue;
         }
         Taskemails::reportMissedTasks($user, $missedTasks);
     }
 }
Example #17
0
function comment_get($where = array())
{
    $comment = new Comment("t_comments");
    $result['comments'] = $comment->select($where);
    $user = new User("t_users");
    $userInfo = array();
    foreach ($result['comments'] as $d) {
        $arrUser = $user->select(array('user_id' => $d['user_id']));
        $userInfo[] = $arrUser[0];
    }
    $result['users'] = $userInfo;
    return $result;
}
Example #18
0
    private function getUsers()
    {
        $users = User::select("1");
        foreach ($users as $u) {
            $user = new User($u);
            $this->users .= <<<FFF
                <tr id="{$user->getId()}user">
                    <td class="name">{$user->getUsername()}</td>
                    <td><span class="delUser" userid="{$user->getId()}">Trinti</span></td>
                </tr>
FFF;
        }
    }
Example #19
0
function discussion_get($where = array())
{
    $discussion = new Discussion("t_discussions");
    $result['discussions'] = $discussion->select($where, "de");
    $user = new User("t_users");
    $userInfo = array();
    foreach ($result['discussions'] as $d) {
        $arrUser = $user->select(array('user_id' => $d['user_id']));
        $userInfo[] = $arrUser[0];
    }
    $result['users'] = $userInfo;
    return $result;
}
Example #20
0
 public function run()
 {
     DB::statement("TRUNCATE TABLE services");
     $adminId = User::select('id')->where('username', 'dungho')->first()->id;
     $services = array('Xông hơi thảo dược', 'Waxing nách', 'Mặt nạ cao bí đao');
     foreach ($services as $service) {
         $sv = new Service();
         $sv->name = $service;
         // $sv->admin_id = $adminId;
         $sv->outlet_id = rand(1, 4);
         $sv->status = 'active';
         $sv->created_at = new DateTime();
         $sv->updated_at = new DateTime();
         $sv->save();
     }
 }
Example #21
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $sortby = Input::get('sortby');
     $order = Input::get('order');
     $option = Input::get('search_opt');
     $keyword = Input::get('keyword');
     if ($sortby && $order && $keyword && $option) {
         $users = User::select('*')->where($option, 'LIKE', '%' . $keyword . '%')->orderBy($sortby, $order)->paginate(5);
     } elseif ($sortby && $order) {
         $users = User::select('*')->orderBy($sortby, $order)->paginate(5);
     } elseif ($keyword && $option) {
         $users = User::select('*')->where($option, 'LIKE', '%' . $keyword . '%')->paginate(5);
     } else {
         $users = User::select('*')->paginate(5);
     }
     return View::make('backend.users.index', compact('users', 'sortby', 'order', 'keyword', 'option'));
 }
Example #22
0
 public function getCorpers()
 {
     $this->layout->title = "Corper Stats";
     $this->layout->description = "";
     $this->layout->keywords = "";
     $this->layout->top_active = 6;
     $alluser = User::get();
     $user = User::where('password', "-1")->get();
     $fbuser = count($user);
     $male_user = User::where('sex', "1")->get();
     $muser = count($male_user);
     $female_user = User::where('sex', "2")->get();
     $fuser = count($female_user);
     $undefined = count($alluser) - $fuser - $muser;
     $via_registration = count($alluser);
     $user_via_registration = $via_registration - $fbuser;
     $user_groups = User::select(DB::raw('count(id) as count, serv_year, batch'))->groupBy("serv_year")->groupBy("batch")->get();
     $this->layout->main = View::make('admin.corpersdata', ['undefined' => $undefined, 'female' => $fuser, 'male' => $muser, "main_tab" => 1, "sub_tab" => 1, "reg_user" => $fbuser, "corper_registered_user" => $user_via_registration, "cat" => "corper", "user_groups" => $user_groups]);
 }
Example #23
0
 public function run()
 {
     DB::statement("TRUNCATE TABLE outlets");
     $adminId = User::select('id')->where('username', 'dungho')->first()->id;
     $retailerMT = Retailer::select('id')->where('company_register_id', 'MT00001')->first()->id;
     $retailerPL = Retailer::select('id')->where('company_register_id', 'PL00001')->first()->id;
     $outlets = array(array('name' => 'Minh Toan Graxy - Spa Beauty', 'outlet_register_id' => 'MTID001', 'website' => 'www.minhtoan.com.vn', 'retailer_id' => $retailerMT), array('name' => 'Minh Toan Graxy - Spa One', 'outlet_register_id' => 'MTID002', 'website' => 'www.minhtoan.com.vn', 'retailer_id' => $retailerMT), array('name' => 'Minh Toan Graxy - Spa Two', 'outlet_register_id' => 'MTID003', 'website' => 'www.minhtoan.com.vn', 'retailer_id' => $retailerMT), array('name' => 'Phi Lu - Spa Beauty', 'outlet_register_id' => 'PLID001', 'website' => 'www.philu.com.vn', 'retailer_id' => $retailerPL));
     foreach ($outlets as $key => $value) {
         $outlet = new Outlet();
         $outlet->name = $value['name'];
         $outlet->address_id = rand(1, 5);
         $outlet->outlet_register_id = $value['outlet_register_id'];
         $outlet->website = $value['website'];
         $outlet->admin_id = $adminId;
         $outlet->description_id = 1;
         $outlet->status = 'active';
         $outlet->retailer_id = $value['retailer_id'];
         $outlet->save();
     }
 }
Example #24
0
	public function updateUser($mysql, $uid, $username, $password) {
		$user = new User();
			switch($user->select($uid, $mysql)) {
				case User::DATABASE_ERROR :
				{
					echo "<p>A Database error has occured.</p>";
					return;
				}
				case User::INVALID_DATA :
				{
					echo "<p>Invalid operation requested.</p>";
					return;
				}
				case User::SELECT_SUCCESS : 
				default :
					break;
			}
			
			$user->read($username,$password);
			
			switch($user->update($mysql)) {
				case User::DATABASE_ERROR :
				{
					echo "<p>A Database error has occured.</p>";
					return;
				}
				case User::INVALID_DATA :
				{
					echo "<p>Invalid operation requested.</p>";
					return;
				}
				case User::UPDATE_SUCCESS : 
				{
					echo "<p>User updated successfully.</p>";
					break;
				}
				default :
					break;
			}
	}
Example #25
0
 public function account()
 {
     if (Auth::check()) {
         $query = User::select('referal_id', 'active')->where('referal_id', '=', Auth::id())->where('active', '=', '1');
         if ($query->count() == 0) {
             $total = $query->count();
         } else {
             $total = $query->count();
         }
         $ungrouped_total = User::where('referal_id', '=', Auth::id())->where('arrange_group', '=', 'ungrouped')->get();
         $left_count = User::where('referal_id', '=', Auth::id())->where('arrange_group', '=', 'left_side')->get();
         if ($left_count->count() == 0) {
             $left = $left_count->count();
         } else {
             $left = $left_count->count();
         }
         $right_count = User::where('referal_id', '=', Auth::id())->where('arrange_group', '=', 'right_side')->get();
         if ($right_count->count() == 0) {
             $right = $right_count->count();
         } else {
             $right = $right_count->count();
         }
         $points = Point::where("user_id", Auth::user()->id);
         if ($points->count() > 0) {
             $point = $points->sum("point") . " points";
         } else {
             $point = 0 . " point";
         }
         $amounts = Amount::where("user_id", Auth::user()->id);
         if ($amounts->count() > 0) {
             $amount = "৳ " . $amounts->sum("amount");
         } else {
             $amount = "৳ " . 0;
         }
         return View::make('Users.Account', array('total' => $total, 'left' => $left, 'right' => $right, 'ungrouped' => $ungrouped_total, 'left_member' => $left_count, 'right_member' => $right_count, 'point' => $point, 'amount' => $amount));
     } else {
         return Redirect::route("login")->with("event", "<p class='alert alert-danger'><span class='glyphicon glyphicon-exclamation-sign'></span> You are not logged in!</p>");
     }
 }
Example #26
0
 public function buildSQl()
 {
     $db = Zend_Db_Table_Abstract::getDefaultAdapter();
     $model = new User();
     $columns = array('id', 'id_branch', 'login', 'first_name', 'surname', 'email', 'phone', 'last_login_at', 'is_locked', 'ghost', 'timelock_start', 'timelock_end', 'unsuccessful_logins_number');
     $select = $model->select()->from(array('u' => 'user'), $columns)->where('u.user_source IS NULL')->order('surname');
     if ($this->filterdata['filter_is_deleted']) {
         $select->where("is_locked = 't' OR ghost = 't' OR valid_until < NOW()");
     } else {
         $select->where("is_locked = 'f' AND ghost = 'f' AND valid_until >= NOW()");
     }
     if (isset($this->filterdata['filter_first_name']) and $this->filterdata['filter_first_name']) {
         $select->where('u.first_name ~* ?', $this->filterdata['filter_first_name']);
     }
     if (isset($this->filterdata['filter_surname']) and $this->filterdata['filter_surname']) {
         $select->where('u.surname ~* ?', $this->filterdata['filter_surname']);
     }
     if (isset($this->filterdata['filter_login']) and $this->filterdata['filter_login']) {
         $select->where('u.login ~* ?', $this->filterdata['filter_login']);
     }
     return $select->__toString();
 }
 public function update()
 {
     $rules = ['firstname' => 'required', 'lastname' => 'required', 'email' => 'required|email', 'group' => 'required', 'address' => 'required', 'login' => 'required', 'password' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/usersedit/' . Input::get('id'))->withErrors($validator);
     } else {
         $uexits = User::select('*')->where('email', '=', Input::get('email'))->first();
         if (count($uexits) > 0) {
             if ($uexits->id != Input::get('id')) {
                 $errorMessages = new Illuminate\Support\MessageBag();
                 $errorMessages->add('deplicate', 'User all ready exists with this email');
                 return Redirect::to('/users')->withInput(Input::all())->withErrors($errorMessages);
             } else {
                 $user = User::find(Input::get('id'));
                 $user->firstname = Input::get('firstname');
                 $user->lastname = Input::get('lastname');
                 // $user->login = Input::get('login');
                 $user->address = Input::get('address');
                 $user->email = Input::get('email');
                 $user->group = Input::get('group');
                 $user->password = Hash::make(Input::get('password'));
                 $user->save();
                 return Redirect::to('/users')->with("success", "User Updated Succesfully.");
             }
         } else {
             $user = User::find(Input::get('id'));
             $user->firstname = Input::get('firstname');
             $user->lastname = Input::get('lastname');
             // $user->login = Input::get('login');
             $user->address = Input::get('address');
             $user->email = Input::get('email');
             $user->group = Input::get('group');
             $user->password = Hash::make(Input::get('password'));
             $user->save();
             return Redirect::to('/users')->with("success", "User Updated Succesfully.");
         }
     }
 }
Example #28
0
 public function run()
 {
     DB::statement("TRUNCATE TABLE retailers");
     $adminId = User::select('id')->where('username', 'dungho')->first()->id;
     $retailer = new Retailer();
     $retailer->name = 'Minh Toan Graxy';
     $retailer->category_id = 1;
     $retailer->address_id = 1;
     $retailer->admin_id = $adminId;
     $retailer->company_register_id = 'MT00001';
     $retailer->created_at = new DateTime();
     $retailer->updated_at = new DateTime();
     $retailer->save();
     $retailer = new Retailer();
     $retailer->name = 'Phi Lu';
     $retailer->category_id = 1;
     $retailer->address_id = 2;
     $retailer->admin_id = $adminId;
     $retailer->company_register_id = 'PL00001';
     $retailer->created_at = new DateTime();
     $retailer->updated_at = new DateTime();
     $retailer->save();
 }
Example #29
0
<?php

require 'includes/functions.php';
include 'templates/header.php';
include 'templates/navbar.php';
$header = "accounts";
$page = "view";
include 'templates/sidebar.php';
?>
<div class="row" style="margin-right: 0">
	<div class="col-md-6 col-md-offset-3 page-wrapper">
		<h2>My Account Details</h2>
		<hr>
		<?php 
$user = User::select(array('id' => $_SESSION['user_id']));
?>
		<?php 
$emp = Employee::select(array('user_id' => $_SESSION['user_id']));
?>
		<table class="table lead">
			<tr>
				<th>Name:</th>
				<td><?php 
echo $user->full_name();
?>
</td>
			</tr>
			<tr>
				<th>Username:</th>
				<td><?php 
echo $user->username;
Example #30
0
<?php

require_once 'connection.php';
$session = new Session();
$user = User::select($db, $session->getUsername());
//print_r($_POST);
if (!$session->getLoggedin() || !$session->haveAccess(1, 1, 1, 0) || $session->getUsertype() == Session::USER_MANAGER && $user->getEventcode() != $_GET['eventcode']) {
    die("People of India posses a great deal of wisdom for changing what is not their.");
}
$out = [];
if (isset($_POST['eventcode'])) {
    $eventcode = $db->escape($_POST['eventcode']);
    $eventname = $db->escape(str_replace("'", "&#39;", $_POST['ename']));
    $shortdesc = $db->escape(str_replace("'", "&#39;", $_POST['shortdesc']));
    $tags = $db->escape($_POST['tags']);
    $contacts = $db->escape($_POST['contacts']);
    $prizes = $db->escape($_POST['prizes']);
    $longdesc = $db->escape($_POST['longdesc']);
    //single quotes - replaced with javascript .. (really???)
    $prtpnt = $db->escape($_POST['prtpnt']);
    $timings = $db->escape($_POST['timings']);
    $loc = $db->escape($_POST['venue']);
    $query = "UPDATE events SET " . Event::EVENT_NAME . " ='{$eventname}'," . Event::EVENT_SHORTDESC . "='{$shortdesc}'," . Event::EVENT_LONGDESC . "='{$longdesc}'," . Event::EVENT_TAGS . "='{$tags}'," . Event::EVENT_CONTACTS . "='{$contacts}'," . Event::EVENT_PRIZE . "='{$prizes}'," . Event::EVENT_PRTPNT . "='{$prtpnt}'," . Event::EVENT_TIMINGS . "='{$timings}'," . Event::EVENT_LOCATIONID . "='{$loc}' WHERE " . Event::EVENT_CODE . "='{$eventcode}'";
    $db->query($query);
    $status = "Success Fully Updated!!";
} else {
    $status = "Success Fully Failed :P ---> This shouldnt be happening!! Contact Incharge.";
}
require './includes/metadetails.php';
?>
<body>