Visual upload [SOLVED]

The place to be if you need help with any phpacademy tutorials.

Visual upload  [SOLVED]

Postby dummyhummy12 » Sun Feb 07, 2010 2:55 pm

i want the menu to be shown when the user is logged in, but it shows me this menu when the user is logged out and logged in:
upload a video or image
albums
profile
index.php file:
[php]
<!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" lang="en" xml:lang="en">
<?php
session_start();
?>
<head>
<title>Visual Upload</title>
<link rel="stylesheet" href="css/layout.css" type="text/css" />
</head>

<body>

<div id="wrapper">


<div id="logo">
<img src="images/logo.png">
</div><!-- logo -->


<div id="logo_right">

<?php

if (isset($_SESSION['user']))
{
echo "<font size='2' face='arial'>Welcome, ".$_SESSION['user']."! / <a href='logout.php' title='Logout'>Logout</a>";

}
else
{
?>
<table class="tlogin">
<form action="login.php" method="POST">
<tr>

<td>
Username:
</td>
<td>
<input type="text" name="user" size="16" maxlength="25" /> <a href="register.php" title="Register a new account">Register</a>
</td>
</tr>

<tr>

<td>
Password:
</td>
<td>
<input type="password" name="password" size="16" maxlength="25" /> <input type="submit" name="submit" value="Log in" />
</td>

</tr>
</form>
</table>
<?php
}
?>
</div><!-- logo_right -->


<div id="nav">

<ul>

<li><a href="#" title="Upload a video or image">Upload</a></li>
<li><a href="#" title="View your albums">Albums</a></li>
<li><a href="#" title="View your profile">Profile</a></li>

</ul>

</div><!-- nav -->


<div id="content">
<p>Some content here</p>
<p>Maybe some more here</p>
</div><!-- content -->

<div id="footer">
Made By <a href="http://phpacademy.info/forum/memberlist.php?mode=viewprofile&u=893" title="Fuzzi0n">Fuzzi0n</a> <!-- DO NOT REMOVE THIS OR YOU BREAK THE COPYRIGHT, AND LEAVE THE SIZE AT 9PT -->
</div><!-- footer -->


</div><!-- wrapper -->

</body>
</html>
[/php]
dummyhummy12
 
Posts: 49
Joined: Fri Jan 15, 2010 5:46 pm
Online: 3h 48m 19s
Karma: 1

Re: Visual upload  [SOLVED]

Advertisment

Advertisment
 

Re: Visual upload

Postby wide_load » Sun Feb 07, 2010 3:17 pm

you can use the same if statement as for the login form.

If $_SESSION['user'] exists then they are logged in.
Image
User avatar
wide_load
Top Contributor
 
Posts: 5560
Joined: Thu Aug 13, 2009 1:04 pm
Online: 13d 13h 43m 13s
Karma: 45

Re: Visual upload

Postby dummyhummy12 » Sun Feb 07, 2010 4:03 pm

thanks! :D
dummyhummy12
 
Posts: 49
Joined: Fri Jan 15, 2010 5:46 pm
Online: 3h 48m 19s
Karma: 1


Return to Tutorial Help

Who's online?

Users browsing this forum: No registered users and 1 guest