Jump to content

[SOLVED] come from one page only


ronnie88

Recommended Posts

My understanding was that it's so people can't access the database query page directly, without going through another page first.  in which case, the example i've given is the easiest method to use. 

 

My understanding is probably wrong though - it often is!  :P

lol, well I'm thinking its probably something along the lines of a cron file, or some file that is only accessed at certain times. Which would make sense. In that case, the file should be put in the system root where it can't be touched. Or.... MD5 the file name, and MD5 the folder its in lol, and bolt it all up more secure then Alcatraz.

so users can't gain access by going to the php file to run a mysql command only when you refer by a certain page..

 

But are the users "logged in" to the website at the time. as in, they logged in using a form, and a session var has been set to show they are logged in. If thats the case, then its much easier to make a script to secure the mysql command file.

i probley did it wrong

i placed this into the file that is going to the protected file

<? 
define(ALLOW_PAGE_LOAD, true);
?>

and this in the target file

<?
if (!ALLOW_PAGE_LOAD) die ("You're not allowed to view this page directly");
?>

 

lol I know it was an example but I don't know how I would incorporate it  thanks

 

yea logged in using a session and all

well if there logged in with a session. and if you got there info in a database. grab there ID or username, whatever from the database, and on the mysql script page, check if it equals the ID or username of who you want to have access to it.

well its actually a game start your own virtual airline and manage it... they wait however long there flight is then after the timer stops it gives a link to the php file which has the mysql update and adds the cash to there cash column... Thats what I meant johnny its in the right place..

From some testing I just did I would remit my last post and advise against using $_SERVER['HTTP_REFERER'].

I would do this on the page that does the query:

<?php
session_start()
if(isset($_SESSION['varName']))
{
   die("You're not allowed to view this page directly");
}
$_SESSION['varName'] = "123";
//do query
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.