Jump to content
Larry Ullman's Book Forums

rdburbridgesr

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by rdburbridgesr

  1. Hi Larry, I hadn't edited my post. That editing comment was from kamaboko. I received in email his original post. That is what I was replying to. I'll put it here for you. This is the only time I'll copy/paste in a forum. [ START ] rdburbridgesr, kamaboko has just posted a new topic entitled "Chapter 12. Do Not Understand Login Process" in forum "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)". ---------------------------------------------------------------------- Hello, I've been at this for some time now, and cannot seem to draw a connection as to how login_page.inc.php, login_functions.inc.php, and login.php all work together. For instance, when I go to the URL and type in login.php, it pulls up the content coded in page login_page.inc.php. In this case, the input for the email address and the password. How? I don't see an include or a funciton call in login.php that specifically pulls in login_page.inc.php. This is all very confusing to me. A diagram showing the chain of events would be fantastically useful. For instance, what line of code on which page is affecting another page and some other line of code. Up to this point, I feel pretty good about what I've covered in the book, but now I'm utterly confused. Thanks in advance for your input. K [ END ]
  2. By way of example of that tip: <?php include ('foo.bar'); if ($x == $something) { let's do something if this is true; } else { let's do some else instead; } ?> This looks much cleaner and easier to read especially when you have over 100 lines of this type of coding. I've seen it look like this before. <?php include ('foo.bar'); if ($x == $something) { let's do something if this is true; } else { let's do some else instead; } ?> Now that is to me harder to read and follow, don't you agree. Have a prosporous day. Richard ?>
  3. Think of the login.php as a container or box. Inside that box at the bottom is an include statement for the login_page.inc.php. At the top of the login.php is an include for the login_functions.inc.php page. Entering login.php loads that and everything else inside that box. Because of the beauty of this, it's now all available for use. Now that we have that, you'll notice that the < forms > action tag, reloads the page on submitting. Again, at the top, you'll see it going through the page top to bottom, left to right. This time the $_POST is true and because of that check, the function is called. When your first load login,php, that $_POST call is false, so the code is bypassed and the login pages forms loads instead. As a tip: One of the wonderful things you can to to help yourself, is to indent in a proper way all the coding. It makes it MUCH easier to read and very clean to look at. Hope this helps you. Richard
  4. ################################## I'm sorry, I should have mentioned. That is from the function.js file and also I used my ftp program to get the url of the pictures and it comes back as ftp://ftp.rdburbridge.org/uploads/richard-01.jpg My directory structure starts at public_html. If I go one above that to keep things private as you suggest, then the url completely changes to what I've shown above. Also if I put that url in my browser, of course it will give a popup asking for username/password for the ftp abilities. So I've put the uploads directory in my public_html folder as normal and with the different function as indicated in the last post, it works fine without the $image_size[0] and [1] ability. I have learned so very much from your books and I am very happy and quite proud of myself that I've been able to come this far. All these years I've put websites together but not really knowing what I was doing. I had to purchase other's programs in cgi/perl, javascript and such to accomplish things, but never really knew what all that was doing. I tried to learn this stuff over 15 years ago, but it was very difficult so I just gave up. You - Larry Ullman, have given me a reason to hope and have helped me to become more proud of what I am doing now. Not to mention that I know that the code I am using doesn't have any spyware in it in case those programs I was buying happened to have coding in it so they could watch me. Thank you Mr. Ullman - your efforts have paid off for at least one of us out here. Richard Burbridge
  5. Nothing worked, so here's what I came up with and this does work for the most part. A rewrite (copy paste put together actually): I'm not able to get the windows to adjust because I don't fully understand javascript. So I'm off to the bookstore to get a copy of your javascript manual. ################################################# function popup(mylink, windowname) { if (!window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; david=window.open(href, 'windowname', 'width=500, height=500, left=400, top=150,'); if (window.focus) {david.focus()} if (!david.closed) {david.focus()} return false; #########################################################
  6. It looks strange, but the isset line towards the top - the $GET I already replaced with $_GET and that didn't do anything. I hadn't thought of echoing those lines out to screen, I'll try that and let you know. Just as a side note, in Chapter 18 I had to change the name over from require MYSQL to get it to work. I added a 1 and it worked fine. MYSQL1.
  7. Absolutely, thank you sir images.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-transitional.dtd"> <html xmlns="http://www.w3.org/TR/xhtml"xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Images</title> <script type="text/javascript" charset="utf-8" src="js/function.js"></script> </head> <body> <p>Click on an image to view it in a separate window.</p> <ul> <?php # Script 11.4 - images.php // This script lists the images in the uploads directory. $dir = '../uploads/'; // Define the directory to view. $files = scandir($dir); // Read all the images into an array. // Display each image caption as a link to the JavaScript function: foreach ($files as $image) { if (substr($image, 0, 1) != '.') { // Ignore anything starting with a period. // Get the image's size in pixels: $image_size = getimagesize("$dir/$image"); // Make the image's name URL-safe: $image_name = urlencode($image); // Print the information: echo "<li><a href=\"javascript:create_window('$image_name', $image_size[0], $image_size[1])\">$image</a></li>\n"; } // End of the IF. } // End of the foreach loop. ?> </ul> </body> show_image.php: <?php # Script 11.5 - show_image.php // This page displays an image. $name = FALSE; // Flag variable: // Check for an image name in the URL: if (isset($GET['image'])) { // Make sure it has an image's extension: $ext = strtolower ( substr ($_GET['image'], -4)); if (($ext == '.jpg') OR ($ext == 'jpeg') OR ($ext == '.png')) { // Full image path: $image = "../uploads/{$_GET['image']}"; // Check that the image exists and is a file: if (file_exists ($image) && (is_file($image))) { // Set the name as this image: $name = $_GET['image']; } // End of file_exists( ) IF. } // End of $ext IF. } // End of isset($_GET['image']) IF. // If there was a problem, use the default image: if (!$name) { $image = './images/unavailable.png'; $name = 'unavailable.png'; } // Get the image information: $info = getimagesize($image); $fs = filesize($image); // Send the content information: header ("Content-Type: {$info['mime']}\n"); header ("Content-Disposition: inline; filename=\"$name\"\n"); header ("Content-Length: $fs\n"); // Send the file: readfile ($image);
  8. This is becoming very confusing. Now I have a pop up with the correct dimensions matching the images dimensions, however not even the unavilable.png file shows. Using the properties on what I am seeing in the pop up, first the background colour is all black with the words: The image "http://rdburbridge.org/show_image.php?image=unavailable.png"cannot be displayed because it contains errors. Before clicking the image names to get the pop up, those images do show in the listing properly. Just when I click on each one, the popup adjusts for each images dimensions with this error here: Looking at the View Image Info from that popup, there are two lines: 1) chrome://global/skin/media/imagedoc-darknoise.png 2) http://rdburbridge.org/show_image.php?image=unavailable.png I do not use Chrome. I have checked this in Firefox my primary and MSIE. The unavailable.png is located at http://rdburbridge.org/images/unavailable.pngwhere the other images I have uploaded using the upload.php are outside the domain: ../uploads Very confusing but I have patience and I just know it's going to be educational for me.
  9. Hi Larry, From the View Source using Firefox, it only shows the image name, no path is showing.
  10. Everything with one exception is working fine in showing the images. When I click on any of the images, it will only show the unavailable image. I've renamed the unvailable.png to the extension of jpg. It shows the unavailable.jpg but nothing else. Clicking on tree.jpg shows unavailable.jpg - looking at the page it says tree.jpg and the source code shows tree.jpg. Any thoughts?
  11. So far so good until now. In chapter 12, script 12.7 the following exists and runs fine, but I just don't understand it. In retrieving records and printing them inside the while loop: print "<p><h3>{ From what I have seen thus far, this looks strange and don't understand why the use of the curly and not the parenthesis. Can you please help me understand why replacing the curly with the parin does not work or rather why the curly is needed here? Thank you and your books are awesome. I'm finally getting a grasp on PHP and in so doing is actually helping me understand JavaScript and Perl. Richard Burbridge
×
×
  • Create New...