Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. I cleaned up your code a bit and it seems to work fine. <?php session_start(); error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); // $scelta = isset($_POST['user_rights']) ? $_POST['user_rights'] : array(); if (isset($_POST["user_rights"])) { echo 'User rights setting:<br>'; print_r($scelta); } else { echo '<form method="post">'; echo '<input type="checkbox" name="user_rights[]" value="0"> 0'; echo "<br>"; echo '<input type="checkbox" name="user_rights[]" value="1"> 1'; echo '<br>'; echo '<input type="checkbox" name="user_rights[]" value="2"> 2'; echo '<br><br><input type="submit">'; echo '</form>'; } exit();
  2. a deprecated alias of a deprecated function. Go figure....
  3. turn on error checking - it will tell you that MySQL_selectdb is invalid.
  4. This doesn't look like "working" php code (and it's not posted as code here correctly either). Fix it up so it runs and tell us what errors you get. As for opening in a pdf file - you have to make it a pdf first.
  5. You orig post said you didn't get an email or you didn't get the mail with the att. As I posted a few mins ago (where did it go?) I had success with this code (and some modifications to make it error free) and it sends me an email. As for the attatchment I don't see that code here so I'm not about to fix it. Curb your attitude at the door please. And don't post pseudo-code or "code" that you haven't actually run. It makes us all irritable here. Have a good life.
  6. SEE my comments. And as for being a smart-a - WHO post sham code and asks for help? // YOU ARE HASHING A DATE AND TIME ??? $random_hash = md5(date('r', time())); $csvString = "..."; // your entire csv as a string $attachment = chunk_split(base64_encode($csvString)); $to = "email@email.com"; if(isset($_POST['submit'])) { // VALIDATION if(empty($_POST['firstName'])) { // ERROR HERE "First Name Required"; } if(empty($_POST['lastName'])) { // ERROR HERE "Last Name Required"; } if(empty($error)) { // WHY REDEFINING $TO HERE??? $to = "$to"; $subject = 'The Form'; // NEED A FROM ADDRESS IN HEADERS $headers = "MIME-Version: 1.0 \r\n"; $headers .= "Content-Type: text/html; \r\n" ; // NEED TO START WITH = HERE NOT .= $msg .="<html> <head></head> <body> <table width='100%' cellspacing='0' border='0' cellpadding='0'> <tr><td> <table width='100%' cellspacing='0' border='0' cellpadding='0'> <tr><td>This is the email sent.</td></tr> </table> </body> </html>"; include('con.php'); $con = mysqli_connect($host,$user,$pass,$dbName); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } // ARE YOU SURE DB AND TABLE ARE BOTH NAMED 'THETABLE'???? // AND WHY SELECT IT WHEN YOU ARE DOING IT IN CONNECT ??? mysqli_select_db($con,"thetable"); $firstName = mysqli_real_escape_string($con, $_POST['firstName']); $lastName = mysqli_real_escape_string($con, $_POST['lastName']); // DON'T NEED {} AROUND VARS HERE // YOU SAY THAT IF YOU GET A HIT THAT THE PERSON EXISTS. // WHAT IF YOU LOOK FOR JOHN SMITH AND FIND JOHN DOE? $sql = "SELECT * FROM thetable WHERE `firstName` = '{$firstName}' OR `lastName` = '{$lastName}'"; $result = mysqli_query($con,$sql); if(($result->num_rows)>= 1) { $theerror = "You exist"; } else { // NO NO NO... DON'T INSERT THE UNSANITIZED INPUTS HERE!!!!! $sql="INSERT INTO thetable(firstName, lastName) VALUES ('$_POST[firstName]','$_POST[lastName]'"; $success = "Sent ... Insert it!!!"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } // WHY OH WHY DO PEOPLE SUPPRESS ERRORS HERE????? REMOVE THE @ CHAR $result = @mail($to, $subject, $msg, $headers); } mysqli_close($con); // WHAT IS THIS FOR??? { } } }
  7. If this is supposed to be REAL code, you have a lot to learn. See my signature and add those lines to the top of your script and then debug all your errors.
  8. You already escaped the incoming 'message' value. Why do you think you need to do it again in the query?? Just use the var you created in the first line. $sql = "INSERT INTO table (message) VALUES ('$message')";
  9. And when you viewed the source in the browser you saw no js code? And despite that anchor being in the html, it still needs quotes.
  10. Sorry - I don't see anything that could be doing a 'popup confirmation message'. I do see this tho as bad/invalid code - did you copy it verbatim or re-type it yourself? <div class=message>{$message}<br><br>{$confirmed_link}</div> </code> message needs to be quoted so this is obviously an error. Try viewing the source code of the page that is onscreen when the confirm msg pops up (in your browser). There you should see the JS code or at least some references to js modules.
  11. I don't think you are showing us the relevant code. I'm assuming that the confirmation message is a JS production, so you should be looking for something using a 'confirm(xxx)' or 'alert(xxx)' statement in js code. Don't see that here.
  12. As a former IT supervisor who was not up on the more modern technologies that were being used to accomplish our company's goals, I found that seeing examples of completed, working projects were more helpful than trying to look at code that had no meaning to me.
  13. I think you want: $parameters['key'] = STEAM_WEB_API_KEY;
  14. You should learn how to create your output in an easier to read (and write) way. foreach($_POST as $k=>$v) { $ucv = ucase($v); echo "<input name=$k type='hidden' value='$v'>"; } See how easy that is to read? And how easy to type? Although the whole exercise seems odd. You're grabbing a set of inputs and then creating html form output? Uhhh - don't you want to USE the post values for something rather than write them back out? Also - you have other errors in your posted code. Turn on error checking to see. (See my signature)
  15. doing what wrong?
  16. I'm more confused now than before. Guess I'll move on.
  17. I just have not run across it. That's all.
  18. So - maybe try re-explaining what your problem is since we are confused about what you have and what you want to do with it.
  19. Type hinting in PHP? I have not seen that mentioned before. My bad.
  20. I agree with jcjones . You propose a table full of numbers but then give only examples of date arithmetic. Whether you know it or not, dates CAN be stored as numbers which there are functions for handling. Perhaps a little reading is in order here before you proceed.
  21. You're right - I guess I got tired of sorting thru the embedded html inside the php. OP - work on learning how to split your presentation code away from your logic code.
  22. All that code but you couldn't be bothered to point out the lines giving you the errors?
  23. Not sure at all what you are doing here. You run the query with the desc option in it but then you process the results by doing an Include statement over and over. How do you know its not working? You're not displaying any of the results? Please stop posting your code in chunks. It is impossible to get a complete picture of your problem when you break it up like that and we can't see the real picture. Isolate the code you have a problem with and then post it intact.
  24. WHAT is that word 'Database' doing in that header? You need to pass the variable that represents your current instance of database class. So test(!one,$two,$three,$database) is what you want. IMHO - if you are such a newcomer to PHP, why are you getting into classes and whatever else (objects?) when you don't even know how to pass arguments to a function or how to format the header of one? That is a basic premise of functions in any language that supports functions and you don't understand it.
  25. You bought some code with no guarantee of support?
×
×
  • 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.