Hi, I want a PHP script which short links but I need some features : every one register on my site www.domain.com take a sub domain like www.user.domain.com then he can short his links like http://www.google.com.eg/search?hl=a...D%D8%AB!&meta= to be like www.user.domain.com/1gfd6 , also he can put his ads codes that will appear when any one go to www.user.domain.com/1gfd6 by going to his sub domain control panel and put his ads. and for non-registered users if any one short a link it must be like this www.free.domain.com/154fdf for admin, he can allow or disallowed the following: registration, users put ads and has the ability to close the whole site and appear a message to tell them the reason for closing like maintenance. my host support both wildcard DNS and mod_rewrite I made a deep search but I did not find a script like what I want. I can pay for any one who make this script for me. Thanks for your time
Here you will need to create a small user management program for making users register for uploading their ads codes, URLs and then based on their user ID create a virtual subdomain for them. After login into their account user upload their ads codes and even upload their URL's for shortening, the script will convert their short URL codes based on their user ID subdomain and even their ads shown on that link. eg: http://userid.domain.com/1gfd6 For general public without registration they too can upload their URL for short URL but it will be of main domain. eg: http://www.domain.com/1gfd6 Gonzo
Well it depands on what approach you want to take if your host support cpanel then you can make a script to create auto subdomain for users or else if your host support wildcard DNS then you can use .htaccess for the job eg: RewriteEngine On # Extract the subdomain part of domain.com RewriteCond %{HTTP_HOST} ^([^\.]+)\.website\.com$ [NC] # Check that the subdomain part is not www and ftp and mail RewriteCond %1 !^(www|ftp|mail)$ [NC] # Redirect all requests to a php script passing as argument the subdomain RewriteRule ^.*$ http://www.website.com/index.php?userid=%1 [R,L] Note: [NC] = (no case - case insensitive) and [L] = Last rule This will give you a start for the script and plan forward. Gonzo