Hello,

I'm having trouble with these syntax errors & need some help. Thanks!

Parse error: syntax error, unexpected T_STRING in /home/a3933825/public_html/require.inc.php on line 43





function footer() {
?>
<CENTER>
<table>
<tr>
<td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
</table>
</CENTER>
<?
}
?>

I also get the following syntax error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '{' in /home/a5957980/public_html/includes/functions.php on line 18

Here's the code:

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function get_num_websites()
{
$query = mysql_query("SELECT * FROM urls");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_banners()
{
$query = mysql_query("SELECT * FROM banners");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_users()
{
$query = mysql_query("SELECT * FROM users");
$numrows = mysql_num_rows($query);   <<<<<<<<<<<< line 18
return $numrows;


}

I don't understand why i'm getting an error since I have the same string earlier in the code & I don't get an error on that.

Thank you,
StreeRodFanatik

Edited 3 Years Ago by happygeek: fixed formatting

It would be better if you put your code in code tag. Easier to look through.

and post all of your code from require.inc.php because this is not 43 lines

function footer() {
?>
<CENTER>
<table>
<tr>
<td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
</table>
</CENTER>
<?
}
?>

<td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>

^^^^^^^^^^^^^^^^^^^this is line 43

as far as "It would be better if you put your code in code tag. Easier to look through."

I don't know what that means. This is how it is in the script.

as far as "It would be better if you put your code in code tag. Easier to look through."

I don't know what that means. This is how it is in the script.

.... Read the rules of the forum before posting, the code tags are explained in the paragraph at the top of the PHP forum main page which also links to this page you should read the last paragraph on there which details the repercussions of not using code tags.

Also, you would have been asked to provide the code since problems can't be seen in the code you posted, it is possible PHP is reporting a line other than the one it appears to be which could be above or below what you quoted.

<td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>

^^^ line 43

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function get_num_websites()
{
$query = mysql_query("SELECT * FROM urls");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_banners()
{
$query = mysql_query("SELECT * FROM banners");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_users()
{
$query = mysql_query("SELECT * FROM users");
$numrows = mysql_num_rows($query); <<<<<<<<<<<< line 18
return $numrows;

}

I'm new to this- I hope this is what you meant

<td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>

^^^ line 43

Think about it this way, php is trying to tell you the correct line the error is on, But it is usually unable to if there is a syntax error because the interpreter is unable to parse the file correctly. It usually comes fairly close but not exact. What I am saying is that your first error:

Parse error: syntax error, unexpected T_STRING in /home/a3933825/public_html/require.inc.php on line 43

Cannot be diagnosed until you post all the code from require.inc.php.

ok here it is

<?
global $username;
require 'dconn.php';
session_start();

$username = @$_SESSION["username"];

$connection = mysql_connect($db_server,$db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name, $connection) or die(mysql_error());

// A few important variables to set
$title = "Surfanatiks SuperSurf";
$motto = "Free hits without the bandwidth";
$siteUrl = "http://www.surfanatiks.site50.net/new/"; // remember to include the end slash
$contact_email = "streetrodfanatik@gmail.com";
$paypal= "streetrodfanatik@yahoo.com";
$emailFooter = " - You are receiving this email because you are currently a member of ".$title."Surfanatiks";

// misc settings
$signPoints = 1000; //points for signing up
$surfTime = 20; //time to view each website
$goldSurfTime = 15; //time for each gold member to surf
$maxSites = 10; //total links one can put in the system
$goldPrice = 1; // the monthly price of gold membership. Changing this will not affect current gold members
$sreturn = .75; // points user gets per site visited (1 point = 1 hit)
$goldreturn = 1; // points gold members get per site visited

// advertising
$bannerCost = 5; //cost per month of banners.

// this is shown on the main page. This can be any html code
$mainText = "Welcome to Surfanatiks Supersurf, the no-fuss traffic exchange website, where you can get visits to your websites for absolutely free, just by visiting others. We have a <b>4:3</b> ratio, that means for however many sites you visit, you get 75% of those back!<br><br>

// ***********************************
// ** Do not edit beyond this point **
// ***********************************

function footer() {
 ?>
 <CENTER>
 <table>
<tr>
  <td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
 </table>
 </CENTER>
 <?
}
?>

Theres the problem, the line above the comment telling you not to edit, line 32, does not have an " or ; on the end and that is whats causing the problem here.

change

$mainText = "Welcome to Surfanatiks........you visit, you get 75% of those back!<br><br>

to

$mainText = "Welcome to Surfanatiks........you visit, you get 75% of those back!<br><br>";

Great that did it! TY any ideas on the other error, it says :

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a5957980_monte'@'192.168.0.9' (using password: YES) in /home/a5957980/public_html/includes/.connect.php on line 6

Free Web Hosting

PHP Error Message

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/a5957980/public_html/includes/.connect.php on line 7

Free Web Hosting

PHP Error Message

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/a5957980/public_html/includes/.connect.php on line 7

Free Web Hosting

PHP Error Message

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '{' in /home/a5957980/public_html/includes/functions.php on line 18

Free Web Hosting

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function get_num_websites()
{
    $query = mysql_query("SELECT * FROM urls");
    $numrows = mysql_num_rows($query);
    return $numrows;
}
function get_num_banners()
{
    $query = mysql_query("SELECT * FROM banners");
    $numrows = mysql_num_rows($query);
    return $numrows;
}
function get_num_users()
{
    $query = mysql_query("SELECT * FROM users");
    $numrows = mysql_num_rows($query);
    return $numrows;
}
function email_content($layout)
{
    $GetConfig = mysql_query("SELECT * FROM config WHERE id = 1");
    $conf = mysql_fetch_array($GetConfig);
    $fp = fopen("includes/email_messages/".$layout.".txt", "r");
    $content = '';
    while(!feof($fp)) {
        $content .= fread($fp, 1024);
    }
    fclose($fp);
    $content = str_replace("{site_name}", $conf[site_name], $content);
    $content = str_replace("{site_url}", $conf[site_url], $content);
    return $content;
}
function optimize_tables()
{
    $query = mysql_query("OPTIMIZE TABLE coonfig,users,banners,urls,sessions ");
}
function get_user_info($id)
{
    $query = mysql_query("SELECT * FROM users WHERE id = '$id'");
    $rows = mysql_fetch_array($query);
    return $rows;
}
function get_banner_info($id)
{
    $query = mysql_query("SELECT * FROM banners WHERE id = '$id'");
    $rows = mysql_fetch_array($query);
    return $rows;
}
function get_url_info($id)
{
    $query = mysql_query("SELECT * FROM urls WHERE id = '$id'");
    $rows = mysql_fetch_array($query);
    return $rows;
}
function get_num_user_website($id)
{
    $query = mysql_query("SELECT * FROM urls WHERE user_id = '$id'");
    $numrows = mysql_num_rows($query);
    return $numrows;
}
function get_num_user_banners($id)
{
    $query = mysql_query("SELECT * FROM banners WHERE user_id = '$id'");
    $numrows = mysql_num_rows($query);
    return $numrows;
}
function check_email_exists($email)
{
    $query = mysql_query("SELECT * FROM users WHERE email = '$email'");
    $numrows = mysql_num_rows($query);
    return $numrows;
}
function get_user_info_email($email)
{
    $query = mysql_query("SELECT * FROM users WHERE email = '$email'");
    $rows = mysql_fetch_array($query);
    return $rows;
}
?>

thanks.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Great that did it! TY any ideas on the other error:

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function get_num_websites()
{
$query = mysql_query("SELECT * FROM urls");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_banners()
{
$query = mysql_query("SELECT * FROM banners");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_users()
{
$query = mysql_query("SELECT * FROM users");
$numrows = mysql_num_rows($query); <<<<<<<<<<<< line 18
return $numrows;

}

This says that it is expecting one of these "{". Is this the entire code from this file?

no- here is the complete code-

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function check_credits($email,$credits)
{
	$user = get_user_info_email($email);
	if ($credits < $user[credits] OR $credits == $user[credits])
	{
		return true;
	}
	else
	{
		return false;
}
{
function check_url_user ($email,$url_id)
{
	$user = get_user_info_email($email);
	$query = mysql_query("SELECT * FROM urls WHERE id = '$url_id' AND user_id = '$user[id]'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function check_banner_user($email,$banner_id)
{
	$user = get_user_info_email($email);
	$query = mysql_query("SELECT * FROM banners WHERE id = '$banner_id' AND user_id = '$user[id]'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function logout()
{
	setcookie("EMAIL","");
	setcookie("PASSWORD","");
	$message = "You have successfully logged out";
}
function authenticate ($email,$pass)
{
	$query = mysql_query("SELECT * FROM users WHERE email = '$email' AND password = '$pass'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function optimize_tables()
{
	$query = mysql_query("OPTIMIZE TABLE config,users,banners,urls,sessions ");
}
function unsubscribe_email($email,$confirmkey)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1")
	$query = mysql_query("SELECT * FROM users WHERE email = '$email' AND confirmkey = '$confirmkey'");
	$numrows = mysql_num_rows($query);
	if ($numrows > 0)
	{
		$rows = mysql_fetch_array($query);
		$delete_banners = mysql_query("DELETE FROM banners WHERE user_id = '$rows[id]'");
		$delete_urls = mysql_query("DELETE FROM urls WHERE user_id = '$rows[id]'");
		$delete_sessions = mysql_query("DELETE from sessions WHERE user_id = '$rows[id]'");
		$delete_user = mysql_query("DELETE FROM users WHERE id = '$rows[id]'");
		mail ($conf[admin_email],"$rows[email] has unsubscribed from $conf[site_name]","$rows[email] has unsubscribed from $conf[site_name]","From: $conf[site_name]<$conf[send_from_email]>");
		optimize_tables();
		$message = "Your email has been unsubscribed and your account has been canceled at your request!";
	}
	else
	{
		$message = "Your email does not exist in our database";
	}
	return $message;
}
function confirm_email($email,$confirmkey)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
	$query = mysql_query("SELECT * FROM users WHERE email = '$email' AND confirmkey = '$confirmkey'");
	$numrows = mysql_num_rows($query);
	if ($numrows > 0)
	{
		$rows = mysql_fetch_array($query);
		if ($rows[status] == "active")
		{
			$message = "Your email address has already been confirmed";
		}
		else
		{
			$update = mysql_query("UPDATE users SET status = 'active' WHERE id = '$rows[id]'");
			mail ($conf[admin_email],"New membership signup at $conf[site_name]","$rows[email] has signed up at $conf[site_name]\r\nClick Below to view\r\n".$conf[site_url]."admin/","From: $conf[site_name]<$conf[send_from_email]>");
			$message = "Your account has been activated!<br>You may now sign in and add your URL/Banners and start surfing for credits.";
		}
	}
	else
	{
		$message = "Your email does not exist in our database";
	}
	return $message;
}
function email_content($layout)
{
	$GetConfig = mysql_query("SELECT * FROM config WHERE id = 1");
	$conf = mysql_fetch_array($GetConfig);
	$fp = fopen("includes/email_messages/".$layout.".txt", "r");
    $content = '';
    while(!feof($fp)) {
        $content .= fread($fp, 1024);
    }
    fclose($fp);
    $content = str_replace("{site_name}", $conf[site_name], $content);
	$content = str_replace("{site_url}", $conf[site_url], $content);
	return $content;
}
function check_email_exists($email)
{
	$numrows = mysql_num_rows(mysql_query("SELECT * FROM users WHERE email = '$email'"));
	return $numrows;
}
function get_next_main_banner ($last_banner)
{
	$id = $last_banner + 1;
	$query = mysql_query("SELECT * FROM banners WHERE id = '$id' AND status = 'active'");
	$numrows = mysql_num_rows($query);
	if($numrows == 0)
	{
		$replace_query = mysql_query("SELECT * FROM banners WHERE id > '$id' AND status = 'active'");
		$replace_numrows = mysql_num_rows($replace_query);
		if ($replace_numrows > 0)
		{
			$rows = mysql_fetch_array($replace_query);
		}
		else
		{
			$replace_query_1 = mysql_query("SELECT * FROM banners WHERE id > 0 AND status = 'active'");
			$rows = mysql_fetch_array($replace_query_1);
		}
	}
	else
	{
		$rows = mysql_fetch_array($query);
	}
	return $rows;
}
function get_banner_info($id)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM banners WHERE id = '$id'"));
	return $rows;
}
function get_next_banner($email,$id)
{
	$user_rows = get_user_info($id,$email);
	$ReplaceBanner = mysql_query("SELECT * FROM banners WHERE id > '$user_rows[last_banner]' AND status = 'active' AND credits > 0.9 AND user_id != '$id'");
	$numrows_replace = mysql_num_rows($ReplaceBanner);
	if ($numrows_replace > 0)
	{
		$banner_info = mysql_fetch_array($ReplaceBanner);
	}
	else
	{
		$banner_info = mysql_fetch_array(mysql_query("SELECT * FROM banners WHERE id > 0 AND status = 'active' and credits > 0.9 AND user_id !='$id'"));
	}
	$update_user = mysql_query("UPDATE users SET last_banner = '$banner_info[id]' WHERE id = '$id'");
	return $banner_info;
}
function check_cheat($email,$id)
{
	$numrows = mysql_num_rows(mysql_query("SELECT * FROM sessions WHERE cheat = 1 AND user_email = '$email' AND user_id = '$id'"));
	return $numrows;
}
function add_credit_to_user($email)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
	$query = mysql_query("UPDATE users SET credits = credits + '$conf[credit_earn]' WHERE email = '$email'");
}
function deduct_credit_url($id)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
	$query = mysql_query("UPDATE urls SET credits = credits - '$conf[credit_cost]', views = views + 1 WHERE id = '$id'");
}
function start_session ($id,$email)
{
	$session_id = md5(uniqid(rand()));
	$add_session = mysql_query("INSERT INTO sessions values('','$session_id','$id','$email',0,0,NOW())");
	optimize_tables();
	return $session_id;
}
function get_session_info($session)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM sessions WHERE session_id = '$session'"));
	return $rows;
}
function check_session($session,$id,$email)
{
	$query = mysql_query("SELECT * FROM sessions WHERE user_email = '$email' AND user_id = '$id'");
	$numrows = mysql_num_rows($query);
	if ($numrows == 1)
	{
		$rows = mysql_fetch_array($query);
		if ($rows["session_id"] != $session)
		{
			$update = mysql_query("UPDATE sessions SET cheat = 1 WHERE user_email = '$email' AND user_id = '$id'");
		}
		return $rows["session_id"];
	}
	else
	if ($numrows > 1)
	{
		$update = mysql_query("UPDATE sessions SET cheat = 1 WHERE user_email = '$email' AND user_id = '$id'");
		return false;
	}
	else
	{
		$update = mysql_query("UPDATE sessions SET cheat = 1 WHERE user_email = '$email' AND user_id = '$id'");
		return false;
	}
}	
function get_user_info($id,$email)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id = '$id' AND email = '$email'"));
	return $rows;
}
function get_user_info_email($email)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE email = '$email'"));
	return $rows;
}
function check_if_url_exists($id,$user_id)
{
	$query = mysql_query("SELECT * FROM urls WHERE id = '$id' AND status = 'active' AND credits > 0.9 AND user_id != '$user_id'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function get_url_info($id)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM urls WHERE id = '$id'"));
	return $rows;
}
function get_next_url($id,$email)
{
	$user_rows = get_user_info($id,$email);
	$ReplaceUrl = mysql_query("SELECT * FROM urls WHERE id > '$user_rows[last_url]' AND status = 'active' AND credits > 0.9 AND user_id != '$id'");
	$numrows_replace = mysql_num_rows($ReplaceUrl);
	if ($numrows_replace > 0)
	{
		$url_info = mysql_fetch_array($ReplaceUrl);
	}
	else
	{
		$url_info = mysql_fetch_array(mysql_query("SELECT * FROM urls WHERE id > 0 AND status = 'active' and credits > 0.9 AND user_id !='$id'"));
	}
	$update_user = mysql_query("UPDATE users SET last_url = '$url_info[id]' WHERE id = '$id'");
	return $url_info;
}
?>[c/code]

line 18 I pointed out I think was the wrong line, I think it's the line above the one I had pointed out. It's this one: 
[code]
$query = mysql_query("SELECT * FROM urls WHERE id = '$url_id' AND user_id = '$user[id]'");

I cant see a problem at line 18, but line 47:

$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1")

does not have an ; on the end and there is a missing ).

Here are your first 34 lines

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function check_credits($email,$credits)
{
	$user = get_user_info_email($email);
	if ($credits < $user[credits] OR $credits == $user[credits])
	{
		return true;
	}
	else
	{
		return false;
	}
{
function check_url_user ($email,$url_id)
{
	$user = get_user_info_email($email);
	$query = mysql_query("SELECT * FROM urls WHERE id = '$url_id' AND user_id = '$user[id]'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function check_banner_user($email,$banner_id)
{
	$user = get_user_info_email($email);
	$query = mysql_query("SELECT * FROM banners WHERE id = '$banner_id' AND user_id = '$user[id]'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function logout()
{
	setcookie("EMAIL","");
	setcookie("PASSWORD","");
	$message = "You have successfully logged out";
}
?>

line 14 is suppose to be a } not {

Ok thanks guys, yours worked xan, RObbobs' didn't when I changed the bracket it gave me another whole page of errors. now i'm getting this: Parse error: syntax error, unexpected $end in /home/a5957980/public_html/includes/functions.php on line 247

You would think that people who make & sell this scripts would check to see that they work correctly!

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function check_credits($email,$credits)
{
	$user = get_user_info_email($email);
	if ($credits < $user[credits] OR $credits == $user[credits])
	{
		return true;
	}
	else
	{
		return false;
}
{
function check_url_user ($email,$url_id)
{
	$user = get_user_info_email($email);
	$query = mysql_query("SELECT * FROM urls WHERE id = '$url_id' AND user_id = '$user[id]'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function check_banner_user($email,$banner_id)
{
	$user = get_user_info_email($email);
	$query = mysql_query("SELECT * FROM banners WHERE id = '$banner_id' AND user_id = '$user[id]'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function logout()
{
	setcookie("EMAIL","");
	setcookie("PASSWORD","");
	$message = "You have successfully logged out";
}
function authenticate ($email,$pass)
{
	$query = mysql_query("SELECT * FROM users WHERE email = '$email' AND password = '$pass'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function optimize_tables()
{
	$query = mysql_query("OPTIMIZE TABLE config,users,banners,urls,sessions ");
}
function unsubscribe_email($email,$confirmkey)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
    $query = mysql_query("SELECT * FROM users WHERE email = '$email' AND confirmkey = '$confirmkey'");
	$numrows = mysql_num_rows($query);
	if ($numrows > 0)
	{
		$rows = mysql_fetch_array($query);
		$delete_banners = mysql_query("DELETE FROM banners WHERE user_id = '$rows[id]'");
		$delete_urls = mysql_query("DELETE FROM urls WHERE user_id = '$rows[id]'");
		$delete_sessions = mysql_query("DELETE from sessions WHERE user_id = '$rows[id]'");
		$delete_user = mysql_query("DELETE FROM users WHERE id = '$rows[id]'");
		mail ($conf[admin_email],"$rows[email] has unsubscribed from $conf[site_name]","$rows[email] has unsubscribed from $conf[site_name]","From: $conf[site_name]<$conf[send_from_email]>");
		optimize_tables();
		$message = "Your email has been unsubscribed and your account has been canceled at your request!";
	}
	else
	{
		$message = "Your email does not exist in our database";
	}
	return $message;
}
function confirm_email($email,$confirmkey)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
	$query = mysql_query("SELECT * FROM users WHERE email = '$email' AND confirmkey = '$confirmkey'");
	$numrows = mysql_num_rows($query);
	if ($numrows > 0)
	{
		$rows = mysql_fetch_array($query);
		if ($rows[status] == "active")
		{
			$message = "Your email address has already been confirmed";
		}
		else
		{
			$update = mysql_query("UPDATE users SET status = 'active' WHERE id = '$rows[id]'");
			mail ($conf[admin_email],"New membership signup at $conf[site_name]","$rows[email] has signed up at $conf[site_name]\r\nClick Below to view\r\n".$conf[site_url]."admin/","From: $conf[site_name]<$conf[send_from_email]>");
			$message = "Your account has been activated!<br>You may now sign in and add your URL/Banners and start surfing for credits.";
		}
	}
	else
	{
		$message = "Your email does not exist in our database";
	}
	return $message;
}
function email_content($layout)
{
	$GetConfig = mysql_query("SELECT * FROM config WHERE id = 1");
	$conf = mysql_fetch_array($GetConfig);
	$fp = fopen("includes/email_messages/".$layout.".txt", "r");
    $content = '';
    while(!feof($fp)) {
        $content .= fread($fp, 1024);
    }
    fclose($fp);
    $content = str_replace("{site_name}", $conf[site_name], $content);
	$content = str_replace("{site_url}", $conf[site_url], $content);
	return $content;
}
function check_email_exists($email)
{
	$numrows = mysql_num_rows(mysql_query("SELECT * FROM users WHERE email = '$email'"));
	return $numrows;
}
function get_next_main_banner ($last_banner)
{
	$id = $last_banner + 1;
	$query = mysql_query("SELECT * FROM banners WHERE id = '$id' AND status = 'active'");
	$numrows = mysql_num_rows($query);
	if($numrows == 0)
	{
		$replace_query = mysql_query("SELECT * FROM banners WHERE id > '$id' AND status = 'active'");
		$replace_numrows = mysql_num_rows($replace_query);
		if ($replace_numrows > 0)
		{
			$rows = mysql_fetch_array($replace_query);
		}
		else
		{
			$replace_query_1 = mysql_query("SELECT * FROM banners WHERE id > 0 AND status = 'active'");
			$rows = mysql_fetch_array($replace_query_1);
		}
	}
	else
	{
		$rows = mysql_fetch_array($query);
	}
	return $rows;
}
function get_banner_info($id)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM banners WHERE id = '$id'"));
	return $rows;
}
function get_next_banner($email,$id)
{
	$user_rows = get_user_info($id,$email);
	$ReplaceBanner = mysql_query("SELECT * FROM banners WHERE id > '$user_rows[last_banner]' AND status = 'active' AND credits > 0.9 AND user_id != '$id'");
	$numrows_replace = mysql_num_rows($ReplaceBanner);
	if ($numrows_replace > 0)
	{
		$banner_info = mysql_fetch_array($ReplaceBanner);
	}
	else
	{
		$banner_info = mysql_fetch_array(mysql_query("SELECT * FROM banners WHERE id > 0 AND status = 'active' and credits > 0.9 AND user_id !='$id'"));
	}
	$update_user = mysql_query("UPDATE users SET last_banner = '$banner_info[id]' WHERE id = '$id'");
	return $banner_info;
}
function check_cheat($email,$id)
{
	$numrows = mysql_num_rows(mysql_query("SELECT * FROM sessions WHERE cheat = 1 AND user_email = '$email' AND user_id = '$id'"));
	return $numrows;
}
function add_credit_to_user($email)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
	$query = mysql_query("UPDATE users SET credits = credits + '$conf[credit_earn]' WHERE email = '$email'");
}
function deduct_credit_url($id)
{
	$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
	$query = mysql_query("UPDATE urls SET credits = credits - '$conf[credit_cost]', views = views + 1 WHERE id = '$id'");
}
function start_session ($id,$email)
{
	$session_id = md5(uniqid(rand()));
	$add_session = mysql_query("INSERT INTO sessions values('','$session_id','$id','$email',0,0,NOW())");
	optimize_tables();
	return $session_id;
}
function get_session_info($session)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM sessions WHERE session_id = '$session'"));
	return $rows;
}
function check_session($session,$id,$email)
{
	$query = mysql_query("SELECT * FROM sessions WHERE user_email = '$email' AND user_id = '$id'");
	$numrows = mysql_num_rows($query);
	if ($numrows == 1)
	{
		$rows = mysql_fetch_array($query);
		if ($rows["session_id"] != $session)
		{
			$update = mysql_query("UPDATE sessions SET cheat = 1 WHERE user_email = '$email' AND user_id = '$id'");
		}
		return $rows["session_id"];
	}
	else
	if ($numrows > 1)
	{
		$update = mysql_query("UPDATE sessions SET cheat = 1 WHERE user_email = '$email' AND user_id = '$id'");
		return false;
	}
	else
	{
		$update = mysql_query("UPDATE sessions SET cheat = 1 WHERE user_email = '$email' AND user_id = '$id'");
		return false;
	}
}	
function get_user_info($id,$email)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id = '$id' AND email = '$email'"));
	return $rows;
}
function get_user_info_email($email)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE email = '$email'"));
	return $rows;
}
function check_if_url_exists($id,$user_id)
{
	$query = mysql_query("SELECT * FROM urls WHERE id = '$id' AND status = 'active' AND credits > 0.9 AND user_id != '$user_id'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
function get_url_info($id)
{
	$rows = mysql_fetch_array(mysql_query("SELECT * FROM urls WHERE id = '$id'"));
	return $rows;
}
function get_next_url($id,$email)
{
	$user_rows = get_user_info($id,$email);
	$ReplaceUrl = mysql_query("SELECT * FROM urls WHERE id > '$user_rows[last_url]' AND status = 'active' AND credits > 0.9 AND user_id != '$id'");
	$numrows_replace = mysql_num_rows($ReplaceUrl);
	if ($numrows_replace > 0)
	{
		$url_info = mysql_fetch_array($ReplaceUrl);
	}
	else
	{
		$url_info = mysql_fetch_array(mysql_query("SELECT * FROM urls WHERE id > 0 AND status = 'active' and credits > 0.9 AND user_id !='$id'"));
	}
	$update_user = mysql_query("UPDATE users SET last_url = '$url_info[id]' WHERE id = '$id'");
	return $url_info;
}
?>

Line 217 should be

}
elseif ($numrows > 1)
{

not

}
	else
	if ($numrows > 1)
	{

Ill keep checking but I thinks thats the only other error.

Also, I can see no use for this elseif as it does exactly the same as the else below it.

Ok thanks guys, yours worked xan, RObbobs' didn't when I changed the bracket it gave me another whole page of errors. now i'm getting this: Parse error: syntax error, unexpected $end in /home/a5957980/public_html/includes/functions.php on line 247

You would think that people who make & sell this scripts would check to see that they work correctly!

Either way, this is still not going to work because you are closing your first function with an open bracket

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function check_credits($email,$credits)
{
	$user = get_user_info_email($email);
	if ($credits < $user[credits] OR $credits == $user[credits])
	{
		return true;
	}
	else
	{
		return false;
}
{
function check_url_user ($email,$url_id)
{
	$user = get_user_info_email($email);
	$query = mysql_query("SELECT * FROM urls WHERE id = '$url_id' AND user_id = '$user[id]'");
	$numrows = mysql_num_rows($query);
	return $numrows;
}
?>

line 14 needs to be } not {. By the time you get to the bottom of all of your errors you will still have an "expecting }" or an "expecting {" error.

xan- that made no difference, Rob- when I changed it,it gave me a whole page of errors.

Can anyone tell me of a free program I can use that will catch these errors? And tell me what the fixes should be?
I've tried a couple different free trial ones but they don't offer the fixes & they end up giving me different errors & lines they are on than what I get when I upload the page.

I deleted the bracket all together- now it's just this: Parse error: syntax error, unexpected $end in /home/a5957980/public_html/includes/functions.php on line 247

Which functions are being called from this script? and what are the values being passed to the functions when the errors occur.

xan- i don't know. i'm new to this, these errors are what i get when i type in my sites url.

I deleted the bracket all together- now it's just this: Parse error: syntax error, unexpected $end in /home/a5957980/public_html/includes/functions.php on line 247

.... By doing this, you are including all the code following where the bracket should be in the same function which may well result in further errors when the current one is fixed.

If you put this bracket back and then post the other errors as there are obviously multiple problems through the script if you are getting errors and removing a required } to hide these is not solving the problem, just masking it..

ok i put it back now i get the following:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5957980/public_html/includes/functions.php on line 2
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a5957980/public_html/includes/functions.php on line 38
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a5957980/public_html/includes/functions.php on line 115
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5957980/public_html/includes/functions.php on line 127

Ok, im looking though you're code at the moment, one thing I have noticed is that this line is at the top of the file:

$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));

It may as well be removed since it will not be available within the function without declaring it as a global within each function it is required.

As for the SQL queries, try putting the coluumn names in backticks ` example:

$conf = mysql_fetch_array(mysql_query("SELECT * FROM `config` WHERE `id` = 1"));

ok- tried the backticks, same result. As for removing it your saying it won't affect the script from running correctly if it's removed?

That's correct, if it was defined outside the functions.php page before the file was called it would be available to the functions, but if it is within the same file then it will not be usable by the functions in that file.

Take a look here for more info on this.


Add or die(mysql_error()); to the end of the SQL querys causing the problem:

mysql_query("SOME QUERY")or die(mysql_error());

and let us know what that reports.

xan, that seemed to do the job & now I get this:Table 'a5957980_auto.config' doesn't exist.

This is what I get now- according to my php editor I only have 246 lines. How can I get an error for a line that's not there???

Parse error: syntax error, unexpected $end in /home/a8511253/public_html/includes/functions.php on line 247

This question has already been answered. Start a new discussion instead.