Jump to content
php.lv forumi

nezinu kas par lietu


ziedinjsh

Recommended Posts

es uz to kodu esmu atskatījies un nevaru vienalga saprast kapēc man neievada informāciju datubāzes tabulās!!

 

<?php
error_reporting(E_ALL);
include "fcs/dbase.php";
include "lang/lv.php";

if(isset($_POST['register'])){

$user_name = addslashes($_POST['user_name']);
$user_email = addslashes($_POST['user_email']);
$user_pass = md5($_POST['user_pass']);
$user_date = date('dd.mm.yyyy');

if ($_POST['user_pass'] != $_POST['user_pass2']) {
echo "Paroles nesakriit";
}


$add = "INSERT INTO users (user_name, user_email, user_pass, user_date) VALUES ('$user_name', '$user_email', '$user_pass', '$user_date')";
$result = mysql_query($add);

if($result){
echo "All done!";
}else {
echo "ERROR";
}

}





echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>";
echo "".$lang['reg01']."<input type='text' name='user_name' class=''>";
echo "".$lang['reg02']."<input type='text' name='user_email' class=''>";
echo "".$lang['reg03']."<input type='password' name='user_pass' class=''>";
echo "".$lang['reg04']."<input type='password' name='user_pass2' class=''>";
echo "<input type='submit' name='register' value='".$lang['reg05']."'>";

echo "</form>";
?>

Link to comment
Share on other sites

Ieteiktu novākt to debīlismu ar echo, lai var saprast HTML kodu pa priekšu.

 

<?php
error_reporting(E_ALL);
include "fcs/dbase.php";
include "lang/lv.php";

if(isset($_POST['register'])){

$user_name = mysql_real_escape_string(trim($_POST['user_name']));
$user_email = mysql_real_escape_string($_POST['user_email']);
$user_pass = md5($_POST['user_pass']);
$user_date = date('dd.mm.yyyy');

if ($_POST['user_pass'] != $_POST['user_pass2']) {
       echo "Paroles nesakriit";
       }


$add = "INSERT INTO users (user_name, user_email, user_pass, user_date) VALUES ('$user_name', '$user_email', '$user_pass', '$user_date')";
$result = mysql_query($add) or die(mysql_error());

if($result){
echo "All done!";
}else {
echo "ERROR";
}

}





?>
<form method="post" action="">
<input type="text" name="user_name" />
<input type="text" name="user_emai" />
<input type="password" name="user_pass" />
<input type="password" name="user_pass2" />
<input type="submit" name="register" value="<?php echo $lang['reg05']; ?>" />
</form>

 

Kodu neesmu testējis, rakstīju šeit pat, paprovē šādi!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...