Jump to content

What's wrong with this simple code?

- - - - -

  • Please log in to reply
8 replies to this topic

#1
Epatron

Epatron

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
<?php

require "koodit/yhteys.php";


if(!mysql_num_rows(mysql_query("SELECT * FROM kayttajat WHERE 

	nimi='".mysql_real_escape_string($nimi1)."' AND 

	salasana='".mysql_real_escape_string(md5($salasana1))."'"))or die (mysql_error())==1) 

{ 

echo "FAIL";

}else{

echo "Kirjauduit!"; 

$_SESSION['nimi'] = $nimi; 

}

?>

What's wrong with this code? Everytime I put 100% right information to form I get FAIL message!! :O
I might be blind because not seeing it, eventough 1st time using md5 :o!

Young student from Finland!
PS: 15-year-old! :)


#2
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
What is the error?
Does it die mysql_error or echo fail, or nothing at all?

#3
Epatron

Epatron

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
Just echo "FAIL" :(!

Young student from Finland!
PS: 15-year-old! :)


#4
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
do a var_dump of $nimi1 and md5($salasana1)
do you have thoses data in your databases?

#5
Epatron

Epatron

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
Yes I have table with id,name,email, and password, could this error be this md5 ? Am I doin something wrong with those?
(PS. tables are in finnish ofcourse ... id,nimi,salasana)

Young student from Finland!
PS: 15-year-old! :)


#6
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
Ok, but what about the data in thoses columns, do they exist, and do the password columns is in md5 inside the database?

#7
Epatron

Epatron

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
In colums? Yes I insert data from form from other page. ? And yes its md5 at database.

Young student from Finland!
PS: 15-year-old! :)


#8
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
can you show the result of a select *
and the result of the 2 var_dump

#9
Epatron

Epatron

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
Don't get what you mean? :O

---------- Post added at 06:58 AM ---------- Previous post was at 06:36 AM ----------

Seriously need help here! :3

---------- Post added at 07:17 AM ---------- Previous post was at 06:58 AM ----------

Omg !!!! The error was so hilarious , I did have char limit ( 30 ) at password ( re-edited it to 255) !!!
Sorry guys for this stupidness :D

Young student from Finland!
PS: 15-year-old! :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users