PDA

View Full Version : PowerPanel Help 2



Jamieb
31-05-2007, 12:10 PM
I cant remove requests i get this thing come up


Fatal error: Call to undefined function: checkaccount() in /home/thebobba/public_html/djpanel/delreq.php on line 6
This is that file



<?php
session_start();
include("includes/config.php");

if(isset($_SESSION['username']) && isset($_SESSION['password']) && $_SESSION['level'])
{checkaccount($_SESSION[username]);

$id = $_GET['id'];

$query = mysql_query("DELETE FROM requests WHERE id = '$id'") or die('Could not delete request: '.mysql_error());

echo("<br /><center><strong>Request deleted!</strong> Please reload this page</center>");

die();
}
?>+rep for help

Mr Macro
31-05-2007, 12:11 PM
Can i see the functions.php file and the config.php file please.

Jamieb
31-05-2007, 12:13 PM
Sure


Functions

<?php
include("config.php");

function clean($string) {
$string = htmlspecialchars($string);
$string = stripslashes($string);
$string = mysql_escape_string($string);
$string = htmlentities($string);
$string = str_replace("\"", "", $string); // Don't ask why after I did stripslashes() [:
$string = str_replace(">", "", $string);
$string = str_replace("<", "", $string);
return $string;
}

function censor($string) {
## We need to censor the text
#################################

$words = file_get_contents("http://powerpanel.duosystems.net/grab/swears.txt");

$wordz = explode("|", $words);

foreach($wordz as $bad) {

$filter = strlen($bad);


$string = str_replace($bad, "*****", $string);

}

return $string;

#################################
## Censored!
}

function encrypt($string) {
$string = md5($string);
$string = base64_encode($string);
$string = md5($string);
$string = base64_decode($string);
$string = md5($string);
return $string;
}

// Email address valid checker
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}

## BBCode
function bbcode($string) {
$string = str_replace('', "<strong>", $string);
$string = str_replace("", "</strong>", $string);
$string = str_replace("", "<u>", $string);
$string = str_replace("", "</u>", $string);
$string = str_replace("", "<i>", $string);
$string = str_replace("", "</i>", $string);
$string = str_replace("", "<strike>", $string);
$string = str_replace("", "</strike>", $string);
$string = str_replace("
", '<div style="margin-left: 5px; margin-top: 5px;">Code:<br /><div style="border: dotted 1px #000000; padding: 4px;"><!-- Code -->', $string);
$string = str_replace("", "<!-- / Code --></div></div>", $string);

if(@preg_match("/<div style=\"margin-left: 5px; margin-top: 5px;\">Code:<br /><div style=\"border: dotted 1px #000000; padding: 4px;\"><!-- Code -->/i", $string) && !@preg_match("/<!-- / Code --></div></div>/i", $string)) {
$string = "". $string ."</div></div>";
}

$string = str_replace("
", '<div style="margin-left: 5px; margin-top: 5px;">Quote:<br /><div style="border: dotted 1px #000000; padding: 4px;"><!-- Quote -->', $string);
$string = str_replace("", "<!-- / Quote --></div></div>", $string);

if(@preg_match("/<div style=\"margin-left: 5px; margin-top: 5px;\">Quote:<br /><div style=\"border: dotted 1px #000000; padding: 4px;\"><!-- Quote -->/i", $string) && !@preg_match("/<!-- / Quote --></div></div>/i", $string)) {
$string = "". $string ."<!-- / Quote --></div></div>";
}

return $string;
}

function checkaccount($username) {

$user = $username;

$check = @mysql_num_rows(mysql_query("SELECT * FROM users WHERE username = '$user'"));

if($check == "0") {
session_destroy();
die();
return;
}
else {
return;
}
}

?>

Config


<?php

$hostname = "localhost";
$username = "thebobba_panel";
$password = "panel";
$database = "thebobba_panel";

$connect = mysql_connect($hostname, $username, $password, $database) or die('Could not connect to MySQL Database, Error: '. mysql_error());
$dbselect = mysql_select_db($database, $connect) or die('Could not select MySQL Database, Error: '. mysql_error());

$siteinfo = mysql_query("SELECT * FROM config");
$site = mysql_fetch_array($siteinfo);

$hometext = $site[home];
$hometext = nl2br($hometext);

?>


Ok?

Mr Macro
31-05-2007, 12:16 PM
You need to replace the code in config.php with:



<?php
include('functions.php');

$hostname = "localhost";
$username = "thebobba_panel";
$password = "panel";
$database = "thebobba_panel";

$connect = mysql_connect($hostname, $username, $password, $database) or die('Could not connect to MySQL Database, Error: '. mysql_error());
$dbselect = mysql_select_db($database, $connect) or die('Could not select MySQL Database, Error: '. mysql_error());

$siteinfo = mysql_query("SELECT * FROM config");
$site = mysql_fetch_array($siteinfo);

$hometext = $site[home];
$hometext = nl2br($hometext);

?>

Jamieb
31-05-2007, 12:17 PM
Thx +rep!

Jamieb
31-05-2007, 12:18 PM
Sorry duble post its just white now :S http://www.thebobbas.net/djpanel/

Mr Macro
31-05-2007, 12:18 PM
Ok, take the




include('functions.php');

Out of config and add it into the file you originally got an error from.Below:



session_start();

Jamieb
31-05-2007, 12:19 PM
Read post above :P

Mr Macro
31-05-2007, 12:23 PM
Read post above :P

Yeah, i replied to that.Read above :P

Jamieb
31-05-2007, 12:25 PM
done that.. now i carnt remove requests agen :(

Mr Macro
31-05-2007, 12:26 PM
Oh right, sorry.My mistake.

Instead of:



include('functions.php');


It needs to be:



include('includes/functions.php');

Jamieb
31-05-2007, 12:32 PM
Oh right, sorry.My mistake.

Instead of:



include('functions.php');
It needs to be:



include('includes/functions.php');


still dont work :S www.thebobbas.net/djpanel

Mr Macro
31-05-2007, 12:33 PM
What file are you getting the error on ?

Jamieb
31-05-2007, 12:36 PM
pm'ed ...

Drompo
31-05-2007, 12:40 PM
<?php
include("includes/functions.php");
include("includes/config.php");

if(isset($_SESSION['username']) && isset($_SESSION['password']) && $_SESSION['level']) {

checkaccount($_SESSION[username]);


$id = $_GET['id'];

$query = mysql_query("DELETE FROM requests WHERE id = '$id'") or die('Could not delete request: '.mysql_error());

echo("<br /><center><strong>Request deleted!</strong> Please reload this page</center>");

die();
}
?>

replace delreq.php with that.

It should work

Mr Macro
31-05-2007, 12:41 PM
Reina saves the day once again, nice one :)

Drompo
31-05-2007, 12:43 PM
Thanks, Thats what i'm here for.

Mr Macro
I am PMing you.

Want to hide these adverts? Register an account for free!