Guest User

Untitled

a guest
Mar 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit'])){
  3. $prueba = $_POST['txtPrueba'];
  4. $ip = $_SERVER['REMOTE_ADDR'];
  5. if($prueba !='')
  6. {
  7. $curl_handle=curl_init();
  8. curl_setopt($curl_handle,CURLOPT_URL,'192.168.2.2/connection.php');
  9. curl_setopt($curl_handle, CURLOPT_POST, 1);
  10. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "prueba=$_POST['txtPrueba']");
  11. $res = curl_exec($curl_handle);
  12. curl_close($curl_handle);
  13. if ($res) {
  14. echo "success message";
  15. }
  16. }
  17. else{
  18. ?><span><?php echo "Error";?></span> <?php
  19. }
  20. }
  21. ?>
  22.  
  23. <html>
  24. <head><title>Prueba | ProyectoTI</title></head>
  25. <body>
  26. <h1>Prueba ProyectoTI | <a>Santiago Troitiño C - 201421697</a></h1>
  27. <form action="<?PHP $_PHP_SELF ?>" method="post">
  28. Nombre <input type="text" name="txtPrueba" value="" placeholder="Ingresar prueba" /><br/>
  29. <input type="submit" name="btnSubmit" value="Login"/>
  30. </form>
  31. </body>
  32. </html>
  33.  
  34. <?php
  35. $servername = "localhost"; //replace it with your database server name
  36. $username = "root"; //replace it with your database username
  37. $password = ""; //replace it with your database password
  38. $dbname = "proyectoti";
  39. // Create connection
  40. $conn = mysqli_connect($servername, $username, $password, $dbname);
  41. // Check connection
  42. if (!$conn) {
  43. die("Connection failed: " . mysqli_connect_error());
  44. }
  45. ?>
Add Comment
Please, Sign In to add comment