-
Posts
2,921 -
Joined
-
Last visited
-
Days Won
48
Content Type
Profiles
Forums
Events
Everything posted by KyleMassacre
-
The function definition must be in your global functions file. Your Global non-auth file includes your global functions file. So your error is telling me that you do not have that function declared in any file
-
The first error is because you don't have the function in your global funcs file
-
Something like this: echo "<form action=register.php method=post> <table width='75%' class='table' cellspacing='1'> <tr> <td width='30%'>Username</td> <td width='40%'> <input type='text' name='username' onkeyup='CheckUsername(this.value);' /> </td> <td width='30%'><div id='usernameresult'></div></td> </tr> <tr> <td>Password</td> <td> <input type='password' id='pw1' name='password' onkeyup='CheckPasswords(this.value);PasswordMatch();' /> </td> <td><div id='passwordresult'></div></td> </tr> <tr> <td>Confirm Password</td> <td> <input type='password' name='cpassword' id='pw2' onkeyup='PasswordMatch();' /> </td> <td><div id='cpasswordresult'></div></td> </tr> <tr> <td>Email</td> <td> <input type='text' name='email' onkeyup='CheckEmail(this.value);' /> </td> <td><div id='emailresult'></div></td> </tr> <tr> <td>Gender</td> <td colspan='2'> <select name='gender' type='dropdown'> <option value='Male'>Male</option> <option value='Female'>Female</option> </select> </td> </tr> <tr> <td>Class</td> <td colspan='2'> ".class_dropdown(NULL,"classID")." </select> </td> </tr> <tr> <td>Promo Code</td> <td colspan='2'><input type='text' name='promo' /></td> </tr>"; or if your using heredoc: print <<<EOF <form action=register.php method=post> <table width='75%' class='table' cellspacing='1'> <tr> <td width='30%'>Username</td> <td width='40%'> <input type='text' name='username' onkeyup='CheckUsername(this.value);' /> </td> <td width='30%'><div id='usernameresult'></div></td> </tr> <tr> <td>Password</td> <td> <input type='password' id='pw1' name='password' onkeyup='CheckPasswords(this.value);PasswordMatch();' /> </td> <td><div id='passwordresult'></div></td> </tr> <tr> <td>Confirm Password</td> <td> <input type='password' name='cpassword' id='pw2' onkeyup='PasswordMatch();' /> </td> <td><div id='cpasswordresult'></div></td> </tr> <tr> <td>Email</td> <td> <input type='text' name='email' onkeyup='CheckEmail(this.value);' /> </td> <td><div id='emailresult'></div></td> </tr> <tr> <td>Gender</td> <td colspan='2'> <select name='gender' type='dropdown'> <option value='Male'>Male</option> <option value='Female'>Female</option> </select> </td> </tr> <tr> <td>Class</td> <td colspan='2'> EOF; class_dropdown(NULL,"classID") print <<<EOF </select> </td> </tr> <tr> <td>Promo Code</td> <td colspan='2'><input type='text' name='promo' /></td> </tr> EOF;
-
Yes, that server var will take the pagename.php. And you would put in the now "denied" array a list of pages you want to block. For example: $denied = ['gangs.php','explore.php']; The only issue would be your requirements. If you more skilled you could create a relationship table. Which is basically a table with all the pages and then a table with all the requirements, then just loop through those and see if they meet the requirements. :p To achieve that you can look at MySQL joins.
-
Did you switch hosts? If you did, dammit, I could have given you my referral link haha
-
This would be good in Laravel if you have time for the learning curve. If you don't really want to spend time learning something like Laravel you can use let the bashing begin Code Igniter. Or Laravel 4.2 is much easier than 5.*
-
That was an example of a function.
-
Global non auth includes global func. But maybe you have some what of a default register script? If so, you are probably using heredoc/nowdoc. You will have to do what Alan mentioned and kill it to add th function and start it back up after the function
-
You can do what I mentioned and use a switch I guess to change the files around
-
It's because if you have that in global_func.php, it's already included in the file. You can't have two function names that are the same
-
What you can possibly do is create a function inside your global functions that checks the current script name and see if it's in the "allowed" list of scripts or a "black list" of scripts depending on how you wish to do it. And if it is in the list then perform the checks. Then just call that function in globals.php. function isNotAllowed(){ $denied = [] // put all the allowed file names in here. Hardcode them or put them in the db. $page = isset($_SERVER['SCRIPT_NAME']) ? db->escape($_SERVER['SCRIPT_NAME'] : false; if($page) { if(!in_array($page,$denied)) { return false; } else { // put all your conditions in here } } } Yes sloppy, and will need some work
-
That one looks alright but as noted by Dave, it doesn't account for a window not in focus. The script I provided (which I forgot to give credit to for his help with it [MENTION=64684]Dayo[/MENTION]. He helped me a hell of a lot with this) does take into account for people not actually playing the game. Plus it adds a notification if they receive a new mail message. I realized I didn't add events in there but can easily be done.
-
For a shared provider I have never had an issue with Inter Server. I don't know where you are from but they are here in the states
-
I think your host sucks. You should move
-
Your not including it like you do php right? You need to do it like: [script type=text/javascript" src="path/to/your/file.js][/script] Replace the brackets with the correct < or > This forum now strips that stuff even in code tags
-
Did it work?
-
Mine is fully tested and functional so what you have to do is create your JavaScript file and name it whatever you wish, then include that script in your HTML markup ( I generally put it below the body closing tag), you will also need to include the jquery JavaScript library and include that (right above the last JavaScript file) . Download that gritter library I linked up for you and add the folders with the files in your document root and add the JavaScript file for it in between your jquery library and the JavaScript file I made. Then upload that php file I made and name it what you wish but you need to find the URL for the $.ajax call and change it to whatever you named the file. Now your done and it's uploaded and working.
-
Hmm, I'm not seeing an issue with what NSC and Zet have posted. Is there a way you can post what you have and any errors or whatever that you are getting? And also your HTML markup too
-
What exactly were your errors? It's real hard to help without the info
-
Take a look at this: http://lab.mbuonomo.com/notificationcenter/ or: http://thesin-.github.io/notificationcenter/ which is based on the first link. But this one is more like OS X style
-
You are on the right track. But I would like to say that your userid variable wont work with globals_nonauth.php. Here is what I did: Javascript File: var ajaxLoader = function() { /* This is like the __construct function in php any code that is in here will be executed when you do new className() */ }; function notifyMe(message, type) { if (typeof type == 'undefined') { type = 'browser'; } var titleImage = ''; //Put and icon in here to display with the notification switch (type) { case 'browser': // Let's check if the browser supports notifications if (!("Notification" in window)) { alert("This browser does not support desktop notification"); } // Let's check if the user is okay to get some notification else if (Notification.permission === "granted") { // If it's okay let's create a notification var icon = titleImage; var notification = new Notification("Hello!!", { body: message, icon: icon }); } // Otherwise, we need to ask the user for permission else if (Notification.permission !== 'denied') { var icon = titleImage; Notification.requestPermission(function(permission) { // If the user is okay, let's create a notification if (permission === "granted") { var notification = new Notification("Hello!!", { body: message, icon: icon }); } }); } // At last, if the user already denied any notification, and you // want to be respectful there is no need to bother them any more. break; case 'growl': $.gritter.add({ // heading of the notification title: 'New Notification', // the text inside the notification text: message, image: titleImage }); break; } } ajaxLoader.prototype = { onLoad: true, prev: { money: $('#money').html(), level: $('#level').html(), crystals: $('#crystals').html(), energyBar: $('img#energyBar').attr('width'), willBar: $('img#willBar').attr('width'), braveBar: $('img#braveBar').attr('width'), expBar: $('img#expBar').attr('width'), healthBar: $('img#healthBar').attr('width'), mailCount: $('#mail').html(), redbarWill: $('img#wiRedBar').attr('width'), redbarEnergy: $('img#enRedBar').attr('width'), redbarBrave: $('img#brRedBar').attr('width'), redbarExp: $('img#exRedBar').attr('width'), redbarHp: $('img#hpRedBar').attr('width'), energy: $('#energy').html(), health: $('#health').html(), exp: $('#exp').html(), will: $('#will').html(), brave: $('#brave').html() }, /* Make an array of previous results so we can check against this */ callAjax: function() { var self = this; /* used so we can access "this" within other functions */ var alert = false; var money; var level; var crystals; var energyBar; var willBar; var braveBar; var expBar; var healthBar; var mailCount; var redbarWill; var redbarEnergy; var redbarBrave; var redbarExp; var redbarHp; var energy; var health; var exp; var will; var brave; $.ajax({ // ajax call starts url: '../ajax_handler.php', // change this to your php file dataType: 'json' // Choosing a JSON datatype }).done(function(data) { // Variable data contains the data we get from serverside var obj = data; $('#money').html(obj.money); $('#level').html(obj.level); $('#crystals').html(obj.crystals); $('img#energyBar').attr({ width: obj.enperc }); $('img#willBar').attr({ width: obj.wiperc }); $('img#braveBar').attr({ width: obj.brperc }); $('img#expBar').attr({ width: obj.experc }); $('img#healthBar').attr({ width: obj.hpperc }); $('#mail').html(obj.new_mail); $('img#wiRedBar').attr({ width: 100 - obj.wiperc }); $('img#enRedBar').attr({ width: 100 - obj.enperc }); $('img#brRedBar').attr({ width: 100 - obj.brperc }); $('img#exRedBar').attr({ width: 100 - obj.experc }); $('img#hpRedBar').attr({ width: 100 - obj.hpperc }); $('#energy').html(obj.enperc); $('#will').html(obj.wiperc); $('#brave').html(obj.brave + '/' + obj.maxbrave); $('#exp').html(obj.experc); $('#health').html(obj.hpperc); }).success(function(data) { var obj = data; money = obj.money; level = obj.level; crystals = obj.crystals; energyBar = obj.enperc; willBar = obj.wiperc; braveBar = obj.brperc; expBar = obj.experc; healthBar = obj.hpperc; mailCount = obj.new_mail; redbarWill = 100 - obj.wiperc; redbarBrave = 100 - obj.brperc; redbarEnergy = 100 - obj.enperc; redbarExp = 100 - obj.experc; redbarHp = 100 - obj.hpperc; energy = obj.energy; health = obj.health; exp = obj.exp; will = obj.will; brave = obj.brave + '/' + obj.maxbrave; /* Moved here as if the last if statment failed but one above it didnt the alert would not show */ var alert = false; //This needs fixin' if (self.prev.mailCount < mailCount) { alert = true; amount = (mailCount - $('#mail').html()); message = (amount > 1 ? 'You have new Messages' : 'You have a new message'); self.prev.mailCount = mailCount; } if (self.onLoad == true) { self.onLoad = false; } else { if (alert == true) { notifyMe(message, 'growl'); } } timeOut = setTimeout(function() { self.callAjax() }, 5000); $([window, document]).on('blur', function() { clearTimeout(timeOut); }); }); //return false; // keeps the page from not refreshing } }; $(document).ready(function() { var ajax = new ajaxLoader(); /* Use the ajaxLoader class */ ajax.callAjax(); $([window, document]).on('focus', function() { ajax.callAjax(); }); }); This is the handlers php file: <?php include_once('globals_nonauth.php'); $exclude = ['userpass', 'pass_salt']; if(!isset($_SESSION['userid'])) { return; } $userid = isset($_SESSION['userid']) ?: null; $is =$db->query("SELECT `u`.*, `us`.* FROM `users` AS `u` INNER JOIN `userstats` AS `us` ON `u`.`userid`=`us`.`userid` WHERE `u`.`userid` = {$userid} LIMIT 1"); while($ir = $db->fetch_row($is)) { check_level(); foreach($exclude as $ex) { unset($ir[$ex]); } $ir['money'] = money_formatter($ir['money']); $ir['enperc'] = min((int)($ir['energy'] / $ir['maxenergy'] * 100), 100); $ir['wiperc'] = min((int)($ir['will'] / $ir['maxwill'] * 100), 100); $ir['experc'] = min((int)($ir['exp'] / $ir['exp_needed'] * 100), 100); $ir['brperc'] = min((int)($ir['brave'] / $ir['maxbrave'] * 100), 100); $ir['hpperc'] = min((int)($ir['hp'] / $ir['maxhp'] * 100), 100); echo json_encode($ir); } You will just have to rename your divs but this returns and parses everything you need. You just either rename them in your menu file or rename them here. Forgot to mention, I added this plugin for the growl notifications: https://github.com/jboesch/Gritter
-
I'm thinking that your include should be the very first line after your opening php tag.
-
In your gym file, what are the first few lines in it? Plus mod security is kind of a global type thing. So I don't think that you can partially enable/disable the plugin as you see fit.
-
They are stored in variables like $beer and $vodka
-
I came up with something like this: I kept the log up so that you can see when the Ajax request is made and see that it is not being fired off when the page isn't in focus. Also in the video I didn't account for the status bar sizes but I fixed that after I recorded it :p and I even set up a little notification when they get a new mail message that uses either the default browser notification or a growl like notification