Jump to content

fastsol

Moderators
  • Posts

    827
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by fastsol

  1. I am trying to handle 404 errors to mainly pdf files that used to reside in a different directory but have now moved permanantly to a new directory. I have tired many variations for the rewrite and none have worked or even given me errors to make me think I am kind on the right track. This is the line I have tried using RewriteRule ^/files/starter-manuals(.*) /admin_files/PDF$1 [R=301,L] This is an example of a url that should be redirected http://remotelystartedmn.com/files/starter-manuals/RS625.pdf Here is a copy of the whole htaccess just in case something else if mking it not work. RewriteEngine On RewriteCond %{HTTP_HOST} ^www.remotelystartedmn.com$ [NC] RewriteRule ^(.*)$ http://remotelystartedmn.com/$1 [R=301,L] RewriteCond %{QUERY_STRING} ^product_id=(.*)$ RewriteRule . %{REQUEST_URI}?product-id=%1 [R=301,L] RewriteBase / RewriteCond %{HTTP:Cookie} devicePixelRatio [NC] RewriteRule \.(?:jpe?g|gif|png|bmp)$ /retinaimages.php [NC,L] RewriteRule ^/files/starter-manuals/(.*) /admin_files/PDF/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L] ErrorDocument 404 /404.php # ---------------------------------------------------------------------- # Expires headers (for better cache control) # ---------------------------------------------------------------------- # # These are pretty far-future expires headers # They assume you control versioning with cachebusting query params like: # <script src="application.js?20100608"> # Additionally, consider that outdated proxies may miscache # # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ # # If you don`t use filenames to version, lower the css and js to something like "access plus 1 week" # <IfModule mod_expires.c> ExpiresActive on # Perhaps better to whitelist expires rules? Perhaps. ExpiresDefault "access plus 1 month" # cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5) ExpiresByType text/cache-manifest "access plus 0 seconds" # Your document html ExpiresByType text/html "access plus 0 seconds" # Data ExpiresByType text/xml "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType application/json "access plus 0 seconds" # RSS feed ExpiresByType application/rss+xml "access plus 1 hour" # Favicon (cannot be renamed) ExpiresByType image/x-icon "access plus 1 week" # Media: images, video, audio ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType video/ogg "access plus 1 month" ExpiresByType audio/ogg "access plus 1 month" ExpiresByType video/mp4 "access plus 1 month" ExpiresByType video/webm "access plus 1 month" # HTC files (css3pie) ExpiresByType text/x-component "access plus 1 month" # Webfonts ExpiresByType font/truetype "access plus 1 month" ExpiresByType font/opentype "access plus 1 month" ExpiresByType application/x-font-woff "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType application/vnd.ms-fontobject "access plus 1 month" # CSS and JavaScript ExpiresByType text/css "access plus 1 month" ExpiresByType application/javascript "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" <IfModule mod_headers.c> Header append Cache-Control "public" </IfModule> </IfModule> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript I have also tried putting the line in question above the RewriteBase, putting an absolute url for both directories and removed/moved slashes before/after just about everything but nothing has worked. Any insight is appreciated!
  2. You need a width also if there is no content. Have you actually tried putting ANYTHING in the div and see that it works. AGAIN you NEED the single or double quotes around the image path in the css.
  3. Oh, you don't have any content in the div, so it's collapsed to nothing. If you don't have contente in a div and you want to see the background you need to give the div a height and width property.
  4. You would need to run a query beforehand to gather the available table names and check if the tokens_$survey_id is in the array of names returned, then only run the next query if it does exist.
  5. I am wonrdering what the best type of http header to declare for a product page the is trying to display a product that is either not active at the moment or no longer available. Basically is google was trying to reach product-details.php?product-id=50 but that $_GET didn't return any results from the DB, I typically have a message that says "That product does not exist or is unavailable at this time.", but it's just a else{} that is showing that and not declaring any http error like 404. I don't think 404 would be appropriate though cause I don't want it to be can't find type error I think since the product might just be inactive at the moment. Maybe I am wrong and it should be a 404 error, or is there a more appropriate error to use? I am mostly concerned about the http header for search engines since the message I display is more than enough for users on the page.
  6. Can you provide a link to the actual site and page in question so we can see what you are talking about?
  7. I think I found your error. You had a $ instead of & in your link to Add the product. <a href="index2.php?page=products&action=add$id=<?php echo $row['id_product'] ?>">Add To Cart</a> Should be this <a href="index2.php?page=products&action=add&id=<?php echo $row['id_product'] ?>">Add To Cart</a> So it wasn't reading the $_GET['id'] at all.
  8. Ok well that makes no sense to the code you provided, cause there isn't any variable close to line 50. Are you sure the code ou provided is the entire code for the page? If it is then you need to tell us exactly what bit of code the error is referring to since it doesn't match up to line 50 for us.
  9. Well it surely needs the single quotes, it's not correct syntax otherwise and will surely fail for that reason. Are you sure that you have the correct path to the image? Is the image found in the style directory? you could also try the background-image: property instead of the basic background: Remember the image path in the css is relative to where the css file is located, not to the page the css file is on.
  10. Do you get any errors? Echo out the $sql before running the query on the index2 page and see if the query string looks correct and has the product ids that you expect it too. Obviously the query if failing to return anything on index2 cause it's telling you the cart is empty. So either the query is failing cause the $sql syntax is wrong or there are no matches for the query string provided. Also this line $id=intval($_GET['id']); Would be better like this $id=(int)$_GET['id']; // This type casts it to a integer. Even if it's been compromised by someone it will still return a 0 which will not make your query fail on the other page.
  11. You need single quotes for the url string url('style/headerline1.png'); Also please make sure to use the forums code tags to post code. It's the <> button under the smiley face icon.
  12. First I would try putting `backticks` around your column names. Time is a mysql function so you might be confusing the query with how you're putting it together. Second, what data type is your Time column in the database? It should be in the "time" type for what you're doing (based on the limited info you have provided). If it's stored as a VARCHAR it won't work the way you want cause it can't mathematically figure out the time difference since it's a string rather than a number. Plus strtotime() would not be effective in this instance unless you're storing the time as a INT which would be I believe 11 number characters ling for a timestamp type value. Please provide more info for a better answer and help.
  13. Prepared statements are used for things that are user defined variables. If you are defining the query to build the menu then you would just do a normal SELECT query.
  14. Alright, first off you need to learn to use the forum code tags to post code, it's the rules of the forum and it makes it a lot easier for anyone to read the code. The code tag button is the <> just under the smiley face in the reply textarea. Now, "Thanks for the email" doesn't tell me anything since that text is not in the code that I gave you, so I have no idea how or where that is coming from. You really need to start thinking logically if you want anyone to help figure this out with you. You need to start doing basic diagnostics to trace down where in the code the fault is before you post saying "it doesn't work". But, have you checked your spam box for the email? I said it before, you really should use a library for this kind of thing, like phpmailer. It might seem difficult to use, but it's honestly not. They have working examples on the site so you can see how to piece the code together. At this point from what you have told me, the only thing to know if it actually sent the email via the script is if the json that was returned has "Thanks for your comment" as the msg array item. If it's returning that message then the php is working correctly and the issue lies in the server or your email program. As I said before, delivery to an email inbox is a whole nother subject and pretty in depth. Email in todays market doesn't just "appear" cause you asked it to, it goes through a huge amount of filtering and BS before it's even considered for delivery. If you don't have the basics of the info a email program wants to see, it won't even think about delivering it and you likely won't see it in your spam box either. If you want a ready made contact form that uses phpmailer and ajax submission, I distribute one at - http://amecms.com/article/Easy-to-use-contact-form-with-validation
  15. Well those codes blocks don't have anything to do with the displaying of the info you updated. Most likely the issue is that the script (somewhere else in the code) is gathering the users info and storing it in a session. Then on each page load it just re-uses that info rather than making another query until the browser is closed or the user logs out and back in. So you would need to find and edit how that info is being stored and displayed.
  16. This is probably more of what you're going after echo '<form name="login" action="'.$_SERVER['SCRIPT_NAME'].'" method="post" class="box login">'; Technically html attributes are supposed to have double quotes. The way you had it the action would have had single quotes. But if all you're doing is submitting the form to the same page it resides on, then just leave the action blank. Also do not use the $_SERVER['PHP_SELF'] cause it is a big security risk, the SCRIPT_NAME or blank like I already suggested.
  17. You're still not running the query!! You need to call mysql_query() before the while loop.
  18. Then you have something else going on. You need to be more specific than "it doesn't work". That statement doesnt tell us anything. What doesn't it do? Which json values are returned?
  19. Well I can see a couple things right off the bat. Where are you defining $QID for this part? list($QID, $correct) And $res would be undefined since you haven't even ran the query, you only defined the query string with $sql.
  20. You'll want to use paypals IPN service. There are tutorials out there on the subject, but depending on the time the tutorial was made you may have to get the more current code from the paypal docs. That's the easiest way to do what you're asking with paypal.
  21. Well PHP is very good a doing math, but you're going to have to give us a bit more to go on than what you have. How about an example of what you're currently doing and the result you expect to get from it.
  22. You had many things wrong in that code. I editted it and included my mailing function I gave you and tested the whole thing on my server and it works as expected. You just need to remove the form at the bottom after you test it. <?php // Builds an email from given parameters function buildEmail($to, $subject, $body, $from, $reply = NULL) { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-Type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(). "\r\n"; $headers .= 'From: "'.$from.'" <'.$from.'>' . "\r\n"; if(!empty($reply)){$headers .= 'Reply-To: '.$reply.'' . "\r\n";} return (mail($to, $subject, $body, $headers) === TRUE) ? TRUE : FALSE; } if(isset($_POST["submit"])) { $errors = array(); $name = htmlentities($_POST['name']); $email = $_POST['email']; $comment = htmlentities($_POST['comment']); $emailReg = '/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/'; if(empty($name) || empty($email) || empty($comment)) { $errors[] = 'All fields are required.'; } elseif(!preg_match($emailReg, $email)) { $errors[] = "Not a valid email address"; } if(!empty($errors)) { echo json_encode($errors); } else { $to = "[email protected]"; // Edit this to your actual email address you want the emails sent to. $from = $email; $subject = 'Contact From Submission'; $body = 'Name: ' .$name . '<br>'; $body .= 'Email: ' .$email . '<br>'; $body .= 'Message: ' .$comment . '<br>'; if(buildEmail($to, $subject, $body, $from, $from) === TRUE) { $return['error'] = false; $return['msg'] = "Thanks for your comment"; echo json_encode($return); } else { $return['error'] = true; $return['msg'] ="Sorry email not send try again"; echo json_encode($return); } } } ?> <form action="" method="post"> <input type="text" name="name"> <input type="text" name="email"> <textarea name="comment"></textarea> <input type="submit" name="submit" value="Submit"> </form>
  23. Do you understand how to use a function? You don't put the function I gave you in the code block you already had and expect it to work. The function should be put either before your first if() or in a separate file that is included before the if(). Then you call the function in your if() at the appropriate time and provide the parameters it needs to run. You should check out some info I have on validating a form properly, at least the way I like to do it, that is logical to understand. There are some here that will debate my use of some vars in the script but they do serve a specific purpose on how it works. If nothing else, look at the structure and understand how yours can be improved to accomplish your end result and the flaws you currently have. http://amecms.com/article/How-to-validate-a-form-the-right-way
  24. You're missing a few hearders that an email needs to effectively be delivered. Also you are blindly sending the email BEFORE even checking the variables that were posted. You need to only send the email once you have done all the validation checks and ONLY if they all pass, so you need to rearrange your code. The best way to send email in php is to use a php library like phpmailer which will automatically assign the proper headers to "help" with delivery. Granted delivery is a whole other issue in itself and is a long subject to discuss. This is a function I used to send emails before switching to phpmailer. It has the most basic headers needed to send an email. You can modify it to your needs. The function sends the email in HTML format, not plain text, so you can google the proper header for plain text if you want that option. // Builds an email from given parameters function buildEmail($to, $subject, $body, $from, $reply = NULL) { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-Type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(). "\r\n"; $headers .= 'From: "'.$from.'" <'.$from.'>' . "\r\n"; if(!empty($reply)){$headers .= 'Reply-To: '.$reply.'' . "\r\n";} return (mail($to, $subject, $body, $headers) === TRUE) ? TRUE : FALSE; }
  25. It's called responsive design. The difference is the use of css media queries to change the layout of the page when it detects a smaller viewport size from the device being viewed on. Here is a good tutorial on the subject http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries
×
×
  • 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.