My users can send links from popular file hosts like Rapidshare, Megaupload, Hotfile and FileFactory. I need to somehow find out what filehost they sent the link from and use the correct class for it appropriately.
For example, if I sent a Rapidshare link in a form on my web page, I need to somehow cycle through each file host that I allow until I find the text rapidshare.com
, then I know the user has posted a Rapidshare link.
Perhaps a PHP example:
switch($_POST['link'])
{
case strstr($_POST['link'], 'rapidshare.com'):
// the link is a Rapidshare one
break;
case strstr($_POST['link'], 'megaupload.com'):
// the link is a Megaupload one
break;
case strstr($_POST['link'], 'hotfile.com'):
// the link is a Hotfile one
break;
case strstr($_POST['link'], 'filefactory.com'):
// the link is a Filefactory one
break;
}
However, I know for a fact this isn't correct and I'd rather not use a huge IF statement if I can help it.
Does anyone have any solution to this problem?
If you need me to explain more I can try, English isn't my native language so it's kinda hard.
Thanks all.