title: PHP script get ip, check, insert and redirect
body: <p>i dont know much about php but here my question:</p>
  
  <p>How i do in php a script/page (index.php) that get user ip, check if it already exist in a txt file(iplist.txt). If exist send that user IP to (pay.html) if dont exist insert ip on the txt file(iplist.txt) and send to main.html page.</p>
  
  <p>the files inside "(file)" is a exmaple to be easier to understand.</p>
  
  <p>i already made the code to get ip and tryed inserting the ip on a file but failed lol.</p>
  
  <pre><code>        include 'getip.php';
          $user_ip = getUSerIP();
          echo "&lt;h2&gt; ".$user_ip." &lt;/h2&gt;";
  </code></pre>
  
  <p>This code is abit of what i did on a file to test if i get the user id. If i execute it, it tells me the user IP on a page. i just could did this part.</p>
  
  <p>Best regards.</p>