xcoderx Posted May 23, 2010 Share Posted May 23, 2010 how exactly does facebook use that redirect thing to send users to external website? e.g. http://www.facebook.com/l.php?u=http://www.youtube.com/watch%3Fv%3D8WnCdf04ba0%26h%3D34021&h=60567 how to make an option like this to our own site? Link to comment https://forums.phpfreaks.com/topic/202635-redirect-links-like-facebook-etc/ Share on other sites More sharing options...
Graxeon Posted May 23, 2010 Share Posted May 23, 2010 It just has a generic "do you really want to continue" yes/no option to a link defined by whatever comes after the .php?u= Link to comment https://forums.phpfreaks.com/topic/202635-redirect-links-like-facebook-etc/#findComment-1062190 Share on other sites More sharing options...
xcoderx Posted May 23, 2010 Author Share Posted May 23, 2010 culd u post some example of coding? in my site where i have a field where users can post their website and i feel like making it kind of like that. show me some examples and how to add it to the field? Link to comment https://forums.phpfreaks.com/topic/202635-redirect-links-like-facebook-etc/#findComment-1062192 Share on other sites More sharing options...
-Karl- Posted May 23, 2010 Share Posted May 23, 2010 <?php if (isset($_GET['u'])) { echo 'Do you really want to continue?<br/> <form method="post" action=""><input type="submit" name="yes" value="Yes"><input type="submit" name="no" value="No"></form>'; } if (isset($_POST['yes'])) { //Redirect Code } if (isset($_POST['no'])) { //Go back to old location } ?> Something like that would be suffice. Link to comment https://forums.phpfreaks.com/topic/202635-redirect-links-like-facebook-etc/#findComment-1062196 Share on other sites More sharing options...
xcoderx Posted May 23, 2010 Author Share Posted May 23, 2010 ok and the link which from database displays is like Website: <a href="#">somesite.com</a>, so how am i goin to use a link.php to be added automatically to the fields where user add a link to external website? Link to comment https://forums.phpfreaks.com/topic/202635-redirect-links-like-facebook-etc/#findComment-1062200 Share on other sites More sharing options...
-Karl- Posted May 23, 2010 Share Posted May 23, 2010 <a href="http://www.yoursite.com/index.php?u=somesite.com> Link to comment https://forums.phpfreaks.com/topic/202635-redirect-links-like-facebook-etc/#findComment-1062201 Share on other sites More sharing options...
Graxeon Posted May 23, 2010 Share Posted May 23, 2010 I haven't tested it but it should be something like this with the redirect put in: <?php if (isset($_GET['u'])) { echo 'Do you really want to continue?<br/> <form method="post" action=""><input type="submit" name="yes" value="Yes"><input type="submit" name="no" value="No"></form>'; } if (isset($_POST['yes'])) { //Redirect Code header("Location: " .$_GET['u']); } if (isset($_POST['no'])) { //Go back to old location or whatever else you want. } ?> Link to comment https://forums.phpfreaks.com/topic/202635-redirect-links-like-facebook-etc/#findComment-1062205 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.