Bio Generator Php Project

38
Admin.php <?php session_start(); //Authenticating Users require_once('connect.php'); $query='SELECT * FROM auth'; $result=@mysql_query($query); $num=mysql_num_rows($result); $i=0; while ($i < $num) { $passw=mysql_result($result,$i,"password"); $user=mysql_result($result,$i,"username"); $i++; } if (($_POST["username"] == $user) and ($_POST["password"] == $passw)){ $_SESSION["blogen"] = "true"; } if ($_SESSION["blogen"] == "true"){ ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>BloGenerator Administration- Admin Home</title> <link href="stylesheet.css" rel="stylesheet" type="text/css"> </head> <body> <table width="600" border="0" cellspacing="1" cellpadding="1"> <tr> <td height="60" colspan="2" valign="top"><img src="title.jpg" width="332" height="54"></td> </tr> <tr> <td > <div class="rollover"><a href="admin.php">Admin Home</a> <a href="new.php">New Post</a> <a href="update.php">Update</a> <a href="support.php">Support</a> <a href="index.php">Your Blog</a></div> <div id="adminmain">

description

Bio Generator Php Project

Transcript of Bio Generator Php Project

Page 1: Bio Generator Php Project

Admin.php <?php session_start(); //Authenticating Users require_once('connect.php'); $query='SELECT * FROM auth'; $result=@mysql_query($query); $num=mysql_num_rows($result); $i=0; while ($i < $num) { $passw=mysql_result($result,$i,"password"); $user=mysql_result($result,$i,"username"); $i++; } if (($_POST["username"] == $user) and ($_POST["password"] == $passw)){ $_SESSION["blogen"] = "true"; } if ($_SESSION["blogen"] == "true"){ ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>BloGenerator Administration- Admin Home</title> <link href="stylesheet.css" rel="stylesheet" type="text/css"> </head> <body> <table width="600" border="0" cellspacing="1" cellpadding="1"> <tr> <td height="60" colspan="2" valign="top"><img src="title.jpg" width="332" height="54"></td> </tr> <tr> <td > <div class="rollover"><a href="admin.php">Admin Home</a> <a href="new.php">New Post</a> <a href="update.php">Update</a> <a href="support.php">Support</a> <a href="index.php">Your Blog</a></div> <div id="adminmain">

Page 2: Bio Generator Php Project

Welcome to the BloGenerator Admin Home. <br> Click New Post to begin blogging. Click Update to change your user information. Click Support for help. Click Your Blog to view your blog. </div> </td> </tr> </table> </body> </html> <?php } else { echo "<font color=red>Wrong username or password. Click <a href='login.php'>here</a> to try again.</fonts>"; $_SESSION["error"] = "<font color=red>Wrong username or password. Try again.</fonts>"; } ?>

Page 3: Bio Generator Php Project

Config.php <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>BloGenerator - Blog tool</title> <link href="stylesheet.css" rel="stylesheet" type="text/css"> </head> <body> <table width="600" border="0" cellspacing="1" cellpadding="1"> <tr> <td height="60" colspan="2" valign="top"><img src="title.jpg" width="332" height="54"></td> </tr> <tr> <td > <?php if ($submit) { //the prefix variable $table_prefix= 'blog_'; //here you set the table name for usage in your code define('EXAMPLE_TABLE', $table_prefix. 'table_name'); //the implementation in your query: $sql = "SELECT * FROM " .EXAMPLE_TABLE. " WHERE `something` = 'something'"; require_once('connect.php'); $query=" CREATE TABLE `entries` ( `id` INT NOT NULL AUTO_INCREMENT , `title` TINYTEXT NOT NULL , `text` TEXT NOT NULL , `picture` TINYTEXT, `mood` TINYTEXT, `year` SMALLINT NOT NULL , `month` TINYINT NOT NULL , `day` TINYINT NOT NULL , `time` TIMESTAMP( 14 ) NOT NULL, PRIMARY KEY ( `id` ) ); "; $query1=" CREATE TABLE `about` ( `name` VARCHAR( 30 ) NOT NULL , `email` VARCHAR( 40 ) , `AIM` VARCHAR( 40 ) , `MSN` VARCHAR( 40 ) , `country` VARCHAR( 30 ) , `state` VARCHAR( 20 ) , `dob` TINYTEXT , `gender` VARCHAR( 7 ) ,

Page 4: Bio Generator Php Project

`bio` TEXT, `intrests` TEXT, `picture` TINYTEXT, `ocupation` TINYTEXT ); "; $query2=" CREATE TABLE `blog` ( `template` TINYTEXT NOT NULL , `color1` VARCHAR( 7 ) NOT NULL , `color2` VARCHAR( 7 ) NOT NULL , `color3` VARCHAR( 7 ) NOT NULL , `font1` TINYTEXT NOT NULL , `font2` TINYTEXT NOT NULL , `font3` TINYTEXT NOT NULL , `title` TINYTEXT, `titlefont` TINYTEXT, `sub` TINYTEXT NOT NULL , `subfont` TINYTEXT NOT NULL , `titleimage` TINYTEXT, `bgimage` TINYTEXT ); "; $query3=" CREATE TABLE `auth` ( `username` VARCHAR( 20 ) NOT NULL , `password` VARCHAR( 20 ) NOT NULL ); "; $query4 = "INSERT INTO auth (username, password) VALUES ('$bloguser', '$blogpass')"; $query5 = "INSERT INTO about (name, email, aim, msn, country, state, dob, gender, bio, intrests, picture, ocupation) VALUES ('$name','$email', '$aim','$msn','$country','$state','$dob','$gender','$bio','$intrests','$picture','$ocupation')"; $query6 = "INSERT INTO blog (title, sub, titleimage) VALUES ( '$blogtitle','$blogsub','$blogimg')"; mysql_query($query); mysql_query($query1); mysql_query($query2); mysql_query($query3); mysql_query($query4); mysql_query($query5); mysql_query($query6); mysql_close(); echo "Configuration Complete. <a href='login.php'>Click here</a> to start blogging."; } else{ $host="localhost"; // display form

Page 5: Bio Generator Php Project

if (!isset($_POST['submit'])) { ?> <form method="post" action="<?php echo $PHP_SELF?>"> <table> <tr> <td colspan="2"> Welcome to the BloGenerator configuraton page. Here you can setup your blog. <br> * required fields - all other fields may be left blank if desired </td> </tr> <tr> <td> Blog Settings </td> </tr> <tr> <td> *Blog Administration username:</td><td><input type="Text" name="bloguser" size="50"><br> </td> </tr> <tr> <td> *Blog Administration password:</td><td><input type="Text" name="blogpass" size="50"><br> </td> </tr> <tr> <td> *Blog Title:</td><td><input type="Text" name="blogtitle" size="50"><br> </td> </tr> <tr> <td> Blog Subtitle:</td><td><input type="Text" name="blogsub" size="50"><br> </td> </tr> <tr> <td> Blog Title Image URL:</td><td><input type="Text" name="blogimg" size="50"><br> </td> </tr> <tr> <td> Personal Information (Will be displayed on Blog) </td> </tr>

Page 6: Bio Generator Php Project

<tr> <td> *Name:</td><td><input type="Text" name="name" size="50"><br> </td> </tr> <tr> <td> Picture URL:</td><td><input type="Text" name="picture" size="50"><br> </td> </tr> <tr> <td> Email:</td><td><input type="Text" name="email" size="50"><br> </td> </tr> <tr> <td> AIM:</td><td><input type="Text" name="aim" size="50"><br> </td> </tr> <tr> <td> MSN:</td><td><input type="Text" name="msn" size="50"><br> </td> </tr> <tr> <td> Country:</td><td><input type="Text" name="country" size="50"><br> </td> </tr> <tr> <td> State/Province:</td><td><input type="Text" name="state" size="50"><br> </td> </tr> <tr> <td> Birthday:</td><td><input type="Text" name="dob" size="50"><br> </td> </tr> <tr> <td> Gender:</td><td><input type="Text" name="gender" size="50"><br> </td> </tr> <tr> <td> Ocupation:</td><td><input type="Text" name="ocupation" size="50"><br> </td> </tr> <tr> <td> Bio:</td><td><textarea rows="10" cols="50" maxlength="300" name="bio"></textarea><br> </td> </tr> <tr> <td>

Page 7: Bio Generator Php Project

Intrests:</td><td><textarea rows="10" cols="50" maxlength="300" name="intrests"></textarea><br> </td> </tr> <tr> <td> <input type="submit" name="submit" value="submit"> </td> </tr> </table> </form> <?php } // end if } ?> </div> </td> </tr> </table> </body> </html>

Page 8: Bio Generator Php Project

Connect.php <?php

//Read and follow the clearly marked instructions below.

// <-- Instructions -->

// replace "localhost" with your host name. If you're not sure what to put, leave localhost.

// <--End Instructions -->

$dbhost=localhost;

// <-- Instructions -->

// replace "database_name" with the MySQL database name.

// <--End Instructions -->

$dbname=database_name;

// <-- Instructions -->

// replace "username" with the MySQL database username.

// <--End Instructions -->

$dbusername=username;

// <-- Instructions -->

// replace "password" with the MySQL database password.

// <--End Instructions -->

$dbpassword=password;

$db=mysql_connect ($dbhost, $dbusername, $dbpassword) or die ('Error - cannot connect to the database because: ' . mysql_error());

mysql_select_db($dbname,$db);

?>

Page 9: Bio Generator Php Project
Page 10: Bio Generator Php Project

Index.php <?php

$page=1;

require_once('connect.php');

$query='SELECT * FROM blog';

$result=mysql_query($query);

$num=mysql_numrows($result);

$i=0;

while ($i < $num) {

$blogtitle=mysql_result($result,$i,"title");

$blogsub=mysql_result($result,$i,"sub");

$blogimage=mysql_result($result,$i,"titleimage");

$i++;

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title><?php echo "$blogtitle"; ?></title>

<link href="stylesheet.css" rel="stylesheet" type="text/css">

</head>

<body>

Page 11: Bio Generator Php Project

<table width="600" border="0" cellspacing="1" cellpadding="1">

<tr>

<td height="60" colspan="2" valign="top">

<?php

//Displaying the title

if($blogimage!=null)

{

echo "

<img src=$blogimage></img>

";

}else{

echo "

<div class='maintitle'>

$blogtitle

</div>

<div class='mainsub'>

$blogsub

</div>

";

}

?>

</td>

</tr>

<tr>

<td width="113" height="208" valign="top">

<div class="menu">

<?php

//Displaying personal blogger information

Page 12: Bio Generator Php Project

$query='SELECT * FROM about';

$result=mysql_query($query);

$num=mysql_numrows($result);

$i=0;

while ($i < $num) {

$picture=mysql_result($result,$i,"picture");

$name=mysql_result($result,$i,"name");

$email=mysql_result($result,$i,"email");

$aim=mysql_result($result,$i,"aim");

$msn=mysql_result($result,$i,"msn");

$country=mysql_result($result,$i,"country");

$state=mysql_result($result,$i,"state");

$dob=mysql_result($result,$i,"dob");

$gender=mysql_result($result,$i,"gender");

$bio=mysql_result($result,$i,"bio");

$intrests=mysql_result($result,$i,"intrests");

$ocupation=mysql_result($result,$i,"ocupation");

if($picture!=null)

{

echo "<table><tr><td width='250' align='center'>

<div class='aboutimg'><img src=$picture></img></div>

</td></tr></table>";

}

if($name!=null)

{

echo "<div class='fact'>Name: $name</div>";

}

if($email!=null)

{

echo "<div class='fact'>Email: $email</div>";

}

if($aim!=null)

Page 13: Bio Generator Php Project

{

echo "<div class='fact'>AIM: $aim</div>";

}

if($msn!=null)

{

echo "<div class='fact'>MSN: $msn</div>";

}

if($country!=null)

{

echo "<div class='fact'>Country: $country</div>";

}

if($state!=null)

{

echo "<div class='fact'>State/Province: $state</div>";

}

if($dob!=null)

{

echo "<div class='fact'>Birthday: $dob</div>";

}

if($gender!=null)

{

echo "<div class='fact'>Gender: $gender</div>";

}

if($bio!=null)

{

echo "<div class='fact'>Bio: $bio</div>";

}

if($intrests!=null)

{

echo "<div class='fact'>Intrests: $intrests</div>";

}

if($ocupation!=null)

{

echo "<div class='fact'>Ocupation: $ocupation</div>";

}

Page 14: Bio Generator Php Project

$i++;

}

?>

</div>

<div id="main">

<?php

//Displaying Blog Posts

$query='SELECT * FROM entries ORDER BY time DESC';

$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

?>

<form method='post' action='<?php echo $PHP_SELF;?>'>

<select name='page'>

<?php

$pernum=5;

$pagenum=$num/$pernum;

if($pagenum<1)

{

$pagenum=1;

}

for ($i=0; $i<$pagenum; $i++)

Page 15: Bio Generator Php Project

{

$fornum=$i+1;

echo "<option value='$fornum'>Page $fornum</option>";

}

?>

</select>

<input type='submit' value='Go' name='Go'>

</form>

<?

for ($x=1; $x<=$pernum; $x++)

{

if($page==$x)

{

if($x==1)

{

$i=0;

}

else

{

$i=$x*$pernum-$pernum;

}

while ($i < $num)

{

$id=mysql_result($result,$i,"id");

$title=mysql_result($result,$i,"title");

$text=mysql_result($result,$i,"text");

$picture=mysql_result($result,$i,"picture");

$mood=mysql_result($result,$i,"mood");

$day=mysql_result($result,$i,"day");

$month=mysql_result($result,$i,"month");

Page 16: Bio Generator Php Project

$year=mysql_result($result,$i,"year");

echo "

<div class='entry' height='200'>

<div class='entrytitle'>$month/$day/$year - $title</div>

<table border='0'>

<tr>

<td valign='top'>

<div class='entryimg'><img src='$picture'></img></div>

</td>

<td valign='top'>

<div class='entrytext'>$text</div>

</td>

</tr>

</table>

</div>

";

if($i==$pernum-1)

{

break;

}

$i++;

}

}

}

?>

</div>

</td>

</tr>

</table>

</body>

</html>

Page 17: Bio Generator Php Project

Login.php <?php

session_start();

?>

<html>

<title>BloGenerator</title>

<body>

<form name="login" method="post"

action="admin.php">

<table width="290" border="0" align="center"

cellpadding="4" cellspacing="1">

<tr>

<td colspan="2"><div align="center">Please Log

in

<br>

Use your Blog Administratioin username and password

</div>

</td>

</tr>

<tr>

<td width="99" bgcolor="#3366ff"> <div

align="right">login</div></td>

<td width="181" bgcolor="#3366ff"> <div

algin="left">

<input name="username" type="text"

id="username"></input>

</div></td>

</tr>

<tr>

<td bgcolor="#0033ff"> <div

align="right">password</div></td>

<td bgcolor="#0033ff"> <div align="left">

<input name="password" type="password"

id="password"></input>

Page 18: Bio Generator Php Project

</div></td>

</tr>

<tr>

<td colspan="2"><div align="center">

<input type="submit" name="Submit"

value="Submit"></input>

&nbsp;

<input name="reset" type="reset" id="reset" value="reset"></input>

</div></td>

</tr>

<tr>

<td colspan=2 align=center>

<?php echo $_SESSION["error"]; ?>

</td>

</tr>

</table>

</form>

</body>

</html>

Page 19: Bio Generator Php Project

New.php <?php

session_start();

if ($_SESSION["blogen"] != "true"){

header("Location:login.php");

$_SESSION["error"] = "<font color=red>Wrong Password or User Name</font>";

exit;

}

?>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>BloGenerator Administration - New Post</title>

<link href="stylesheet.css" rel="stylesheet" type="text/css">

</head>

<body>

<table width="600" border="0" cellspacing="1" cellpadding="1">

<tr>

<td height="60" colspan="2" valign="top"><img src="title.jpg" width="332" height="54"></td>

</tr>

<tr>

<td >

<div class="rollover"><a href="admin.php">Admin Home</a>

<a href="new.php">New Post</a>

<a href="update.php">Update</a>

<a href="support.php">Support</a>

<a href="index.php">Your Blog</a></div>

<div id="adminmain">

<?php

if ($submit) {

Page 20: Bio Generator Php Project

require_once('connect.php');

$day=date("d");

$month=date("m");

$year=date("Y");

$year=date("Y");

$month=date("m");

$day=date("d");

$hour=date("h");

$minute=date("i");

$second=date("s");

$time="$year$month$day$hour$minute$second";

$query = "INSERT INTO entries (title, text, picture, mood, year, month, day, time) VALUES ('$title','$text', '$picture','$mood','$year','$month', '$day','$time')";

mysql_query($query);

mysql_close();

echo "New Post submitted";

} else{

// display form

if (!isset($_POST['submit']))

{

?>

Page 21: Bio Generator Php Project

<form method="post" action="<?php echo $PHP_SELF?>">

<table>

<tr>

<td colspan="2">

Welcome to the BloGenerator New Post page.

<br>

</td>

</tr>

<tr>

<td>

Post Title:</td><td><input type="Text" name="title" size="50"><br>

</td>

</tr>

<tr>

<td>

Picture URL:</td><td><input type="Text" name="picture" size="50"><br>

</td>

</tr>

<tr>

<td>

Post:</td><td><textarea rows="10" cols="50" maxlength="300" name="text"></textarea><br>

</td>

</tr>

<tr>

<td>

<input type="submit" name="submit" value="submit">

</td>

Page 22: Bio Generator Php Project

</tr>

</table>

</form>

<?php

} // end if

}

?>

</div>

</td>

</tr>

</table>

</body>

</html>

Page 23: Bio Generator Php Project

Stylesheet.css .menu {

width:253px;

border-top: 1px solid #000000;

border-left: 1px solid #000000;

border-right: 1px solid #000000;

border-bottom: 1px solid #000000;

padding-bottom:10px;

padding-top:5px;

float:left;

}

div.aboutimg{

background-color: #ffffff;

margin-top:5px;

border-bottom: 2px solid #ffffff;

width:250px;

display: block;

}

div.entryimg {

float:left;

padding-top: 3px;

padding-bottom: 3px;

padding-right: 3px;

padding-left: 3px;

margin-top: 3px;

margin-bottom: 3px;

Page 24: Bio Generator Php Project

margin-right: 3px;

margin-left: 3px;

}

div.fact{

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 12px;

border-bottom: 2px solid #ffffff;

color:000000;

padding-top: 1px;

padding-bottom: 3px;

padding-right: 1px;

padding-left: 1px;

border-bottom: 1px solid #000000;

margin-top: 3px;

margin-bottom: 3px;

margin-right: 15px;

margin-left: 15px;

width:220px;

display: block;

}

div.fact:last-child{

border-bottom: 0px solid #000000;

}

div.clear

{

clear:left;

}

.rollover {

Page 25: Bio Generator Php Project

width:103px;

border-top: 1px solid #000000;

height:400px;

float:left;

}

.rollover a {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 13px;

display: block;

border-bottom: 1px solid #000000;

border-right: 1px solid #000000;

border-left: 1px solid #000000;

display: block;

background-color: #3366ff;

width:100px;

font-style: normal;

line-height: normal;

color: #000000;

text-decoration: none;

list-style-type:none;

padding-top: 1px;

padding-bottom: 1px;

padding-right: 1px;

padding-left: 1px;

}

.rollover a:hover {

padding-top: 1px;

padding-bottom: 1px;

padding-right: 1px;

padding-left: 1px;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 13px;

Page 26: Bio Generator Php Project

display: block;

border-bottom: 1px solid #000000;

border-right: 1px solid #000000;

border-left: 1px solid #000000;

display: block;

background-color: #0000ff;

width:100px;

font-style: normal;

line-height: normal;

color: #ffffff;

text-decoration: none;

list-style-type:none;

}

div#adminmain

{

border-top: 1px solid #000000;

background-color: #ffffff;

border-left: 1px solid #000000;

border-right: 1px solid #000000;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 12px;

font-style: normal;

line-height: normal;

color: #000000;

text-decoration: none;

width: 498px;

margin-left: 103px;

padding-left: 11px;

padding-right: 10px;

padding-top: 10px;

padding-bottom: 10px;

border-right: 1px solid #000000;

border-bottom: 1px solid #000000;

Page 27: Bio Generator Php Project

}

div#main

{

border-top: 1px solid #000000;

background-color: #ffffff;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 12px;

font-style: normal;

line-height: normal;

color: #000000;

text-decoration: none;

width: 498px;

margin-left: 254px;

padding-left: 11px;

padding-right: 10px;

padding-top: 5px;

padding-bottom: 5px;

border-right: 1px solid #000000;

border-bottom: 1px solid #000000;

border-left: 1px solid #000000;

}

div.entry

{

border: 1px solid #000000;

padding-left: 5px;

padding-right: 5px;

padding-top: 5px;

padding-bottom: 5px;

margin-top: 5px;

margin-bottom: 5px;

font-family: Verdana, Arial, Helvetica, sans-serif;

Page 28: Bio Generator Php Project

font-size: 12px;

font-style: normal;

line-height: normal;

color: #000000;

text-decoration: none;

}

div.entrytitle

{

font-size: 13px;

padding-bottom:4px;

margin-bottom:4px;

border-bottom: 1px solid #000000;

}

div.entrytext

{

margin-left:10px;

margin-right:5px;

}

div.maintitle

{

font-family: cursive;

font-size: 30px;

font-style: bold;

}

div.mainsub

{

font-family: fantasy;

font-size: 18px;

font-style: normal;

}

Page 29: Bio Generator Php Project
Page 30: Bio Generator Php Project

Support.php <?php

session_start();

if ($_SESSION["blogen"] != "true"){

header("Location:login.php");

$_SESSION["error"] = "<font color=red>Wrong Password or User Name</font>";

exit;

}

?>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>BloGenerator Administration - Support</title>

<link href="stylesheet.css" rel="stylesheet" type="text/css">

</head>

<body>

<table width="600" border="0" cellspacing="1" cellpadding="1">

<tr>

<td height="60" colspan="2" valign="top"><img src="title.jpg" width="332" height="54"></td>

</tr>

<tr>

<td >

<div class="rollover"><a href="admin.php">Admin Home</a>

<a href="new.php">New Post</a>

<a href="update.php">Update</a>

<a href="support.php">Support</a>

<a href="index.php">Your Blog</a></div>

<div id="adminmain">

Welcome to the BloGenerator Support page.

<br>

If you have any problems send an email to <a href="mailto:[email protected]?subject=BloGenerator%20Support">[email protected]</a>. For

Page 31: Bio Generator Php Project

more support information please visit our website at <a href="http://blogenerator.cjb.net">blogenerator.cjb.net</a>

</div>

</td>

</tr>

</table>

</body>

</html>

Page 32: Bio Generator Php Project

Update.php <?php

session_start();

if ($_SESSION["blogen"] != "true"){

header("Location:login.php");

$_SESSION["error"] = "<font color=red>Wrong Password or User Name</font>";

exit;

}

?>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>BloGenerator Administration - Update Information</title>

<link href="stylesheet.css" rel="stylesheet" type="text/css">

</head>

<body>

<table width="600" border="0" cellspacing="1" cellpadding="1">

<tr>

<td height="60" colspan="2" valign="top"><img src="title.jpg" width="332" height="54"></td>

</tr>

<tr>

<td >

<div class="rollover"><a href="admin.php">Admin Home</a>

<a href="new.php">New Post</a>

<a href="update.php">Update</a>

<a href="support.php">Support</a>

<a href="index.php">Your Blog</a></div>

<div id="adminmain">

<?php

if ($submit) {

Page 33: Bio Generator Php Project

require_once('connect.php');

$query='SELECT * FROM entries';

$result=mysql_query($query);

$num=mysql_numrows($result);

if($name==null)

{

$name=mysql_result($result,$i,"name");

}

if($email==null)

{

$email=mysql_result($result,$i,"email");

}

if($aim==null)

{

$aim=mysql_result($result,$i,"aim");

}

if($msn==null)

{

$msn=mysql_result($result,$i,"msn");

}

if($country==null)

{

$country=mysql_result($result,$i,"country");

}

if($state==null)

{

$state=mysql_result($result,$i,"state");

}

Page 34: Bio Generator Php Project

if($dob==null)

{

$dob=mysql_result($result,$i,"dob");

}

if($gender==null)

{

$gender=mysql_result($result,$i,"gender");

}

if($bio==null)

{

$bio=mysql_result($result,$i,"bio");

}

if($intrests==null)

{

$intrests=mysql_result($result,$i,"intrests");

}

if($picture==null)

{

$picture=mysql_result($result,$i,"picture");

}

if($ocupation==null)

{

$ocupation=mysql_result($result,$i,"ocupation");

}

$query = "UPDATE contacts SET name = '$name', email = '$email', aim = '$aim',msn = '$msn', country = '$country', state = '$state', dob = '$dob', gender = '$gender', bio='$bio', ubtrests='$intrests', picture='$picture', ocupation='ocupation'";

mysql_query($query);

mysql_close();

echo "Update Complete";

Page 35: Bio Generator Php Project

} else{

// display form

if (!isset($_POST['submit']))

{

?>

<form method="post" action="<?php echo $PHP_SELF?>">

<table>

<tr>

<td colspan="2">

Welcome to the BloGenerator update page

<br>

</td>

</tr>

<tr>

<td colspan="2">

Personal Information (Will be displayed on Blog)

</td>

</tr>

<tr>

<td>

Name:</td><td><input type="Text" name="name" size="50"><br>

</td>

</tr>

<tr>

<td>

Picture URL:</td><td><input type="Text" name="picture" size="50"><br>

</td>

</tr>

Page 36: Bio Generator Php Project

<tr>

<td>

Email:</td><td><input type="Text" name="email" size="50"><br>

</td>

</tr>

<tr>

<td>

AIM:</td><td><input type="Text" name="aim" size="50"><br>

</td>

</tr>

<tr>

<td>

MSN:</td><td><input type="Text" name="msn" size="50"><br>

</td>

</tr>

<tr>

<td>

Country:</td><td><input type="Text" name="country" size="50"><br>

</td>

</tr>

<tr>

<td>

State/Province:</td><td><input type="Text" name="state" size="50"><br>

</td>

</tr>

<tr>

<td>

Birthday:</td><td><input type="Text" name="dob" size="50"><br>

</td>

</tr>

<tr>

<td>

Gender:</td><td><input type="Text" name="gender" size="50"><br>

</td>

</tr>

<tr>

Page 37: Bio Generator Php Project

<td>

Ocupation:</td><td><input type="Text" name="ocupation" size="50"><br>

</td>

</tr>

<tr>

<td>

Bio:</td><td><textarea rows="10" cols="50" maxlength="300" name="bio"></textarea><br>

</td>

</tr>

<tr>

<td>

Intrests:</td><td><textarea rows="10" cols="50" maxlength="300" name="intrests"></textarea><br>

</td>

</tr>

<tr>

<td>

<input type="submit" name="submit" value="submit">

</td>

</tr>

</table>

</form>

<?php

} // end if

}

?>

Page 38: Bio Generator Php Project

</div>

</td>

</tr>

</table>

</body>

</html>