Page 1 of 1

Error with xampp v3.2.4 while protecting the server.

PostPosted: 04. October 2020 05:03
by DrFrank
Hello. I already solved some troubles from my php remote hosting via tunnelin and xampp. But I have already gotten a new trouble. My php files are those:

lectura.php

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<?php
$actual_link="https://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
$conexion=mysqli_connect("localhost","root","4624cmv4624","bd3");
list($preURL,$tag)=explode('#',$actual_link);
if($tag==="password17109234"){
if($conexion){
$lectura=mysqli_query($conexion,"SELECT * FROM `mensajes`");
if($lectura){
while($row=mysqli_fetch_row($lectura)){
echo <<<EOF
<table class="table">
<tr>
<td rowspan="2">
<img src="
EOF.$row[1].<<<EOF
"width="150"height="150"></img>
</td>
<td style="height:30px;width:90%">
<b>
EOF.$row[2].<<<EOF
</b>
</td>
</tr>
<tr>
<td>
<textarea rows=4 style="width:100%" disabled>
EOF.$row[0].<<<EOF
</textarea>
</td>
</tr>
</table>
EOF;
}
}else{
echo "<h1>Error de lectura.</h1>";
}
}else{
echo "<h1>Error de conexión.</h1>";
}
}else{
echo "<h1>Contraseña incorrecta.</h1>";
}
?>

And index.php:

<link rel="icon" type="image/png" href="https://i.ibb.co/59gR5FP/icono-estatista-comunista.png">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.9.0/firebase.js"></script>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<nav class="navbar navbar-dark bg-dark">
<div id="linkslot_214396"><script src="https://linkslot.ru/bancode.php?id=214396" async></script></div>
<div id="linkslot_214398"><script src="https://linkslot.ru/bancode.php?id=214398" async></script></div>
</nav>
<nav class="navbar navbar-dark bg-dark">
<a class="navbar-brand" href="#">
Para continuar, necesitas registrarte en el chat:
</a>
<a class="navbar-brand" href="#">
<meta name="google-signin-client_id" content="464161591015-ljic3th229vojbf83esclvdsobfo95o5.apps.googleusercontent.com">
<div class="g-signin2" data-onsuccess="onSignIn"></div>
</a>
</nav>
<div id="txt1"></div>
<form method="POST"action="index.php">
<input name="imgURL"type="hidden"id="inputIMGURL">
<input name="username"type="hidden"id="inputUserName">
<input type="hidden"name="password"id="inputPassword">
<textarea class="form-control" id="txt2" rows="4" placeholder="Introduce aqui tu mensaje."name="message"></textarea>
<input type="submit" class="btn btn-primary" value="Enviar.">
</form>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="inputFollow" checked>
<label class="form-check-label" for="exampleCheck1">Leer los últimos mensajes.</label>
</div>
<input id="txt3"class="form-control"placeholder="Introduce la contraseña para acceder a la conversación.">
<?php
$conexion=mysqli_connect("localhost","root","4624cmv4624","bd3");
if($conexion){
echo '<h1>Conectado exitosamente.</h1>';
if($_POST["password"]==="password17109234"){
if($_POST["imgURL"]&&$_POST["username"]&&$_POST["message"]){
$msgSimplified=strtolower($_POST["message"]);
$msgSimplified=$msgSimplified;
$acent = array("á","é","í","ó","ú");
$noAcent=array("a","e","i","o","u");
$number = array("0","1","2","4","5","6","7");
$noNumber=array("o","i","z","a","s","b","t");
$msgSimplified=str_replace($acent,$noAcent,$msgSimplified);
$msgSimplified=str_replace($number,$noNumber,$msgSimplified);
if(
strpos($msgSimplified,"put")!==false
||
strpos($msgSimplified,"pendej")!==false
||
strpos($msgSimplified,"idiot")!==false
||
strpos($msgSimplified,"jod")!==false
||
strpos($msgSimplified,"no sirves")!==false
||
strpos($msgSimplified,"no sos capaz")!==false
||
strpos($msgSimplified,"gay")!==false
||
strpos($msgSimplified,"homosexual")!==false
||
strpos($msgSimplified,"caca")!==false
||
strpos($msgSimplified,"excrement")!==false
||
strpos($msgSimplified,"diarrea")!==false
||
strpos($msgSimplified,"putref")!==false
||
strpos($msgSimplified,"podr")!==false
||
strpos($msgSimplified,"no sirves")!==false
||
strpos($msgSimplified,"ridicul")!==false
||
strpos($msgSimplified,"diva")!==false
||
strpos($msgSimplified,"aweona")!==false
||
strpos($msgSimplified,"cul")!==false
||
strpos($msgSimplified,"pija")!==false
||
strpos($msgSimplified,"verg")!==false
||
strpos($msgSimplified,"tranca")!==false
||
strpos($msgSimplified,"chorra")!==false
||
strpos($msgSimplified,"titola")!==false
||
strpos($msgSimplified,"pene")!==false
||
strpos($msgSimplified,"patetic")!==false
||
strpos($msgSimplified,"noob")!==false
||
strpos($msgSimplified,"stupid")!==false
||
strpos($msgSimplified,"whore")!==false
||
strpos($msgSimplified,"dumb")!==false
||
strpos($msgSimplified,"dick")!==false
||
strpos($msgSimplified,"lamb")!==false
||
strpos($msgSimplified,"bitch")!==false
||
strpos($msgSimplified,"shit")!==false
||
strpos($msgSimplified,"maric")!==false
){
echo '<h1>Hay palabras conflictivas en tu mensaje. Prueba con otras.</h1>';
}else{
$query=mysqli_query($conexion,"INSERT INTO mensajes VALUES('".$_POST["message"]."','".$_POST["imgURL"]."','".$_POST["username"]."');");
if($query){
echo '<h1>Fila insertada exitosamente.</h1>';
}else{
echo '<h1>Error de inserción.</h1>';
}
}
}
}else{
echo "<h1>El envío del mensaje no se ha podido realizar porque usted ha ingresado una contraseña incorrecta.</h1>";
}
}else{
echo "<h1>Error de conexion.</h1>";
}
?>
<script>
onSignIn=(googleUser)=>{
profile=googleUser.getBasicProfile()
console.log('ID: ' + profile.getId()) // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName())
console.log('Image URL: ' + profile.getImageUrl())
console.log('Email: ' + profile.getEmail()) // This is null if the 'email' scope is not present.
render=()=>{
requestAnimationFrame(render)
inputIMGURL.value=profile.getImageUrl()
inputUserName.value=profile.getName()
if(inputFollow.checked==true){
txt1.scrollTop=txt1.scrollHeight
}
inputPassword.value=txt3.value
}
prevResponse=""
xhttp=new XMLHttpRequest()
xhttp.onreadystatechange=()=>{
if(prevResponse!=xhttp.responseText&&xhttp.responseText!=""){
txt1.innerHTML=xhttp.responseText
}
prevResponse=xhttp.responseText
}
loadDoc=()=>{
xhttp.open("GET","lectura.php#"+txt3.value,true)
xhttp.send()
}
setInterval(loadDoc,5000)
loadDoc()
render()
}
</script>
<style>
#txt1 {
width: 100%;
height: 50%;
overflow: scroll;
}
</style>

And the error is which any password could I enter, the password is incorrect. What I should do?

Re: Error with xampp v3.2.4 while protecting the server.

PostPosted: 04. October 2020 09:27
by Altrea
This topic does have nothing to do with XAMPP. It's a pure code debugging problem.

Maybe you should start to read some tutorials on how to debug php code, how to output variables and compare them to each other.

Re: Error with xampp v3.2.4 while protecting the server.

PostPosted: 04. October 2020 11:36
by Nobbie
DrFrank wrote:What I should do?


Debug your code and find out what is going wrong. What else?