NSA
sudo apt-get thefuckout.tar.gz
- Dec 9, 2011
- 715
- 86
Hey guys,
Doing a project for College and I need to be able to display information from a database.
I currently have a profile.php page which set's some variables, send's them to another PHP file which acts as a CSS file.
The problem I am having is, it doesn't update unless I "refresh the page". If I go directly to the url profile.php?id=Josh it will still display for instance Anna's username from "profile.php?id=anna". But when I refresh the new one, it updates to "Josh".
I am aware of security issues in my code, but it is just for a College project, so don't bawl on at me about security.
Code:
Doing a project for College and I need to be able to display information from a database.
I currently have a profile.php page which set's some variables, send's them to another PHP file which acts as a CSS file.
The problem I am having is, it doesn't update unless I "refresh the page". If I go directly to the url profile.php?id=Josh it will still display for instance Anna's username from "profile.php?id=anna". But when I refresh the new one, it updates to "Josh".
I am aware of security issues in my code, but it is just for a College project, so don't bawl on at me about security.
Code:
Code:
<?php
$_SESSION['localhostrealname'] = "";
include("ban.php");
session_start();
$id = $_SESSION['localhostid'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("vote", $con);
$result = mysql_query("SELECT * FROM layout WHERE username='$id'");
while($row = mysql_fetch_array($result))
{
$background = $row['background'];
$profile_picture = $row['profile_picture'];
$real_name = $row['real_name'];
$_SESSION['localhostrealname'] = "$real_name";
}
mysql_close($con);
?>
<link rel='stylesheet' type='text/css' href='back.php' />
<div id="profile_picture">
</div>
<?php
$id = $_GET['id'];
$_SESSION['localhostid'] = "$id";
?>
<span id="real_name"><?php echo $_SESSION['localhostrealname']; ?></span>