facebook with php
Posted: Fri Jul 30, 2010 12:02 am
hello..
I am newbie to php as well as to your forum also.I am making facebook like website as a project.
i am getting some problems:
1) I do not how to make the border cover whole screen like in login page of facebook. i am getting like your where your heading is there means i want no margins.
2)I want to make a text box which will be displayed only when user has entered something wrong else it will be hidden.
3)I want to pass the variable to third page from first page so that i can display username. for which i have used session but session doesn't save in insert.
4)i want to sh0w updates from friends also..i am working on it but please some main points for it..
here is my code:as extension php is not allowed to attach so pasting the code
login
for insering new user data and checking for valid user
and my profile page:
please reply as soon as possible
I am newbie to php as well as to your forum also.I am making facebook like website as a project.
i am getting some problems:
1) I do not how to make the border cover whole screen like in login page of facebook. i am getting like your where your heading is there means i want no margins.
2)I want to make a text box which will be displayed only when user has entered something wrong else it will be hidden.
3)I want to pass the variable to third page from first page so that i can display username. for which i have used session but session doesn't save in insert.
4)i want to sh0w updates from friends also..i am working on it but please some main points for it..
here is my code:as extension php is not allowed to attach so pasting the code
login
Code: Select all
<?php
session_start();
?><html>
<head>
<title>
Login
</title>
<style type="text/css">
<!--
#header
{
background-color:#036;
padding:10px 0 10px 850px;
margin:0 0 60px 0;
color:#FFF;
}
#signup
{
color:#036;
margin:4px 2px 40px 850px;
}
#form
{
color:#036;
margin:0 2px 40px 870px;}
body {
font-family: Times New Roman, Times, serif;
}
-->
</style>
</head>
<body>
<div id="header">
<form method="post" action="db_finsert.php">
<small>Email
Password
</small><br/>
<input type="text" name="id"/> <input type="password" name="pwd"/> <input class="searchbutton" type="submit"name="submit" value="Login"/><br/>
<input type="checkbox" name="log"><small><em>keep me logged in Forgot your password?</em></small>
</div>
<div>
<h2>
Sign Up
</h2>
</div>
<div id="form">
<small>First Name: <input type="text" name="fname" style="width:15em;"> <br/></small>
<small>Last Name : <input type="text" name="lname" style="width:15em;"> <br/></small>
<small>Your Email: <input type="text" name="email" style="width:15em;"> <br/></small>
<small>I am:
<select name="sex">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Select Sex" selected="Selected Sex">Select Sex</option>
</select>
</small>
<br/>
<p>
<input class="s"type="submit" value="sign up" name="sign up" style="width:5em;"></p>
<br/>
</div>
<div id="warning">
<p><input type="hidden" name="warning" value="You must fill in all the data." >
</p>
</div>
</form>
</body>
</html>Code: Select all
<?php
session_start();
$con=mysql_connect("localhost","root","") or die (mysql_error($con));
mysql_select_db('facebook',$con);
$_SESSION['user']=$_POST['id'];
$user=$_SESSION['user'];
$_SESSION['pass']=$_POST['pwd'];
$pass=$_SESSION['pass'];
if($_POST['submit']=='Login')
{
$query="select username from user where username='$user' and password='$pass'";
$result=mysql_query($query);
if(!$result) {
$err=mysql_error();
print $err;
exit();
}
else if(mysql_num_rows($result)==0){
print "Username or password is not correct";
exit();
}
else{
header("Location: profile.php?user=$user" );
}
}
?>Code: Select all
<?php
session_start();
?>
<html>
<head>
<title>Profile page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
<!--
body,td,th {
font-family:Georgia, "Times New Roman", Times, serif;
color: #000;
}
body {
background-color: #FCF;
}
a:link {
color: #FFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #300;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
color: #090;
}
ul
{
margin:0.5em;
padding:0;
list-style-type:none;
overflow:hidden;
}
li
{
display:inline;
}
-->
</style>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
</head>
<body >
<table cellpadding="0" cellspacing="10" frame="box"/ >
<tr bgcolor="#FFFFFF"/>
<td colspan="2">
<ul>
<li>MYsite | </li>
<li> home | </li>
<li> profile |</li>
<li>
<input align="right" type="text" name="searchbox"/></li>
<li><input align="right" type="submit" name="search" value="Search"/> </li>
</ul>
</tr>
<tr>
<td>
<tr >
<td>
<img align="left" src="taylor-swift1.jpg" border="2" width="140px" height="150px"/>
<h2>Welcome, <?php echo $_SESSION["user"]; ?></h2>
</td>
<td rowspan="2" width="1000px">
friends
</td>
</tr>
<tr>
<td height="10" ><ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="login.php" target="display">Profile</a>
</li>
<li><a href="">Photos</a></li>
<li><a href="">Videos</a></li>
<li><a href="">Messages</a></li>
</ul>
</tr>
</td>
<tr>
<td width="1000px">
<iframe name="display" height="1000px" width="1000px" frameborder="0" scrolling="auto">
</iframe>
</td>
</tr>
</tr>
</table>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>please reply as soon as possible