Veramys Posted July 26, 2013 Posted July 26, 2013 Ok so I'm thinking it is simple but I can't think of how I should do it at the moment so I'm asking you all. Say someone is in fedjail and you want them to be able to access one php file. Meaning like fedsupport.php. How would I go about letting them see just that page and no others? Thanks in advance. Quote
Razor42 Posted July 26, 2013 Posted July 26, 2013 if ($ir['fedjail'] => 1) { //file goes in here } else { print "You are not allowed to access here."; } Quote
jcvenom Posted July 26, 2013 Posted July 26, 2013 if ($ir['fedjail'] => 1) { //file goes in here } else { print "You are not allowed to access here."; } if you like i can make you one like torn city were you cann lock replies etc Quote
Veramys Posted July 26, 2013 Author Posted July 26, 2013 I've made the system itself. I just can't figure out why it won't let someone in fed access the file. Tried your way Razor and it wouldn't work. Quote
jcvenom Posted July 26, 2013 Posted July 26, 2013 I've made the system itself. I just can't figure out why it won't let someone in fed access the file. Tried your way Razor and it wouldn't work. does it say at the top include "globals.php"; Quote
jcvenom Posted July 26, 2013 Posted July 26, 2013 Yes it does. thats the problem check your globals for something about fed Quote
HauntedDawg Posted July 26, 2013 Posted July 26, 2013 The header.php if I am not mistaken, is at the bottom of the mainmenu function ( should still be in the header.php file ) Do a search on the header.php for ['fedjail']. You'll then need to put an if statement around it: if($_SERVER['SCRIPT_FILENAME'] != "filenamehere.php") { fed jail stuff here! } Quote
Dominion Posted July 26, 2013 Posted July 26, 2013 The original check is in header.php and looks something like - if ($ir['fedjail'] > 0) Quote
Veramys Posted July 26, 2013 Author Posted July 26, 2013 if ($ir['fedjail'] > 0) { $q = $db->query("SELECT * FROM `fedjail` WHERE `fed_userid` = $userid"); $r = $db->fetch_row($q); die("<span style='font-weight: bold; color:red;'> You have been put in the Pits of Purgatory for {$r['fed_days']} day(s).<br /> Reason: {$r['fed_reason']}<br /> </span></body></html>"); } Yes this is what it is in the header. I'm trying to make it allow a person in fedjail to look at one php file which is fedsupport.php and it doesn't seem to want to work. Quote
HauntedDawg Posted July 26, 2013 Posted July 26, 2013 (edited) Do you have a link for them to click on to go into that file? If you have the include "globals.php" on your fedsupport.php, doing an include won't work. What you can do is something like: <?php if ($ir['fedjail'] > 0) { if($_SERVER['SCRIPT_FILENAME'] != "fedsupport.php") { @header('Location: fedsupport.php'); } } UNTESTED Edited July 26, 2013 by HauntedDawg Quote
Veramys Posted July 26, 2013 Author Posted July 26, 2013 If I take out the globals file it won't let it connect to the database. Also I lose the layout. Quote
HauntedDawg Posted July 26, 2013 Posted July 26, 2013 If I take out the globals file it won't let it connect to the database. Also I lose the layout. Actually, if you take the globals out, and include it from the header. Everything is already set for you, and will only use the content on your fedsupport.php file. Try out the above code, it redirects to fedsupport.php if you are not on it. Quote
Veramys Posted July 26, 2013 Author Posted July 26, 2013 Still doesn't fix the header problem and I still get problems fetching data from the database. Quote
Dominion Posted July 26, 2013 Posted July 26, 2013 Still doesn't fix the header problem and I still get problems fetching data from the database. Check if they are on that file, and don't block them. HD already showed you how simply add it to the if(). Quote
Veramys Posted July 26, 2013 Author Posted July 26, 2013 Idk I guess I'm missing something. I suppose I'll figure it out eventually. Thanks for the help. Quote
Dragon Blade Posted July 26, 2013 Posted July 26, 2013 include"globals_nonauth.php"; It will let you connect to the DB everything with out the globals.php... Quote
jcvenom Posted July 26, 2013 Posted July 26, 2013 create a file called globals_nonauth.php then remove include "globals.php" from the support file Then in globals_nonauth.php add this if (strpos($_SERVER['PHP_SELF'], "globals_nonauth.php") !== false) { exit; } session_name('MCCSID'); @session_start(); if (!isset($_SESSION['started'])) { session_regenerate_id(); $_SESSION['started'] = true; } ob_start(); if (function_exists("get_magic_quotes_gpc") == false) { function get_magic_quotes_gpc() { return 0; } } if (get_magic_quotes_gpc() == 0) { foreach ($_POST as $k => $v) { $_POST[$k] = addslashes($v); } foreach ($_GET as $k => $v) { $_GET[$k] = addslashes($v); } } include "config.php"; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; require_once('global_func.php'); $db = new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c = $db->connection_id; $set = array(); $settq = $db->query("SELECT * FROM `settings`"); while ($r = $db->fetch_row($settq)) { $set[$r['conf_name']] = $r['conf_value']; } That should help you with the global Quote
KyleMassacre Posted July 26, 2013 Posted July 26, 2013 @jcvenom: I removed your last post because I dont think that file should be posted since its part of the core mccodes. I just did a soft delete so if I am wrong then it can be restored but if he is a license holder he can go and download the updated version of mccodes which comes with the global non auth file. and if he's not a license holder then, well tough luck :p Quote
jcvenom Posted July 26, 2013 Posted July 26, 2013 @jcvenom: I removed your last post because I dont think that file should be posted since its part of the core mccodes. I just did a soft delete so if I am wrong then it can be restored but if he is a license holder he can go and download the updated version of mccodes which comes with the global non auth file. and if he's not a license holder then, well tough luck :p no problem kyle i never knew it wasn't allowed sorry Quote
Alan Posted July 26, 2013 Posted July 26, 2013 it has come to my attention that people are stealing my work i am not happy about this and my laywer is on my cases i recently made 3 games anonymouscity,breakoutcity,crimecitymafia and i have found people have stolen all 3 scripts now i am warning you guys anyone that is found using any of those scripts will be brought to court and im serious if you find anyone using these scripts pm me and i will give you 100$ and the game will be handled with my laywer no problem kyle i never knew it wasn't allowed sorrySo on one hand, we publically renounce people who have ""stolen"" scripts, on the other, we blatantly disregard the copyright rules.. Still, as CE/MWG has never really had that much of a clean record, and even a casual glance around these forums is sufficient to build an almost 100% complete (ignoring staff functions) McCodes V1 & V2, I guess posting such material can really be considered "fair use". Discuss ;) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.