Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Oturum
- {
- public $name;
- public $other=array();
- public function __construct()
- {
- session_start();
- }
- public function check_user($username="Kayhan",$password="Ozturk")
- {
- mysql_connect('localhost','root','') or die(mysql_error());
- mysql_select_db('cinema') or die(mysql_error());
- $query="select * from users where user_name='$username' and user_pass='$password'";
- $result=mysql_query($query);
- print_r($result);
- if(mysql_num_rows($result)>0)
- {
- $display=mysql_fetch_array($result);
- $_SESSION['user_name']=$display['user_name'];
- $_SESSION['pass']=$display['user_pass'];
- return $_SESSION;
- }
- else
- {
- echo 'Boyle bir kullanıcı yoktur!';
- }
- }
- public function display_message()
- {
- if(!$_SESSION)
- echo 'Siktirgit oturum bile acmamıssın sen daha amcık';
- foreach($_SESSION as $key=>$value)
- {
- echo 'Hosgeldin '.' '.$key.'<br />'.'Sifren ise soyle:'.' '.$value;
- }
- }
- function logout($conditional=false)
- {
- if($conditional!=false)
- {
- echo 'Kapatılamadı adamım sen izin vermedin zaten';
- }
- else
- {
- unset($_SESSION);
- session_destroy();
- echo 'Cıkıs yaptınız ';
- }
- }
- }
- $deneme=new Oturum();
- $deneme->check_user('Kayhan','Ozturk');
- $deneme->display_message();
- $deneme->logout();
- ?>
Add Comment
Please, Sign In to add comment