Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by CroNiX

  1. For the $headers, don't you mean to use $address instead of $name? I assume $address is an email address and $name is a name like "Joe Blow". That might be why this didn't work to begin with.
  2. Also, the PDOExceptions would probably be more useful info than your custom ones.
  3. htusers is just a text file that contains a user:password on each line. user1:password user2:password2 So all you'd need to do is load the htusers file in php, read line by line and explode on the : to separate the user from the password, and then store in mysql however you want.
  4. What have you tried? Have you tried using the DateTime interface? http://php.net/manual/en/class.datetime.php
  5. All HTML form data is a string. So you just need to convert it to a number in javascript before doing math. var test = parseInt(document.getElementById('number').value); //use parseInt() to convert to an integer. There are others for float, etc. total = test + 10;
  6. Because $res IS an array of all usernames, which is what your query asked for by using fetchAll(). So you'd need to iterate over that array. foreach($res as $user) { echo $user['username'] . "<br>"; }
  7. Depends on what you need to search for, but let's say you want to search for the users last name. Create a form with an input for the last name. When submitting the form, just do a search for the last name in the db using WHERE lastname = 'lastname_from_form' to get an exact match, or WHERE lastname LIKE 'lastname_from_form%' to get all that start with lastname_from_form (the % at the end is a wildcard). Then display the list of matched users
  8. Before going through the code, does the "assets/images/avatar/" directory that the file is being uploaded to have write permissions for the web user?
  9. That's a lot of code to wade through, but here's how I'd generally do it: 1) form is sent 2) data is validated, images saved, etc 3) Reshow form with data 3a) When generating the FILE inputs, if one has a file already uploaded, don't show the FILE input for that one. Instead show a checkbox to delete the file and show the filename. So if 3 pdf's/whatever were uploaded, the first 3 spots where you'd normally see the upload button would instead have a checkbox. The other remaining 7 inputs would show the upload. Checking some or all of the checkboxes and resubmitting the form would delete/unlink() those files during step #1 above, and when the form is redisplayed, the upload slots would show up again in their place.
  10. There's not really enough info to answer the question. All the code above shows is incrementing a counter in $_SESSION. It doesn't show anything about what's in the cart. What data from the cart are you trying to save and what does it look like? What's the schema for the db that you want to add the cart data into?
  11. Do you have error reporting turned on and display_errors? I see a problem in your code which should be obvious, and you should be getting an error complaining about this line: $result = $mysqli->query("SELECT * FROM store WHERE id=".$_GET['name']); /
  12. You'd have better luck if you posted the code in your post rather than having to download it. Many won't do that.
  13. There is a "Mark Solved" button on the lower-right of each post. Click that next to the post that was most helpful.
  14. Right, so go through and match all opening braces to closing braces. You have extras.
  15. Look at the previous line, which is missing the ending semicolon. Also the parenthesis are unnecessary: ($row=mysql_fetch_assoc($result))
  16. Yes, you'd need a php powered pdf generator. There are many around, like FPDF, TCPDF and a few more main ones (google "php pdf"). It's also not easy to do and you'd have a lot of tweaking to your css to get them to display properly in a pdf document, since PDF's are of a fixed height/width. It won't be as easy as just saying "take the current HTML and put it in a PDF".
  17. $image = $default_skin_url; //used as default if (isset($_GET['user'])) { //is the user set? $user = $_GET['user']; //Does the user image exist on site A? $site_a = "http://halcyon-pvp.fr/skins/$user.png"; $site_b = "http://skins.minecraft.net/MinecraftSkins/$user.png"; if (file_get_contents($site_a) !== FALSE) $image = $site_a; else if (file_get_contents($site_b) !== FALSE) $image = $site_b; } $skin = imagecreatefrompng($image); 1) If image exists on site_a, it uses that. 2) If image does not exist on site_a, it checks site_b. If it exists there, it uses that. 3) If image does not exist on site_a or site_b, it uses the default.
  18. But you have a logic problem and you're essentially saying this: if ($something == 'a') { echo 'found in the IF'; } else if ($something == 'a') { echo 'found in the elseif'; } If something does == 'a', what will be echoed? It will never reach the elseif if something == 'a'.
  19. What does your browsers console say about the ajax requests? Are they being sent to the correct URL? Your code shows you pass the url to the function so we can't see how the url is constructed.
  20. if (isset($_GET['user'])) { } elseif (isset($_GET['user'])) { //since this is checking the exact same thing as the first IF(), this will never get triggered since it's in the elseif() which will only happen if the first IF() isn't true, which it is }
  21. Congrats, and welcome!
  22. I believe you'd need to use register_shutdown_function() to capture FATAL errors, which are the most important to know about Otherwise fatal errors will crash the system and won't get reported by a custom error handler because PHP is done processing at that point since fatal errors kill the script right then and there so they can't be logged normally. http://stackoverflow.com/questions/4410632/handle-fatal-errors-in-php-using-register-shutdown-function
  23. I think actually you might only want to track the IDs that the email was successfully sent to, and delete only those. So build a new array of IDs to be deleted within the ELSE. Otherwise you won't be able to resend to people who the email wasn't successfully sent to the first time as they are now deleted from the db. Another thing to check before running the MySQL delete is whether the $IDs array contains any values, or there will be a mysql error if the array is empty.
  24. For one thing, if your host is named "myhost.com", you need to send email FROM someone@myhost.com. If the FROM in an email differs from the HOST, most ISPs will reject it outright or send it to spam. Email is extremely tricky and one of the most complex things in terms of getting high deliverability. You need things like PTR DNS records, Reverse DNS records, DKIM, your IP must have a good "reputation" and not be on any RBLs, etc. If you have critical emails that MUST get delivered, you should really look to using a service like SendGrid which will do all of that for you.
×
×
  • 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.