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,