 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
05-09-2008, 04:31 PM
|
#21 (permalink)
|
|
The Contributor
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
|
well ran into an issue i wanted to ask
Code:
function __construct(){
$EvulSess = EvulSession::getInst();
$EvulSys = $this->Connect();
}
is my evulsys constructor, but its not doing what its supposed to... i think.
well, i have
index.php
files/index.php
sources/(my classes)
when i try to $system->SetGuest(); on files/index.php
i get an error...
Quote:
Fatal error: Call to a member function set_var() on a non-object in C:\httpd\www\EvulCMS\sources\EvulSys.php on line 45
|
which, is this
Code:
function SetGuest(){
//$EvulSess = EvulSession::getInst();
$EvulSess->set_var("usr_nme", "Guest");
}
i have the line commented out, because, if i uncomment that line, it works, and sets guest...
without that line, i get the error
shouldn't that be taken care of by the constructor? not each time each method is used like this? or should i be setting $EvulSess like that, in every method i need to use my session instance?
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
|
|
|
05-09-2008, 06:34 PM
|
#22 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
put it inside an object member variable, at the moment those variables are local to the method i.e. not able to be accessed by the other methods.
PHP Code:
class whatever { private $EvulSess;
function __construct(){ $this->EvulSess = EvulSession::getInst(); $EvulSys = $this->Connect(); }
function SetGuest(){ $this->EvulSess->set_var("usr_nme", "Guest"); } }
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
|
The Following User Says Thank You to sketchMedia For This Useful Post:
|
|
05-09-2008, 08:31 PM
|
#23 (permalink)
|
|
The Contributor
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
|
ooo i see now
sweet
thanks guys
good thing i stopped to check when i did, because i just got done fixing my register function heh.
not much of a change though
thanks for you help guys.
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
|
|
|
05-10-2008, 02:27 PM
|
#24 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
no problem m8, glad to see you got it sorted.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-11-2008, 01:40 PM
|
#25 (permalink)
|
|
The Contributor
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
|
well, i just tested what you suggested and i get this error
Quote:
|
Cannot access empty property in C:\wamp\www\EvulCMS\sources\EvulSys.php on line 14
|
which is.. well exactly what you have...
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
|
|
|
05-11-2008, 02:31 PM
|
#26 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
there is only really one thing i didnt do in my example, but even so it shouldnt be causing an error:
PHP Code:
class whatever { private $EvulSess; private $EvulSys;
function __construct(){ $this->EvulSess = EvulSession::getInst(); $this->EvulSys = $this->Connect(); }
function SetGuest(){ $this->EvulSess->set_var("usr_nme", "Guest"); } }
What is the code for your 'set_var' method? also should this:
PHP Code:
function SetGuest(){ $this->EvulSess->set_var("usr_nme", "Guest"); }
be:
PHP Code:
function SetGuest(){ $this->EvulSess->set_var("usr_name", "Guest"); }
i cant debug your code with any great accuracy because i dont have enough to work on.
</span></span>
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-11-2008, 03:02 PM
|
#27 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
What's happening on line 14? If you're using an IDE walk through the code and see precisely where the error is occurring, if not then perhaps it might be worth setting up a crude error handler to give you/us some more information? Either that or we need to see the code causing problems (things like the internals of EvulSess::set_var might be to blame).
Just for kick, try temporarily putting the following into your file:
PHP Code:
set_error_handler(array('SalError', 'handler')); class SalError { public static function handler($num, $str, $file, $line, $context) { debug_print_backtrace(); } }
|
|
|
|
05-22-2008, 12:31 PM
|
#28 (permalink)
|
|
The Visitor
Join Date: May 2008
Posts: 2
Thanks: 1
|
What i did in my session-db combined login class in vo.php file is
PHP Code:
<?php error_reporting(E_ALL); @ini_set("display_errors","1");
require_once("database.php"); require_once("session.php"); require_once("izinler.php");
class login { var $username; var $password; var $userid; var $user_enable; var $oturumid;
function login() { global $db; global $session;
$db = new database; $db->setUser("root",""); $db->setDatabase("viyatek");
$db->query("SET NAMES 'utf8'"); $db->query("SET collation_connection = 'utf8_turkish_ci'");
$session = new session; $this->oturumid = $session->session_id; }
/* * Genel kullanimda iki sozcugun match'i icin fonksiyon. Ozel olarak burada gonderilen username'in * veritabanindaki sifresini gonderilen sifre ile match ediyor. */ function checker($username,$password,$posta_adi="1") { global $db; global $session;
$this->username = $username; $this->password = $password;
$user_que = $db->query("SELECT * FROM userdata WHERE username='$this->username'"); $user_list = $db->result();
$this->userid = $user_list['id']; $this->username = $user_list['username']; $this->ad_soyad = $user_list['ad'] . ' ' . $user_list['soyad']; $this->user_level = $user_list['level']; $this->user_switchno = $user_list['switchno']; $this->user_onuno = $user_list['onuno'];
$oturum_que = $db->query("SELECT * FROM sessions WHERE userid='$this->userid';");
if( ( $posta_adi == "1" ) && ( $this->password != "" ) && ( $this->username != "" ) ) { if( $this->user_enable != constant("ADMIN") ) { if ( $this->user_level == constant("BANNED") ) { header("Location: user_banned.php"); exit(); } if ( $db->num_rows($oturum_que) && ($this->userid != "2") ) { $session->destroy(); header("Location: duplicate_user.php"); exit(); } }
if( $this->password == $user_list['password'] ) { $session->set("userid",$this->userid); $session->set("username",$this->username); $session->set("user_level",$this->user_level); $session->set("adsoyad",$this->ad_soyad); $session->set("sepet","0_0"); $session->set("oturum","1"); $session->set("user_switchno",$this->user_switchno); $session->set("user_onuno",$this->user_onuno);
$session->set("mac_filtering_macid","0"); $session->set("mac_filtering_vlanid","0"); $session->set("static_mac_filtering_macid","0"); $session->set("static_mac_filtering_vlanid","0"); $session->set("mac_filtering_gid","0");
$db->query("UPDATE sessions SET userid='$this->userid' WHERE id='$this->oturumid';"); header("Location: index.php"); exit(); } else { header("Location: kullanici_giris.php"); exit(); } } }
/* *Oturum acilmismi kontrolu */ function kontrolcu() { global $db; global $session; if($session->get("oturum") != "1") { //$this->eslestirici("guest","guest","1"); //header("Location: index.php"); header("Location: kullanici_giris.php"); } else return 1; } } ?>
and for the index.php part
PHP Code:
<?php ob_start(); error_reporting(E_ALL); @ini_set('display_errors','1'); require_once("kutuphane/vo.php"); $login = new login; $login->kontrolcu(); ?>
That's all. If you go pages by lettin index.php calls the files then your session and database objects as well as the login object will work really fine.
|
|
|
|
05-22-2008, 04:29 PM
|
#29 (permalink)
|
|
The Contributor
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
|
its working fine now actually. though, after messing with the entire thing over the weekend, i started to make a permissions system... which will require me to go back over my systems class, and adjusting the session stuff again, and adjusting the registration/login stuff too....
sites setup with my index.php as my load page. everything else is included.
Index.temp.php is the main template....
pages are included into the template.
I rather like how SMF layers their template..... templatehead(), templatefoot(), and on index, put your body inclusion between, and poof, layered template. i'll explain more later if anyone wishes....
added my article class the other day, but i think i'm going to rewrite it. probably going to use tinyMCE on the site.
things are going along slowly, but surely
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|