Advertisement
Corey

ID Post

Jan 30th, 2023
2,510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.76 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  4. <body>
  5. <br />
  6. <?php
  7. if(!$_POST)
  8. {
  9. ?>
  10. <div class="col-md-4">
  11.          <div class="input-group">
  12.  
  13.         <form action="" method="POST">
  14.             <label for="ID">IDs:</label>
  15.   <textarea class="form-control" id="ids" name="ids" rows="10" cols="30" autofocus></textarea>
  16.   <br />
  17.   <label for="tab">Tab:</label><br>
  18.   <input type="text" id="tab" name="tab"><br>
  19. </div>
  20. <br />
  21.   <input class="btn btn-success btn-lg" type="submit" value="Create Links"></input>
  22. </form>
  23. </div>
  24. <?php
  25. }
  26. ?>
  27.  
  28. </body>
  29. </html>
  30.  
  31. <?php
  32.  
  33.     class Config
  34.     {
  35.         public $url = "https://changethislink.com";
  36.        
  37.         function url()
  38.         {
  39.             return $this->url;
  40.         }
  41.     }
  42.    
  43.     $config = new Config;
  44.    
  45.     if(!empty($_POST['ids']))
  46.     {
  47.         $ids = trim($_POST['ids']);
  48.         $ids = explode("\n", $ids);
  49.  
  50.         echo '<style>.alert { width:20%; } </style>';
  51.         echo '<div class="col-md-10">';
  52.        
  53.         foreach ($ids AS $id)
  54.         {
  55.             $oid = (int) $id;
  56.             if(!is_int($oid) OR $oid == 0)
  57.             {
  58.                 echo '<div class="alert alert-danger" role="alert"><strong>ERROR: Invalid Offer ID Provided</strong></div>';
  59.                 exit();
  60.             }
  61.         }
  62.         echo '<div class="alert alert-success" role="alert"><strong>Congrats! The links are below.</strong></div>';
  63.  
  64.         foreach ($ids AS $id)
  65.         {
  66.             $oid = (int) $id;
  67.             if(!(empty($_POST['tab'])))
  68.             {
  69.                 $addtab = (string) htmlspecialchars($_POST['tab']);
  70.                 $firstCharacter = substr($addtab, 0, 1);
  71.                
  72.                 // Edit Tabs
  73.                 $edittab = substr($addtab, 0, 4);
  74.                 if($edittab == "edit")
  75.                 {
  76.                     echo "$config->url/$oid/$addtab";
  77.                 }
  78.                 elseif($firstCharacter == "?")
  79.                 {
  80.                     echo "$config->url/$oid$addtab";
  81.                 }
  82.                 else
  83.                 {
  84.                     echo "$config->url/$oid?$addtab";
  85.                 }
  86.             }
  87.             else
  88.             {
  89.                 echo "$config->url/$oid";
  90.             }
  91.             echo "<br />";
  92.         }
  93.     }
  94.     elseif($_POST && empty($_POST['ids']))
  95.     {
  96.         echo '<style>.alert { width:25%; } </style>';
  97.         echo '<div class="col-md-10">';
  98.         echo '<div class="alert alert-danger" role="alert"><strong>ERROR: You must provide atleast one ID.</strong></div>';
  99.     }
  100. ?>
  101. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement