
bylletski
Members-
Posts
15 -
Joined
-
Last visited
Everything posted by bylletski
-
How to use sticky forms for MD5 passwords?
bylletski replied to bylletski's topic in PHP Coding Help
My english is not so good. -
How to use sticky forms for MD5 passwords?
bylletski replied to bylletski's topic in PHP Coding Help
You want me to use mysql_real_escape_string in the query code? -
You can always use a time function i think?
-
How to use sticky forms for MD5 passwords?
bylletski replied to bylletski's topic in PHP Coding Help
Okey i give a shit about the sticky for the passwords but i can't still get the messages from if (!$pass1) { $errors[] = "You forgot to fill the first password field."; } if (!$pass2) { $errors[] = "You forgot to fill the second password field"; } Because i use MD5 and the gender thing didn't work please help me now. -
How to use sticky forms for MD5 passwords?
bylletski replied to bylletski's topic in PHP Coding Help
I didn't get any answer from my post in first section on this thread. Is there any possible too use sticky forms for MD5 passwords? And i wonder the same of the gender thing too. <select name="regender" ' . (isset($_POST['regender']) ? 'selected="selected"':'') .'> <option>Man</option><option>Woman</option></select> I tried that but didn't work. -
How to use sticky forms for MD5 passwords?
bylletski replied to bylletski's topic in PHP Coding Help
So you mean is wrong to use MD5 passwords? You want me to use hasch insteed? -
Hello i wonder how to use sticky forms for password with MD5? If you don't know what sticky forms is i will explain. Explain. You have a page and your user will register on it. Then the user write wrong in username the username already exists and everything he have wrote stays. I got this problem when i don't use MD5 for passwords it stays but when i use it don't stay there. And there is one more problem I don't get the error messages from $pass1 and $pass2 what would be You forgot to fill the first password field and You forgot to fill the second password field. Would be great if you have a answer for me. <?php include 'db.php'; if(isset($_POST['regbutton'])) { $regfname = ""; $reglname = ""; $regage = ""; $regpass1 = ""; $regpass2 = ""; $regender = ""; $regemail1 = ""; $regemail2 = ""; $regcheckbox = ""; $regpage = ""; $regaccess = "1"; $regdate = date("Y/m/d"); function protect($string){ $string = mysql_real_escape_string($string); $string = strip_tags($string); $string = addslashes($string); return $string; } function protectx($stringx){ $stringx = mysql_real_escape_string($stringx); $stringx = strip_tags($stringx); $stringx = addslashes($stringx); $stringx = md5($stringx); return $stringx; } $regfname = protect($_POST['regfname']); $reglname = protect ($_POST['reglname']); $regnickname = protect ($_POST['regnickname']); $regage = protect ($_POST['regage']); $pass1 = protectx ($_POST['pass1']); $pass2 = protectx ($_POST['pass2']); $regender = protect ($_POST['regender']); $regemail1 = protect ($_POST['regemail1']); $regemail2 = protect($_POST['regemail2']); $regpage = protect ($_POST['regpage']); $regcheckbox = ($_POST['regcheckbox']); $regip = $_SERVER['REMOTE_ADDR']; $errors = array(); if($pass1 != $pass2) { $errors[] = "Passwords don't match."; } if($regemail1 != $regemail2) { $errors[] = "E-Mails don't match"; } if ($regnickname){ $sql = "SELECT * FROM `accounts` WHERE `nickname`='".$regnickname."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) > 0){ $errors[] = "Nickname already exist."; } } if ($regemail1){ $sql = "SELECT * FROM `accounts` WHERE `email`='".$regemail1."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) > 0){ $errors[] = "E-Mail already exist."; } } if ($regemail1) { $checkregemail1 = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i"; if(!preg_match($checkregemail1, $regemail1)){ $errors[] = "The E-Mail need to be name@example.com"; } } if (!$regcheckbox) { $errors[] = "You forgot to mark the checkbox"; } if (!$regfname) { $errors[] = "You forgot to fill the Firstname field."; } if (!$reglname) { $errors[] = "You forgot to fill the Lastname field."; } if (!$regnickname) { $errors[] = "You forgot to fill the Nickname field."; } if (!$regage) { $errors[] = "You forgot to fill the Age field."; } if (!$pass1) { $errors[] = "You forgot to fill the first password field."; } if (!$pass2) { $errors[] = "You forgot to fill the second password field"; } if (!$regemail1) { $errors[] = "You forgot to fill the first E-Mail field."; } if (!$regemail2) { $errors[] = "You forgot to fill the second E-Mail field"; } if ($regage < 18){ $error[] = "You forgot to fill the Age field"; } if(count($errors) > 0){ foreach($errors AS $error) echo $error . "<br>\n"; } else { mysql_query("INSERT INTO accounts (firstname, lastname, nickname, age, password, gender, email, access, ip, page, date) values ('$regfname', '$reglname', '$regnickname', '$regage', '$pass1', '$regender', '$regemail1', '$regaccess', '$regip', '$regpage', '$regdate')"); echo "Congratulations the user "; echo $regnickname ; echo " has been created and you can "; echo '<a href="?p=login">login here.</a>'; } } echo ' <html><body> <center><h3>Register</h3> <form method="post" action="?p=register"> Firstname <br><input type="text" maxlength="20" name="regfname" value="' . $regfname . '"> <br><br>Lastname <br><input type="text" maxlength="20" name="reglname" value="' . $reglname . '"> <br><br>Nickname (Max 30 characters) <br><input type="text" maxlength="30" name="regnickname" value="' . $regnickname . '"> <br><br>How old are you? <br><input type="text" maxlength="3" name="regage" value="' . $regage . '"> <br><br>Password (Max 15 characters) <br><input type="password" maxlength="15" name="pass1"> <br><br>Password again (Max 15 characters) <br><input type="password" maxlength="15" name="pass2"> <br><br>Man or Woman?<br> <select name="regender" value="' . $regender . '"> <option>Man</option><option>Woman</option></select> <br><br>Email <br><input type="text" name="regemail1" value="' . $regemail1 . '"> <br><br>Email again <br><input type="text" name="regemail2" value="' . $regemail2 . '"> <br><br>Do you got a homepage? Maybe facebook?<br> <input type="text" name="regpage" value="' . $regpage . '"><br><br> I have read the <a href="?p=rules">RULES </a>and I agree them. <input type="checkbox" name="regcheckbox" ' . (isset($_POST['regcheckbox']) ? 'checked="checked"':'') .'><br><br> <input type="submit" name="regbutton" value="Register"> </form> </center> </html></body>'; ?>
-
My register script why can't i use else there?
bylletski replied to bylletski's topic in PHP Coding Help
Thank you very much! -
Get error: Parse error: syntax error, unexpected T_ELSE in C:\wamp\www\cursetube\scripts\user\register.php on line 130 <?php include 'db.php'; $regfname = ""; $reglname = ""; $regage = ""; $regpass1 = ""; $regpass2 = ""; $regender = ""; $regemail1 = ""; $regemail2 = ""; $regcheckbox = ""; $regpage = ""; $regaccess = "1"; $regdate = date("Y/m/d"); if(isset($_POST['regbutton'])) { $regfname = mysql_real_escape_string ($_POST['regfname']); $reglname = mysql_real_escape_string ($_POST['reglname']); $regnickname = mysql_real_escape_string ($_POST['regnickname']); $regage = mysql_real_escape_string ($_POST['regage']); $pass1 = md5 ($_POST['pass1']); $pass2 = md5 ($_POST['pass2']); $regender = mysql_real_escape_string ($_POST['regender']); $regemail1 = mysql_real_escape_string ($_POST['regemail1']); $regemail2 = ($_POST['regemail2']); $regpage = mysql_real_escape_string ($_POST['regpage']); $regcheck = mysql_real_escape_string ($_POST['regcheck']); $regip = $_SERVER['REMOTE_ADDR']; $errors = array(); $errors[0] = "Passwords don't match"; $errors[1] = "E-Mails don't match"; $errors[2] = "You age is under 18."; $errors[3] = "Nickname already exist."; $errors[4] = "Email already exist."; $errors[5] = "Email most be name@exampel.com"; $errors[6] = "You forgot to mark the checkbox."; $errors[7] = "You forgot to fill the textfield for Firstname."; $errors[8] = "You forgot to fill the textfield for Lastname."; $errors[9] = "You forgot to fill the textfield for Nickname."; $errors[10] = "You forgot to fill the textfield for Age."; $errors[11] = "You forgot to fill the textfield for the first password section."; $errors[12] = "You forgot to fill the textfield for the second password section."; $errors[13] = "You forgot to fill the textfield for the first E-mail section."; $errors[14] = "You forgot to fill the textfield for the second E-mail section."; if($pass1 != $pass2) { $errors[] = "Passwords don't match."; } if($regemail1 != $regemail2) { $errors[] = "E-Mails don't match"; } if ($regnickname){ $sql = "SELECT * FROM `accounts` WHERE `nickname`='".$regnickname."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) > 0){ $errors[] = "Nickname already exist."; } } if ($regemail1){ $sql = "SELECT * FROM `accounts` WHERE `email`='".$regemail1."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) > 0){ $errors[] = "E-Mail already exist."; } } if ($regemail1) { $checkregemail1 = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i"; if(!preg_match($checkregemail1, $regemail1)){ $errors[] = "The E-Mail need to be name@example.com"; } } if (!$regcheck) { $errors[] = "You forgot to mark the checkbox"; } if (!$regfname) { $errors[] = "You forgot to fill the Firstname field."; } if (!$reglname) { $errors[] = "You forgot to fill the Lastname field."; } if (!$regnickname) { $errors[] = "You forgot to fill the Nickname field."; } if (!$regage) { $errors[] = "You forgot to fill the Age field."; } if (!$pass1) { $errors[] = "You forgot to fill the first password field."; } if (!$pass2) { $errors[] = "You forgot to fill the second password field"; } if (!$regemail1) { $errors[] = "You forgot to fill the first E-Mail field."; } if (!$regemail2) { $errors[] = "You forgot to fill the second E-Mail field"; } if ($regage < 18){ $error[] = "You forgot to fill the Age field"; } } if(count($errors) > 0){ foreach($errors AS $error){ echo $error . "<br>\n"; } else { mysql_query("INSERT INTO accounts (firstname, lastname, nickname, age, password, gender, email, access, ip, page, date) values ('$regfname', '$reglname', '$regnickname', '$regage', '$pass1', '$regender', '$regemail1', '$regaccess', '$regip', '$regpage', '$regdate')"); } } echo ' <html><body> <center><h3>Register</h3> <form method="post" action="?p=register"> Firstname <br><input type="text" maxlength="20" name="regfname" value="' . $regfname . '"> <br><br>Lastname <br><input type="text" maxlength="20" name="reglname" value="' . $reglname . '"> <br><br>Nickname (Max 30 characters) <br><input type="text" maxlength="30" name="regnickname" value="' . $regnickname . '"> <br><br>How old are you? <br><input type="text" maxlength="3" name="regage" value="' . $regage . '"> <br><br>Password (Max 15 characters) <br><input type="password" maxlength="15" name="pass1"> <br><br>Password again (Max 15 characters) <br><input type="password" maxlength="15" name="pass2"> <br><br>Man or Woman?<br> <select name="regender" value="' . $regender . '"> <option>Man</option><option>Woman</option></select> <br><br>Email <br><input type="text" name="regemail1" value="' . $regemail1 . '"> <br><br>Email again <br><input type="text" name="regemail2" value="' . $regemail2 . '"> <br><br>Do you got a homepage? Maybe facebook?<br> <input type="text" name="regpage" value="' . $regpage . '"><br><br> I have read the <a href="?p=rules">RULES </a>and I agree them. <input type="checkbox" name="regcheck"><br><br> <input type="submit" name="regbutton" value="Register"> </form> </center> </html></body> '; ?>
-
Yeah why not! But is there a more a simple without using database?
-
Hello i created a code today who works very good. But there is 1 one problem i can't figure out. I want all the comments to stay on the site. Like this if i comment Hey and then hello i want Hey and Hello stay one the screen. But when i comment now It's be like this. I first comment Hey and It's stay one the screen. Then I comment Hello that will make Hey disappear and Hello stays on the screen. I want them both to stay on the screen. <?php error_reporting(E_ALL ^ E_NOTICE); echo "Comments<br><br><br>"; $name = $_POST['name']; $comment = $_POST['comment']; if(isset($_POST['button'])) { echo "Comment by<br>"; echo 'Name: ' . $name = $_POST['name']; echo '<br>'; echo 'Comment: ' . $comment = $_POST['comment']; echo '<br>'; } ?> <form method="post" action="new.php"> Name: <br><input type="text" name="name"><br><br> Comment:<br> <input type="text" name="comment" size="60" height="100"> <input type="submit" name="button" value="Comment"> </form>
-
Trying to make a math thing with variabels
bylletski replied to bylletski's topic in PHP Coding Help
Never mind i figure it out. <?php $one = $_POST['one']; $two = $_POST['two']; if(isset($_POST['button'])) { echo $one + $two; } ?> <form method="post" action="new.php"> <input type="text" name="one">+ <input type="text" name="two"> <input type="submit" name="button"> </form> -
Hello i want to $one + $two and then get the answer but i have stuck right now. <?php $one = $_POST['one']; $two = $_POST['two']; if(isset($_POST['button'])) { if ($one + $two) { echo ; } } ?> <form method="post" action="new.php"> <input type="text" name="one">+ <input type="text" name="two"> <input type="submit" name="button"> </form>
-
Nevermind i figure it out. Before ($theanswer = $answer) Now ($theanswer == $answer)
-
Hello I'm new in this forum but i hope you understand what I trying to do. <?php $theanswer = 4; $answer = $_POST['answer']; if(isset($_POST['button'])){ if ($theanswer = $answer){ echo "Right the answer is 4<br>"; } else { echo "Wrong try again!"; } } ?> 2 + 2 is? <form method="post" action="new.php"> <input type="text" name="answer"> <input type="submit" name="button"> </form> The code don't work and I get an notice too. Notice: Undefined index: answer in C:\wamp\www\ss\new.php on line 4 I think you understand what i want but i will explain if you don't. If they write 4 in the textfield the echo will say Right the answer is 4. But if they write anything else it will say wrong try again! Now i wonder what have i do wrong?