this is from the dummies book create new account ... <?php /* File: login_form.inc * Desc: Displays login page. Page displays two forms: * one form for entering an existing login name * and password and another form for the * information needed to apply for a new account. */ include(“function12.incâ€); ?> <html> <head> <title>Members Only Login</title> <style type=â€text/cssâ€><!-- .bold_right {font-weight: bold; text-align: right;} .gray_banner { font-weight: bold; color: white; background-color: gray; text-align: center; font-size: 3em;} .bold_large {font-size: 1.1em; font-weight: bold;} --></style> </head> <body style=â€margin: 0â€> <table border=â€0†cellpadding=â€5†cellspacing=â€0â€> <tr><td colspan=â€3†class=â€gray_bannerâ€> Members Only Section</td></tr> <tr><td width=â€33%†valign=â€top†class=â€bold_largeâ€> Are you a member? <!-- form for Member login --> <form action=â€Login.php†method=â€POSTâ€> <p><table border=â€0â€> <?php #30 if (isset($message)) { echo “<tr><td style=’color: red’ colspan=’2’ >$message <br /></td></tr>â€; } ?> <tr><td class=â€bold_rightâ€>Username</td> <td><input type=â€text†name=â€fusername†size=â€20†maxsize=â€20â€></td></tr> <tr><td class=â€bold_rightâ€>Password</td> <td><input type=â€password†name=â€fpassword†size=â€20†maxsize=â€20â€></td></tr> <input type=â€hidden†name=â€do†value=â€loginâ€> <tr><td style=â€text-align: center†colspan=â€2â€> <br /><input type=â€submit†name=â€log†value=â€Enterâ€></td></tr> </table> </form> </td> <td style=â€width: 1; background-color: grayâ€></td> <td style=â€width: 67%â€><p> <span class=â€bold_largeâ€>Not a member yet?</span> Get discounts, a newsletter, advance notice of new pets, much more. Fill in the information below and join. It’s easy and free!</p> <!-- form for new member to fill in --> <form action=â€Login.php†method=â€POSTâ€> <table border=â€0†width=â€100%â€> <?php #60 if (isset($message_new)) { echo “<tr><td style=’color: red; font-weight: bold’ colspan=’2’> <p>$message_new</p></td></tr>â€; } ?> <tr><td class=â€bold_rightâ€>Member ID</td> <td><input type=â€text†name=â€loginName†value=â€<?php echo @$loginName ?>†size=â€20†maxlength=â€20â€></td></tr> <tr><td class=â€bold_rightâ€>Password</td> <td><input type=â€password†name=â€password†value=â€<?php echo @$password ?>†size=â€10†maxlength=â€8â€></td></tr> <tr><td class=â€bold_rightâ€>First Name</td> <td><input type=â€text†name=â€firstName†value=â€<?php echo @$firstName ?>†size=â€40†maxlength=â€40â€></td></tr> <tr><td class=â€bold_rightâ€>Last Name</td> <td><input type=â€text†name=â€lastName†value=â€<?php echo @$lastName ?>†size=â€40†maxlength=â€40â€></td></tr> <tr><td class=â€bold_rightâ€>Street</td> <td><input type=â€text†name=â€street†value=â€<?php echo @$street ?>†size=â€55†maxlength=â€50â€></td></tr> <tr><td class=â€bold_rightâ€>City</td> <td><input type=â€text†name=â€city†value=â€<?php echo @$city ?>†size=â€40†maxlength=â€40â€></td></tr> <tr><td class=â€bold_rightâ€>State</td> <td><select name=â€stateâ€> <?php $stateName=getStateName(); $stateCode=getStateCode(); for ($n=1;$n<=50;$n++) { $state=$stateName[$n]; $scode=$stateCode[$n]; echo “<option value=’$scode’â€; if ($scode== “ALâ€) echo “ selectedâ€; echo “>$state\nâ€; } ?> </select> <b>Zip</b> <input type=â€text†name=â€zip†value=â€<?php echo @$zip ?>†size=â€10†maxsize=â€10â€> </td></tr> <tr><td class=â€bold_rightâ€>Phone</td> <td><input type=â€text†name=â€phone†350 Part IV: Applications value=â€<?php echo @$phone ?>†size=â€15†maxlength=â€20â€> <b>Fax</b> <input type=â€text†name=â€fax†value=â€<?php echo @$fax ?>†size=â€15†maxlength=â€20â€></td></tr> <tr><td class=â€bold_rightâ€>Email Address</td> <td><input type=â€text†name=â€email†value=â€<?php echo @$email ?>†size=â€55†maxlength=â€67â€></td></tr> <input type=â€hidden†name=â€do†value=â€newâ€> <tr><td> </td> <td style=â€text-align: centerâ€> <input type=â€submit†value=â€Become a Memberâ€></td> </tr> </table> </form> </td> </tr> <tr><td colspan=â€3†style=â€background-color: grayâ€> </td></tr> </table> <div style=â€text-align: center; font-size: .8emâ€> All comments and suggestions are appreciated. Please send comments to <a href=â€mailto:webmaster@petstore.comâ€> [EMAIL="webmaster@petstore.com"]webmaster@petstore.com[/EMAIL]</a></div> </body></html> Code (markup): ... login form <?php /* Program: Login.php * Desc: Login program for the Members Only section of * the pet store. It provides two options: * (1) login using an existing Login Name and * (2) enter a new login name. Login Names and * passwords are stored in a MySQL database. */ session_start(); include(“dogs.incâ€); switch (@$_POST[‘do’]) { case “loginâ€: $cxn = mysqli_connect($host, $user,$passwd,$dbname) or die (“Couldn’t connect to server.â€); $sql = “SELECT loginName FROM Member WHERE loginName=’$_POST[fusername]’â€; $result = mysqli_query($cxn,$sql) or die(“Couldn’t execute query.â€); $num = mysqli_num_rows($result); if ($num > 0) // login name was found { $sql = “SELECT loginName FROM Member WHERE loginName=’$_POST[fusername]’ AND password=md5(‘$_POST[fpassword]’)â€; $result2 = mysqli_query($cxn,$sql) or die(“Couldn’t execute query 2.â€); $num2 = mysqli_num_rows($result2); if ($num2 > 0) // password is correct { $_SESSION[‘auth’]=â€yesâ€; $logname=$_POST[‘fusername’]; $_SESSION[‘logname’] = $logname; $today = date(“Y-m-d h:i:sâ€); $sql = “INSERT INTO Login (loginName,loginTime) VALUES (‘$logname’,’$today’)â€; $result = mysqli_query($cxn,$sql) or die(“Can’t execute insert query.â€); header(“Location: Member_page.phpâ€); } else // password is not correct { $message=â€The Login Name, ‘$_POST[fusername]’ exists, but you have not entered the correct password! Please try again.<br />â€; include(“login_form.incâ€); } } elseif ($num == 0) // login name not found { $message = “The Login Name you entered does not exist! Please try again.<br>â€; include(“login_form.incâ€); } break; case “newâ€: /* Check for blanks */ foreach($_POST as $field => $value) { if ($field != “faxâ€) { if ($value == “â€) { $blanks[] = $field; } } } if(isset($blanks)) { $message_new = “The following fields are blank. Please enter the required information: “; foreach($blanks as $value) { $message_new .= “$value, “; } extract($_POST); include(“login_form.incâ€); exit(); } /* Validate data */ foreach($_POST as $field => $value) { if(!empty($value)) { if(eregi(“nameâ€,$field) and !eregi(“loginâ€,$field)) { if (!ereg(“^[A-Za-z’ -]{1,50}$â€,$value)) { $errors[]=â€$value is not a valid name.â€; } } if(eregi(“streetâ€,$field) or eregi(“addrâ€,$field) or eregi(“cityâ€,$field)) { if(!ereg(“^[A-Za-z0-9.,’ -]{1,50}$â€,$value)) { $errors[] = “$value is not a valid address or city.â€; } } if(eregi(“stateâ€,$field)) { if(!ereg(“[A-Za-z]{2}â€,$value)) { $errors[]=â€$value is not a valid state.â€; } } if(eregi(“emailâ€,$field)) { if(!ereg(“^.+@.+\\..+$â€,$value)) { $errors[] = “$value is not a valid email address.â€; } } if(eregi(“zipâ€,$field)) { if(!ereg(“^[0-9]{5,5}(\-[0-9]{4,4})?$â€, $value)) { $errors[]=â€$value is not a valid zipcode.â€; } } if(eregi(“phoneâ€,$field) or eregi(“faxâ€,$field)) { if(!ereg(“^[0-9)(xX -]{7,20}$â€,$value)) { $errors[] = “$value is not a valid phone number. “; } } } // end if empty } // end foreach if(@is_array($errors)) { $message_new = “â€; foreach($errors as $value) 342 Part IV: Applications { $message_new .= $value.†Please try again<br />â€; } extract($_POST); include(“login_form.incâ€); exit(); } /* clean data */ $cxn = mysqli_connect($host,$user,$passwd,$dbname); foreach($_POST as $field => $value) { if($field != “Button†and $field != “doâ€) { if($field == “passwordâ€) { $password = strip_tags(trim($value)); } else { $fields[]=$field; $value = strip_tags(trim($value)); $values[] = mysqli_real_escape_string($cxn,$value); $$field = $value; } } } /* check whether user name already exists */ $sql = “SELECT loginName FROM Member WHERE loginName = ‘$loginName’â€; $result = mysqli_query($cxn,$sql) or die(“Couldn’t execute select query.â€); $num = mysqli_num_rows($result); if ($num > 0) { $message_new = “$loginName already used. Select another User Name.â€; include(“login_form.incâ€); exit(); } /* Add new member to database */ else { $today = date(“Y-m-dâ€); $fields_str = implode(“,â€,$fields); $values_str = implode(‘“,â€â€™,$values); $fields_str .=â€,createDateâ€; $values_str .=’â€â€™.â€,â€.’â€â€™.$today; $fields_str .=â€,passwordâ€; $values_str .= ‘“‘.â€,â€.â€md5â€.â€(‘“.$password.â€â€™)â€; $sql = “INSERT INTO Member “; $sql .= “(“.$fields_str.â€)â€; $sql .= “ VALUES “; $sql .= “(“.’â€â€™.$values_str.â€)â€; $result = mysqli_query($cxn,$sql) or die(“Couldn’t execute insert query.â€); $_SESSION[‘auth’]=â€yesâ€; $_SESSION[‘logname’] = $loginName; /* send email to new member */ $emess = “A new Member Account has been set up. “; $emess.= “Your new Member ID and password are: “; $emess.= “\n\n\t$loginName\n\t$password\n\nâ€; $emess.=â€We appreciate your interest in Petâ€; $emess.= “ Store at PetStore.com. \n\nâ€; $emess.= “If you have any questions or problems,â€; $emess.= “ email [EMAIL="webmaster@petstore.com"]webmaster@petstore.com[/EMAIL]â€; $ehead=â€From: [EMAIL="member-desk@petstore.com"]member-desk@petstore.com[/EMAIL]\r\nâ€; $subj = “Your new Member Account from Pet Storeâ€; $mailsnd=mail(“$emailâ€,â€$subjâ€,â€$emessâ€,â€$eheadâ€); header(“Location: New_member.phpâ€); #218 } break; default: include(“login_form.incâ€); } ?> Code (markup): somebody please help ..
ok .. one really stupid question .. which one is going to be my index.html home page .. or index.php homepage ?
thanks.. i think i started this a month ago.. did not had any clue like where to start etc..after reading a few books i have decided to start here.. now i have a wamp server .. i have not configured a user and a password for mysql..do i really need that ? i have created a database (database name ) and table in it .. with phpmyadmin now i cannot make an html form insert data into the database .. how do i do that?