0

this PHP file is working but now i need a favor one understanding idea. Domain A and Domain B is in different server. So now this index.php is in Domain A. I want the following code to generate a link for Domain B and register a domain so it could redirect . Is it possible?

 <?php       
    $new_link = ""; 
    if(isset($_POST['submit'])) 
    {
        if(isset($_POST['cid'],$_POST['gid']))
        {
            $cid = $_POST['cid'];
            $gid = $_POST['gid'];
            $new_link = "www.something.com/".$cid.$gid;

               // if your input is integer and you want to add them then use this
               // $new_link = "www.something.com/".($cid+$gid);

        }
    }

    ?>


    <form method="post" action="">
         <h1 style="color:#0CF; font-family:Arial, Helvetica, sans-serif;">Enter ID 1:</h1>
            <input type="text" value="" name ="cid" id="cid" />
         <h1 style="color:#0CF; font-family:Arial, Helvetica, sans-serif;">Enter ID 2:</h1>
            <input type="text" value="" name ="gid" id="gid"/>

        <h1 style="color:#0CF; font-family:Arial, Helvetica, sans-serif;">Copy Your Link     Here</h1>
            <textarea style="width:500px; height:50px;"><?php echo $new_link;?></textarea><br /><br /><br />

       <input type="submit" value="submit" name="submit" id="submit"/>

    </form>
JayVicious
  • 25
  • 3
  • elaborate on 'register a domain'. do you mean going to a domain? – kennypu Apr 15 '14 at 03:29
  • Registering a domain at a "registrar" normally takes some more than simply querying the url. In case you want to link to another server, this should work fine. – Willem Van Onsem Apr 15 '14 at 03:30
  • @kennypu , creating a sub domain with affiliate link[Domain B] and the generator for the Domain B is [Domain A] – JayVicious Apr 15 '14 at 03:37
  • @CommuSoft, how to link to the server and enable it to create subdomain. – JayVicious Apr 15 '14 at 03:38
  • if you actually want to create a sub domain, it'll be much work than just using PHP – kennypu Apr 15 '14 at 03:38
  • @kennypu, i need to play with htaccess also but i just need idea or some help would be appreciated. – JayVicious Apr 15 '14 at 03:43
  • At the very least you need a Wildcard DNS to dynamically create subdomains without needing to modify zone files and vhost files. – Ohgodwhy Apr 15 '14 at 03:46
  • @Ohgodwhy, please shine some light . I would wish to know how to solve this issue . haha – JayVicious Apr 15 '14 at 03:48
  • a simple google search pulls this up: http://stackoverflow.com/questions/5822117/how-to-dynamically-create-subdomains – kennypu Apr 15 '14 at 03:49
  • @kennypu , i also got it but then i need Domain A to give permission to Domain B to create a subdomain at Domain B. – JayVicious Apr 15 '14 at 03:53
  • Then that is up to your script. You need to figure out how you're going to identify when it's Domain A and when it's Domain B and how to share permissions across those domains. This is something you must develop. – Ohgodwhy Apr 15 '14 at 04:12
  • @Ohgodwhy , for once i'm going to shout your name for my case. – JayVicious Apr 15 '14 at 04:29

0 Answers0