Need help with this, please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

Its cool, thanks for the help you have provided. I think I am just going to go hunt down a different Web Based Property Management Software. Wakodi looks some what promising.
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

editing all the "this" to "thiss" in pb_events.php got me where I was able to login and view users that are in the account. Any other links except deleting users gives me a blank. So I am figuring alot of the problems is in this pb_events.php

Here is the code for it, could use some more help if anyone is willing.

Code: Select all

<?php



//define ("PB_CRYPT_LINKS" , "1");



function DoEvents($thiss) {

	global $_CONF , $_TSM;



	$_TSM["MENU"] = "";



	//checking if user is logged in

	if (!$_SESSION["minibase"]["user"]) {



		if ($_SERVER["REQUEST_METHOD"] == "POST") {



			//autentificate

			$user = $thiss->db->QFetchArray("select * from {$thiss->tables[users]} where `user_login` = '{$_POST[user]}' AND `user_password` = '{$_POST[pass]}'");



			if (is_array($user)) {

				$_SESSION["minibase"]["user"] = 1;

				$_SESSION["minibase"]["raw"] = $user;



				//redirecing to viuw sites

				header("Location: $_CONF[default_location]");

				exit;

			} else

				return $thiss->templates["login"]->blocks["Login"]->output;



		} else

			return $thiss->templates["login"]->blocks["Login"]->output;

	}

	if ($_SESSION["minibase"]["raw"]["user_level"] == 0) {

		$_TSM["MENU"] = $thiss->templates["login"]->blocks["MenuAdmin"]->output;

	} else {

		$_TSM["MENU"] = $thiss->templates["login"]->blocks["MenuUser"]->output;

	}



	if (!$_POST["task_user"])

		$_POST["task_user"] = $_SESSION["minibase"]["user"];



	if($_SESSION["minibase"]["raw"]["user_level"] == 1) {

		$_CONF["forms"]["adminpath"] = $_CONF["forms"]["userpath"];

	}



	switch ($_GET["sub"]) {

		case "logout":

			unset($_SESSION["minibase"]["user"]);

			header("Location: index.php");



			return $thiss->templates["login"]->EmptyVars();

		break;



		case "properties":

		case "expenses":



			if (($_GET["sub"] == "properties") && ($_GET["action"] == "details")) {

				$task = new CSQLAdmin("expenses", $_CONF["forms"]["admintemplate"],$thiss->db,$thiss->tables , $extra);

				$extra["details"]["fields"]["button"] = $task->DoEvents();			

			}



			$data = new CSQLAdmin($_GET["sub"], $_CONF["forms"]["admintemplate"],$this->db,$thiss->tables,$extra);



			if (($_GET["sub"] == "properties") && ($_GET["action"] == "details")) {



				$expense = $thiss->db->QFetchArray("SELECT sum(expense_cost) FROM `{$thiss->tables[expenses]}` WHERE expense_prop ='{$_GET[prop_id]}' " .

							($_GET[date_year] ? " AND expense_date_year ={$_GET[date_year]} " : '') .

							($_GET[date_month] ? " AND expense_date_month ={$_GET[date_month]} " : ''));



				$property = $thiss->db->QFetchArray("SELECT * FROM {$thiss->tables[properties]} WHERE prop_id='{$_GET[prop_id]}'");



				$data->forms["forms"]["details"]["fields"]["expense_total"]= array(

															

															"type" => "text",

															"title" => "Expenses Total",

															"action" => "price",

															"preffix" => "$",

															"forcevalue" => $expense['sum(expense_cost)']

															);



				$data->forms["forms"]["details"]["fields"]["expense_income"]= array(

															

															"type" => "text",

															"title" => "Leased Amount",

															"action" => "price",

															"preffix" => "$",

															"forcevalue" => $property['prop_leased_amount']

															);



				if ($_GET["date_month"] && $_GET["date_year"])

					$data->forms["forms"]["details"]["fields"]["expense_income2"]= array(

																

																"type" => "text",

																"title" => "Profit",

																"action" => "price",

																"preffix" => "$",

																"forcevalue" => $property['prop_leased_amount'] - $expense['sum(expense_cost)']

																);



			}



			return $data->DoEvents("","",$_POST);

		break;



		case "users":

			

			if ((!$_GET["action"])&&($_SESSION["minibase"]["raw"]["user_level"] != 0 )) {

				$_GET["action"] = "details";				

			}



			if ($_SESSION["minibase"]["raw"]["user_level"] == 1) {

				$_GET["user_id"] = $_SESSION["minibase"]["raw"]["user_id"]; 

				$_POST["user_id"] = $_SESSION["minibase"]["raw"]["user_id"];

			}

			

			$data = new CSQLAdmin($_GET["sub"], $_CONF["forms"]["admintemplate"],$thiss->db,$thiss->tables);

			return $data->DoEvents();

		break;



		default:

			return "Properties Expenses Administration Area";

		break;

	}

}



?>
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

All of these

Code: Select all

Deprecated: Call-time pass-by-reference has been deprecated in
were pertaining to the symbol "&". So I have deleted all of those. So no all I am down to is:

Code: Select all

Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined index: NAME in /var/www/lib/config.php on line 107 Notice: Undefined variable: type in /var/www/lib/database.php on line 66 
What would this be relating to? What I mean is what am I suppose to fix?
/lib/config.php line 107

Code: Select all

if ($this->attr["NAME"] != "")
/lib/database.php line 66

Code: Select all

$this->type = $type;
I already tried making "this" into "thiss" thinking maybe it had something to do with what I already did to pb_events.php Did not work I got this instead:

Code: Select all

Undefined variable: type in /var/www/lib/database.php on line 66 Strict Standards: Creating default object from empty value in /var/www/lib/database.php on line 66 
UPDATE: I got rid of the Undefined variable at database.php on line 66 by making $type into "type". I hope this is the right thing to do. Still have problem with config.php at line 107.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Need help with this, please

Post by Jonah Bron »

The undefined index "NAME" error is coming up because there is no index of "NAME" in $this->attr. You can fix it by replacing

Code: Select all

if ($this->attr["NAME"] != "")
With

Code: Select all

if (isset($this->attr["NAME"]) && !empty($this->attr["NAME"]))
As to the error on line 66, it's saying that $type has not yet been declared. Look up above in that file and try to find $type mentioned anywhere.
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

Here it is, it is mentioned on line 14

Code: Select all

var $type;
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

So what do I do now, since it seems to be declared?
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

For right now, I am not even going to worry about that Notice, it shouldn't be interfering with displaying the pages.

The problem I am wanting to correct is that pages are not loading up.

Login page loads up, users page loads up.

These are the pages that dont load up:

Details of user
add user
expenses list
details of expenses
add expenses
edit expenses
property list
add property
details of property
edit property

Can some one please help me with this, I will be more than happy to send you all the codes. Or something else can work out.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Need help with this, please

Post by Jonah Bron »

Change your php.ini settings to display error reporting. If you don't know how, google "php turn on error reporting".
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

I have been using my IDE, totally forgot about it. Anyway, I am seeing some of the same errors over and over again in several scripts.

Code: Select all

PHP Fatal Error: Class 'CXMLParser' not found
each time this shows up it corresponds to a line that is:

Code: Select all

class CConfig extends CXMLParser {
Also get this one

Code: Select all

PHP Fatal Error: Class 'CLibrary' not found
these lines say this:

Code: Select all

class CForm extends CLibrary{
As far as that turning error report on, I will go get that done and report back.
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

Nothing new with the errors
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Need help with this, please

Post by Jonah Bron »

The code is trying to implement two classes that are not defined. There are two possibilities.
  1. They are somewhere, but the files are not included; in which case you would need to find it.
  2. They don't exist at all
This is becoming a lot of trouble for you. After a certain point, buying some more recent software will pay for itself.
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

Jonah Bron wrote:The code is trying to implement two classes that are not defined. There are two possibilities.
  1. They are somewhere, but the files are not included; in which case you would need to find it.
  2. They don't exist at all
This is becoming a lot of trouble for you. After a certain point, buying some more recent software will pay for itself.
Lol, I dont give up to easily, besides, this is becoming a real learning experience for me. As I stated before, I dont really know PHP at all. But after all of this, I am learning some. Even if I get to a point where I personally give up, I am actually thinking of hiring someone to debug it for me. Sooner or later it has to work. Oh and the Class is being defined, found it in xml.php. Still having trouble with it, but looking over every bit of code, whether it is xml, js, css, html, or php to get to the bottom of it all.
I am however starting to think that some of the code or files is missing, Was looking at some code earlier today that called for an image, went to go look for that image in the path given, however that image was not in there. Go figure right? I had to go to a different directory look for a similiar image, copy it to the path I need it in, and rename it. So yup, having some fun in here. :))

Oh and it seems I will be rewriting some of this code, one file has defined _LIBPATH as ./lib/ but for some reason it is not doing right when it is called upon, so I will be writing _LIBPATH out and putting in each place it was called for the exact path.
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

Ok here is two of my biggest problems:

1.When I execute inside my IDE /index.php I get errors on /lib/database.php. However when I execute /lib/database.php I dont get any errors.
anyway here is the errors I get:

Code: Select all

PHP NOTICE:Undefined Variable: type in /var/www/lib/database.php on line 66

PHP Fatal error: Call to undefined function mysql_connect() in /var/www/lib/database.php on line 84

Code: Select all

  $this->type = $type;

$this->conn_id = mysql_connect($server,$login,$password,TRUE) or die("CDatabase::Connect() error " . mysql_error($this->conn_id));

Another big thing that is puzzling me is in these files:
/lib/menu.php
/lib/site.php

Code: Select all

PHP Fatal error: require_once():Failed opening required './lib/common.php' (include_path='.:/usr/share/php:/usr/share/pear')
The part that is really confusing me is the include_path I am not sure where it is pointing to, like what file, also I dont have /usr/share/pear. My pear dir is inside /usr/share/php5/pear and yes I also have /usr/share/php/.


UPDATE: Cant seem to find the main pear module in Ubuntu repos, hwoever I created the dir /usr/share/pear. Since I do have php5-pear. I also installed php-db. Yet I am still getting same errors.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Need help with this, please

Post by Jonah Bron »

1. That means that $type doesn't exist. Try to find mentions of $type, and see if it's defined somewhere.

2. I think you can ignore the include path thing. It's saying that lib/common.php doesn't exist, but it's wanting it.
k33bz
Forum Newbie
Posts: 23
Joined: Tue Sep 21, 2010 1:57 pm

Re: Need help with this, please

Post by k33bz »

Jonah Bron wrote:1. That means that $type doesn't exist. Try to find mentions of $type, and see if it's defined somewhere.

2. I think you can ignore the include path thing. It's saying that lib/common.php doesn't exist, but it's wanting it.
$type is mentioned several times through out almost all the scripts. I am guessing when it says var $type is defining it? Am I correct or wrong to assume that. Funnier thing is /lib/common.php does exist, spelled the same, in path it is defined at, as well as all lower case.
Post Reply