Jump to content

phpagent

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpagent's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah i try this in checkLogin.php If Ihave understand well. I have to encrypt password from inputbox and then in sql query i tell him to compare encrypted password from password box with password in database... That didn't work. Should i even bother with pass encryption?? $encrypt = crypt('$Lozinka'); // Spajanje na tablicu i potraga za korisničkim imenom i lozonkom $sql="SELECT * FROM $tablica WHERE username='$Korisnik' and password='$encrypt'"; $result=mysql_query($sql);
  2. Tnx, MasterACE14, it works. Also I have removed password from session... I was trying also to place crypt() function to encrypt password but no luck with that syntax http://www.php.net/manual/en/function.crypt.php. Anyways tnx,
  3. Hi all, I have made so far a login and action what to do... Maybe i'm to tired to see what i have to do.. I have stuck on 3th script where it have to say "Welcome, $Username" Login_Screen.php <html> <head> <style type="text/css"> body { margin: 0; padding: 0; padding-top: 10px; text-align: center; } #centered1 { width: 800px; /* set to desired width in px or percent */ text-align: Center; /* optionally you could use "justified" */ border: 0px; /* Changing this value will add lines around the centered area */ padding-top: 90px; margin: 0 auto; } #centered2 { width: 800px; /* set to desired width in px or percent */ text-align: Center; /* optionally you could use "justified" */ border: 0px; /* Changing this value will add lines around the centered area */ padding-top: 0px; margin: 0 auto; } </style> <title><?php echo "Prijava_Korisnika";?></title> <div id="Centered1"> <?php Setlocale(LC_ALL, 'hr_HR'); $Datum = strftime("%d %B, %Y"); echo "Danas je ",$Datum, " <br> Ulogirajte se kako bi započeli sa radom"; $loc_cro = setlocale(LC_ALL, 'cro_Cro@euro', 'cro_Cro', 'hr', 'cro'); ?> </div> </head> <body> <div id="Centered2"> <h1>Login</h1> <FORM NAME ="LoginPanel" METHOD ="pOST" ACTION = "checklogin.php"> <p><INPUT TYPE = "Text" VALUE ="Korisničko Ime" NAME = "Korisnik"><p> <p><INPUT TYPE = "Password" VALUE ="Lozinka" NAME = "Lozinka"><p> <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Ulaz"> </FORM> <div> </body> </html> checklogin.php <?php // Podaci za login i spajanje na tablicu koja me zanuma ob_start(); $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $Baza="test"; // Database name $tablica="members"; // Table name // Spajanje na server koristeći gornje verijable i odabir baze i tablice mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$Baza")or die("cannot select DB"); // Definiramo Korisnika i njegovu lozinku $Korisnik=$_POST['Korisnik']; $Lozinka=$_POST['Lozinka']; // Zaštita MySQL injection $myusername = stripslashes($Korisnik); $mypassword = stripslashes($Lozinka); $myusername = mysql_real_escape_string($Korisnik); $mypassword = mysql_real_escape_string($Lozinka); // Spajanje na tablicu i potraga za korisničkim imenom i lozonkom $sql="SELECT * FROM $tablica WHERE username='$Korisnik' and password='$Lozinka'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); //Ako pronađe barem jedan rezultat koji odgovara opisu if($count==1){ // registriraj ga i preusmjeri na "login_success.php" session_register("$Korisnik"); session_register("$Lozinka"); header("location:login_success.php"); } else { echo "Krivo Korisničko ime ili lozinka, pokušajte ponovo"; } ob_end_flush(); ?> login_success.php Here i have to add Username of pearson that has logged in.. anbody <html> <body> Dobrodošao, <?php ?> </body> </html> Tnx in advance,
  4. omg i have done the = = and that is why it didn't work all because one space.. lol tnx Alex P.S Also tnx to skwap for som upgrade on code i will check it out
  5. Hi all, New at the forum but i am freak for php but i have this strage problem with code.. I'm sure that it should work but i can't see whats missing part in my if statement. Can't be simpler that this, any idea? <html> <head> <title><?php echo "Form Test";?></title> <?PHP $City = $_POST['City']; if ($City = "New York") { print ("Cool city!"); } else { print ("Write some other city"); } ?> </head> <body> <FORM NAME ="City Searcher" METHOD ="pOST" ACTION = ""> <INPUT TYPE = "Enter city" VALUE ="City" NAME = "City"> <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Search"> </FORM> </body> </html>
×
×
  • 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.