Jump to content

White_Lily

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by White_Lily

  1. I know the security risks of this script, however it is just what he wanted. Also, your answer still doesn't explain why the update code does not update the database. You mentioned sanitizing the inputs - which I am doing...: function testStr($type, $string){ switch($type){ case "empty": if(strlen($string) == 0 || $string == NULL){return false;} else{return true;} break; case "clean": $string = strip_tags($string); $string = mysql_real_escape_string($string); return $string; break; } } Now, in any of the code that is posted, is there anything there that would be the cause of the database not being updated?
  2. Remember the issue is that it doesn't update the database... but returns no errors? Thanks for all your help!
  3. Here is the PHP code that processing the password recovery... <?php include("../../config.php"); if(isset($_POST)){ $error = array(); if(testStr("empty", $_POST["email"])){ $email = testStr("clean", $_POST["email"]); $check = mysql_select("users", "", "email = '{$email}'", NULL, 1); if(!mysql_num_rows($check)){$error[] = "That email address does not exist.";} }else{$error[] = "Please enter your email address.";} if(count($error) == 0){ $headers = "From: ".config('email/name')." ".config('email/address')."\r\n"; $headers.= "MIME-Version: 1.0\r\n"; $headers.= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $pass = makePassword(15); $salt = salt(); $password = encrypt($pass, $salt); $htmlMessage = " <html> <body> <h2>Password Recovery for Ed's Login System</h2> <p>Hi, you requested a password change. Below you will find your new password.<br /> Once you have logged in, you will be prompted to change it again, this time - remember it!</p> <p><strong>Your New Password:</strong> {$pass}</p> </body> </html> "; if(mail($email, "Password Recovery", $htmlMessage, $headers)){ $update = mysql_update("users", array("password", "salt", "p_prompt"), array($password, $salt, 1), "email = '".$_POST["email"]."'"); if($update && count($error) == 0){ echo json_encode(array("success" => true, "message" => "Password has been changed successfully, check your email for your new password.")); }else{$error[] = "Failed to update password.";} }else{$error[] = "Something went wrong creating your password.";} } if(count($error) > 0){ echo json_encode(array("success" => false,"error" => $error)); } } ?>
  4. Here is the ajax code... jQuery(function($){ $("button#recovery").on("click", function(){ $.post("javascript/ajax/recovery.php", $("form").serializeArray(), function(data){ console.log(data); if(data.success){ $("div#error").addClass("pass").html("<p>" + data.message + "</p><br /><a href='login.php'>Login</a>"); }else{ var errorMsg = ""; for(i=0;i<data.error.length;i++){ errorMsg += "<p>" + data.error[i] + "</p>"; } $("div#error").addClass("fail").html(errorMsg); } }, "json"); }); });
  5. Hi, I have been asked by a friend to create a login system for him to use and it requires a password recovery page, and to have all the PHP processing code to be done with AJAX to avoid page 'refreshes', which is fine... However, on the password recovery page, you enter your email address... and nothing happens, it checks the email address is there and that it is a registered email address, but when it comes to updating the database with a new password... it comes up with nothing, no PHP errors, no MySQL errors, and no javascript errors... Here is the update function (no comments on the mysql method... I know it is deprecated, just his choice!)... function mysql_update($table, $columns, $values, $where) { $set = array(); for($up=0;$up<count($columns);$up++){ $set[] = "{$columns[$up]} = '{$values[$up]}'"; } $query = "UPDATE {$table} SET ".implode(",", $set)." WHERE {$where}"; return mysql_query($query); }
  6. I wouldn't say this is a CSS issue as such. I am using the value "100vh" in a height property on my portfolio and noticed that this value does not work in Safari. It then that I noticed that Apple has dropped support for Windows in their Safari software, so does this mean that it is recommended websites should drop support for Safari 5.1? What are peoples thoughts on this subject? The only reason I am asking is I need my portfolio to be up and running in the next few months, but I don't want to waste time finding "fixes" when it just isn't worth it! Any opinions and help on this matter are greatly appreciated!
  7. Thank you for this, it really helped!!
  8. Hi, I currently have a client that wants a custom CMS built onto their website. I have built the typical CMS that lets you edit pretty much everything on the site (even the design!). However he wants to take it 1 step further and be able to control his SEO trough his CMS rather than have to log into many different websites. So for example he wants to be able to see his Google Analytics from within his website, rather than go to the Google Analytics website and use it there. Is there a way to do any of this? I don't believe he got this idea by himself as such, I think he was looking at other CMS' because he provided a couple of links to CMS' that apparently have "SEO Built-in". For example: http://www.lightcms.com/ Any ideas and help would be appreciated.
  9. Thank you Barand, it was the credentials for the IP - the client gave us the wrong username and password.
  10. Hi, I am currently trying to build an Artist's website, the artist wanted a CMS that was completely customized to the site (so no Wordpress, Joomla, Drupel, etc) - because of this I am having to create a CMS completely from scratch. The problem I am having is with the database connection (hence the topic title), other sites that I have built with this same code work fine - however this particular site does not seem to want to play ball. It keeps giving me this error: SQLSTATE[HY000] [1045] Access denied for user 'web113-janesart'@'10.0.44.113' (using password: YES) I have tried obvious things such as spelling mistakes, wrong password/username/db name, nothing seems to get rid of this error. Any help on what else this could be would be appreciated.
  11. Never mind I have found out why they are not working.
  12. Hi, I have been asked to check some 301 redirects for a site we have recently built. I have run into a problem with this set: redirect 301 /contact-diverse-cleaning-company.php "http://www.deep-cleaning.com/contact-us" redirect 301 /cleaning-services/kitchen-floor-deep-cleaning.php "http://www.deep-cleaning.com/page/Kitchen%20Deep%20Cleaning" redirect 301 /domestic-commercial-cleaning-quote.php "http://www.deep-cleaning.com/page/Commercial%20and%20Private%20Sector" redirect 301 /cleaning-services/index.php "http://www.deep-cleaning.com/" redirect 301 /cleaning-services/high-level-cleaning.php "http://www.deep-cleaning.com/page/High%20Level%20Deep%20Cleaning" redirect 301 /cleaning-services/ventilation-system-cleaning.php "http://www.deep-cleaning.com/page/Ventilation%20System%20Deep%20Cleaning" redirect 301 /cleaning-customer-testimonials.php "http://www.deep-cleaning.com/testimonials" redirect 301 /cleaning-services/ "http://www.deep-cleaning.com/" redirect 301 /cleaning-services/daily-cleaning.php "http://www.deep-cleaning.com/" redirect 301 /cleaning-services/domestic-property-cleaning.php "http://www.deep-cleaning.com/" it appears that all the redirects that begin with "/cleaning-services/" dont work, the other 3 do work. any suggestions?
  13. is the search terms stored in a session or is the whole ting powered by javascript?
  14. On your company website, look at the code for the two buttons that say "Request a call back" and "Get a quote today", they use the css you will need to get your problem sorted.
  15. I have been asked to produce code that make a banner fade through a set of images, but in between fading the images need to slide a little bit. I have produced this: <script type="text/javascript"> $("#banner-images > img:eq(0)").show(); var box_height = 249, img_height = $("#banner-images > img:eq(0)").outerHeight(true), calc_bottom = ((img_height - box_height) - 30); $("#banner-caption").html($("#banner-images > img:eq(0)").attr("title")); $("#banner-images > img:eq(0)").animate({bottom: "-" + calc_bottom + "px"}, 5000); setInterval(function(){ $("#banner-images > img:eq(0)").fadeOut(1000); $("#banner-images > img:eq(0)").appendTo("#banner-images"); $("#banner-images > img:eq(0)").fadeIn(1000, function(){ $("#banner-caption").html($(this).attr("title")); var img_height = $(this).outerHeight(true), calc_bottom = ((img_height - box_height) - 30); $("#banner-images > img").css({bottom: "0px"}); $(this).animate({bottom: "-" + calc_bottom + "px"}, 4000); }); }, 5000); </script> The problem I have is that when you first go onto the page, the first image slides down fine, and then the rest follows suit. However if you click the refresh button on your browser ( or hit F5 ) the code seems to skip the animation of the first image completely and just straight into the second image. Any ideas as to why this is, and how to fix it would be much appreciated.
  16. If you want submitted information to NOT show in the address bar, then set your form to use the method "post" not "get".
  17. As php.net says you could use mysql_real_escape_string() to help prevent sql attacks, another way to prevent such things is to use regex's. so for names you would write a regex that only allows the user submit values that contain upper and lower case letters and hyphens. This way, if the user were to type an equals sign or quote marks etc, then then the match would return false and ask the user to take out any "illegal" characters.
  18. In terms of error checking with arrays and checking to see if a value exists or not, could be written like this: <?php $error = array(); if(isset($_POST['send-form'])){ // check if submit button was pressed $countBlank = 0; // required fields "name" attribute $reqArray = array("comp-fname", "comp-addr1", "comp-town", "comp-county", "comp-post", "comp-email", "comp-hometel"); foreach($_POST as $key => $value){ if(in_array($key, $reqArray)) if(empty($value)) $countBlank++; } if($countBlank > 0) $error[] = "Please do not leave any required fields empty."; if(count($error) == 0){ // do the of the code (pattern checks, database checks/inserts) } ?> it is faster than checking each one individually, and it can be modified a bit to tell the user exactly which fields are empty.
  19. It also looks like your going to need to process the form through AJAX / JSON if you intend to have 3 fields per form slide, you may also want to consider client-side validation so that the user's page doesn't have to refresh all the time just to bring up any errors.
  20. 1) The carousel at the top of the home page does not work. 2) What's with the ad, it makes the site untidy, seeing the ads on every single page is starting to bug me. 3) Quotes/Testimonials on the home page could be in a clearer font, i had to magnify the screen to read them. 4) The news headlines on the home page are also messy, all 3 are different heights... why not put the images inside divs make the divs all the same height, centralise the images inside their containers? You could also put the content inside divs too and make these the same height, this would keep the "Full Story" buttons at the bottom of the news boxes (where they personally should be). DO THIS TO THE "Other Stories" boxes to! 5) The "Blogs" dropdown doesn't work, because of this i noticed an error on the "Blogs" page, the pagination at the bottom of the posts jump straight to 3?
  21. name="submit" should be on the submit button, nothing else. Otherwise it would never be "set".
  22. try writing a line between your query and the item output echos that says: $row = mysql_fetch_assoc($res); EDIT: Put all your echos on new lines too, this would make it slightly easier to read.
  23. Try running the form in Chrome, as the inspect element in Chrome tells you exactly what line the error is occurring on, and whats causing it to occur.
  24. and to add to irates answer, you may also want to check the comparison of the value in the input field to, as you stated if(document.getElementById('optDelivery').value == 'optDel') when in actual fact it is (and always will be unless you change it elsewhere) equal to Delivery not optDel.
  25. Okay so I decided I wanted to develop my own text editor for the CMS I am developing, but the problem I am facing at the moment is that the iframe that is generated with the javascript I have written is displaying the text from the database as plain text rather than html. This is the link to the site where you will find the simple text editor and the content: http://www.janedealsart.co.uk/cms/edit-default-page.php?editPage=Home
×
×
  • 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.