Jump to content

Lingo

New Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Lingo

  1. Ok so I have a class with a switch that changes a variable in the class depending on some conditions. Safe to say it doesnt work. $trainSloppyCheeseMen = new trainSloppyCheeseMen(); // Get train class $sloppyCheeseLock = new sloppyCheeseLock(); // Get sql inject scrubber class. $trainSloppyCheeseMen->type = 1; // Type is Orbital Platform //die("a"); $sloppyCheeseLock->vulnerable = $_POST['miner']; $sloppyCheeseLock->sloppyUniverseProtect(); $trainSloppyCheeseMen->amt = $sloppyCheeseLock->sloppyUniverseProtect();// Amount to Train switch ($trainSloppyCheeseMen->amt){ case $trainSloppyCheeseMen->amt <= 10000: $trainSloppyCheeseMen->turns = 1; break; case $trainSloppyCheeseMen->amt >= 10001 && $trainSloppyCheeseMen->amt <= 100000: $trainSloppyCheeseMen->turns = 2; break; case $trainSloppyCheeseMen->amt >= 100001 && $trainSloppyCheeseMen->amt <= 5000000: $trainSloppyCheeseMen->turns = 5; break; case $trainSloppyCheeseMen->amt >= 5000001 && $trainSloppyCheeseMen->amt <= 20000000: $trainSloppyCheeseMen->turns = 15; break; default: $trainSloppyCheeseMen->turns = 1; // How many turns to train these buggers break; } die($trainSloppyCheeseMen->turns); They variable turns in the class is set to public but when I die it returns nothing. Please help thanks, Lingo
  2. Haha I figured it out... I was not using <?php $this-> WHAT EVER; ?> I started using it inside the class and things cleared up Thanks.
  3. Hmm weirdly enough I change die($sloppyID); to die("".$sloppyID.""); and it dies 22. Which is really weird anyone know why this is happening?
  4. I know that! But shouldnt it display 22? It displays nothing at all.
  5. So here is the Class: <?php /* * Game Name - Copyright 2013-2014; * This page will be * and open the template in the editor. */ /** * Author of Training * * @author Lingo Muwahaha */ class trainSloppyCheeseMen{ // Set Class public $type; // Unit Type public $amt; // Amount per Unit public $turns; // How much time will it take public $id; // Get user id public function doTrainSloppyCheeseMen(){ /* @var $type type */ if($type=="miners"){ $player = R::load('user', $id); echo $this->id; $new_price = bcmul($amt, 6000); // Create overall price by multiplication } } } ?> And here is the main page that calls the class: <?php require_once("config.php"); include("classes/trainSloppyCheeseMen.class.php"); // Get new Class $trainSloppyCheeseMen = new trainSloppyCheeseMen(); // Get train class $sloppyCheeseLock = new sloppyCheeseLock(); // Get sql inject scrubber. $trainSloppyCheeseMen->type = "miners"; // Type is Miner $sloppyID = 22; die($sloppyID); /* @var $sloppyProtect type */ $sloppyCheeseLock->vulnerable = $_POST['miner_amt']; $sloppyProtect = $sloppyCheeseLock->sloppyUniverseProtect(); $trainSloppyCheeseMen->amt = $sloppyProtect;// Amount to Train $trainSloppyCheeseMen->turns = 1; // How many turns to train these buggers $trainSloppyCheeseMen->plasma = $player->plasma; $trainSloppyCheeseMen->id = $sloppyID; $trainSloppyCheeseMen->doTrainSloppyCheeseMen(); ?> Ok when I try to die the $sloppyID nothing is outputed? This makes no Sense. Am I doing something wrong? I know this is my first time working with classes. If you need the config.php file let me know. Thanks, Lingo
  6. You my friend kicken are Awesome it worked great!
  7. Hello so I am using a setInterval to query an ajax to PHP script that returns a number which depending on the number will make a div appear on screen. However the setInterval freezes and does nothing unless I refresh the page in which it then appears. Code: <div id="invisable"> <font color="red">You have a new message! <a href="inbox.php">Click here</a> to go to messages.</font> </div> <script type="text/javascript"> function getXMLHttp() { var xmlHttp try { //Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch(e) { //Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("Your browser does not support AJAX!") return false; } } } return xmlHttp; } function MakeRequest() { var xmlHttp = getXMLHttp(); xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState == 4) { HandleResponse(xmlHttp.responseText); } } xmlHttp.open("GET", "getmessages.php", true); xmlHttp.send(null); } function HandleResponse(response) { if(response==1){ document.getElementById('invisable').style.display="block"; } } setInterval(MakeRequest(),1000); </script> setInterval is set to every second... I don't know why it freezes please help Thanks, Lingo
  8. That is weird the error is there... I just got a new server so I am going to test there.
  9. Hello fellow PHP Enthusiasts if you could help me with this I would apprieciate it very much. Error: Parse error: syntax error, unexpected 'id' (T_STRING), expecting ']' in C:\xampp\ Code: <?php if(!empty($_POST['id'])){ $id = $_POST['id']; $arf=getStatistics($id); } ?>
×
×
  • 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.