Jump to content

Recommended Posts

Hey yo, peeps...

 

I really need some help now...

I was requested to make a simple contact agenda, and I started programming yesterday.

 

I finished (at least I thought I did) yesterday, the login method.

And it was working! O_O

 

But today, I logged in the agenda using IE 8.

Everything was ok.

 

Then I opened Google Chrome and Firefox (both very popular in this enterprise), and they were not loggin in!  :wtf:

 

I checked the login form. The variable for username is "usuario" and for password is "senha". Everything is right in my 'login.php'.

 

If you guys wish to see the code,  it is something like that:

 

('autentica.php', the form action)

 

session_start();
include "funcoes.php";          //This is a file with my functions (OO disguise )

conectaBanco();               //This function conects to the database.

$usuario=$_POST["usuario"];
$senha=md5($_POST["senha"]);        //I think the cryptografy is ok. The pass is already MD5ed in the base.

$tabela="agenda_user_fundacao";	//Agenda users table

$query="SELECT * FROM ".$tabela." WHERE usuario='".$usuario."' AND senha='".$senha."'";
$consulta=mysql_query($query);
$resultado=mysql_num_rows($consulta);

if($resultado==true)	//If there are results, creates session
{
  $_SESSION["usuario"]=$usuario;
  $_SESSION["ok"]=true;
  
  echo "<script>location.href=('')</script>";	//Redirects to index.php
}
else     //Everytime I run on Chrome and FireOrangeDog, this is what it shows:
{
  echo "<script>alert('Usuário e/ou senha incorreto(s).')</script>";   //Invalid user n' pass.
  echo "<script>history.go(-1)</script>";
}

 

Can someone help, or this is the end? (... my only friend...)

 

TY, Vinicius.

I tested this, and that's what is happening:

 

When I use a correct user and a incorrect password, this is what it shows:

"  Usuario: vinicius.costa

Senha: e10adc3949ba59abbe56e057f20f883e

Query: SELECT * FROM agenda_user_fundacao WHERE usuario='vinicius.costa' AND senha='e10adc3949ba59abbe56e057f20f883e'        "

 

Then when I use the right user and the right pass, the user 'disappears':

"    Usuario:

Senha: d41d8cd98f00b204e9800998ecf8427e

Query: SELECT * FROM agenda_user_fundacao WHERE usuario='' AND senha='d41d8cd98f00b204e9800998ecf8427e'      "

 

I really don't get it O_O

I tryed the if($resultado===1) etc... and I checked the database... Everything is ok.

 

About the login form, it is this way:

 

<body>
  <div align="center"><img src="img/fundanfip.png" height="100"/></div>
  <form method="post" action="autentica.php">
   <table>
    <tr id="login">
     <td>Usuário:</td>
     <td>
      <input name="usuario" type="text" size="30" maxlength="30" />
     </td>
    </tr>
    <tr id="login">
     <td>Senha: </td>
     <td>
      <input name="senha" type="password" size="30" maxlength="30" />
     </td>
    </tr>
    <tr id="login">
     <td colspan="2">
      <div align="center">
       <input type="submit" value="Entrar" />
      </div>
     </td>
    </tr>
   </table>
  </form>
</body>

Awwwh.

 

The funniest thing now is that if I go to 'login.php', and fill in with my data, it will go to the else condition in 'autentica.php'.

BUT

After this, if I go directly to the 'index.php' page, it appears normally. As if I was logged in, and even echoes my name in the page.

 

I'll create a login to you guys, so you can see what I'm talking about.

Ok, check it out...

 

Try going to the Web Agenda: http://fundanfipagendatemp.ueuo.com/

 

It will take you to 'index.php', verify that you are NOT logged in, and redirect you to 'login.php'...

 

The data you must type is:

 

Usuário: test

Senha (pass): 123

 

You will see my debugging notes, and you should also see that the '$usuario' is empty.

 

Then now try to type in the url again http://fundanfipagendatemp.ueuo.com/.

It will login in the system, like it had passed through the 'if' and the 'else' condition.

 

I also don't know why in Firefox and Google Chrome, when you click in 'Sair', that is the logout function, it lasts forever in that page.

 

:wtf:

Ok, I'll try to talk to the other ITS guys, see if there's any Proxy or Cookie disabled in other browsers, because I tried in another 2 computers, and they all had the same result.

 

IE works, FireOrangeDog doesn't, GChrome neither.

 

Maybe I should try in Opera and Safari, too... G_G

Hmmmm...

 

Can servers influence this way in a php code?

Like, depending on the browser you cannot run it properly?

 

'Cause if they do, that would be it.

 

I installed EasyPHP in my PC, but it didn't open the http://localhost/ folder, so I got one free server like 'freewebhostingarea', just to test if it's okay.

 

But if the problem happens in the server, when I finish this job, I'll host it in the enterprise server...

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.