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

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 It is pretty easy to have a login without MySQL for protecting one page and one person. Let’s do it… <?php ?> <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? Multiple pages via sessions
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2008 for the course INFO 2300 taught by Professor Williamson during the Spring '08 term at Cornell University (Engineering School).

Page1 / 7

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online