Jump to content
Larry Ullman's Book Forums

Marie

Members
  • Posts

    148
  • Joined

  • Last visited

Everything posted by Marie

  1. Thank you. This does help. That is one amazing line of accents but I can't forget anyone. It is possible that I will have to set up the sites in different languages - in the furture. Still working on the apostrophe problem. I set up a testing server on my machine and it works fine which is logical because I probably don't have magic quotes enabled. So, back to php.
  2. Thank you for all the helpful information. I am still experimenting with different codes etc. The following did not work for me - Use Sybase-style magic quotes (escape ' with '' instead of \'). Also, it seems that it is not possible to turn Magic Quotes off at the server level so I am still playing around with escaping and stripslashes etc. Josee is right about foreign accets. The form will not accept those either. SO, back to the web site. Marie
  3. Hello, I have examined this further and discovered that it seems it is just the apostrophes that my form does not accept. The code in the book may or may not be correct as I stated, however, when I Register within the page set up on the Knowledge is Power site within the Larry Ullman website the form there will accept a name with an apostrophe. Supposedly I am using the same code in my sample web site although my page will not accept an apostrophe. When I used the stripslashes code above it accepts it but then the backslash shows up in the database which I have discovered indicated that the code has been escaped twice. Will the slashes show up when the data is retrieved from the database? I got in contact with my server but they cannot offer php support. They have told me that magic quotes is on. The more I check into forums books etc. the more I think this should be simple, however, everything I try does not work. I cannot find anything on this in the "php manual". Thanks.
  4. Thanks for giving me a heads up with regard to the French accents since there are plenty of French people living in English Canada and eventually I will have to do my site in French as well. I was wondering about my server because I when I tried to register under the site which is on the Larry Ullman website it worked fine. Thanks very much for your help.
  5. Thanks for posting. The form submitted and I got this in my database - O\'Toole instead of just O'Toole. I was wondering though, why the original code would be incorrect. I was thinking that I may have been missing something in another area, like the config file, or forms function file. Marie
  6. My registration form will not accept any name with a space, hyphen or apostrophe, such as O'Meara or Mary-Lou. The form tells me to "Please enter your first name or last name or username - whichever applies. When I take the space, hyphen, or apostrophe out then the form will submit. I am using the code from the Knowledge is Power sight.<?php // Check for a form submission: if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Check for a first name: if (preg_match ('/^[A-Z \'.-]{2,20}$/i', $_POST['first_name'])) { $fn = mysqli_real_escape_string ($connect, $_POST['first_name']); } else { $reg_errors['first_name'] = 'Please enter your first name!'; } // Check for a last name: if (preg_match ('/^[A-Z \'.-]{2,40}$/i', $_POST['last_name'])) { $ln = mysqli_real_escape_string ($connect, $_POST['last_name']); } else { $reg_errors['last_name'] = 'Please enter your last name!'; } // Check for a username: if (preg_match ('/^[A-Z0-9]{2,30}$/i', $_POST['username'])) { $u = mysqli_real_escape_string ($connect, $_POST['username']); } else { $reg_errors['username'] = 'Please enter a desired name!'; } Hoping that someone can shed some light on this problem. Thanks, Marie
  7. Thank you. I will give this a try but will have to get back to the forum later. Marie
  8. Hello, It seems when I try to add some space between the form field and any visible wording, I lose the form's "stickiness" and also the hints to tell people to fill out a certain field, if it has been done incorrectly. I would like my forms to look nice but can't seem to override this in CSS or in the php code. Marie.
  9. Hello, Thanks for your suggestion. I thought that I had tried to do something with CSS before and it didn't work. However, your suggestion did change the size of the text area but also changed all the other form fields which are now too big. So I will have to do some tweaking but at least I can see that CSS can override the forms function file. CSS is very powerful.
  10. No matter what I do the length of my text area does not change. I can change the depth. I am testing my site on three different browsers and it comes out with either a scroll bar or a tab that the user can pull to a different length. I would like a set box so that the user can see what they type and know how much space they have to use. My text areas are about 1-1/2" wide and I would like it to be 4" wide. I do not see any CSS that would be overriding it. This is the code from the Knowledge is Power web site in the forms_function.inc.php. I have changed the depth to 2 columns. I have tried several different configurations of code but it does not change. // Start creating the textarea: echo '<textarea name="' . $name . '" id="' . $name . '" rows="2" cols="150"'; Thank you, Marie
  11. Hello all, Thank you for your help. I am still wrestling with this and have been working on it throughout the week. Larry, I appreciate you answering my post. I have two of you other books and have been referring to the PHP book and the eCommerce book most often. I thought I had a good understanding of sessions before I encountered this site and tying to integrate the code into my own site. I am using the Knowledge is Power as my model. In the login.inc.php there is a query on the database where the id, username, type and whether or not the account is valid has been selected. Then they have been assigned to a session. // Store the data in a session: $_SESSION['user_id'] = $row[0]; $_SESSION['username'] = $row[1]; So, I presumed that a value and session regarding the username has already been established. However, when I put in $_Session['user_id"] I will get the registrant's id number so that session makes sense although I do not understand where you get the $row[0] from. So I would think that $_Session['username'] would give me the registrant's user name which could be anything - like "happy cat walking" or "fall leaves dropping" or whatever. I ALMOST had it working at one point but it was not consistant. So I usually get my username for the database, as I mentioned above. What I understand is that $_SESSION['username'] is merely the name of the session and the value would be $row[1] although I am not too sure how you determined that value - where it came from. My site is live although sitting in a subdirectory of another site while I do testing. I have been able to reset and change passwords just fine. Wondering why the Knowledge of Power site has a username when it does not appear to be used in the site anywhere. When I was doing this kind of coding in Dreamweaver when my site was on the local host it was working fine. When I upgraded to Snow Leopard I lost the MySql connection and the files are now hidden, so I decided to take it up a notch and make it live. I think this should be simple and of course it would be for you. I guess I don't understand the values that you have assigned to the SESSIONS. Since you have already queried the database I did not want to do it again. SO, is this the route I now take. Query the database for the username only, assign it to another SESSION? Any help at all would be appreciated. Thanks, Marie
  12. Hello all, I believe that I have finally figured this out - at least the route that I would like to take. All of your suggestions would have worked, I am sure, however, I started reading chapter 4 again and discovered what I was looking for on page 73. Personally I work on a MacBook Pro so I don't get into IE at all. Anyway, I changed the code on the form_functions.inc.php page to the following — // Start creating the input: echo '<input type="' . $type . '" name="' . $name . '" id="' . $name . '" size="' . "40" . '"'; You will notice that I added a size to the form inputs. Now it seems that on every page where there are form fields they are all uniformly longer on each page and I only had to change that one include page. Okay, now on to other problems. Marie
  13. Thank you everyone for your comments, Abigail - I threw in your code on the "last name" field of the Registration Form and this is how that code appeared. <p><label for="last_name"><b>Last Name:</b> <input type="text" name="last_name" size="20" maxlength="40" value="<?php echo $ln; ?>" /></p><?php create_form_input('last_name', 'text', $reg_errors); ?></p> When I checked it out I got an undefined variable error - In So, I know I could rework this to make it work. I tried this several times before my original post but the length was always the same as if something was overriding any code that I put into the form. I can see that entering this kind of code in a CSS file would be better since then one would not have to change this on each page where it would appear. However, I still don't see anything where the original "size" or Display Length appear so if the browser's default takes care of this, then I suppose that a person does not have to do anything. Sorry, if it is there, then I am missing it. Don't mean to keep harping on a "point" but just want to learn PHP, etc. inside and out so I do not keep getting these bumps in my web site. Marie
  14. I have been trying various codes and scripting. When I put this on my ResetPassword page - $_SESSION['username'] = $_POST ['username']; print "<h1>Welcome Back {$_SESSION['username']}!<//h1>"; I get this error message - Undefined index: username - referring to the ResetPassword page. If I try to change the Session name on this page I get the undefined index on the login,inc.php page. Thanks Marie
  15. Hello, I looked through the PHP book on the section called Sessions and have inserted this code into my page — <p></p> <p> 'Welcome Back, ' . <?php echo $_SESSION['username'] . '!' ?>;<p></p> and I still get the username for the database not the username for my fake registrants. Should I change the name of the session? I have noticed that the other session name is user_id, and the other is just username. How does the database find user_id when the name of the table is actually users with an s? Thanks, Marie
  16. Thanks Larry, Okay the session is started and the user has logged in and now gone to the Reset Password page. When I have this code inserted - <p> Welcome Back <?php echo $_SESSION['user_id'];?> - I get the logged in user's id number which seems to always be correct when I check the data base. When I have this code inserted - <p> Welcome Back <?php echo $_SESSION['username'];?> - I get my personal, supposed, secret username that lets me into my database NOT the logged in member's username. With the first code I am actually getting into the database and with the second code I am not getting past the database. Am I even close? Or do I get the result I want with a cookie. Marie
  17. Hello, Here is the code that I have in place right now — <p> Welcome Back <?php $_SESSION['username'] = $row[1];?> I guess using user_id to query the database would work. I will see if I can figure that one out. Marie
  18. Hello, I have been attempting a "Welcome Back" type message using a session variable in order to give the user the idea that they have actually logged in. I also understand that his is done with cookies. However, when I put the "user_id" session variable code on my page, I get the registrant's user id so that makes me think I am using the right code, but that is not what I want the user or the world to see. When I use the same code and insert "username", I don't get the registrant's username I get MY actually username for the database. I am basing my test website on the Knowledge of Power site and would like this kind of thing to come up on all pages that the user might pull up as they go through the site. I am still learning PHP and it seems like there are many different ways of writing this language. Thanks, Marie
  19. Hello All, Sorry for not getting back to this post. I gave up on it and got sidetracked on something else. SO, I have not change the size of the visual or width as of yet but understand that this should be CSS. It makes sense. However, I still do not see it in any of the files that I have downloaded for the Knowledge is Power website. I seem to remember something in the book that says it is set to the browser default. This is the kind of code I am used to seeing - <input type="text" name="MiddleName" id="MiddleName" size="40" /> So the size - "40" could be "58" "100" or whatever and it would give the user more space to see their input. Personally I do not like to input something into a form that doesn't let you see the whole email address or name or street address. Thanks, Marie
  20. Thank you, I should have realized that this would be controlled by CSS. I was working on the register.php page under section 2 of the book and just trying to rearrange the fields into a different layout as well as make the length of the "name", "password" fields a little wider. Marie
  21. Hello, I know this should be simple but I cannot see where one can change the length of the text fields in any of the forms, more specifically the register page. Also, I cannot see what is determining the size as they are now. I would like to make them longer in case someone has an extremely long name. Thanks, Marie
  22. Thank you, I guess I didn't examine things as thoroughly as I could have done. Good point about giving people a sense of what the site is all about. This is exactly what I want to do with my "real" site. I have several of your books and am finding the eCommerce book most beneficial as I do not plan to become a full scale web developer. I just want to get my site up and running and have a good idea of what is going on in the code so I can hire an expert to maintain and carry it further if necessary. Marie
  23. Hello, It seems that when I test out the scripts for the first project in the e-commerce book with fake registrants, I can log in even though I have not paid with the Pay Pal sandbox. Would this be a problem if the PayPal was "real". I have looked at the code and do not see any kind of trigger or blocking mechanism, at least not on the Index page or Register page. Marie
×
×
  • Create New...