how do i display data on a page from mysql
Posted on
16th Feb 2014 07:03 pm by
admin
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a session
Code: <?php
include_once 'Connect.php';
if (!is_authed())
{
die ('You are not permitted to view this page, <a href="index.php">click here</a> to go back.');
}
?>
connect.php i use to conect to database this also does a included to functions.php
this is part of my functions.php
Code: function user_login($username, $password)
// Now encrypt the data to be stored in the session
$encrypted_id = md5($user['id']);
$encrypted_name = md5($user['username']);
// Store the data in the session
$_SESSION['id'] = $id;
$_SESSION['username'] = $username;
$_SESSION['encrypted_id'] = $encrypted_id;
$_SESSION['encrypted_name'] = $encrypted_name;
}
function is_authed()
{
// Check if the encrypted username is the same
// as the unencrypted one, if it is, it hasn't been changed
if (isset($_SESSION['username']) && (md5($_SESSION['username']) == $_SESSION['encrypted_name']))
{
return true;
}
else
{
return false;
}
}
lastly if i want do display info from the database where it matches the session being used
What code would if any would i use to compliment the code in the first question and what code would i enter into the table below
Code: <html>
<head></head>
<body>
<table>
<tr>
<td>feild1 from database here</td>
<td>feild2 from database here</td>
<td>feild3 from database here</td>
</tr>
</table>
</body>
</html>
No comments posted yet
Your Answer:
Login to answer
167
30
Other forums
Table colours fail when extra row added
Hey Gurus,
I got a weird problem with formating the colour of a table made in php. Everything
article site help remaining text
Hi all hope you will be fine
I am creating a article site in this site i want to put some text on
animation progress while uploading files?
Hello, i have some website form to upload few files to server. i want to put some gif animation whi
need help in update query
hi
i have a dynamic form. i need help in how can i use update query when values from dynamic for
set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli
type check while uploading
Hi Everyone,
How can I check the exact type of a file while uploading on my site?
Here
Help, Base64 encoding url and decoding server side.
Hello everyone, i have a website with videos and games and also provide an embed code which people c
help with email script...
hey
I need help with my mail script
when the form on http://www.mcgdesignstudio.com/c
Ariba 9r - SAP MM Integration
Hi experts,
The standard Ariba adapter for 9r creates a relationship between Cost Centers
Libraries in C++
Hi all,
I have two libraries. one is based targeted on linux platform and uses another li