I use the below to verify user login. I first check the cookie for the id, ip and a unique id. If it's set then I move on to verifying that they all belong together. I usually copy and paste everything on a page that needs verification and I just edit the "we are good...." part.
Login verification
<?php
//Check to see if cookie is set
if (isset($_COOKIE['id']) && isset($_COOKIE['ip']) && isset($_COOKIE['uniqueid'])){
$cookieid = $_COOKIE['id'];
$cookieip = $_COOKIE['ip'];
$cookieuniqueid = $_COOKIE['uniqueid'];
require('header.php');
//Select id and loginip according to cookie uniqueid
$query = "SELECT * FROM user WHERE uniqueid = '$cookieuniqueid' LIMIT 1";
if ($result = mysql_query ($query)) {
while ($row = mysql_fetch_array ($result)) {
$id = $row['id'];
$uniqueid = $row['uniqueid'];
$ip = $row['ip'];
}
}
//Compare cookie ip and id with query loginip and id --- if cookies match database then we allow
if ($_COOKIE['id'] == $id && $_COOKIE['ip'] == $ip && $_COOKIE['uniqueid'] == $uniqueid) {
?>
we are good....
<?php
require('footer.php');
//End cookie compare
}
//Redirect to index if cookie compare fails
else {
header('Location: index.php');
}
//End cookie set
}
//Redirect to index if cookie is not set
else {
header('Location: index.php');
}
?>
I was wondering if there was a way for me to just do something like:
<?php
require('verify.php');
//If not logged in user wont see the below..
?>
Login user sees this
Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a new user when I'm not logged in. It should redirect me back to the login page but I get this
newbie question
Hi out thereIm totaly new in this forum and to .net and vb so here is a totaly newbie question.I want to make a couter display how many times ive clicket a buttonWhy does my code alwas start over at 0
Must be a string? Huh, what? HELP?
with the following script, I get Fatal error: Property name must be a string in /home/content/e/s/o/esone/html/test/123.php on line 24Anyone maybe know what is causing it?Code: <?phpfunction
Security Exception on pages using AJAX
I am getting the exception: attempted to perform an operation not allowed by the security policy on my AJAX pages. If i remove the AJAX control it works.
Load file in PHP
I have 2 files. The first is a PHP generated XML file that's dependent by 2 inputs. The second is a PHP file that grabs the content of the XML file.So I have
Using the $_GET variable to view certain records
Hello,First let me explain my problem, I have 2 pages the first page pull a list of Guide titles from a database for example if i had a guide called "Install windows" it would be pulled from
Creating web pages by php
Hello again,I was just wondering us there a way to use a php script to create a new web page. I guess the best example is something like YouTube where when a video is uploaded, it's assigned a new
How to assign JS screen.width to ASP.Net variable
I've got this ASP.net routine that gets the cookie value of the screen width, but now I need to change it so that it gets the width using Javascript, in case the users don't have cookies enabled.
Auto install
Hi I have a directory lets say "apps" that I then have more folders ie "email", "projectmanagment" now each of these "apps" need a mysql table, each of these
How to clone an SAP ECC using bacup tape on z/os?
We want to clone our production to a different SID using backup tape.