Jump to content
php.lv forumi
Sign in to follow this  
ziedinjsh

nezinu kas par lietu

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>";
?>

Share this post


Link to post
Share on other sites
mysql_query( ... ) or exit( mysql_error() );

Share this post


Link to post
Share on other sites

$result = mysql_query($add) or exit(mysql_error());
action='".$_SERVER['REQUEST_URI']."'

Un tad paskaties, ko Tev izmet..

 

btw, baigi neforšs un "neloģisks" skripts :\

Edited by ezis

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

$user_date = date('dd.mm.yyyy'); Kas tas tāds pa draņķi? Izlasi par funkciju date() vismaz!

Un vēl, kurš pipuks html tomēr ir starā par nenoslēgtiem tagiem?

Edited by mounkuls

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...