View Single Post
ישן 01-03-10, 22:58   # 7
dor77
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Jan 2008
הודעות: 1,650

dor77 לא מחובר  

זה הקוד:
PHP קוד:
<?php
mysql_connect
("localhost""root""");
mysql_select_db("phpmyadmin"); 
$user_name mysql_real_escape_string(htmlspecialchars($_POST['user_name']));
$password mysql_real_escape_string(htmlspecialchars(md5($_POST['password'])));
$query mysql_query("SELECT * FROM users WHERE user_name='$user_name'"); 
$row=mysql_fetch_array($query);
$row_password=$row['password'];
$row_user_name=$row['user_name'];
$password_cookie=$row['password'];
$user_name_cookie=$row['user_name'];
if (isset(
$_POST['submit']))
{
if (
$row_password==$password && $row_user_name==$user_name)
{
    
setcookie("username"$user_nametime()+60000);
    
setcookie("id"$id_cookietime()+60000);
    echo 
'<meta http-equiv="refresh" content="10;url=index.php" />'
}
  else
{
        echo 
'
    
        <div id="top_menu">
        <span class="menu_class">
        <a href="sign_in.php">Login</a>&nbsp;&nbsp;
        <a href="sign_up.php">Register</a>
        </span>
        </div>
        
        <h1>Login to your account...</h1> 
        
          <div id="register_message"><p class="failed">Login Fail!</p>
        <span class="failed">Please check your deatiles and try again.</span></div> 
        
        <div id="form">
        <form action="" method="POST">
        <table id="registertable" cellpadding="10" border="0">
        <tr>
            <td align="left">
                <span class="field">Username:</span>
            </td>
            <td align="left">
                    <input type="text" name="user_name" id="user_name" dir="ltr" value="" style="width:200px;" maxlength="50">
            </td>
        </tr>
        <tr>
            <td align="left">
                <span class="field">Password:</span>
            </td>
            <td align="left">
                <input type="Password" name="password" id="password" dir="ltr"  value="" style="width:200px;" maxlength="15">
            </td>      
        <tr>
            <td align="right"></td>
            <td align="center">
                <label>&nbsp; </label><input type="submit" name="submit" value="" id="submit" />
            </td> 
        </tr>
        </table>
        </form>
        </div>
    
        <div id="copyrights">
        © All rights reserved.
        </div>
}
        '
;
}

}
else
{
        echo 
'
    
        <div id="top_menu">
        <span class="menu_class">
        <a href="sign_in.php">Login</a>&nbsp;&nbsp;
        <a href="sign_up.php">Register</a>
        </span>
        </div>
        
        <h1>Login to your account...</h1> 
        
        <div id="form">
        <form action="" method="POST">
        <table id="registertable" cellpadding="10" border="0">
        <tr>
            <td align="left">
                <span class="field">Username:</span>
            </td>
            <td align="left">
                    <input type="text" name="user_name" id="user_name" dir="ltr" value="" style="width:200px;" maxlength="50">
            </td>
        </tr>
        <tr>
            <td align="left">
                <span class="field">Password:</span>
            </td>
            <td align="left">
                <input type="Password" name="password" id="password" dir="ltr"  value="" style="width:200px;" maxlength="15">
            </td>      
        <tr>
            <td align="right"></td>
            <td align="center">
                <label>&nbsp; </label><input type="submit" name="submit" value="" id="submit" />
            </td> 
        </tr>
        </table>
        </form>
        </div>
    
        <div id="copyrights">
        © All rights reserved.
        </div>
        '
;
}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Your Private Homepage</title>
    <meta  http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
body {
    background-image:url('background.png');
    background-repeat: repeat-x;
}

#top_menu {
    text-align: right;
    position:relative;
    right:30px;
    top:0px;
}
.menu_class a:link {
    color:gray; 
    font-size:10pt;  
    font-family:Arial; 
     text-decoration: underline;
}
.menu_class a:visited {
         color:gray; 
         font-size:10pt; 
         font-weight:normal;  
         font-family:Arial; 
         text-decoration: underline;
}
a.links {
        display: block;
        padding-top: 24px;
        height: 46px;
        width: 200px;
        color: #484848;
        font-family: Arial, sans-serif;
        font-size:18px;
        font-weight: bold;
        text-decoration: none;
}
a.links:hover {
        display: block;
        padding-top: 24px;
        height: 46px;
        width: 200px;
        color: gray;
        font-family: Arial, sans-serif;
        font-size:18px;
        font-weight: bold;
        text-decoration: none;
}
h1 {
        color:#3366CC; 
        font-size:25pt; 
        font-weight:bold;  
        font-family:Arial; 
        text-align: left;
        margin-top: 60px;
        margin-right: 0px;
        margin-bottom: 0px;
        margin-left: 100px;
        border: 0px solid #000000;
}
#form {
     position:relative;
     left:87px;
     top:40px;
        width:500px;
}
span.field {
        text-align:left;
        direction:ltr;
        color:#505050; 
        font-size:12pt;
        font-weight:bold;  
        font-family:Arial;
}
p.failed {
        text-align:left;
        direction:ltr;
        color:red; 
        font-size:15pt;
        font-weight:bold;  
        font-family:Arial;
}
span.succed {
    text-align:left;
 direction:ltr;
 color:green; 
 font-size:12pt;
 font-weight:normal;  
 font-family:Arial;
}
p.succed {
 text-align:left;
 direction:ltr;
 color:green; 
 font-size:15pt;
 font-weight:bold;  
 font-family:Arial;
}
span.errors {
        text-align:left;
        direction:ltr;
        color:red; 
        font-size:10pt;
        font-weight:normal;  
        font-family:Arial;
}
span.failed {
        text-align:left;
        direction:ltr;
        color:red; 
        font-size:10pt;
        font-weight:bold;  
        font-family:Arial;
}
#register_message {
        position:relative;
        left:100px;
        top:17px;
        width:450px;
        border: 0px solid #000000;
}
table#registertable  { 
        border: 0px solid #000000;
        border-right: 0px solid #000000;
}
#copyrights {
    clear:both;
    padding:80px 0px 15px;
    text-align:center;
    color:gray; 
    font-size:10pt;  
    font-family:Arial; 
}
.button {
        border: 1px solid #505050;
        background: #f5f5f5;
        cursor:pointer;
        width: 100px;
        padding-left:5px;
        padding-right:5px;
        padding-bottom:5px;
        padding-top:5px;
        text-align: center;
        text-align:center;
        color:#505050; 
        font-size:12pt;
        font-weight:bold;  
        font-family:Arial;
}
label {
        display: block;
        width: 180px;
        float: left;
        margin: 2px 4px 6px 4px;
        text-align: left;
}
#submit {
        color: #fff;
        font-size: 0;
        width: 68px;
        height: 28px;
        border: none;
        background: #ffffff url(signin_btn.bmp) 0 0 no-repeat;
        cursor:pointer;
}
}
</style>
</head>
</html>
בול מה שיש בקובץ.

בקשר לקידוד, איך שומרים קידוד כזה?
__________________
מתכנת php אמין ומקצועי.
מחירים נוחים!
יצירת קשר: 0544378743
  Reply With Quote