![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Feb 2005
Posts: 37
Rep Power: 0
![]() |
error I dont understand
Ok I have this file called common.php
<?php
/*********************************************************************************
* Filename: common.php
* Generated with CodeCharge 2.0.5
* PHP 4.0 & Templates build 11/30/2001
*********************************************************************************/
error_reporting (E_ALL ^ E_NOTICE);
include("config/config.inc.php");
include("./template.php");
//===============================
// Database Connection Definition
//-------------------------------
//PHP FFA Admin Connection begin
include("./db_mysql.inc");
define("DATABASE_NAME","$PHP_FFA_dbName");
define("DATABASE_USER","$PHP_FFA_mySQL_user");
define("DATABASE_PASSWORD","$PHP_FFA_mySQL_pwd");
define("DATABASE_HOST","$PHP_FFA_mySQL_host");
// Database Initialize
$db = new DB_Sql();
$db->Database = DATABASE_NAME;
$db->User = DATABASE_USER;
$db->Password = DATABASE_PASSWORD;
$db->Host = DATABASE_HOST;
// PHP FFA Admin Connection end
//===============================
// Site Initialization
//-------------------------------
// Obtain the path where this site is located on the server
//-------------------------------
$app_path = ".";
//-------------------------------
// Create Header and Footer Path variables
//-------------------------------
$header_filename = "header.html";
//===============================
//===============================
// Common functions
//-------------------------------
// Convert non-standard characters to HTML
//-------------------------------
function tohtml($strValue)
{
return htmlspecialchars($strValue);
}
//-------------------------------
// Convert value to URL
//-------------------------------
function tourl($strValue)
{
return urlencode($strValue);
}
//-------------------------------
// Obtain specific URL Parameter from URL string
//-------------------------------
function get_param($param_name)
{
global $HTTP_POST_VARS;
global $HTTP_GET_VARS;
$param_value = "";
if(isset($HTTP_POST_VARS[$param_name]))
$param_value = $HTTP_POST_VARS[$param_name];
else if(isset($HTTP_GET_VARS[$param_name]))
$param_value = $HTTP_GET_VARS[$param_name];
return $param_value;
}
function get_session($param_name)
{
global $HTTP_POST_VARS;
global $HTTP_GET_VARS;
global ${$param_name};
$param_value = "";
if(!isset($HTTP_POST_VARS[$param_name]) && !isset($HTTP_GET_VARS[$param_name]) && session_is_registered($param_name))
$param_value = ${$param_name};
return $param_value;
}
function set_session($param_name, $param_value)
{
global ${$param_name};
if(session_is_registered($param_name))
session_unregister($param_name);
${$param_name} = $param_value;
session_register($param_name);
}
function is_number($string_value)
{
if(is_numeric($string_value) || !strlen($string_value))
return true;
else
return false;
}
//-------------------------------
// Convert value for use with SQL statament
//-------------------------------
function tosql($value, $type)
{
if(!strlen($value))
return "NULL";
else
if($type == "Number")
return str_replace (",", ".", doubleval($value));
else
{
if(get_magic_quotes_gpc() == 0)
{
$value = str_replace("'","''",$value);
$value = str_replace("\\","\\\\",$value);
}
else
{
$value = str_replace("\\'","''",$value);
$value = str_replace("\\\"","\"",$value);
}
return "'" . $value . "'";
}
}
function strip($value)
{
if(get_magic_quotes_gpc() == 0)
return $value;
else
return stripslashes($value);
}
function db_fill_array($sql_query)
{
global $db;
$db_fill = new DB_Sql();
$db_fill->Database = $db->Database;
$db_fill->User = $db->User;
$db_fill->Password = $db->Password;
$db_fill->Host = $db->Host;
$db_fill->query($sql_query);
if ($db_fill->next_record())
{
do
{
$ar_lookup[$db_fill->f(0)] = $db_fill->f(1);
} while ($db_fill->next_record());
return $ar_lookup;
}
else
return false;
}
//-------------------------------
// Deprecated function - use get_db_value($sql)
//-------------------------------
function dlookup($table_name, $field_name, $where_condition)
{
$sql = "SELECT " . $field_name . " FROM " . $table_name . " WHERE " . $where_condition;
return get_db_value($sql);
}
//-------------------------------
// Lookup field in the database based on SQL query
//-------------------------------
function get_db_value($sql)
{
global $db;
$db_look = new DB_Sql();
$db_look->Database = $db->Database;
$db_look->User = $db->User;
$db_look->Password = $db->Password;
$db_look->Host = $db->Host;
$db_look->query($sql);
if($db_look->next_record())
return $db_look->f(0);
else
return "";
}
//-------------------------------
// Obtain Checkbox value depending on field type
//-------------------------------
function get_checkbox_value($value, $checked_value, $unchecked_value, $type)
{
if(!strlen($value))
return tosql($unchecked_value, $type);
else
return tosql($checked_value, $type);
}
//-------------------------------
// Obtain lookup value from array containing List Of Values
//-------------------------------
function get_lov_value($value, $array)
{
$return_result = "";
if(sizeof($array) % 2 != 0)
$array_length = sizeof($array) - 1;
else
$array_length = sizeof($array);
reset($array);
for($i = 0; $i < $array_length; $i = $i + 2)
{
if($value == $array[$i]) $return_result = $array[$i+1];
}
return $return_result;
}
//-------------------------------
// Verify user's security level and redirect to login page if needed
//-------------------------------
function check_security($security_level)
{
global $UserRights;
if(!session_is_registered("UserID"))
{
header ("Location: login.php?querystring=" . urlencode(getenv("QUERY_STRING")) . "&ret_page=" . urlencode(getenv("REQUEST_URI")));
exit;
}
else
if(!session_is_registered("UserRights") || $UserRights < $security_level)
{
header ("Location: login.php?querystring=" . urlencode(getenv("QUERY_STRING")) . "&ret_page=" . urlencode(getenv("REQUEST_URI")));
exit;
}
}
//===============================
// GlobalFuncs begin
// GlobalFuncs end
//===============================
?>And i get this error when i open it in my browser. Notice: Undefined variable: PHP_FFA_dbName in /home/freehost/t35.com/p/r/projectx/common.php on line 17 Notice: Undefined variable: PHP_FFA_mySQL_user in /home/freehost/t35.com/p/r/projectx/common.php on line 18 Notice: Undefined variable: PHP_FFA_mySQL_pwd in /home/freehost/t35.com/p/r/projectx/common.php on line 19 Notice: Undefined variable: PHP_FFA_mySQL_host in /home/freehost/t35.com/p/r/projectx/common.php on line 2 Or you can just go to http://projectx.t35.com/index.php and youll see it. SORRY IF THE THREAD IS TOO LONG |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Sep 2004
Posts: 207
Rep Power: 5
![]() |
Make sure those varibles are set in the config.inc.php file.
__________________
_______________________________ BlazingWolf |
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Is $PHP_FFA_dbName defined in "config/config.inc.php", "./template.php" or "./db_mysql.inc"?
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Feb 2005
Posts: 37
Rep Power: 0
![]() |
thanks I will check righ now
|
|
|
|
|
|
#5 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
You should start with writing your own code - from copying code you won't learn anything, and you will not be able to debug it. You can use copied code - when you exactly know where what happens.
|
|
|
|
|
|
#6 |
|
Programmer
Join Date: Feb 2005
Posts: 37
Rep Power: 0
![]() |
ok I know. I will
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|