Lecture 13 - Logins - annotated

Lecture 13 - Logins - annotated - Logins INFO/COM S 230...

Info icon This preview shows pages 1–3. Sign up to view the full content.

1 Logins INFO/COM S 230: Intermediate Web Design and Programming PHP commands for MySQL MySQL commands Recall from last time: mysql_connect( hostname, username, password); Returns a MySQL DB link if successful, false otherwise. mysql_select_db( dbname , link ); Selects DB dbname for use given connection link . MySQL commands mysql_query( sqlquery , dblink ); Issues sqlquery to MySQL DB given by dblink. • For INSERT, UPDATE, DELETE, returns true if successful, false if not • For SELECT, returns resource if successful, false if not. mysql_fetch_array( resource, arg ); Returns array containing next tuple from relation given by resource , or false if no more tuples. MySQL commands mysql_num_rows( resource ) Returns the number of rows in the relation given by resource . mysql_close( dblink ) Closes connection to DB given by dblink . Simple logins: A warm-up Easy PDF Creator is professional software to create PDF. If you wish to remove this line, buy it now.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

2 It is pretty easy to have a login without MySQL for protecting one page and one person. Let’s do it… <?php if (!isset($_POST[‘username’]) && !isset($_POST[‘password’])) { ?> <h1>Log in</h1> <form action=”login.php” method=”post”> Username: <input /> <br /> Password: <input /> <br /> <input type=”submit” value=”Submit” /> </form> <?php } elseif ( ) { print(“You have accessed the secret content of this page. \n”); } else { Problems What are some difficulties with this type of login?
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '08
  • hash function, Cryptographic hash function, Easy PDF Creator

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern