Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. As @Barand said, you need to get those dates updated properly before you do anything else as well as update the code that is putting it into the database.
  2. You obviously do not have $row2['Completion Date'] stored in your db as y-m-d What is the format and what type of column do you have it in. Best thing to do is let mysql format it in your query.
  3. If there is any personal information in the document you should secure it. If you leave it in a public directory, at least put an index file in there to stop directory browsing if you have it enabled.
  4. I assumed you wanted the entire row based on a particular date. Exactly what "columns" of the data do you want?
  5. I will leave it up to you to handle the dates <?php $url = "http://ichart.finance.yahoo.com/table.csv?s=f"; $file = file($url); foreach ($file as $value) { if (stristr($value, '2015-09-10')) { echo $value; } } ?>
  6. I am not interested in how you are trying to do what you think needs to be done. I want to now the ultimate goal, which I understand to be "save each as a single value in the same database table" The only other thing I need to see is the actual data you are working with and where it is coming from. Now your off into stored procedures.
  7. Oh goodness, so not complicated. if you need the id for the image for a url just select the id as well as the image. This will get your URL for for the last one image. Confused about you mentioning 12 images. If you want the last X amount of images you will need to change the code for multiple rows. <?php $sql = "SELECT id, image FROM test_image ORDER BY id DESC LIMIT 1"; $result = mysqli_query($conn, $sql); $row = mysqli_fetch_row($result); ?> <a href="http://padihamcars.com/file_display.php?id=<?= {$row['id']} ?>"><img src="<?= {$row['image']} ?>"></a>
  8. Ok, this is what I was looking for. Lets start from the beginning. What is the source of your array data? I am pretty sure whats going on here is all wrong. You say, save the values in the same table so it sounds like you are getting your data from a table and putting it into an array and then wanting to put it back in. Show me an sql dump of your table with sample data.
  9. @ginerjm, I was wondering why you are putting your connection in a function and passing the DB name. Do you use different DB's in the same application? That would be the only reason I know of to be passing the database name every time you connect. It is very rare that multiple DB's are used in the same app.
  10. This is all you need to get the last image. You are only getting one row. There is no loop needed. SELECT image FROM test_image ORDER BY id DESC LIMIT 1 <?php $sql = "SELECT image FROM test_image ORDER BY id DESC LIMIT 1"; $result = mysqli_query($conn, $sql); $row = mysqli_fetch_row($result); ?> <img src="<?= {$row['image']} ?>">
  11. What has not been mentioned is that you are using obsolete Mysql code that does not work in the latest version of Php. You need to be using PDO with parameterized queries or at the least Mysqli
  12. Thats not the query I gave you. So what is it you want? You want to display the last 12 images or the last single image? What I gave you will give you the last 12 images.
  13. Have you checked to see if there is any data in $actual_image_name? In the following line you have $id, but I dont see it anwhere in your code gettting a value. $actual_image_name = time().$id.".".$ext;
  14. You are using obsolete Mysql code that will not work in the latest version of php and are open to SQL injection. You need to use PDO with prepared statements. But to answer your question: SELECT image FROM test_image ORDER BY id DESC LIMIT 12
  15. Your group_by is in the wrong place.
  16. The funny thing about people talking about their app security is that their server itself is almost always insecure. I mean just basic stuff like being vulnerable to click-jacking, exposing php and apache version, not setting XSS protection etc. 99.9999% of all websites I check can be click-jacked and it is a simple 2 second fix. +1 on using PDO
  17. Thanks to @Jacques1, set_exception_handler is my new best friend. I unloaded a ton of unnecessary try/catch blocks on a very large project I am doing.
  18. Anything free is just going obfuscate your code which basically means to make it humanly unreadable. It is by no means encoded. It is referred to as "Security Through Obscurity". It will keep the average Joe from knowing your code but is easily circumvented by anyone with a little knowledge. You can get godaddy hosting for a dollar a month. Why would you put your site on your partners server if you are worried about him seeing your source code?
  19. Just what is the end result of what your trying to do with your data? I cant think of any reason you would want or need to do this. A lot of times what the code someone presents to us for an answer to is not the code that should be used to reach the ultimate goal.
  20. Zend Encoder and IonCube are two of the top options. https://www.zend.com/en/products/zend-guard http://www.ioncube.com/
  21. There is no point doing the same screenshot for this site. I already told you it is vulnerable just as yours is. @Jacques1 gave you the correct answer how to fix it. It takes like two seconds. Optimally you want to do the fix in the server config rather than application level. Depends on whether you have root access to the server or not. Shared hosting, you will have to do it in the app unless you have .htaccess privleges. I could have just gave you the simple fix, but my belief is you would do better for yourself to look it up and learn about it. On complicated matters I don't mind providing the answers. The Owasp link is probably just going to confuse you. Just do what @Jacques1 said.
  22. Creating multiple forms on the same page is not going to work. As soon as you submit one question/answer set the page is going to refresh. You would also need to identify which one of the many forms you submited (I assume the page createquestions.php you are submitting to is also the page you are creating the questions on. Might work with Ajax) The opening and closing form element need to come out of the loop. You would then need to create the X amount of question/answer sets as an array and loop through it for your insert. Simplest thing to do is just create one Q&A set at a time. Here is similar example of what I mean <?php if ($_POST) { $db = new PDO("mysql:host=localhost;dbname=phphelp_form_array", "user", "pass"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $insertStmt = $db->prepare("INSERT INTO datatable (field1, field2) VALUES (?,?)"); for ($i = 0; $i < count($_POST['field1']); $i++) { $insertStmt->execute(array( $_POST['field1'][$i], $_POST['field2'][$i] )); } } ?> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post"> <b>field1 1</b><br> <label>field1 <input type="text" name="field1[]"></label> <br> <label>field2 <input type="text" name="field2[]"></label> <br> <b>field1 2</b><br> <label>field1 <input type="text" name="field1[]"></label> <br> <label>field2 <input type="text" name="field2[]"></label> <input name="" type="submit" value="Submit"> </form>
  23. What is the point of my post? Is it not clear that I notified you of a security issue you were not aware of? I have not implied anything. I have straight up told you your server has security issues that should be fixed and provided you a screenshot of your site click jacked. There was no code stripped from anywhere. What you should have done if you don't know what click jacking is, is do a 2 second google search on what it is and how to fix it.
  24. +1 I personally prefer an underscore separator as well. first_name Much more readable to me than firstname. Sticking to lowercase will completely eliminate an errors due to wrong case. If you develop on windows (IIS) it is dumb when it comes to case and thinks FIRSTNAME, firstname and FirstName is all the same, then you move it to Linux and run into problems since Linux says they are all different.
  25. Post an SQL dump of your data (Just a couple rows, only need signature column). @Barand's code is correct and works. Need to see how your data actually is in the DB.
×
×
  • 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.