hello guys i need put banner on 'my account table'. banner should included reflink of member or user who's accessing this page.

here is banner picture:
<img src="" border="0">

and here is all php code of my account table:

<?php include_once('header.php');
if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"])){ 
		$user = $_COOKIE["usNick"];
		$myDb->connect();
			$sql = "SELECT * FROM yob_users WHERE username='$user'";
			$result = mysql_query($sql);        
			$row = mysql_fetch_array($result);
		$myDb->close();
?>
		<div id="content">
			<h2>My Account - Stats</h2>
			<table align="center" width="10%" cellspacing="0" cellpadding="0" class="table1">
/////// need put that banner here---->------->(with username or reflink of user who access this page of course)////////////				

<tr>
					<th width="190">Referral Link</th>
					<td>&nbsp;&nbsp;<? echo SITE_URL."index.php?ref=".$row["username"]; ?></td>
			       </tr>
				<tr>
					<th width="190">Username</th>
					<td>&nbsp;&nbsp;<? echo $row["username"]; ?></td>
				</tr>
				<tr>
					<th width="190">Account</th>
					<td>&nbsp;&nbsp;<? echo $row["account"]; ?></td>
				</tr>
				<tr>
					<th width="190">Ads Viewed</th>
					<td>&nbsp;&nbsp;<? echo $row["visits"]; ?></td>
				</tr>
				<tr>
					<th>Referrals</th>
					<td>&nbsp;&nbsp;<? echo $row["referals"]; ?></td>
				</tr>
				<tr>
					<th>Referral Visits</th>
					<td>&nbsp;&nbsp;<? echo $row["referalvisits"]; ?></td>
				</tr>
				<tr>
					<th>Balance</th>
					<td>&nbsp;&nbsp;$&nbsp;<? echo $row["money"]; ?></td>
				</tr>
				<tr>
					<th>Total Paid</th>
					<td>&nbsp;&nbsp;$&nbsp;<? echo $row["paid"]; ?></td>
				</tr>	
			</table>&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />
<center>Your IP address is:<script language='Javascript' src='http://www.jstracker.com/ip'></script><noscript><a href='http://www.jstracker.com/' target=_blank>IP detector</a></noscript><center>

<?php include ('footer.php'); ?>
<?
}else{
	$display_error = "* You must login to access this page."; // error language
	include ('error.php');
	exit();	
}?>

thank you guys

Dani AI

Generated

Simple, robust approach: add a table row (colspan=2) that links to the logged-in user’s referral URL and wrap the banner image inside that link. was on the right track and confirmed it worked. Below is a safer, modernized example and a few practical tips you can apply immediately.

<?php
// build a safe referral URL and banner output
$ref = isset($row['username']) ? $row['username'] : '';
$refUrl = SITE_URL . 'index.php?ref=' . urlencode($ref);
$bannerUrl = 'https://yourdomain.com/images/ref-banner.jpg';

echo '<tr><td colspan="2">';
echo '<a href="' . htmlspecialchars($refUrl, ENT_QUOTES, 'UTF-8') . '" rel="nofollow noopener">';
echo '<img src="' . htmlspecialchars($bannerUrl, ENT_QUOTES, 'UTF-8') . '" alt="Referral banner" />';
echo '</a>';
echo '</td></tr>';
?>

Notes and best practices: use full PHP tags (<?php ?>) rather than short tags, url-encode the username (urlencode) and escape output with htmlspecialchars to prevent XSS. Host the banner on your own server over HTTPS to avoid mixed-content blocks and hotlinking problems. Prefer session-based authentication and server-validated user data instead of trusting raw cookie values.

If you plan to keep the site long-term, migrate away from deprecated mysql_* calls to mysqli or PDO with prepared statements to prevent SQL injection. Troubleshooting quick checklist: view page source to confirm the anchor/img HTML is rendered, check the banner URL in the browser for 404 or mixed-content errors, and inspect the generated referral link to ensure ref= is properly URL-encoded and points to the intended SITE_URL.

Recommended Answers

All 3 Replies

no1 want reply me :/

What type of reflink are you meaning? I guess I don't quite understand what you mean.

Do you wan't a link like this:
http://YourDomain.com/?ref=yourusername
if so you could simply add the following to you code above

<tr><td colspan="2"><a href=\"<? echo SITE_URL."index.php?ref=".$row["username"]; ?>\"><img src="" border="0" alt="" /></a></td></tr>

I don't know if this is what you wanted or not, but I would be willing to help.

thank you man alot but i did it myself. One more thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.