How can I add a user's id to a redirect file in html?

0

This is the html that I use to redirect, how can I make the end of the url where it says "subid=" add the id of a registered user on my web page? that is, when the user joins with id = 57 go to www.example.com/redirect.html, take him to link . adding that 57 at the end that would be the user id juan. here I leave the code of my html.

<html>
<head>
<META HTTP-EQUIV="REFRESH" 
CONTENT="5;URL=https://www.publicidad.de/lead.php?id=1&sid=1&usubid=">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
<title>Redireccionando...</title><script type="text/javascript">
</script>
</head>
<body bgcolor="white">
<center><h1>Estas siendo redirecionado</h1></center>
</body>
</html>
    
asked by Luis Cesar 30.04.2018 в 17:37
source

1 answer

0

There are two methods with which the browser can send information to the server:

  • HTTP GET method. Information is sent in a visible way
  • HTTP POST method. Information is sent in a non-visible way

Before the browser sends the information provided, it encodes it via URL encoding, resulting in a Query String. This coding is a scheme of keys and values separated by an ampersand & amp;

What you want to do is by the GET method:

The GET method

sends the user's encoded information in the header of the HTTP request, directly in the URL. The web page and the encoded information are separated by a question?:

www.ejemplo.com/index.htm?key1=value1&key2=value2&key3=value3...

Simple example of html form with the GET method:

<html>
<body>
<form action="formget.php" method="get">
    Nombre: <input type="text" name="nombre"><br>
    Email: <input type="text" name="email"><br>
    <input type="submit" value="Enviar">
</form>
Hola <?php isset($_GET["nombre"]) ? print $_GET["nombre"] : ""; ?><br>
Tu email es: <?php isset($_GET["email"]) ? print $_GET["email"] : ""; ?>
</body>
</html>

The url that results from clicking submit is of the form:

formget.php?nombre=peter&email=peter%40ejemplo.com

In this case @ is a special character and is coded.

HTTP POST method

The HTTP POST method also encodes the information, but it is sent through the body of the HTTP Request, so it does not appear in the URL.

  • The POST method has no limit on the amount of information to be sent.
  • The information provided is not visible, so it can be send sensitive information.

simple example of post method

<html>
<body>
<form action="formpost.php" method="post">
    Nombre: <input type="text" name="nombre"><br>
    Email: <input type="text" name="email"><br>
    <input type="submit" value="Enviar">
</form>
Hola <?php isset($_POST["nombre"]) ? print $_POST["nombre"] : ""; ?><br>
Tu email es: <?php isset($_POST["email"]) ? print $_POST["email"] : ""; ?>
</body>
</html>

You can check that the information is not shown in the url. I recommend you read: Official Documentation Method Post and Get

    
answered by 30.04.2018 в 17:53