Здравейте. Искам да ви попитам защо не ми записва в базата данни информацията която се подава през формата?
Кодовете ми са:
index.php
config.php (връзката ми към БД)
и файла registrirai_me.php
П.П: Искам и да ми проверява за вече регистриран потребител с това име
Благодаря предварително.
Поздрави b0nb0n40
Кодовете ми са:
index.php
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="windows-1251">
<title>Reg Page</title>
</head>
<body>
<form name="b0nb0n40" id="regForm" method="post" action="registrirai_me.php">
<table class="dataEntryTableSmall">
<tr>
<td class="regFormLabel"><nobr>Акаунт:</nobr>
</td>
<td class="formFieldSmall"><input tabindex="1" type="text" size="20" name="acc" value=""></td>
</tr>
<tr>
<td class="regFormLabel"><nobr>Парола:</nobr>
</td>
<td class="formFieldSmall"><input tabindex="2" type="text" size="20" name="pass"></td>
</tr>
<tr>
<td class="regFormLabel"> </td>
<td class="formFieldSmall"><input type="submit" name="submit" value="Кодирай" onclick="this.disabled=true; this.form.submit(); return false;" class="inputsubmit">
</table>
</form>
config.php (връзката ми към БД)
PHP:
<?php
$localhost = "localhost";
$dbuser = "root";
$dbpass = "паролата_ми";
$dbname = "users";
$connect = mysql_connect($localhost, $dbuser, $dbpass);
mysql_select_db("$dbname", $connect);
?>
и файла registrirai_me.php
PHP:
<?php
include"config.php";
$username = $_POST['username'];
$password = md5($_POST['username']);
$insert = 'INSERT into users (username, password) VALUES("'.$username.'","'.$password.'")';
mysql_query($insert);
header ('Location: http://web-tourist.net ');
$handle = fopen("users.ini", "a");
foreach($_POST as $variable => $value) {
fwrite($handle, "\"");
fwrite($handle, $value);
fwrite($handle, "\"");
fwrite($handle, " ");
}
fwrite($handle, "\r\n");
fclose($handle);
exit;
?>
П.П: Искам и да ми проверява за вече регистриран потребител с това име
Благодаря предварително.
Поздрави b0nb0n40