HDMICable Posted August 29, 2010 Share Posted August 29, 2010 Hello friends. I'm needing a bit of help with some code. I have this code to show my users their referral link: (this code goes in the reg.php file) if($_COOKIE['referido']) { $ref = $_COOKIE['referido']; } else { $ref = $do->get_r_file_url(); $ref = str_replace(array(".html", "/"), "", $ref); if(eregi('.php', $ref)) { $ref=false; } setcookie("referido", $ref, time()+60*60*24*30); } And then this one on the user's profile to show their referral URL: $dp = $do->get_loc()."reg.php/{$signin_username}.html"; So the result is "mysite.com/reg.php/referral.html" and I want it to be "mysite.com/reg.php?referral" I just need to get rid of the "/" I've seen sites like "thesite.com/?r=referral" How can i do something like that? Thanks! Link to comment https://forums.phpfreaks.com/topic/212034-referral-link/ Share on other sites More sharing options...
Alex Posted August 29, 2010 Share Posted August 29, 2010 The reason the URL can be like that because the index for that directory can be excluded. In most cases the directory is index.php, so a URL like www.site.com/?r=referral is the same as www.site.com/index.php?r=referral. In the same way that if you want to visit the index of a website you don't need to include /index.php (assuming the index is index.php). Link to comment https://forums.phpfreaks.com/topic/212034-referral-link/#findComment-1105010 Share on other sites More sharing options...
HDMICable Posted August 29, 2010 Author Share Posted August 29, 2010 The reason the URL can be like that because the index for that directory can be excluded. In most cases the directory is index.php, so a URL like www.site.com/?r=referral is the same as www.site.com/index.php?r=referral. In the same way that if you want to visit the index of a website you don't need to include /index.php (assuming the index is index.php). Thank you very much for your reply. I will try to add the register page into the index.php Thanks! Link to comment https://forums.phpfreaks.com/topic/212034-referral-link/#findComment-1105015 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.