Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. You got a little $ happy there. Too many of them.
  2. It seems like maybe you got on the wrong path. You don't need your own SSL Certificate just to connect to another SSL site, which appears to be all you're trying to do. What you need to do in order to connect to an external SSL site is a) Disable certificate verification (easy/less secure) or b) Properly configure the path to root certificates on your server. Option a is just a matter of setting CURLOPT_SSL_VERIFYPEER to false. Doing that will cause cURL to basically accept the certificate without doing any sort of verification to ensure it matches the URL given and is trusted. Option b is a matter of obtaining the proper root certificates for the site in question and putting them on your server, then you configure either CURLOPT_CAINFO or CURLOPT_CAPATH to point to the location of those certificates. You appear to have started off by trying to implement option b but cURL was failing to read the root certificates. Either your path to the file was incorrect, it was unreadable (check permissions) or possibly in the incorrect format such that cURL is unable to parse it.
  3. SSL is not going to significantly slow down your site, and having it always on makes for a nice re-assurance to end users. Google is always-on SSL, so is Facebook. They both do that because the realized it's silly to try and only use SSL for certain pages, and easier to just have it always on. I've setup my own site to be always-on SSL as well for the same reason. End users like seeing that SSL is enabled and their traffic is encrypted. Enabling it always is going to make users feel safer on your site.
  4. Your use of intval(strval( is a bit odd, and completely unnecessary. What values are you entering into your text boxes for item_price and item_age? Are you including any non-numeric symbols (ie, $, comma)? PHP will convert the values to a number for the math automatically, but if they contain those extra symbols the conversion may fail and you'd get unexpected results. Use var_dump when outputting your values for debugging so you can see exactly what they contain, a simple echo does not always tell the whole story. Rather than make the value of $condition a string which you then compare against to change the equation, you could just make it's value the percentage off and use it directly in the equation. ie: <select name="conditiondrop"> <option name="0">excellent condition</option> <option name="0.05">good condition</option> <option name="0.1">ok condition</option> <option name="0.2">needs some tlc</option> </select> $value = $item_price-$item_price*$condition+$value1; Bonus math tip: $item_price - $item_price*0.1 could be written more simply as: $item_price*0.9 Taking 10% off of something, is the same as taking 90% of it's value.
  5. If you want to hide the .php extension, you should make sure that all the links and form actions your code generates exclude the extension also. That way they do not end up going through the rewrite process and intentionally causing an error. If you're form action there contains .php on the end, the use of the external re-direct to hide the extension will cause the form data and hash tag to be dropped during the redirect. The ability to redirect a version of the url containing .php to the proper no-.php URL should only be there as a way to keep old bookmarks/search engine links working properly. It is not something you should be relying upon to "fix" all your application's links. You application should be generated all correct links that do not include the .php extension.
  6. INNER JOIN with the specification table and then just include specification.field_id=2 in the WHERE clause. Rows that do not match that were clause will be dropped from the result set.
  7. It'd make it much easier if you isolate them to their own folder, as then you could just apply a blanket rule to all pages in that folder. You could however do it on a page-by-page basis if you really need to by including extra conditions in your mod_rewrite rules.
  8. Change $request_url = $base_url . '?'.htmlentities('shipment=<shipment ' . $xml . '><total ' . $xml2 . '/></shipment>&token=' . $token); to this: $request_url = $base_url . '?' . http_build_query(array( 'shipment' => '<shipment ' . $xml . '><total ' . $xml2 . '/></shipment>' , 'token' => $token )); See if that helps.
  9. Most likely you'd have to exec an external utility to do the conversion and then read the results. First you'll need to find a stand-alone CLI tool which will do what you need. Google is your friend there.
  10. mapLat and mapLong reference the elements there, not the values contained within them. You need to add .value to that to get the value of those elements var mapLat = document.getElementById('Lat').value;
  11. Have you tried accessing a site other than google? Have you verified that your server does not have a firewall blocking the ports/ips? Have you tried the code on a different server? Are you sure you're using your class correctly? Try the raw curl functions.
  12. You're not using referencing your MakeRequest function correctly. By having the () after MakeRequest, you are executing it NOW, and passing it's return value (which is undefined) into setInterval. What you actually want to be doing is passing the function itself in as the argument for setInterval that way it will be executed each time setInterval ticks. You do that by using only the function name, no () after it. setInterval(MakeRequest, 1000);
  13. You'd be better off, and it'd be easier to code, using a div overlay as your window. There are a number of libraries out there to create modal dialogs using div overlays, jQuery UI's dialog is a common one and easy to use. Combine that with some ajax to load your image list and display it. function promptForImage(cb){ var dlg = $('<div>'); dlg.on('click', 'img', function(e){ cb(this.src); dlg.dialog('close'); }).load('image_list.html').dialog({ modal: true , width: 500 , height: 500 , autoOpen: true }); } promptForImage(function(img){ alert('You selected image: '+img); }); Just as a sample. image_list.html would just be a page with a bunch of <img> tags. When an image is clicked it will show you the source of the image selected by using the callback function provided when calling promptForImage.
  14. For a demonstration, check: http://jsfiddle.net/9TJJP/ Clicking either of the icons on the end will give you an alert saying you clicked the link, but no navigation occurs because the attached event handler calls preventDefault(). Clicking the middle icon follows the link as expected and shows no alert. Because the event handler for it calls stopPropagation, the event handler attached to the parent A tag is never executed.
  15. Even if you add a separate email task you still don't really need to add a cron job just to check the expiry date. You also don't really need separate 1/0 and date fields for each level. Just allow the date field to be null. Then you could check these conditions if bronze_exp_date = null then they never had a subscription if bronze_exp_date is a date, but expired then they had a subscription that expired if bronze_exp_date is a date and not expired then they have a current subscription. You can use a CASE statement to query pseudo-columns for this information: SELECT CASE WHEN bronze_exp_date IS NULL THEN 1 ELSE 0 END as hasHadSubscription , CASE WHEN bronze_exp_date < CURDATE() THEN 1 ELSE 0 END as hasSubscriptionExpired FROM blah For convenience you could wrap that up into a VIEW and use that view anywhere you want to query such information.
  16. imageCopy each image onto a new image, then output that new image.
  17. you can't mix mysqli_* functions and mysql_ functions. Since you connect and query with mysqli_ functions, you need to fetch the results using those functions also.
  18. PHP doesn't care what the file extension is, it just parses the files content. Your web server software (apache, nginx, iis, etc) is what would (potentially) look at the extension to determine whether the file is a PHP file or not. How multiple extensions are handled will depend on what server software you are using, as well as how it is configured. For example, under some apache configs, somefile.php.jpg would still be recognized as a php file, which can lead to security issues. In general however, so long as whatever you add between the dots doesn't match a common extension that required special processing (ex: php, pl, cgi, etc) then it will likely be ignored.
  19. var_dump($events) after you create it. Then var_dump($event_day) in your loop. Check each output of event_day and make sure you can find it as a key in the output of the events array.
  20. Your whit_head.php file should not contain anything other than <table><tr><td> This is my header </td></tr></table>No doctype, no <html>, no <head>, etc.
  21. Not with basic auth. You'd have to handle the login process yourself so that you can route it where needed. So when someone tried to access image1, send them to login.php and show a login form. When they login, redirect them back to image1. You can do this using mod_rewrite to send requests for image1 to a gateway script which checks if they are logged in. If so, serve image1, if not, send them to the login page.
  22. foreach ($ipRangeList as $range){ echo '<deny>'.$range.'</deny>'; }
  23. You'll want to do this grouping from within PHP, not as part of the query using GROUP BY. Create an array to hold the results and store the results in a multi-dimensional structure with the first level being the main video information, and a second level for the parts listing. Eg: $results = array(); while ($row = mysql_fetch_array($result)){ if (!isset($results[$row['server']]){ $row['videos'] = array($row['short_link']); $results[$row['server']] = $row; } else { $results[$row['server']]['videos'][] = $row['short_link']; } } var_dump($results); Then you'd output the results using a foreach loop over the $results array. For each row in the results array, the key 'videos' would be another array of all the videos for that server.
  24. If the data never changes, then why the bit about READ/WRITE vs READ-ONLY (for that matter, why do you think memcache is read-only?) since never changing data would by definition only need to be read? Second, if the queries and results never change, then the mysql query cache should be providing a good caching option already if configured. Thirdly, since you cache would essentially be read-only, your question about lost data would not really be particularly relevant. If for some reason the cache did loose the data, just re-query the database and re-add it to the cache. It seems like either there is more to this problem than you are making known, or you're trying to over-engineer a solution to a problem that either doesn't exist or has been incorrectly-diagnosed.
  25. There is no test there, that is what he is talking about. The prepare will generally fail if the query is invalid, syntax wise at least. Considering he didn't get an PHP errors about trying to call bindParam on a non-object though, the prepare likely did not fail since syntactically it is fine, it just references an unknown object. The reason there was no useful error reported is because these lines: print_r($conn->errorCode()); echo "<br/>"; print_r($conn->errorInfo()); echo "<br/>"; Need to instead be print_r($q->errorCode()); echo "<br/>"; print_r($q->errorInfo()); echo "<br/>"; If you prepare a query, then you have to get your error information from the resulting PDOStatement object. Errors relating to prepare'd queries are not available on the PDO connection object (except if the prepare itself has failed).
×
×
  • 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.