hi i am php beginner i want to hide actual url links of my site from the mysql i get the url like http://www.megaupload.com/?d=1DYRLC0D and my link become http://s7s7.org/p/?http://www.megaupload.com/?d=1DYRLC0D i want the link to be http://s7s7.org/p/?546345rtsfsd34534wwfsdfdfdf or any thing like that i know i explain my request very bad but hope you understand me this is the code of the page
You'd have to store a unique ID for each URL in the DB. Then when someone passes an ID (e.g. ?d=2399a9sd9a94939f, use _GET['d']), fetch the correct URL from the DB and 302 redirect to it (like so: header("Location: THE_URL")). Alternatively, instead of storing the ID you could encode the original URL somehow I guess.
echo "document.write('<a href=\"$the_url_you_want_the_link_to_go_to\" target=\"_blank\">$the_url_you_want_the_user_to_see</a>'; Code (markup):
The idea of using $_GET['id'] is much better in such cases but here's an encoded URL method. $mulink = 'http://www.megaupload.com/?d=1DYRLC0D'; $encoded = base64_encode($mulink); echo "<a href='?link=$encoded'>Download</a>"; Code (markup): and on download page. $mulink = $_GET['link']; $decoded = base64_decode($mulink); header("Location: $decode"); exit; Code (markup): Don't forget to put validation checks at proper places.