Folks,
They say PHP redirect should be on top part of page above all code. They say similar with session_start(). So which one above the other if both in page ?
And how can you add them on the html header tags section when you got no HTML tags in the page like so …
[code]
<?php
session_start();
require(‘Error_Reporting_Template.php’);
require(‘Conn_Template.php’);
$url = $_GET[‘url’];
//DB Insert Record Into Logging Database.
$query = “INSERT into logs(domain,url,anchor,description,keywords) VALUES (?,?,?,?,?)”;
$stmt = mysqli_stmt_init($conn);
mysqli_stmt_prepare($stmt,$query);
mysqli_stmt_bind_param($stmt,’sssss’,$_SESSION[‘domain’],$_SESSION[‘url’],$_SESSION[‘anchor’],$_SESSION[‘description’],$_SESSION[‘keywords’]);
mysqli_stmt_execute($stmt);
header(“Location: $url”);
die();
?>
Is my code lines in right order ?
The code belongs to my tracker.php.
You see, I building Searchengine. Have you seen when Google presents you search results, the result links are not directly linked to the listed websites but to Google tracker ? This way, when you click a link after reading it’s description on the SERP, you first get sent to their tracker that logs the link click before redirecting you to the destination website. I building such a tracker.where the destination link gets logged before you are forwarded to the destination you chose to go by clicking the third party website’s link found on my SERP.
Is my tracker code ok ? Or need to add more security ? If so then what ?