poison6feet Posted July 3, 2009 Share Posted July 3, 2009 Hi, Earlier I was hosting my website on VPS and written in PHP, recently I moved this site to only webhosting services but due to some reason, the code is not responding and working properly. For example, I have used process.php to handle forms and session.php to handle session variables and database.php to handle data manupilations, but when I trying to add the user then I am getting this error, Fatal error: Call to undefined method MySQLDB::adduser(), however this was working fine. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/ Share on other sites More sharing options...
fooDigi Posted July 3, 2009 Share Posted July 3, 2009 what versions were you using and what are you now (mysql, php)? Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868234 Share on other sites More sharing options...
trq Posted July 3, 2009 Share Posted July 3, 2009 Would seem that MySQLDB (which is not by the way a standard php library) isn't within your include path. Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868235 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 FooDigi I am using MYSQL and PHP 5.2.8. Thorpe Yes, This file is in my website/include/session.php, what should be used instead of mysqldb Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868241 Share on other sites More sharing options...
Adam Posted July 3, 2009 Share Posted July 3, 2009 Are you positive you've set the file structure up exactly the same? There's no chance the code base uses an absolute path to include files? How are you including files? Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868243 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 index.php <? session_start(); include("include/session.php"); $_SESSION['CurRefer']="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $session->updatestats('Guest', $_SESSION['CurRefer']); ?> Fatal error: Call to undefined method MySQLDB::updatestats() Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868244 Share on other sites More sharing options...
Adam Posted July 3, 2009 Share Posted July 3, 2009 And session.php definitely exists in the parent 'include' directory? Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868245 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 include directory is in root directory example public_html/all files public_html/include/all inc files Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868246 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 I have tried by uploading the session.php and related include files to root directory and still the same error. Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868253 Share on other sites More sharing options...
trq Posted July 3, 2009 Share Posted July 3, 2009 Can we see where you define the $session object? Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868254 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 SORRY For unorganized CODE Formatting class Session { var $username; //Username given on sign-up var $userid; //Random value generated on current login var $userlevel; //The level to which the user pertains var $time; //Time user was last active (page loaded) var $logged_in; //True if user is logged in, false otherwise var $userinfo = array(); //The array holding all user info var $url; //The page url current being viewed var $referrer; //Last recorded site page viewed /* Class constructor */ function Session(){ $this->time = time(); $this->startSession(); } function startSession(){ global $database; //The database connection session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /** * Set guest value to users not logged in, and update * active guests table accordingly. */ if(!$this->logged_in){ $this->username = $_SESSION['username'] = GUEST_NAME; $this->userlevel = GUEST_LEVEL; $database->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time); } /* Update users last active timestamp */ else{ $database->addActiveUser($this->username, $this->time); } /* Remove inactive visitors from database */ $database->removeInactiveUsers(); $database->removeInactiveGuests(); /* Set referrer page */ if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url']; }else{ $this->referrer = "/"; } /* Set current url */ $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; } Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868256 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 quick update, picking the values from db is working fine, when I removed that session line from the index page, the site is displaying the data from db. Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868257 Share on other sites More sharing options...
trq Posted July 3, 2009 Share Posted July 3, 2009 Sorry, I meant to ask to see where you instantiate the session object. You don't seem to in any of the code you have posted. Also, there is no updatestats() or adduser() methods within this class. Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868258 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 On index page and login page and all other pages I have started the session session_start(); include("include/session.php"); with in the Session.php file /* Update Statistics*/ function updatestats($username, $page){ global $database; //echo "Entered"; return $database->updatestats($username, $page); } with in the database.php file /** * update daily stats */ function updatestats($username, $page){ $ip=$_SERVER['REMOTE_ADDR']; if ($username){ $loggedin=$username; } else { $loggedin="Guest"; } $datetime = getdate(); $date = $datetime[mday]."/".$datetime[mon]."/".$datetime[year]; $time=$datetime[hours].":".$datetime[minutes].":".$datetime[seconds]; $page=str_replace("'","''",$page); //echo $page; $q = "SELECT count FROM statistics where ipaddress = '$ip' and date='$date' and page='$page'"; $result = mysql_query($q, $this->connection); if (mysql_numrows($result) > 0){ $row_count = mysql_fetch_assoc($result); $count=$row_count['count']+1; $q="Update statistics set LatestTime='$time', count=$count Where ipaddress = '$ip' and date='$date' and page='$page'"; } else { $q = "Insert into statistics values('','$ip','$loggedin','$page','$date','$time','$time',1)"; } return mysql_query($q, $this->connection); } Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868260 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 Thanks everybody's timely reply, not sure, but it is working now. How I dont know. But working fine now. Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868270 Share on other sites More sharing options...
poison6feet Posted July 3, 2009 Author Share Posted July 3, 2009 Earlier I was hosting this on windows OS, not it is on UNIX. I think the problem was the slashes and Upper/Lower case in path definition. Quote Link to comment https://forums.phpfreaks.com/topic/164634-recently-moved-website/#findComment-868281 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.