Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by ginerjm

  1. ginerjm

    Problem with Form URL in PHP Code

    Change the action attribute on your form to be the url you want. And stop using mysql db interface. It is way out of date! Strongly suggest switching to PDO - it is pretty easy.
  2. height and width of a folder? Whatever does that mean?
  3. ginerjm

    Help with search function

    Then you have a problem. Is anyone else reporting this as a problem in a google search?
  4. ginerjm

    Help with search function

    You have already stated that the search function is not returning relevant items. Sounds like this package has flaws that need to be addressed by the authors, not someone who doesn't know how to program.
  5. ginerjm

    Getting blank csv file in email attachedment

    "after following your comments" So - what exactly did you do? Post it perhaps? We are not mind-readers so nobody knows what your code looks like now. Maybe you could add some echo statements to output values that are important to the process so that YOU can verify that what you think is happening is really happening. That's how real programmers debug things that are puzzling them.
  6. ginerjm

    Help with search function

    Along with Phi11W I think you are posting in the wrong place. This is a PHP forum, not a WP forum nor a resource for the plugin you are referencing. The code you posted has no meaning to me, so that should give you a hint, which you haven't seemed to get so far.
  7. ginerjm

    Help with undefined variable error.

    And please don't post ALL of the code - just the part near and around line 26. PS - Does the message REALLY look like what you posted, including the "eval()'d" part?
  8. ginerjm

    Help with search function

    Please note my original post where I made the point of using the word 'SPECIFIC'. By my count you posted 800 lines of code here. Do you really expect us to read through all of that and try and make sense out of your thinking without any comments? If you could point out where you think the problem lies and what if looks like then you might get some useful tips. Sorry - but I'm not going to plow thru all of this.
  9. ginerjm

    Getting blank csv file in email attachedment

    Here is your code with some comments added: $sql = "SELECT * From abc"; $res = mysql_query($sql); $fileatt_type = "text/csv"; $myfile = "myfile.csv"; $handle = fopen($myfile, "w"); $str = ""; // Get the data from the query results while($row = mysql_fetch_array($res)) { // only saving the last row in the $str variable $str = $row['username'].",".$row['mobile']."\n"; } fwrite($handle, $str); fclose($handle); //******************* // Read the newly made file back in? $file_size = filesize($myfile); // re-open the file for WRITING again??? $handle = fopen($myfile, "w"); $content = fread($handle, $file_size); fclose($handle); // break up the just-read content and encrypt it? $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); // Start building the email needs $to = 'abc@gmail.com'; $subject = 'Test email with attachment'; $message = 'welocme'; $header = "From: abc.com\r\n Reply-To: From: abc.com"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-type:text/html; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message."\r\n\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-Type: text/csv; name=\"".$myfile."\"\r\n"; // use diff. tyoes here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$myfile."\"\r\n\r\n"; $header .= $content."\r\n\r\n"; $header .= "--".$uid."--"; if (mail($to, $subject, $message, $header)) { echo "Mail send"; } else { echo "can not send mail"; } Problems - 1 - STOP using the mysql extension since it is no longer valid. Switch to PDO (if available) or else go to mysqlI for your database needs. 2 - Learn how to build a string using concatenation. You aren't building the output message into $str if that is what you think you are doing. 3 - You aren't creating a message for your email. You simply put the word 'welocme' into $message. PS - why are you including $message in your $headers? 4 - You seem to be writing out the data to a file but then you turn around and attempt to read it back in (using a "write" mode?) 5 - Not sure how a multi-part message is meant to be built but I'm going to guess that you don't insert the message body into the headers string. My guess is that you build the message using the different parts, separating them with your $uid value that you define in the header. 6 - Note how neatly my block of code is written. Makes for easier reading, no? And adding comments helps keep your thought processes clearly understood when you come back for maintenance later on.
  10. ginerjm

    Help with search function

    Is there some specific CODE that you are having a problem with? That's what we here work best with.
  11. ginerjm

    my add to cart does not seem to work

    OP - lest you think that you have woken some forum user who has nothing good to say to you let me point out that you couldn't be further from the truth. Gizmola is a tried and true provider of much help for almost any topic. Her/His response to you was more spot on than any 'real' answer could ever have been to you on this topic. Re- read it and take it point by point as good advice in every way.
  12. ginerjm

    my add to cart does not seem to work

    Try using proper coding practices such as checking the results of your query calls to be sure they ran. PS - Why use JS to display your messages? Simply echo the message out and avoid the extra layer of code. And instead of using JS to open a new window, why not simply use a header to redirect to THAT script? Lastly (or firstly!) please use a prepared query instead of your current method of embedding user input values that need to be sanitized.
  13. You have two posters telling you the same basic thing - you have a problem with your assumed values of things that needs to be addressed rather than ignored. Moreover - you state that you "do the normal $varX= $var1 + $var2". I"m not sure what you are really implying here but have to say that, as a rule, you are not validating your data most of the time if that arithmetic line is "normal" for you. That further indicates to me that you have some serious problems with this application that up until now have been ignored but now has to be resolved. Sorry to say but it does look like you have some thinking to do as to how to easily identify where these issues can arise. One solution might be to replace these kinds of lines with a function that analyzes the incoming values before doing the math. The hard part of course is finding these kinds of lines. Good luck!
  14. ginerjm

    Site Won't Submit Multiple Variables

    Looking at what you just posted: //First Page with Selector// <form id="main-search-form" method="GET" action="<?= $baseurl; ?>/_searchresults6.php" role="search"> The first line appears to be a PHP comment line - certainly not an HTML comment. Therefore your next line is confusing since it seems to be plain html that includes some php code which has to cause a syntax error at some point PS - why a GET? Most of the time it is better to use POST for retrieving form data. PS - your error messages refer to the use of "explode". I can't find an "explode" call in any of this code? Wassup?
  15. ginerjm

    bots and forms

    Apparently you don't understand how English works. My sentence did not quote the manual - it made a statement re: the issue you are having. The manual does however specifically tell you that a 0 or '0' will give a false answer - which is the problem you are having. Am I clearer now?
  16. It appears that your from address is correct, assuming that you are actually using a domain that your server recognizes. BTW - Earlier you stated that you were using PHPMailer yet the code you just posted is NOT using PHPMailer. What happened?
  17. ginerjm

    bots and forms

    That pesky PHP manual. It comes in SO VERY handy. If you looked up 'empty' in the manual's function reference you would see very clearly that you can't rely on empty if a 0 or '0' is a possible entry. It is explicitly mentioned there.
  18. Since nothing seems to be happening with this topic, let me ask this: Can you post the php code that is setting up your email headers for us to review? I basically want to see what the from address is set to since you never actually confirmed that for us.
  19. Is the 'from' address in the email a valid address of your domain name? Meaning, if you are paying a host to serve your domain/website and to handle emails for that same domain name, then the emails you send have to use that domain name in the "from" header of the email. That's the way it is always explained here.
  20. ginerjm

    php get url and pass it to a variable possible?

    Add a new field to the output form and use type='hidden'. Then when you received the POST'ed data, be sure to grab that field along with whatever other input fields you are grabbing. Ok? (Perhaps a quick check of your favorite HTML reference would be helpful here.)
  21. ginerjm

    Faking sessions

    Another thing you could do (OTW here) is create a random "value" to store in that uid that is NOT a true user id or anything resembling an important value. Then use that token to do a lookup on a table setup to just store login data and if you find that token value you will have whatever info you need - such as the true user's id. This way - nobody can alter the session value (good luck with that) to another value that could cause you harm since they are all random and not viewable at all by the hacker. This is an awful lot of work to do for something that is pretty darn safe as it is, but if you think that your appl/data is THAT super-sensitive, then go for it! Rather than read the articles that express fear about the safety of Session data, why not find the ones that tell you how sessions really work and how safe they can be?
  22. ginerjm

    browser history broken after form submit

    Let me say this: Double quotes are not responsible for a "variable to be executed". YOU are totally responsible for any "executing" of variables. Using double quotes rather than single quotes allows for a variable to be "interpreted" as in the following: $myvar = 'abc'; echo 'Myvar is now $myvar'; This will produce an output of : Myvar is now $myvar Using this string: echo "Myvar is now $myvar"; will output: Myvar is now abc which is what you usually want to have happen. There is no "executing" going on here. You use double quotes (or no quotes at all!) in order to have the contents of a variable read or interpreted properly. Many beginners run into this problem (single or double?) before they realize the difference. One rarely uses single quotes around php vars unless they are already wrapped inside another (outer) pair of double quotes. For example: echo "Myvar is now '$myvar' " will output the expected value of: Myvar is now 'abc' simply because the outer pair of double quotes takes precedence over the single ones surrounding the var. Of course you can skip using the quotes by using concatenation of your strings but many times it is easier to read the code when strings are properly using the correct quotes.
  23. ginerjm

    php coding to send email from html form

    Regarding the code here - I don't know why you are using the <button> tag in your form but you must have some reason. While the <input> tag is the much preferred method for submitting a form, you can use <button> but you need to actually specifiy the type='submit' clause in it since different browsers may have a different default when you don't specify what you want. Why are you using <button> anyway? PS - input syntax: <input type='submit' name='btn' value='Submit'> A simple example that does a submit for you. You can use any value for it - I just used Submit.
  24. ginerjm

    check if a file is exist in folder

    Or you could write your code like this: $count3 = count($scan3) - 3; if($count1 !== 0) { header('location:exist.html'); exit; } elseif ($count2 !== 0) { header('location:exist.html'); exit; } elseif ($count3 !== 0) { header('location:exist.html'); exit; } While the tabs in this forum are a bit wider than I would like to see, writing your code in simple straight one-command lines is much better to read. My personal choice is to use the curly braces each on their own line as well - again to make it easy on the eyes. NEVER put 2 commands on one line.
  25. ginerjm

    upgrade OR implimentation problem

    I think we would like to see your EXACT table definitions so we can see how you are storing things.

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.