Jump to content
Larry Ullman's Book Forums

trixiesirisheyes

Members
  • Posts

    6
  • Joined

  • Last visited

trixiesirisheyes's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I like Netbeans so much better, and there are several books on Amazon that talk about NetBeans. The NetBeans site also has tutorials on it.
  2. No, I have th PHP version, I could see PHP as one its options, but it kept asking for which PHP framework I wanted, which I then had to install. I installed Zend Eclipse PDT, and that's better. Aptana only goes up to PHP 5.3, and they've been working on adding support for 5.4 for over a year, based on the info I found out during a Google search. That looks like a pretty great IDE, except for that.
  3. LOL! Yes, it's resolved, more or less. I downloaded the downloads folder for the book, cleared my caches AGAIN in FF and Safari, deleted my script, copied and pasted Larry's script, and after the first time of getting an "unexpected end of line error," I was able to get the script to run the second time. Now I'm going to try to recode the script from scratch again. I was using TextWrangler - the free version of BBEdit, and I don't know what was going on. I've downloaded Netbeans and have absolutely no idea how to set up a PHP project in it (I watched the Quickstart tutorial, but at one point, my screen was asking for info that wasn't on the screen in the tutorial, even making allowances for my being on a Mac in it - it kept asking for a PHP framework). WAY too confusing at this time, and it's unlikely I'll find documentation for NetBeans on my Mac. i could install NetBeans on my virtual machine running Win7, but that's kinda sluggish. I've downloaded Zend Eclipse PDT. We'll see if that's any better. The Eclipse Classic (Mac version) does bad things to my Mac running Lion. I've also downloaded Aptana and Komodo and will play with those. Congrats on your team winning!
  4. I'm sorry, I don't understand. "You do posting to register.php which is not posted here." No, the script I posted is from register.php. This is the entire content from register.php from the 8.3 script in his downloads file. And this is the script I'm trying to run.
  5. Interestingly, as I said, even the author's code didn't work. I copied and pasted Larry's script into my file, and still an error message. Eclipse never did install on my Mac (I tried about 3-4 months ago), and Netbeans is Java-based, which I've disabled. I'll post the code from the 8.3 script in Larry's downloads folder: <?php # Script 8.3 - register.php $page_title = 'Register'; include ('includes/header.html'); // Check if the form has been submitted: if (isset($_POST['submitted'])) { $errors = array(); // Initialize an error array. // Check for a first name: if (empty($_POST['first_name'])) { $errors[] = 'You forgot to enter your first name.'; } else { $fn = trim($_POST['first_name']); } // Check for a last name: if (empty($_POST['last_name'])) { $errors[] = 'You forgot to enter your last name.'; } else { $ln = trim($_POST['last_name']); } // Check for an email address: if (empty($_POST['email'])) { $errors[] = 'You forgot to enter your email address.'; } else { $e = trim($_POST['email']); } // Check for a password and match against the confirmed password: if (!empty($_POST['pass1'])) { if ($_POST['pass1'] != $_POST['pass2']) { $errors[] = 'Your password did not match the confirmed password.'; } else { $p = trim($_POST['pass1']); } } else { $errors[] = 'You forgot to enter your password.'; } if (empty($errors)) { // If everything's OK. // Register the user in the database... require_once ('../mysqli_connect.php'); // Connect to the db. // Make the query: $q = "INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES ('$fn', '$ln', '$e', SHA1('$p'), NOW() )"; $r = @mysqli_query ($dbc, $q); // Run the query. if ($r) { // If it ran OK. // Print a message: echo '<h1>Thank you!</h1> <p>You are now registered. In Chapter 11 you will actually be able to log in!</p><p><br /></p>'; } else { // If it did not run OK. // Public message: echo '<h1>System Error</h1> <p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p>'; // Debugging message: echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $q . '</p>'; } // End of if ($r) IF. mysqli_close($dbc); // Close the database connection. // Include the footer and quit the script: include ('includes/footer.html'); exit(); } else { // Report the errors. echo '<h1>Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { // Print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p><p><br /></p>'; } // End of if (empty($errors)) IF. } // End of the main Submit conditional. ?> <h1>Register</h1> <form action="register.php" method="post"> <p>First Name: <input type="text" name="first_name" size="15" maxlength="20" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /></p> <p>Last Name: <input type="text" name="last_name" size="15" maxlength="40" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /></p> <p>Email Address: <input type="text" name="email" size="20" maxlength="80" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /> </p> <p>Password: <input type="password" name="pass1" size="10" maxlength="20" /></p> <p>Confirm Password: <input type="password" name="pass2" size="10" maxlength="20" /></p> <p><input type="submit" name="submit" value="Register" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form> <?php include ('includes/footer.html'); ?>
  6. I'm getting this error message when I try to open register.php in the browser: Parse error: syntax error, unexpected 'isset' (T_ISSET), expecting '(' in /Applications/mampstack-5.4.10-0/apache2/htdocs/register.php on line 90 Here's the section of code around line 90 (starting at line 75 and ending at line 92, the last isset location): } else { // Report the errors. echo '<h1>Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { // Print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p><p><br /></p>'; } // End of if (empty($errors)) IF. } // End of the main Submit conditional. ?> <h1>Register</h1> <form action="register.php" method="post"> <p>First Name: <input type="text" name="first_name" size="15" maxlength="20" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /></p> <p>Last Name: <input type="text" name="last_name" size="15" maxlength="40" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /></p> <p>Email Address: <input type="text" name="email" size="20" maxlength="80" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /> </p> This is the weird part: I then saved MY script as register1.php, then copied and pasted Larry's script from the downloads folder into the register.php file (after comparing my script with Larry's and finding 1 error much higher in the script), overwriting my own script, then tried to open it in the browser. Same error message. (The code above is from Larry's code.) I'm running PHP 5.4.10-0 and MySql 5.0.10 on a Bitnami MAMPstack. Thoughts?
×
×
  • Create New...