darubillah Posted September 14, 2009 Share Posted September 14, 2009 hi, I am getting an error Fatal error: Cannot redeclare iperlevel() (previously declared in /home/shayan/public_html/pakmoneymatrix.com/program.php:30) in /home/shayan/public_html/pakmoneymatrix.com/program.php on line 39 when ever I visit member.php in my site it show the above error, my website url : http://pakmoneymatrix.com/members.php?r= the following is the code of program.php <? require("config.php"); $today = date(Ymd); $now = date(YmdHis); $utimestamp = time(); $r = $_GET["r"]; $step = $_GET["step"]; if ($header == '1') { $header = "<img src='$url/images/logo.gif' ALT='$pname' border='0' height='60' width='468'>"; } if ($header == '2') { $header = "<font size='6'>$pname</font>"; } $totallevels = count ($referral_levels); $db = mysql_pconnect($dbhost, $dbuser, $dbpass) or die("Could not connect"); mysql_select_db($dbname) or die("Could not select database"); require_once("payment_gateway.php"); function iperlevel($level) { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} $people = 1; for ($i = 1; $i <= $level; $i++) { $people *= $maxrefs; } $gl = $level - 1; $total = $referral_levels[$gl] * $people; return number_format($total, 2); } function aperlevel($level) { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} $gl = $level - 1; $total = $referral_levels[$gl]; return number_format($total, 2); } function tiperlevel($level) { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} $people = $maxrefs; $gl = $level - 1; $total = 0; for ($i = 1; $i <= $level; $i++) { $temp = $referral_levels[$gl] * $people; $total += $temp; $people *= $maxrefs; } return number_format($total, 2); } function totalincome() { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} $people = $maxrefs; $total = 0; foreach ($referral_levels as $amount) { $temp = $amount * $people; $total += $temp; $people *= $maxrefs; } return number_format($total, 2); } function pperlevel($level) { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} $people = 1; for ($i = 1; $i <= $level; $i++) { $people *= $maxrefs; } return $people; } $ip = getenv("REMOTE_ADDR"); if ($payment_method == '1' || $payment_method == '3') { $pay = "PayPal"; } if ($payment_method == '2') { $pay = "E-gold"; } if ($payment_method == '4' || $payment_method == '5') { $pay = "StormPay"; } if ($payment_method == '3') { $time = ' per month'; $ctime = ' PER MONTH'; $timey = ' monthly'; } else { $time = ''; $ctime = ''; $timey = ''; } function brotator($br_rid) { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} $br_exptype = "Date (YYYYMMDDHHMMSS)"; $br_updatesql = "UPDATE bannerrotator SET status='Expired' WHERE exptype='$br_exptype' AND expires<=$now"; $br_updateresult = mysql_query($br_updatesql); $br_sql2 = "SELECT * FROM bannerrotator WHERE adgroup='$br_rid' AND status='Normal' ORDER BY RAND() LIMIT 1"; $br_result2 = mysql_query($br_sql2) or die("Query failed"); $br_myrow2 = mysql_fetch_array($br_result2); $br_tid = $br_myrow2["id"]; $br_newviews = $br_myrow2["views"] + 1; if ($br_myrow2["exptype"] == "Views" && $br_newviews == $br_myrow2["expires"]) { $br_sql3 = "UPDATE bannerrotator SET views=views+1,status='Expired' WHERE id='$br_tid'"; } else { $br_sql3 = "UPDATE bannerrotator SET views=views+1 WHERE id='$br_tid'"; } $br_result3 = mysql_query($br_sql3) or die("Query failed"); if ($br_myrow2["type"] == "HTML") { echo $br_myrow2["html"]; } elseif ($br_myrow2["type"] == "Image") { ?> <a href="<?php echo $url ?>/bclick.php?go=<?php echo $br_myrow2["id"] ?>" target="_blank"><img src="<?php echo $br_myrow2["image"] ?>" ALT="<?php echo $br_myrow2["alt"] ?>" border="0" height="<?php echo $br_myrow2["ih"] ?>" width="<?php echo $br_myrow2["iw"] ?>"></a> <?php } } if ($_POST['id']) { $id = $_POST['id']; } elseif ($_GET['id']) { $id = $_GET['id']; } if (isset($_POST['password'])) { $password = md5($_POST['password']); } elseif (isset($_GET['password'])) { $password = md5($_GET['password']); } if ($remember == 'Yes') { setcookie('tsmatrixr', 'Yes',time()+999999); setcookie('tsmatrixid', $id,time()+999999); setcookie('tsmatrixpass', $password,time()+999999); } if (isset($_POST['session'])) { $session = $_POST['session']; } elseif (isset($_GET['session'])) { $session = $_GET['session']; } function clearusercookies() { setcookie('tsmatrixuser', ''); setcookie('tsmatrixlses', ''); setcookie('tsmatrixr', ''); setcookie('tsmatrixid', ''); setcookie('tsmatrixpass', ''); } function userlogin() { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} if (!$session) { $session = $_COOKIE['tsmatrixlses']; } if ($_COOKIE['tsmatrixlses'] != $session) { setcookie('tsmatrixlses', '',time()-86400); setcookie('tsmatrixlses', $session,time()+86400); } if ($session != '') { $result = @mysql_query("SELECT * FROM sessions WHERE id='$session'"); $sessioninfo = @mysql_fetch_array($result); $sessionid = $sessioninfo['id']; if (!$sessionid) { clearusercookies(); require("login.php"); exit(); } $sessionexpires = $sessioninfo['time'] + 3600; if ($sessionexpires < time()) { clearusercookies(); require("login.php"); exit(); } if ($sessioninfo['ip'] != $ip && $sessioninfo['ip'] != '') { clearusercookies(); require("login.php"); exit(); } $GLOBALS['session'] = $sessioninfo['id']; $id = $sessioninfo['username']; $GLOBALS['id'] = $sessioninfo['username']; $password = $sessioninfo['password']; $GLOBALS['password'] = $sessioninfo['password']; } if (!$id) { clearusercookies(); require("login.php"); exit(); } $sql = "SELECT pass FROM users WHERE id='$id'"; $result = @mysql_query($sql); $opass = @mysql_result($result, 0); $epass = md5($opass); if ($password != $epass || !$opass) { clearusercookies(); require("invalid_login.php"); exit(); } if ($session == '') { if ($iplock == 'Yes') { $ipl = $ip; } else { $ipl = ''; } $sessionfull = time().$id; $session = substr(md5($sessionfull), 0, 32); $sql = "INSERT INTO sessions (id,username,password,ip,time) VALUES ('$session','$id','$password','$ipl','$utimestamp')"; $result = @mysql_query($sql); if ($remember != 'Yes') { setcookie('tsmatrixlses', $session,time()+86400); } $GLOBALS['session'] = $session; } else { $result = @mysql_query("UPDATE sessions SET time='$utimestamp' WHERE id='$session'"); } setcookie('tsmatrixuser', $id,time()+999999); } function userlogout() { global $db,$session; $result = @mysql_query("DELETE FROM sessions WHERE id='$session'"); setcookie('tsmatrixuser', '',time()-999999); setcookie('tsmatrixlses', '',time()-999999); setcookie('tsmatrixr', '',time()-999999); setcookie('tsmatrixid', '',time()-99999); setcookie('tsmatrixpass', '',time()-999999); unset($_COOKIE['tsmatrixuser']); $GLOBALS['id'] = ''; unset($_COOKIE['tsmatrixlses']); $GLOBALS['session'] = ''; unset($_COOKIE['tsmatrixr']); $GLOBALS['remember'] = ''; unset($_COOKIE['tsmatrixid']); unset($_COOKIE['tsmatrixpass']); $GLOBALS['password'] = ''; } if ($header == '1') { $header = "<img src=\"$url/images/logo.gif\" ALT=\"$pname\" border=\"0\" height=\"60\" width=\"468\">"; } if ($header == '2') { $header = "<font size=\"6\">$pname</font>"; } ?> Please Help me Thanks Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/ Share on other sites More sharing options...
Zane Posted September 14, 2009 Share Posted September 14, 2009 well..my first instinction is that the function iperlevel is being redeclared This would mean that you are declaring it more than once I"m not sure where or how because that is a LOT of code to read through... Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918286 Share on other sites More sharing options...
darubillah Posted September 14, 2009 Author Share Posted September 14, 2009 the following is the code from 36-41 $gl = $level - 1; $total = $referral_levels[$gl] * $people; return number_format($total, 2); } function aperlevel($level) { foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};} and line 39 has } in it please try to solve it Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918300 Share on other sites More sharing options...
PFMaBiSmAd Posted September 14, 2009 Share Posted September 14, 2009 How is the program.php file being included? It is either inside of a loop or it is being included more than once. Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918302 Share on other sites More sharing options...
Zane Posted September 14, 2009 Share Posted September 14, 2009 the following is the code from 36-41 .... and line 39 has } in it please try to solve it something tells me you have no idea what your code does.....which leads me to ask...did you do anything to your files before this happened? Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918307 Share on other sites More sharing options...
darubillah Posted September 14, 2009 Author Share Posted September 14, 2009 no i did nothing with this file, I was just implementing a template plzzz help me Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918312 Share on other sites More sharing options...
Zane Posted September 14, 2009 Share Posted September 14, 2009 what does members.php look like is what PFM is getting at...I think...if not ... that's what I'm asking Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918315 Share on other sites More sharing options...
darubillah Posted September 14, 2009 Author Share Posted September 14, 2009 this is members.php <?php // This script is copyrighted to FastTreck.info // You are not allowed to copy this script // If you modify this script you may not claim copyrights. // You are not allowed to remove this header // We will take legal action against all violators. require("program.php"); userlogin(); require("top.php"); ?> <br><br><center><font size="4" color=white face=Verdana><b>Member's Area</b></font><br></center> <?php $action = $_GET['action']; require("login_links.php"); if ($act == "edit") { $sql = "UPDATE users SET first='$first',last='$last',email='$email',acc='$acc',pass='$pass' WHERE id='$id'"; $result = mysql_query($sql); echo "Your information has been updated.\n"; } elseif ($act == "delete") { // delete a record $orsql = "SELECT * FROM users WHERE id='$id'"; $orresult = mysql_query($orsql); $ormyrow = mysql_fetch_array($orresult); $oldref = $ormyrow["ref"]; if ($oldref) { $usql = "UPDATE users SET refs=refs-1 WHERE id='$oldref'"; $uresult = mysql_query($usql); } $sql = "DELETE FROM users WHERE id='$id'"; $result = mysql_query($sql); echo "Your account has been deleted!<p>"; } elseif ($action == "delete") { $sql = "SELECT * FROM users WHERE id='$id'"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); ?> <center><font size="3" face=Verdana>Are you sure you want to delete your account?</font> <form method="post" action="<?php echo $PHP_SELF?>"> <input type="hidden" name="session" value="<?php echo $session ?>"> <input type="hidden" name="act" value="delete"> <input type="Submit" name="submit" value="Delete My Account"></center> <?php } elseif ($action == "edit") { $sql = "SELECT * FROM users WHERE id='$id'"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); ?> <font size="3" face=Verdana>Enter your information.</font><br> <table width="100%"><tr><td width="50%"><font size="4" face=Verdana> Your User-ID<br> Your first name<br> Your last name<br> Your Email<br> Your <?php echo $pay?> account<br> Your Password</font><br> </td><td width="50%" valign="top"> <form method="post" action="<?php echo $PHP_SELF?>"> <b><?php echo $myrow["id"] ?></b><br> <input type="Text" name="first" value="<?php echo $myrow["first"] ?>"><br> <input type="Text" name="last" value="<?php echo $myrow["last"] ?>"><br> <input type="Text" name="email" value="<?php echo $myrow["email"] ?>"><br> <input type="Text" name="acc" value="<?php echo $myrow["acc"] ?>"><br> <input type="password" name="pass" value="<?php echo $myrow["pass"] ?>"><br> <input type="hidden" name="session" value="<?php echo $session ?>"> <input type="hidden" name="act" value="edit"> </td></tr></table><input type="Submit" name="submit" value="Enter information"> </form> <br /><br /> <?php } else { $sql = "SELECT * FROM users WHERE id='$id'"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); ?> <table width="100%"><tr><td width="50%"> <font size="3" face=Verdana>Earnings<br> Personally sponsored members.</font> <br> </td><td width="50%" valign="top"> <font size="3" face=Verdana>$<?php echo $myrow["earnings"] ?><br> <?php echo $myrow["refs"] ?></font><br><br> </td></tr></table> <center><font size="3" face=Verdana>Downline</font></center> <?php $l = 1; $cl = array($id); foreach ($referral_levels as $percent) { $j = 0; $nl = array(); foreach ($cl as $refid) { $ref_result = mysql_query("SELECT id FROM users WHERE mpr='$refid'",$db); while ($ref_myrow = mysql_fetch_array($ref_result, MYSQL_ASSOC)) { $nl[$j] = $ref_myrow["id"]; $j++; } } if ($j == 0) { break; } ?> <table width="100%"><tr><td width="50%"> <b><font size="3" face=Verdana>Level <?php echo $l ?></font></b><br> </td><td width="50%" valign="top"> <?php echo $j ?> <select> <?php foreach ($nl as $rvalue) { ?> <option value="<?php echo $rvalue?>"><?php echo $rvalue?></option> <?php } ?> </select><br> </td></tr></table> <?php unset($cl); $cl = $nl; unset($nl); $l++; } ?> <center><font size="3" face=Verdana>Credits</font></center> <?php $trans_result = mysql_query("SELECT * FROM trans WHERE type='Credit' AND username='$id'",$db); while ($trans_myrow = mysql_fetch_array($trans_result, MYSQL_ASSOC)) { ?> <table width="100%"><tr><td width="50%"> <b><?php echo $trans_myrow["event"] ?></b><br> </td><td width="50%" valign="top"> <font size="3" face=Verdana>$<?php echo $trans_myrow["amount"] ?></font><br> </td></tr></table> <?php } ?> <center><font size="3" face=Verdana>Debits</font></center> <?php $trans_result = mysql_query("SELECT * FROM trans WHERE type='Debit' AND username='$id'",$db); while ($trans_myrow = mysql_fetch_array($trans_result, MYSQL_ASSOC)) { ?> <table width="100%"><tr><td width="50%"> <b><?php echo $trans_myrow["event"] ?></b><br> </td><td width="50%" valign="top"> $<?php echo $trans_myrow["amount"] ?><br><br> </td></tr></table> <?php } } require("bottom.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918320 Share on other sites More sharing options...
darubillah Posted September 14, 2009 Author Share Posted September 14, 2009 please help me If you want whole script than I can give you Quote Link to comment https://forums.phpfreaks.com/topic/174192-fatal-error/#findComment-918353 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.