Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


lingolatz last won the day on November 14 2011

lingolatz had the most liked content!

Community Reputation

2 Neutral

About lingolatz

  • Rank
  1. Hmm... alright. Turns out the code I made does not work, unless I am not seeing something else in my code. Also, margaux, your code is not working either.
  2. I have been seeing more and more 'mysqli' stuff around instead of 'mysql' commands. I finally searched it and came up with that it is 'improved'. I did not feel the need to know much more after reading that 'mysql' would be deprecated by the release of PHP 6, so I looked into converting to 'mysqli'. In a simple search, I found this converter tool on a wiki page by mysql.com: http://forge.mysql.com/wiki/Converting_to_MySQLi. I backed up one of my directories and tested it locally. I was given this list of results of which files it altered, how many mysql_* functions were found, etc. (what I f
  3. Thank you for the tip, margaux. Here is what I came up with before coming back to check the thread: if ( empty($_POST['username']) ) { $problem = TRUE; print '<p>Please enter a username.</p>'; } { include('../mysql_connect.php'); $query = "SELECT * FROM credentials WHERE username='{$_POST['username']}'"; $result = mysql_query($query, $dbc); if ( !empty($result) ) { $row = mysql_fetch_array($result); $problem = TRUE; print '<p>Sorry, but the username ' . $_POST['username'] . ' is already in use.</p>'; } else { // Username is free! } mysql_close(
  4. I am using what I have learned from the Intro to Databases chapter of the book to create a table that will hold user credentials: id, firstname, lastname, username, email, hash, timestamp are the columns. For the registration page, I want the user to submit the data firstname, lastname, username, email, and the password which will become hash. (hash being the md5($_POST['password']) string). More to the point, I want a mechanism to check whether or not the user's desired username is already taken or not. I initally went to page 361 (Retrieving Data from a Database). I found this code, thi
  5. Larry, I have seen echo used in some other tutorials, but it does not come up in your book (as far as I remember). What is the difference between it and print ? What are the costs and benefits of using each?
  6. I am having trouble understanding how one would go about solving this problem: Does 'configuration file' translate to 'text file', that acts as a sort of configuration file? I do not see what the purpose of this problem is. Why does one want the login credentials defined, a configuration file to hold the credentials, and then the file included in various pages?
  7. Would any HTML tags inside of JavaScript be stripped? var str = "<br />Are you going to take my br bros? D: <br />";
  8. AprilSwenby function make_date_menus(){ $months=array (1=>'January','February','March','April','May','June','July','August','September','October','November','December'); ... } print'<form action="" method="post">'; make_date_menus(); print'</form>'; phpRob function make_date_menus($n, $v = 10) { $months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); ... print '<select name="year">'; for ($y = $n; $y <= ($n + $v); $y++) { print "\n<option value=\"$y\">$y<
  9. First thing I saw was the '!==' for this condition: $open = fopen("$file", 'a+'); //opens my data file while ($line = fgetcsv($open, 200, "\t" )!== FALSE) { As for the rest of your code (put together)... $open = fopen("$file", 'a+'); //opens my data file while ($line = fgetcsv($open, 200, "\t" )!== FALSE) { //breaks my string from $file into parts $n = count($line); if ($_POST['username'] == ($line[$n])) { $problem = TRUE; print '<p>That username has been taken, please try again</p>'; break; } fclose($open); Break down: line 1: You do not need a+,
  10. The 'was removed' was not there when I was running the code. I am pretty sure the page would not have even loaded if the 'was removed' was present, so that is not the problem.
  11. For the list_dir.php script, line 42 sets conditions to determine if an item should be written or not. The conditions are: if ( (is_file($search_dir . '/' . $item)) AND ((substr($item, 0, 1) != '.') ) I rewrote the condition to fit my preferences, and I will be referring to my version when asking my question, so if my code is wrong that could be the problem. But to the best of my knowledge, they are equivalent. if (is_file($search_dir . '/' . $item) && sub_str($item, 0, 1) != '.') The conditions are quite obvious, and stated in the text. But when I execute the
  12. I have grown a strong liking to TextMate. It is not free, and is only compatible with Mac as far as I know, but if you ever have the opportunity, I highly recommend using it. I use Scribes on Ubuntu, and it gets the job done. I also have Geany installed in case Scribes acts up. I have never been a fan of Dreamweaver, especially if you are paying for it. It is too cluttered in my opinion, and for a beginner, one can get lost. I do not really like Notepad++ either, but it has been a while since the last time I used it, perhaps updates has made it better. (For the record, unlike N
  • Create New...