Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by AyKay47

  1. Gotta love it...
  2. Use a nested foreach loop: $bestek = array ('vorken' => 5, 'messen' => 6, 'lepels' => 7); $servies = array ('borden' => 5, 'kopjes' => 6, 'schalen' => 2); $keuken = array ('bestek' => $bestek, 'servies' => $servies); echo "<table border='1'>"; foreach( $keuken as $val ) { foreach( $val as $k => $v ) { echo "<tr>"; echo "<td>" . $k . "</td><td>" . $v . "</td>"; echo "</tr>"; } } echo "</table>";
  3. Yes, sessions are stored in the browser, not a browser tab. That brings us full circle back to the OP. How would it be possible for multiple users to login with the same account? What authentication steps have you taken?
  4. barands post was for information gathering purposes not a solution. If I understand your logic correctly, you first need to solve the problem of iterating through all of the photos in the directory. Perhaps something like this in between the <form> tags: //loop through files foreach( $files as $image ) { //generate html input elements for each image echo "<input type='hidden' name='image[]' value='$image' />"; echo "<input type='text' name='count[]' />"; } Then when validating form input: //perform any scrubbing necessary on user input $image = $_POST['image']; $count = $_POST['count']; //initialize other necessary variables $dateStamp = date("m-d-y"); $timeStamp = date("H:i.s"); $DBHandle = fopen("imageDB.csv", "a"); if($DBHandle) { //iterate through $_POST values from form and insert into csv file foreach( $image as $key => $img ) { $data = "$img,$count[$key],$dateStamp,$timeStamp\n"; fwrite($DBHandle, $data); } } This will display all of the images and corresponding text fields in the same form. When the user submits the form the script will store the necessary data into the csv file. Keep in mind that this is only a skeleton to get you on the right path.
  5. "Array" is what is output when attempting to output an array directly, which is what $files is. To maintain the CSV structure, perhaps implodeing the $files array using a particular character would be the best solution so that you can explode it upon reading the file: $filesStr = implode("-", $files); You could also insert a new line per $files element or store the data inside a database, depends on your logic
  6. Sounds like you need a little more help then just outputting an array index, please post the relevant code so we can help you further.
  7. Jessica brings up a good point that I misread. Why would multiple users use the same credentials to login in the first place?
  8. Place line terminating semi-colons on lines 3 and 4
  9. Typically a "logged in" field in a database will monitor whether or not a user has logged in (0 - not logged in, 1 - logged in). If someone else with the same credentials attempts to log in, validate the login using the "logged in" fields value. This field can also be used with session timeout logic.
  10. $arr = array("1st Sep, 2012 - 31st Aug, 2013") echo $arr[0]; arrays
  11. Define "doesn't work", are any errors received? This bit of code should put you on the right path: WebClient client = new WebClient(); string url = String.Format("http://www.domain.com/mail.php?to={0}&subject={1}&message={2}", "email@email.com", "recipient@email.com", "message"); client.DownloadString(url); // rest of code
  12. Show us code where you are using crypt so we can help you. There are examples in the manual of how to properly use crypt DO NOT use MD5 hashing for passwords.
  13. With strictly PHP I do not believe this to be possible since the form handler would need to process the form before determining if any errors occurred. A better approach would be to handle both the form and any errors that occur on the landing page.
  14. Seems to me like the first solution is analogous to the second solution only it requires much less code to implement. Either way you will need to add additional code with each sub-page that you create. If a user types in an id of say 1000000 then it will trigger the default value of the switch statement which should be a generic page like the home page/main page etc.
  15. Make sure that error_reporting is set to E_ALL or -1 and display_errors is set to ON
  16. Restructure your code (recommended) or send the output before the header to the output buffer.
  17. It does not look like $course_id and $course_password contain any values, are you retrieving them via $_GET?
  18. Then it sounds like you want to create a persistence abstraction layer on top of the PDO layer and create DAOs that "implement" the custom persistence layer. DAOs can be as large or as small as you want them to be, just remember that they should only handle the basic CRUD operations for a particular object.
  19. Adding to what DavidAM has already mentioned regarding passwords, using hashing algorithms such as MD5, SHA1 and SHA256 is discouraged as these algorithms are trivial to crack. A hashing function such as crypt implementing an algorithm such as CRYPT_BLOWFISH coupled with a correctly formatted salt provides the most "computationally expensive" algorithm. Ergo making it extremely difficult and near impossible for an attacker to crack.
  20. Simply googling "Database Normalization" yields many helpful resources.
  21. Before I can adequately answer your questions and go off on a tangent about ORMs and DAOs, I first need to know what exactly it is that you are trying to achieve. I noted that you are attempting to create a DAO, but is that the root of what you are trying to do or is there something else?
  22. This is because you are not wrapping the course_password value in quotes in the SQL statement, so MYSQL thinks you are referring to another column. Change the SQL statement to: $select = "SELECT * FROM tbl_course_titles WHERE course_id = $course_id AND course_password = '$course_password'";
×
×
  • 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.