Location: PHPKode > projects > Einkaufszettelgenerator > EZettel0.1/user_to_db.php
<?
session_start();
?>
<HTML>

<LINK REL="stylesheet" TYPE="text/css" HREF="menu.css">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Menu - to db</title>

</head>
<body class="body1">
<?
include("menu.ini");
$strsql_t = "select * from users  where user_name='$_POST[user_name]' and user_pass='$_POST[user_pass]';";
$result_t = mysql_query($strsql_t, $connection);
$num_rows = mysql_num_rows($result_t);
// echo "strsql= $strsql_t <br>result =$result_t <br>";
//echo "count=$num_rows<br>";
if ($num_rows!=0)
{
session_register('uid');
$j=0;
while ( $row = mysql_fetch_row($result_t) )
       {
        $j+=1;
       $uid=$row[0]; 
        }
echo "uid=$uid<br>";
?>

<P>Такой пользователь уже существует

<P><P>
<TABLE BORDER=1 align=center class=prod cellspacing="2">
<form  name=user_input Method=post action=user_to_db.php> 
<TR ><TD class=table>Name:</TD><TD><input type=text name=user_name size=10 class="field"></TD></TR> 

<TR><TD class="table">Password:</TD><TD><input type=pass size=10  name=user_pass class="field" id="p">

<TR><TD COLSPAN=2><INPUT type=submit value=Input name=Submit></TD></TR></TABLE>
</FORM> 
<?
}
 else
{
 $strsql = "insert into users (user_name, user_pass) VALUES ('$_POST[user_name]','$_POST[user_pass]');";

 $result = mysql_query($strsql);  

//echo "strsql=$strsql <br>";

echo "Пользователь $_POST[user_name] добавлен"; 
       }
?>

<center><A HREF=login.php>Вход</a></center> 
Return current item: Einkaufszettelgenerator