Rakshi
07-14-2003, 05:53 PM
Go ahead and post your favorite html code, remeber to incluse what it does to though! The good thing about this is just that everybody can share really cool html codes and get some at random!
|
Click to See Complete Forum and Search --> : Post Your Favorite Code Rakshi 07-14-2003, 05:53 PM Go ahead and post your favorite html code, remeber to incluse what it does to though! The good thing about this is just that everybody can share really cool html codes and get some at random! pyro 07-14-2003, 06:18 PM What?? :confused: Vladdy 07-14-2003, 08:36 PM <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> jalarie 07-24-2003, 12:08 PM <opinion type="personal" content="Say What?!" action="ignore" /> Ineedhelp123 07-24-2003, 06:14 PM cmon people!!! this is a good thread... i just wish i had html to show... im dumb Da Warriah 07-24-2003, 07:20 PM my favourite code is this: <html> <body> <table> <tr> <td> <font size="+1"> <p><b>This is my code!</font></b> </td> </tr> </table> </body> </html> *waits for Charles to storm into this thread*:p Ineedhelp123 07-24-2003, 07:46 PM this is mine.... <table>ooo, im a table!</table> mzllr 07-24-2003, 08:04 PM Originally posted by Da Warriah <p><b>This is my code!</font></b> you people are weak... are you going to tell me that not one of you has learned html or gotten tips by looking at others' code??? tight-asses, get over it. everyone learns from everyone else... here's mine for creating a login page with php/mysql... use it, learn from it, change it, who cares??? mzllr 07-24-2003, 08:06 PM index.php [? if (!$HTTP_POST_VARS['submit']) { ?] "] [input type="text" name="uid" value="user"][br] [input type="password" name="pass"][br] [input type="submit" name="submit" value="LogIn"] [? } else { $connect = mysql_connect("localhost", USER, PASSWORD); $select = mysql_select_db(DATABASE, $connect); $query = "SELECT * FROM TABLE WHERE uid= \"$uid\" AND pass= \"$pass\""; $result = mysql_query($query, $connect); // if row exists - login/pass is correct if (mysql_num_rows($result) == 1) { // initiate a session session_start(); // register the user's ID and permission level session_register("SESSION_UID"); session_register("SESSION_SITE"); list($uid, $pass, $site) = mysql_fetch_row($result); $SESSION_UID = $uid; $SESSION_SITE = $site; // redirect to main menu page header("Location:$SESSION_SITE"); mysql_free_result ($result); // close connection mysql_close($connection); } else { // redirect to error page header("Location:error.php"); exit; } } ?] mzllr 07-24-2003, 08:07 PM [? if (!$HTTP_POST_VARS['submit']) { ?] this says that if there is no value for 'submit', display all the code within the first set of brackets. [form name="form" method="post" action="[? echo $PHP_SELF ?]"] this says that once the 'submit' button is pressed to reload the same page. but now there is a value for 'submit', so it will skip the first section and start reading everything below [? } else { ?] . $connect = mysql_connect("localhost", USER, PASSWORD); $select = mysql_select_db(DATABASE, $connect); $query = "SELECT * FROM TABLE WHERE uid= \"$uid\" AND pass= \"$pass\""; $result = mysql_query($query, $connect); this opens a connection to your mysql server and runs a query to check to see if the user id and password match. replace USER, PASSWORD, DATABASE, and TABLE with your actual values. // initiate a session session_start(); // register the user's ID and permission level session_register("SESSION_UID"); session_register("SESSION_SITE"); list($uid, $pass, $site) = mysql_fetch_row($result); $SESSION_UID = $uid; $SESSION_SITE = $site; to pass variables between pages and to validate that the person trying to access your client's site has the privileges to do so, you need to create a session. the other parts not listed are commented as to what they do..... mzllr 07-24-2003, 08:09 PM so now you've got the initial login page set-up, but now you need to keep unauthorized people from accessing your client's site (stored in variable $SESSION_SITE). at the beginning of the page, you need to add a couple of lines of php code that check to see if a session has been initiated and who initiated it. the code to do this is provided below.... some_clients_page.php [? session_start(); if(!session_is_registered("SESSION_UID")) { header("Location:error.php"); exit; } ?] mzllr 07-24-2003, 08:10 PM [? session_start(); if(!session_is_registered("SESSION_UID")) { header("Location:error.php"); exit; } this basically says that if no session has been initiated by SESSION_UID, then the person will be redirected to an error page. if everyting validates, then they will be able to view all the code below.... IncaWarrior 07-24-2003, 08:27 PM maybe no one is posting their favorite code because HTML doesn't HAVE codes. There isn't much that is interesting and you won't learn anything special this way. What you want is javascript. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |