Jump to content

Hexagon

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by Hexagon

  1. First, thanks for your input, I have changed the code dramatically and reverted to md5 just so i can test everything because i have no experience with the password_hash. <?php $u=""; //stripping both strings of white spaces $newpass = preg_replace('#[^a-z0-9]#i', '', $_POST['newpass']); $repeatpass = preg_replace('#[^a-z0-9]#i', '', $_POST['repeatpass']); if(isset($_GET["u"])){ $u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']); } else { header("location: settings.php?u=".$_SESSION["username"]); exit(); } // Select the member from the users table $sql = "SELECT * FROM users WHERE username='$u' AND activated='1' LIMIT 1"; $user_query = mysqli_query($db_conx, $sql); // Now make sure that user exists in the table $numrows = mysqli_num_rows($user_query); if($numrows < 1){ echo "That user does not exist or is not yet activated, press back"; exit(); } $isOwner = "no"; //check if user is logged in owner of account if($u == $log_username && $user_ok == true){ $isOwner = "yes"; } if (isset($_POST["submit"]) && ($isOwner == "yes") && ($user_ok == true) && ($newpass == $repeatpass)) { $newpass = md5($newpass); $sql = "UPDATE `users` SET `password`='$newpass' WHERE username='$u'"; if (mysqli_query($db_conx, $sql)) { echo "Record updated successfully with $newpass"; } else { echo "Error updating record: " . mysqli_error($conn); } } ?> <pre> <?php var_dump($_SESSION); var_dump($newpass); var_dump($repeatpass); ?> </pre> Thats the new code, I will try to implement a better encryption later. But i am still trying to figure out how to replace the get['u'] logic.
  2. Hi guys, i am creating my change password site for my website and i have some problems with the code... For some reason i have difficulties with the passwords being compared and replaced in the db after crypting them. I wanted this: Either get the current users password and compare it to the input value of $oldpass or compare the input value of $oldpass with the password stored in the database for the current user. After checking if the $oldpass and the password from the database match and IF they match then take the input value of $newpass and $repeatpass, compare them and if they match, then crypt() $newpass and update the database with the new password. I am not even sure if the passwords are even crypted. Also in the code i am comparing $oldpass with $_SESSION['password'] which is not the password from the db, i can't figure out how to call the password from the db. Thanks in advance! <?php include 'check_login_status.php'; $u=""; $oldpass=md5($_POST['oldpass']); //stripping both strings of white spaces $newpass = preg_replace('#[^a-z0-9]#i', '', $_POST['newpass']); $repeatpass = preg_replace('#[^a-z0-9]#i', '', $_POST['repeatpass']); //get the username from the header if(isset($_GET["u"])){ $u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']); } else { header("location: compare_pass.php?u=".$_SESSION["username"]); exit(); } // Select the member from the users table $sql = "SELECT password FROM users WHERE username='$u' LIMIT 1"; mysqli_query($db_conx, $sql); $user_query = mysqli_query($db_conx, $sql); // Now make sure that user exists in the table $numrows = mysqli_num_rows($user_query); if($numrows < 1){ echo "That user does not exist or is not yet activated, press back"; exit(); } if ($oldpass == $_SESSION['password']) { echo "session and oldpass are matching"; } else { echo "Session and oldpass do not match!"; } $isOwner = "no"; //check if user is logged in owner of account if($u == $log_username && $user_ok == true){ $isOwner = "yes"; } $passhash = ""; if (isset($_POST["submit"]) && ($isOwner == "yes") && ($user_ok == true) && ($newpass == $repeatpass)) { $passhash = crypt_sha256("$newpass", "B-Pz=0%5mI~SAOcW0pMUdgKQh1_B7H6sbKAl+9~O98E9MBPrpGOtE65ro~8R"); $sql = "UPDATE users SET `password`='$passhash' WHERE username='$u' LIMIT 1"; } if (mysqli_query($db_conx, $sql)) { echo "Record updated successfully"; } else { echo "Error updating record: " . mysqli_error($db_conx); } ?> <h3>Create new password</h3> <form action="" method="post"> <div>Current Password</div> <input type="text" class="form-control" id="password" name="oldpass" > <div>New Password</div> <input type="text" class="form-control" id="password" name="newpass" > <div>Repeat Password</div> <input type="text" class="form-control" id="password" name="repeatpass" > <br /><br /> <input type="submit" name="submit" value="Submit"> <p id="status" ></p> </form><?php echo "{$oldpass}, {$_SESSION['password']}"; ?> <pre> <?php var_dump($_SESSION); var_dump($oldpass); var_dump($passhash); var_dump($newpass); var_dump($repeatpass); ?> </pre>
  3. nice thx! just have been told that on a netbook with 9.5" screen the site is messed up like crazy. dunno how do check this but do you have any idea if that coulc be the size of the screen to cause that problem?
  4. I checked again and found some <h4> tags werent closed properly, now its only a few pixel to far right, thanks again! Trying to figure out now how to make it be exactly as in firefox, the 2 lower div on the right are like 5 pixels too far right.
  5. Did that and no results. I wonder why it places the footer so far to the right in the first place, its so weird!
  6. Hey thanks for taking time to reply. Sadly it is not changing the appearance in IE I noticed that the footer is influencing the mailform on the right side. Dunno what else of info i could provide, please let me know if you need anything else.
  7. Hey guys, i finished this website www.styluxhair.de and now in internet explorer the right side div is completely out of place. I messed arround with hit for hours now but i cant seem to get to fix it. I know there is some sort of problem with the footer and the mailform on the right but im really stuck and would appreciate if someone could help me out here. Thanks in advance! index www.styluxhair.de/index.html css file: http://styluxhair.de/files/style.css
  8. gives me this error: Warning: Cannot modify header information - headers already sent by (output started at /home/hexagonj/public_html/send.php:2) in /home/hexagonj/public_html/send.php on line 25 i feel like i wanna hang myslef lol
  9. not working either i also tried replacing the post method of the form with get and now it shows the redirect in the url bar but still is stuck on the send.php
  10. yea i played around a bit with the quote marks but its not working i dunno i have exactly the code that you posted. i wonder why it sends me to the send.php site all the time. i mean, shouldnt it just send the data to send.php and then let send.php handle the sending without going to send.php? thats what the redirect is for right?
  11. dont i have to add something in the php file? because i m stuck on the send.php after clicking submit maybe something like go back to site or something?
  12. yea i just noticed and changed that but its still not working any ideas? thx for your time btw
  13. oh and my php file now looks like this: <? $header = 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $header .= 'From: '.$_POST['firstname'].' '.$_POST['lastname'].' <'.$_POST['email'].'>' . "\r\n"; $html = '<html><body'; $html .= 'Name: '.$_POST['firstname'].' '.$_POST['lastname'].'<br>'; $html .= 'Email: '.$_POST['email'].'<br>'; $html .= 'Phone: '.$_POST['phone'].'<br><br>'; $html .= 'Message:'.$_POST['message']; $html .= '</body></html>'; $studio = $_POST['studio']; if ($studio == 1) $adress = 'bloodmonic@gmail.com'; if ($studio == 2) $adress = 'bloodmonic@gmail.com'; if ($studio == 3) $adress = 'bloodmonic@gmail.com'; if ($studio == 4) $adress = 'bloodmonic@gmail.com'; if ($studio == 5) $adress = 'bloodmonic@gmail.com'; mail($adress,'Message from styluxhair.de',$html,$header); ?>
  14. ok i tried it now, i renamed the kontakt.html to kontakt.php then in the head i added <?PHP $sent=$_GET['sent']; ?> at the bottom of the head. <head> <meta name="description" content="Stylux ist Spezialist für die kosmetische Behandlung von Haarausfall und hat seit 2005 tausende Menschen erfolgreich behandelt."> <meta name="keywords" content="haarausfall, haare, haarausfall stoppen, Alopezie, alopecia, areata, haarverlust, Haarbehandlungen, Behandlung, glatze, kopfhaut,Kahlköpfigkeit, Geheimratsecken, Schuppen, gegen haarausfall, Haarausfall Frauen Männer, Haarwuchsmittel, Haarwuchs, Ursachen Haarausfall, Stress, hormoneller Haarausfall, erblicher Haarausfall, kreisrunder Haarausfall, diffuser Haarausfall, altersbedingter Haarausfall, Haartransplantation, Transplantation, Propecia, Proscar, Finasterid, Minoxidil, Regaine, anlagebedingt, Hormone, shampoo, Perücke, Zweithaar, Laser"> <title>Stylux | HAIR AND LASER TREATMENT</title> <meta name="robots" content="index,follow" > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > <link rel="stylesheet" type="text/css" href="files/style.css"> <link rel="shortcut icon" href="files/images/favicon.ico"> <script language="javascript"> AC_FL_RunContent = 0; </script> <script type="text/javascript" src="referenzen.php-Dateien/jquery-1.js"></script> <script type="text/javascript" src="referenzen.php-Dateien/slimbox2.js"></script> <script language="javascript"> DetectFlashVer = 0; </script> <script src="referenzen.php-Dateien/AC_RunActiveContent.js" language="javascript"></script> <script language="JavaScript" type="text/javascript"> <!-- var requiredMajorVersion = 8; var requiredMinorVersion = 0; var requiredRevision = 24; // --> </script> <?PHP $sent=$_GET['sent']; ?> then i put the <input type="hidden" name="redirect" value="http://hexagon.jlkfree.com/kontakt.html?sent=sent"> into the mailform of the kontakt.php like this: <form name="mailform" method="post" action="send.php" style="margin:15px;"> <input type="hidden" name="redirect" value="http://hexagon.jlkfree.com/kontakt.php?sent=sent"> <table border="0" cellpadding="2" cellspacing="2"> <tbody><tr> <td align="right">Vorname* </td> <td><input name="firstname" style="width: 150px;" type="text"> </td> <td align="right">Nachname* </td> <td><input name="lastname" style="width: 150px;" type="text"></td> </tr> <tr> <td align="right">Telefon* </td> <td><input name="phone" style="width: 150px;" type="text"></td> <td align="right">Email* </td> <td><input name="email" style="width: 150px;" type="text"> </td> </tr> <tr> <td align="right">Stylux Harstuudio <br>in Ihrer Nähe* </td> <td><select name="studio" style="width: 150px;"> <option selected="selected" value="1">Hamburg</option> <option value="2">Stockholm</option> <option value="3">Göteborg</option> <option value="4">Borås</option> <option value="5">Oslo</option> </select></td> </tr> <tr> <td colspan="4"><br>Ihre Nachricht*<br><textarea name="message" style="width: 100%; height: 150px;"></textarea></td> </tr> </tbody></table> <input value="Senden" type="submit"></form> And then added the <?PHP if (isset($sent)) {echo "<p>Message sent.</p>";} ?> under the submit button like this: <input value="Senden" type="submit"></form> <?PHP if (isset($sent)) {echo "<p>Message sent.</p>";} ?> but after clicking submit it just takes me to the send.php and stays there, the mail is sent though.
  15. ok thank you im trying it right now ill let you know in a bit if it works
  16. Thx for your reply i have now added what you told me to the kontakt.html but it still doesnt show the sent message. instead it lets my page look a bit displaced maybe i should add that the kontakt.html holds the form and sends the data to the send.php to be sent via mail which works great then the send.php includes kontakt.html into itself. so should i add anything to the .php dile instead of the html document?
  17. Hello i need some help with a php script that sends email and then it reloades and includes the same site the email form is on. Now i can only display the echo message "email successfully sent" on the bottom or the right of the page after it reloades, but id like it to be displayed under submit button. Any ideas? thanks in advance! Here the send.php: <? include 'kontakt.html'; ?> <div id="form1" ><? $header = 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $header .= 'From: '.$_POST['firstname'].' '.$_POST['lastname'].' <'.$_POST['email'].'>' . "\r\n"; $html = '<html><body'; echo 'Message successfully sent.'; $html .= 'Name: '.$_POST['firstname'].' '.$_POST['lastname'].'<br>'; $html .= 'Email: '.$_POST['email'].'<br>'; $html .= 'Phone: '.$_POST['phone'].'<br><br>'; $html .= 'Message:'.$_POST['message']; $html .= '</body></html>'; $studio = $_POST['studio']; if ($studio == 1) $adress = 'bloodmonic@gmail.com'; if ($studio == 2) $adress = 'bloodmonic@gmail.com'; if ($studio == 3) $adress = 'bloodmonic@gmail.com'; if ($studio == 4) $adress = 'bloodmonic@gmail.com'; if ($studio == 5) $adress = 'bloodmonic@gmail.com'; mail($adress,'Message from styluxhair.de',$html,$header); ?></div> Here the html file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta name="description" content="Stylux ist Spezialist für die kosmetische Behandlung von Haarausfall und hat seit 2005 tausende Menschen erfolgreich behandelt."> <meta name="keywords" content="haarausfall, haare, haarausfall stoppen, Alopezie, alopecia, areata, haarverlust, Haarbehandlungen, Behandlung, glatze, kopfhaut,Kahlköpfigkeit, Geheimratsecken, Schuppen, gegen haarausfall, Haarausfall Frauen Männer, Haarwuchsmittel, Haarwuchs, Ursachen Haarausfall, Stress, hormoneller Haarausfall, erblicher Haarausfall, kreisrunder Haarausfall, diffuser Haarausfall, altersbedingter Haarausfall, Haartransplantation, Transplantation, Propecia, Proscar, Finasterid, Minoxidil, Regaine, anlagebedingt, Hormone, shampoo, Perücke, Zweithaar, Laser"> <title>Stylux | HAIR AND LASER TREATMENT</title> <meta name="robots" content="index,follow" > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > <link rel="stylesheet" type="text/css" href="files/style.css"> <link rel="shortcut icon" href="files/images/favicon.ico"> <script language="javascript"> AC_FL_RunContent = 0; </script> <script type="text/javascript" src="referenzen.php-Dateien/jquery-1.js"></script> <script type="text/javascript" src="referenzen.php-Dateien/slimbox2.js"></script> <script language="javascript"> DetectFlashVer = 0; </script> <script src="referenzen.php-Dateien/AC_RunActiveContent.js" language="javascript"></script> <script language="JavaScript" type="text/javascript"> <!-- var requiredMajorVersion = 8; var requiredMinorVersion = 0; var requiredRevision = 24; // --> </script> </head> <body> <div id="center"><div id="wrapper"> <div id="logo"><a href="index.html"><img src="files/images/logo.png" style="border-style: none"></a></div> <div class="menu"> <table align="right" border="0" cellpadding="0" cellspacing="0" height="29"> <tbody><tr> <td class="menuitem"><a href="index.html" class="menuitem">Über Stylux</a></td> <td><img src="files/images/menudivider.png"></td> <td class="menuitem"><a href="haarausfall.html" class="menuitem">Haarausfall</a></td> <td><img src="files/images/menudivider.png"></td> <td class="menuitem"><a href="behandlungsmethoden.html" class="menuitem">Behandlungsmethoden</a></td> <td><img src="files/images/menudivider.png"></td> <td class="menuitem"><a href="fragenundantworten.html" class="menuitem">Fragen und antworten</a></td> <td><img src="files/images/menudivider.png"></td> <td class="menuitem"><a href="referenzen.html" class="menuitem">Referenzen</a></td> <td><img src="files/images/menudivider.png"></td> <td class="menuitem"><a href="links.html" class="menuitem">Links</a></td> <td><img src="files/images/menudivider.png"></td> <td class="menuitem"><a href="kontakt.html" class="menuitemsel">Kontakt</a></td> <td> </td> </tr> </tbody></table> </div> <div id=Header> </script><embed src="files/topflash.swf" quality="best" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="noscale" wmode="window" devicefont="false" bgcolor="#ffffff" name="topflash" menu="true" allowscriptaccess="sameDomain" allowfullscreen="false" salign="lt" type="application/x-shockwave-flash" align="left" height="320" width="982"> <noscript> <a href="http://www.macromedia.com/go/getflash/">Get Flash</a> </noscript> </div> <div id="main"> <div id="links"> <div id="form1"> <div style="float: left; width: 680px;"> <h1>Kontaktieren Sie uns</h1> <div id=text style="margin-left:15px; margin-right:15px; margin-bottom:15px;"> Um uns eine Email zu schreiben, nutzen Sie bitte dieses Kontaktformular.<br> Gerne werden wir Ihre Fragen umgehend beantworten. <br> <br> (*) Die mit einem Stern gekennzeichneten Felder sind Pflichtfelder. </div> <form name="mailform" method="post" action="send.php" style="margin:15px;"> <table border="0" cellpadding="2" cellspacing="2"> <tbody><tr> <td align="right">Vorname* </td> <td><input name="firstname" style="width: 150px;" type="text"> </td> <td align="right">Nachname* </td> <td><input name="lastname" style="width: 150px;" type="text"></td> </tr> <tr> <td align="right">Telefon* </td> <td><input name="phone" style="width: 150px;" type="text"></td> <td align="right">Email* </td> <td><input name="email" style="width: 150px;" type="text"> </td> </tr> <tr> <td align="right">Stylux Harstuudio <br>in Ihrer Nähe* </td> <td><select name="studio" style="width: 150px;"> <option selected="selected" value="1">Hamburg</option> <option value="2">Stockholm</option> <option value="3">Göteborg</option> <option value="4">Borås</option> <option value="5">Oslo</option> </select></td> </tr> <tr> <td colspan="4"><br>Ihre Nachricht*<br><textarea name="message" style="width: 100%; height: 150px;"></textarea></td> </tr> </tbody></table> <input value="Senden" type="submit"></form> </div> </div> <div id="form2" style="align:left;"> <div id="hhlux"><img src="files/images/hhlux.png" style="float:right; margin:15px;"></div> <div id=text style="margin-left:15px; margin-right:15px; margin-bottom:40px; padding-top:35px;"> <h1>Stylux Hamburg</h1> Neuer Wall 36 <br> 20354 Hamburg <br> Tel: +49 (0)40 / 38 64 99 90 <br> Email: <a class="blue" href="mailto:hamburg@styluxhair.de">hamburg@styluxhair.de</a> </div> </div> <div id="form2" style="align:left;""> <div id="hhlux"><img src="files/images/stylux.png" style="float:right; margin:15px;"></div> <div id=text style="margin-left:15px; margin-right:15px; margin-bottom:40px; padding-top:35px;"> <h1>Stylux Oslo</h1> Gabelsgt.19 <br> 0272 Oslo <br> Tel: +47 22 / 44 55 94 <br> Email: <a class="blue" href="mailto:oslo@stylux.no">oslo@stylux.no</a> </div> </div> <div id="form2" style="align:left;""> <div id="hhlux"><img src="files/images/stylux.png" style="float:right; margin:15px;"></div> <div id=text style="margin-left:15px; margin-right:15px; margin-bottom:25px; padding-top:35px;"> <h1>Stylux Stockholm</h1> Strindbergsgatan 52 <br> 115 31 Stockholm <br> +46 (0)8 / 41 05 15 00 <br> T-Karlaplan, uppgång: Valhallavägen, Tessinparken <br> Email: <a class="blue" href="mailto:stockholm@stylux.se">stockholm@stylux.se</a> </div> </div> <div id="form2" style="align:left;""> <div id="hhlux"><img src="files/images/stylux.png" style="float:right; margin:15px;"></div> <div id=text style="margin-left:15px; margin-right:15px; margin-bottom:40px; padding-top:35px;"> <h1>Stylux Göteborg</h1> Vasagatan 21 <br> 411 24 Göteborg <br> Tel: +46 (0)31 / 711 19 04 <br> Email: <a class="blue" href="mailto:goteborg@stylux.se">goteborg@stylux.se</a> </div> </div> <div id="form2" style="align:left;""> <div id="hhlux"><img src="files/images/stylux.png" style="float:right; margin:15px;"></div> <div id=text style="margin-left:15px; margin-right:15px; margin-bottom:15px; padding-top:35px;"> <h1>Stylux Borås</h1> Västerlånggatan 30-32 <br> 503 30 Borås <br> Tel: +46 (0)33 / 430 60 60 <br> Email: <a class="blue" href="mailto:boras@stylux.se">boras@stylux.se</a> </div> </div> </div> <div id="rechts"> <div class="sidebar2"><h1 style="text-align: center;">Kostenlose Beratung</h1> <p>Nehmen Sie mit uns Kontakt auf, um einen Termin für eine kostenlose Haaruntersuchung und ein Beratungsgespräch zu vereinbaren.</p> <p>Rufen Sie uns direkt an oder vereinbaren Sie einen Termin online über unser <b><a href="kontakt.html">Kontaktformular.</a></b></p> <h1 style="text-align: center;">+49 (0)40 / 38 64 99 90</h1> <center><form name="mailform" method="post" action="send.php"> <br> <br> <center><div id="bartxt" style="color: #515356;"><h4>Vorname</h4</div><input name="firstname" style="width: 150px; clear:right; float:right;" type="text"> <br> <br> <center><div id="bartxt" style="color: #515356;"><h4>Nachname</h4</div><input name="lastname" style="width: 150px; clear:right; float:right;" type="text"> <br> <br> <center><div id="bartxt" style="color: #515356;"><h4>Telefon</h4</div><input name="phone" style="width: 150px; clear:right; float:right;" type="text"> <br> <br> <center><div id="bartxt" style="color: #515356;"><h4>Email</h4</div><input name="email" style="width: 150px; clear:right; float:right;" type="text"> <br> <p><h4>Wo haben Sie uns gefunden?</h4></p> <br> <br> <td><select name="studio" style="width: 150px; float:right;"> <option selected="selected" value="1">Google</option> <option value="2">U- und S-Bahn</option> <option value="3">Tageszeitung</option> <option value="4">Wochenblatt</option> <option value="5">Magazin</option> <option value="6">Sonstiges</option> </select></td> <br> <br> <input value="Senden" type="submit" style="float:right;"> <br> <br> </div> <br> <div class="sidebar2"><h1 style="text-align: center;">Öffnungszeiten</h1> <p style="text-align: center;">Montag bis Freitag: 10:00 bis 20:00 Uhr</p> </div> <br> <div class="sidebar2"><h1 style="text-align: center;">Finanzierung</h1> <p style="text-align: center;"><img src="files/images/medipaylogo.gif"></p> <p>Durch unseren Partner medipay bieten wir Ihnen eine flexible Lösung für <b><a href="finanzierungsmoglichkeiten.html">Finanzierungsmöglichkeiten</a></b>.</p> </div><br> </div> </div> <div id=footer><div style="float:left;">copyright stylux 2009 contact <a href="mailto:info@styluxhair.de">info@styluxhair.de</a></div><div style="float: right; padding-right: 19px;"><a href="impressum.html">Impressum</a></div></div> </div> </div></div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-6191579-2"); pageTracker._trackPageview(); } catch(err) {}</script> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.