Jump to content
Killersites Forums


  • Posts

  • Joined

  • Last visited

Everything posted by Virtual-Instructor

  1. Thanks Ben that clears that up a great deal and it now makes sense. I would like to ask a side question about the videos. In each file I have several other files. For example in the PHP Login folder, I have the following files. PHP Login Part 1, 2 and 3. I also have PHP Loin Project files Part 1, 2, 3 & 4. This is common through out most of the video files that I have. What I am trying to figure out is what the Project files are for. When looking at them they look like the code that is being covered in the videos, but what is the purpose of that? Should I be printing these out and taking notes on them as I go, or do they serve another function that I am not aware of as of yet?
  2. Ok that clears things up a bit more. Now I just two follow on questions and I should be good. 1. What does the actual encryption, the md5 or the salt. In this case it seems like it would be the md5. 2. Does the same salt work for all user passwords, or do I have to generate another salt for each password that is loaded to the dbase?
  3. $stmt->bind_param("ss", $input['user'], md5($input['pass'] . $config['salt'])); How about a little clarification here. I've got a pretty firm grip on sql statments and binding the parameters. In this example the addition of the . $config['salt'] is making me take a double take. We set the md5 up in the temp folder then used that code in the config.php. If we are setting the string as an md5, why do we need to append the string with .$config['salt']? md5($input['pass'] . $config['salt'])). I am assuming that the md5 is telling php that this is an encrypted input and for the input we will use the pass variable that we assigned; that makes sence. Adding the . $config['salt'] to the statement tells me that while we have 32 characters, our password is only 5, therefore we will fill in the remaining 27 with the remainder of the random string. This is the way that I am seeing this work in my mind, but I'm not sure if that is correct. Can someone help me out on this one?
  4. Yeah that was it. I'll try walking away from time to time.
  5. Ok this should be working, but for some reason I can't get it to work. I'm trying to work through video 4 of the login series. I've got a pretty good idea of what is going on, but when it comes to the log in errror in refrence to the username and password, I can't seem to get the page to display correctly. I've attached what I get when I enter in the wrong username and password. Below I have copied the code that I am using. if (isset($_POST['submit'])) { //Process the form if($_POST['usernmae'] == '' || $_POST['password'] == '') { //both fields need to be filled in if ($_POST['username'] == '') {$error['user'] = 'required!';} if ($_POST['password'] == '') {$error['pass'] = 'required!';} $error['alert'] = 'Please fill in the Required Fields'; $input['user'] = $_POST['username']; $input['pass'] = $_POST['password']; include('views/v_login.php'); } else { $input['user'] = htmlentities($_POST['username'], ENT_QUOTES); $input['pass'] = htmlentities($_POST['password'], ENT_QUOTES); // create query if ($stmt = $mysqli->prepare("SELECT * FROM members WHERE username=? AND password=?")) { $stmt->bind_param("ss", $input['user'], md5($input['pass'] . $config['salt'])); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { // set session variable $_SESSION['username'] = $input['user']; header('Location: members.php'); } else { // username/password incorrect $error['alert'] = "Username or password incorrect!"; include('views/v_login.php'); } } else { echo "ERROR: Could not prepare MySQLI statement."; } } } else { include('views/v_login.php'); } ?> I'm not seeing any coding errors so this should work.
  6. I figured as much, and I will be looking forward to those videos when I get there. On to part 4!
  7. Ok I've got it now, I found the error. Thanks yet again.
  8. Ok so now that I am working with PHP Logins I have a simple question to ask. The table that I have attached to this post is my members table. In the examples in the PHP Login videos the table contains an ID and a password. Here again I built this table with a little forethoght in mind. Because my site will incorperate several different levels of user, I needed to make sure that I could distinguish between the various roles and then display the appropriate information based on the data returned. What I would like to know is should I continue to use this table for my log in's, or should I keep that seperate. The reason that I ask this is because I will eventually be working with emails and I figured that grabbing that infromation would be very simple if I already have it stored on the dbase for the members table? Anyone have any insight on this? members table.PDF
  9. Weekend at last, time to get on the project

  10. Weekend at last, time to get on the project

  11. .alert { background #feff96; border: 1px solid yellow; padding: 8px; margin-bottom: 20px; } This is the alert code on the style.css page.
  12. Thanks. Ben to the rescue again. But it still won't display in solid yellow background?
  13. I've made yet another error. Ben showed me once how to get rid of that index error, but I don't remember how. The other problem that I have as you will see by the attached file is that my yellow Alert box doesn't show. The actual text shows up, but for some reason the yellow box is missing. style.css code body { font-family: Arial; margin:0; } h1 { background: green; padding: 20px; font-size: 1.2m; color: white; margin: 0 0 20px 0; } #content { padding: 0 20px; } .required { color: red; font-size: .8m; clear:both; padding-top: 20px; } .error { float: left; color: red; display: block; padding: 4px 0 0 10px; font-size: .8m } .alert { background" #feff96; border: 1px solid yellow; padding: 8px; margin-bottom: 20px; } form { overflow: auto; } label { float: left; clear: both; width: 160px; display: block; } input { width: 220px; padding: 2px; margin-bottom: 4px; float: left; } input.submit { float: left; clear:both; width: 80px; margin-top: 20px; } v_login.php <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Log In</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="views/style.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> <h1>Log In</h1> <div id='content'> <form action='' method="post"> <div> <?php if($error['alert'] !='') { echo "<div class='alert'>" .$error['alert']."</div>"; } ?> <label for='username'>Username: *</label> <input type="text" name="username" value="<?php echo $input['user'];?>"><div class="error"><?php echo $error['user']; ?></div> <label for='password'>Password: *</label> <input type="password" name="password" value="<?php echo $input['pass'];?>"><div class="error"><?php echo $error['pass']; ?></div> <p class="required"> * Required Fields</p> <input type="submit" name="submit" class='submit' value="Submit"> </div> </form> </div> </body> </html> login.php // form defaults $error['alert'] = ''; $error['user'] = ''; $error['pass'] = ''; $input['user'] = ''; $input['pass'] = ''; if (isset($_POST['submit'])) { //Process the form if($_POST['usernmae'] == '' || $_POST['password'] == '') { //both fields need to be filled in if ($_POST['username'] == '') {$error['user'] = 'required!';} if ($_POST['password'] == '') {$error['pass'] = 'required!';} $error['alert'] = 'Please fill in the Required Fields'; $input['user'] = $_POST['username']; $input['pass'] = $_POST['password']; include('views/v_login.php'); } } else { include('views/v_login.php'); } ?> Now I'm pretty sure that the error is somewhere between the style.css and v_login.php. Of course I could be wrong here, but anyone that has any insight, I would appriciate it if someone could explain this one to me.
  14. *facepalm* LOL. I can't believe I did that. It's always something simple. I think that we need to make an emoticon for my "DOH" moments. Thanks Ben, I'll give that a try just as soon as I get back to the house.
  15. To both of our new members allow me to extend a warm welcome to you both. Mr.Magoo made a statement about asking questions. I can tell you from experiance that this community is a wealth of knowledge and has the best support staff that I have ever seen. Don't feel embarased to ask something if you don't understand, and when you get a good responce that helps you, vote the post up in the lower right corner, the contributor will appriciate it.
  16. Ok I think I may have missed something but I need a little help in determining where. I'm going through the PHP Login videos right now and I'm on Part 3. I have double and tripple checked everything and still cannont find where I went wrong. I've been following Ben trhough the examples, but for some reason when I check the code in IE, I get what you see on the attached document. The error reporting is directing me back to line 11 of my login.php code, but I don't see where I did anything different than what Ben did, asside from all the notes that I have been taking. Anyone with any insight is welcome to comment. <?php /* * LOGIN.PHP * Log In Members */ // Query the dbase and make sure that the userneame and password that //the user has entered matches what the dbase has. If so set the session variable and direct the member on to the members page. // Sessions are a way to store data along multiple pages. They are temporary so that they will be destroyed when either the destroy function is called or when the browser is closed. They work by temporarily setting a cookie on the users browser that uniqely identifies the users machine and allows them to interact with the server, the server will automatically save variable associated with the user. // start session / load configs. This needs to be the first thing that the server see's. Spaces at the top of the document will cause problems. $session_start(); //Include the needed files. include('includes/config.php'); include('includes/db.php'); // form defaults $error['alert'] = ''; $error['user'] = ''; $error['pass'] = ''; $input['user'] = ''; $input['pass'] = ''; include('views/v_login.php'); ?> session start line 11.PDF
  17. I'm starting to get the hang of this, but I have just enough information to still confuse myself.

  18. I think I have throughly confussed myself Ok so as of now I have established a page to view available training blocks. The table has a hyperlink to "Request Block", which then takes the user to the request schedule page (that code is below). What I am trying to do right now is pass some of the data from the actual record to the form itself which will display the infromation between the header tags. I spent a good deal of time trying to figure out how to get the information out, and I think that what I have right now should work if I have understood everything correctly. My problem is in setting the variables. (see the bolded code below) I'm having trouble trying to figure out how to grab the record id from the Available Training Blocks Page. I know that I am probably just dancing around the anwser, but I'm still so new at this I have a tendency to chase my tail as it were. Not all of the code is here because I'm not finished with it just yet, but if you want to see what I have, then please just let me know. <?php //Connect to the dbase.// include('connection-db.php'); ?> <form action="" method="post"> <div> <h1> <?php if($id != '') { ?> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <p>ID: <?php echo $id; ?></p> <?php }?> <?php //Set the Variables// $mentorid = $my_sqli->query("SELECT mentor_id FROM schedule WHERE id = '?'"); $mentorname = $my_sqli->query("SELECT mentor_first_name FROM schedule WHERE id = '?'"); $date = $my_sqli->query("SELECT avail_date FROM schedule WHERE id = '?'"); $time = $my_sqli->query("SELECT start_time FROM schedule WHERE id = '?'"); if ($id != '') { echo "Request Training flight with" . $mentorid . " - " . $mentorname . "on" . $date . "beginning at" . $time ."."; } else { echo ""; } ?> </h1> <label for='pilotid'>Pilot BVA ID:</label> <input type='text' name='pilot' id='pilotid' size="20"><br /> <label for='pilotname'>Pilot First Name:</label> <input type='text' name='first' id='pilotname' size="20"><br /> <label for='program'>Please Select Your Program:</label> <input type="text" name="program" id="program" size="20"><br /> <label for='type'>Please Select a Flight Type:</label> <input type="text" name="type" id="type" size="20"><br /> <label for='description'>Describe Flight Objective</label> <input type="text" name="descriptioin" id='descriptioin' size="20"><br /> <label for='ac'>Please Select AC Type</label> <input type="text" name="ac" id="ac" size="20"><br /> <input type="submit" name="submit" value="Submit Request"> </div> </form>
  19. Ok this is getting complicated and now I feel like I'm getting nowhere. Try this one on for size. I've been doing some reading, and it looks as though I can't do anything to alter the format in the dbase table. It is set that way it is and its not going to change. Rather than typing out dozens of lines of code to handle this issue for this single form, what if I started a new file and created the functions to handle these issues in that file, then called the function from the file for the form that I am working on. This way, I should be able to keep my code relatively clean and still accomplish my goal.
  20. Thanks for the updated link, that time it worked. I tried using the integer method and that seemed to work, but when it loaded to the dbase it was in the way wrong format. Inputting 14:00 into the form, returned 00:00:14 in the dbase.
  21. Times will be handled in military time, or a 24 hour clock. 13:00, 15:00 and so on. I actually did try the integer method, but it displayed in the dbase all wrong, which leads me to believe that I would have a similar problem when extracting the information. I am of the opintioin that if I could find a way to format the infromation being inserted into the dbase then that would certainly help. But as a basic anwser to your question, the information will deffinately be integer in nature. What I would really like to do is to auto format the entry so that as they type it just naturally fills in. As I said before, right now, at this stage of my learning, I would just be happy making the functionality work, I can go back later and improve on it. Oh and by the way, I tried clicking on the link that you sent me and it didn't work. Said that it wasn't available at this time.
  22. I just found out about the killer sites university. I will be starting that just as soon as I finish my PHP videos. Its a better price than trying to go back to school.

  23. Ben you are a Genius! Ok so then let me clarify so that I understand. $my_sqli = new mysqli($server, $user, $pass, $db); The bold text is a created variable and the italisized text is the actual command line to which we pass the previously established connection variables? If that is true could I then rename the $my_sqli variable to something like $dbconnection? Moving on here. Ok so it would appear that I am getting closer. I have changed nothing in the dbase table but I am now getting a new error as you can see on the attached file. I'm pretty sure that I simply used the wrong data type here. But going off of your previous examples, I figured that the data type was simply the first letter of the data type. Both the start and stop variables are units of time as in hours of the day. Correcting one will probably lead to a correction of both and allow the data to be saved to the dbase. time.PDF
  24. <?php //Create the Variables for the db connection. $server = 'localhost'; $user = 'root'; $pass = ''; $db = 'stc'; //Make the Connection.// $my_sqli = new mysqli($server, $user, $pass, $db); //Return any errors.// mysqli_report(MYSQLI_REPORT_ERROR); ?> This is the code that I use to connect to the db. It is based directly from the other connection that I established for another db that I built to work the examples in the videos.
  25. <?php //Create the Variables for the db connection. $server = 'localhost'; $user = 'root'; $pass = ''; $db = 'stc'; //Make the Connection.// $my_sqli = new mysqli($server, $user, $pass, $db); //Return any errors.// mysqli_report(MYSQLI_REPORT_ERROR); ?> This is the code that I use to connect to the db. It is based directly from the other connection that I established for another db that I built to work the examples in the videos.
  • Create New...