Folks,
I need to echo link securely. How to do it ?
Q. Is below right ?
““
echo ‘<b>Page Url:</b> ‘; echo urlencode($page_url); echo “<br>”;
Q2. Need to echo link, below not quite right. How to fix it ?
““
echo ‘<b>Page Url:</b> ‘; echo “<a href=”urlencode($page_url)”>urlencode($page_url)</a>”; echo “<br>”;
Context:
““
$query_2 = “SELECT id,username,domain,page_url,page_title,page_description,exclusive_offer FROM links WHERE $col = ? ORDER BY id LIMIT $offset,$limit”;
$stmt_2 = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt_2,$query_2))
{
die(“B.Query Failed!”);
}
else
{
mysqli_stmt_bind_param($stmt_2,’s’,$keywords);
mysqli_stmt_execute($stmt_2);
$result_2 = mysqli_stmt_get_result($stmt_2);
if(!$result_2)
{
die(“Fetching Error!”);
}
while($row = mysqli_fetch_array($result_2,MYSQLI_ASSOC))
{
$id = $row[‘id’];
$domain = $row[‘domain’];
$page_url = $row[‘page_url’];
$page_title = $row[‘page_title’];
$page_description = $row[‘page_description’];
$exclusive_offer = $row[‘exclusive_offer’];
$username = $row[‘username’];
echo ‘<b>Sumission Id:</b> ‘; echo $id; echo “<br>”;
echo ‘<b>Domain:</b> ‘; echo $domain; echo “<br>”;//IS THIS LINE CORRECT TO ECHO URL SECURELY ?
echo ‘<b>Page Url:</b> ‘; echo urlencode($page_url); echo “<br>”;//HOW TO FIX THIS LINE TO EXHO LINK SECURELY ?
echo ‘<b>Page Url:</b> ‘; echo “<a href=”urlencode($page_url)”>urlencode($page_url)</a>”; echo “<br>”;
echo ‘<b>Page Title:</b> ‘; echo $page_title; echo “<br>”;
echo ‘<b>Page Description:</b> ‘; echo $page_description; echo “<br>”;
echo ‘<b>Exclusive Offer:</b> ‘; echo $exclusive_offer; echo “<br>”;
echo ‘<b>Username:</b> ‘; echo $username; echo “<br>”;
echo “<br>”;
}
}
NOTE: Read comment in the echoes.