Jump to content

lemmin

Members
  • Posts

    1,904
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by lemmin

  1. This is a Gas Buddy type website for beer prices. Feel free to add real or fake data. http://beerzip.com http://beerzip.com/phpfreaks.txt I would like to include weekly circular prices from the big supermarkets, but I've tried ad nauseam to contact anyone at a corporate level who could answer any questions. Any ideas on that level? I appreciate any and all feedback. Thanks
  2. You'll have to do some research then. The wp_count_comments() function accepts a post ID, so I would look around that code area for a variable that might contain that. Once you have that, you can add your logic: $comments_num = wp_count_comments($post_id); if ($comments_num > 5) //show more code
  3. Depending on your goal, you might want to set up a listserv.
  4. So what isn't working? Is there just no output, or is there an error? Have you double checked that the ID you are using IS in the database along with an associated size in the related table?
  5. I'm just saying, I don't know what value $XCart_StockID holds, so it might not be what you expect. It NEEDS to have the value from the "select" element.
  6. You could include a difference in your query that would represent a true or false value: SELECT expenses, payments, expenses-payments diff [...] Then, while looping through them: $style = ($row['diff']) ? 'greenstyle' : 'redstyle'; Or do it all in PHP or all in SQL. You probably won't see much of a performance difference either way.
  7. Can you post the exact values of your variables in the query?
  8. Your logic is checking if the MySQL query result is an integer, which it isn't. You want to check the number of rows: Change, if($result == 1) to: if($totalreg == 1)
  9. You will need a simple HTML form: <form method="POST" action="handler.php"> <input type="text" name="key"/> <input type="submit"/> </form> Then, in the PHP file (handler.php in this case): <?php //mysql_connect() //mysql_select_db() $r = mysql_query('SELECT * FROM tbl_code WHERE key = "'.$_POST['key'].'"'); if (mysql_num_rows($r)) header('Location: success.html'); else header('Location: denied.html'); ?> This is very basic, it should work in perfect circumstances. Don't forget to add error handling and input cleaning.
  10. Have you tried other browsers? I think the problem you are having is stemming from how the browser handles iframes specifically. My suggestion is to switch to AJAX for this kind of thing.
  11. Do any of the other links have drop downs? The drop down part would be controlled by Javascript, so you would have to integrate your PHP without that.
  12. Your code is hard to read in blocks like that. You have derived variable variables without showing their instantiation. Anyway, your form submits the StockID as a value of the "select" select (select named select). After submitting your form, $_POST['select'] will contain the StockID that was selected. You should then be able to use that variable in your query.
  13. Post the new code that throws the Javascript error
  14. Assuming this is for WordPress, you probably want to use the wp_count_comments() function: http://codex.wordpress.org/Function_Reference/wp_count_comments More info can be found here: http://codex.wordpress.org/Function_Reference#Comment.2C_Ping.2C_and_Trackback_Functions
  15. If I'm understanding correctly, you need to send the random number back to the server when the user clicks the link? Something like this? <?php if (isset($_GET['rn'])) { mysql_query('SELECT * FROM table WHERE rn = '.$_GET['rn']); } $rn = rand(); echo '<a href="?rn='.$rn.'">random number link</a>'; ?>
  16. So, it validated after adding that line? If so, the next thing to check is whether or not it is the formatting of the output that is the culprit. Try removing the json_encode function and just output the validation variable: echo $valid; And don't forget to remove the die("true") line from the top first.
  17. Are you actually looking at the files' source directly or through the web browser? It looks suspiciously like Cross Site Scripting (XSS - http://hwang.cisdept.csupomona.edu/swa/content/xss.htm). If those files have been edited on the disk, my first guess would be SQL injection, but there are numerous other possibilities. I would check EVERY log that you have. Access logs are a good place to start, but if you can find MySQL errors in your PHP logs, that is a red flag for injection.
  18. Where are you storing the student registration information?
  19. Do you have PHP installed on your server? Is your file a .PHP file?
  20. Why not use the id as the index of your dropdown array instead of the numeric value $c? <select name="<?php echo "dropdown[".$data[$c]."]" ?>" id="<?php echo $data[$c] ?>" ><?php Then you can loop through each drop down like so: foreach ($_POST['dropdown'] as $dbcolumn => $value) Something you should note, though: Accepting the name of a column from user input will leave your application open for SQL injection.
  21. If the form action is actually addproduct-func.php, you will probably want to put a little hook at the beginning of that file (or applicable function) to redirect the data to your new validation function and back out.
  22. To get the Javascript variables, you would have to pass them to the PHP file either directly through the URL or using a form: http://localhost/index.php?page_name=home OR <form action="index.php"> <input type="text" name="page_name"/> <input type="submit"/> </form> In your case, where you want the page from a prompt, this should work: function addPage() { var page_name=prompt("Enter name"); if (page_name!=null) top.location = '?page_name=' + page_name; }
  23. More code would be helpful in solving this. I'm guessing you ARE getting errors, but aren't seeing them. Can you check your error_logs? If you actually aren't getting any errors and nothing is being inserted into that table, then the add() function isn't executing, meaning the $error variable is probably set. Remember, a variable can be empty, but still "set."
×
×
  • 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.