Jump to content

spelltwister

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

spelltwister's Achievements

Member

Member (2/5)

0

Reputation

  1. Wow, that was easy enough. I moved them to the same level as my domain; which as far as I know there is no way to access via web browser. Thanks!
  2. I would say, yeah, that's probably not the greatest arrangement of data. You can't think of a way to break it into logical units? For example, if you have 25 or so of the columns that you frequently use, why not put them together. Also, fields that are frequently blank, perhaps those should be somewhere else? Think of it this way; if i have 1,000,000 users, but only 300 of them have some field set, why have room set for all of them?
  3. Hey all! I have a page that looks at a users posted data and fetches a .txt file for them, I want to prevent users from navigating to the .txt file directly, but if i change security off of 755, I get an error saying permission to read file denied. I'm reading the file and echoing it back because the requesting application is a C# app using HttpWebRequest. If there's a better way to do that, I'm all ears. Here's the php code up: <?php $game = $_POST['gameNum']; $player = $_POST['player']; $file = $_POST['file']; include('db.php'); if($file=="p"){ $path = "/pathToFiles/$player.txt"; getFileByPath($path); }elseif($file=="setup"){//get setup file $path = "pathToFiles/setup.txt"; getFileByPath($path); } function getFileByPath($path){ $fp = fopen($path, 'r');// <------------ERROR: permission denied unless 755 :/ if($fp){ while(!feof($fp)){ $buffer = fgets($fp, 4096); echo $buffer; } fclose($fp); }else{ echo "Could not open file"; } } ?> If I leave the file as 755, then anyone on the internet can view it by going to mydomain.com/pathToFiles/setup.txt and that'd be terrible Thanks for any help! Mike
  4. Hey all, Just wondering if anyone knows of a script that will perform (at least most of) the following tasks: 1. Hide the files actual location from the user (possibly not needed as I can store files outside of wwwroot). 2. Manage users who are allowed to download the file(s) 3. Will show all files in the folder for download without needing to set a link to each file manually I can do the first two myself if there are no scripts readily available, however, the third, I'm not sure on. Any direction on that would be appreciated. Mike
  5. Hey all, I am having a hard time searching for this one because "select multiple files" or "multiple file upload" generates results that are not what I need and I don't know any other way of asking. I need to give users the ability to select multiple files in the same dialog box to upload to a script of mine. I DO NOT want to generate an unlimited amount of browse buttons (one for each file), I want the user to select all files after clicking ONE browse button. I've seen this in flash and heard it can be done in PHP. Thanks, Mike
  6. I  would explode the sentance by the space, causing each individual word to be placed into an array, then you can filter out words that are smaller than 3 letters or something and then you can sort the array.  After the array is sorted, you can easily find which are repeated the most.
  7. Hey all, I was attempting to play around with classes,  figuring out the proper syntax and such and I ran into a very annoying problem.  Hopefully someone can point out what i'm doing wrong.  I'm using PHP5.  The problem is that all variables assume the value of the last assignment that I made. Here's one attempt: <?php class ship{   public $gen=0;   public $infantry=0;   public $type;     public function setGen($g){     $this->$gen = $g;   }   public function setInf($i){     $this->$infantry = $i;   }   public function getGen(){     echo $this->$gen;   }   public function getInf(){     echo $this->$infantry;   } } define("MM", 1); define("FRI", 2); define("SOL", 3); $ship = new ship(); $ship->setGen(0); $ship->setInf(1); $ship->getGen();//outputs 1, should be 0 $ship->getInf();//outputs 1 ?> Here's another attempt: class ship{   public $gen=0;   public $infantry=0;   public $type;     public function __construct($g, $i, $t){     $this->$gen = $g; echo $this->$gen;//correct $this->$infantry = $i; echo $this->$gen;//value of $i echo $this->$infantry;//correct $this->$type = $t; echo $this->$gen;//value of $t echo $this->$infantry;//value of $t   }     public function getGen(){     echo $this->$gen;//value of $t   }   public function getInf(){     echo $this->$infantry;//value of $t   } } define("MM", 1); define("FRI", 2); define("SOL", 3); $ship = new ship(0,2,MM); echo $ship->$type;//correct $ships = array(); for($i=1;$i<10;$i++){   echo "\n".$i;   $ships[$i] = new ship($i, 0, FRI); } for($i=1;$i<10;$i++){   echo "\n".$i;   $ships[$i]->getInf();   $ships[$i]->getGen(); } ?> Thanks, Mike
  8. well, if i first force the posted data into the database, then retreive it, it works... any clues?
  9. you can have the javascript in the body for onLoad = 'javascript:whateverfunction()' when you have your original page redirect, have the if($_POST['submit']){ around the javascript function that way it will only fire if the redirect was from the origianl submit.  You can also add in error handling.
  10. you want to open a file literally or just change the page url for that separate window? I really can't tell what you're after
  11. Maybe I could be more clear.  The posted data looks like: <units><info attacker="persian" turn="2" /><g><calvary ranged="0" number="2" bonus="0" /></g></units> and if I use $XMLDoc->toString(); is prints <units>   <info />   <g>     <calvary />   </g> </units> Again, this worked fine when reading the EXACT same xml from a file then performing the operations on it. If no one knows, can someone please give me another method of parsing posted XML data? Thanks, Mike
  12. Hey all, This is a sort of specific question, but hopefully someone knows ;-D I'm using minixml to parse an xml file.  Here's the code: $XMLString = $_POST['xml_stuff']; $XMLDoc = new MiniXMLDoc(); $XMLDoc->fromString($XMLString); $XMLRoot =& $XMLDoc->getRoot(); Now, if I write echo $XMLDoc->toString(); it takes the following xml: <units>   <info attacker="persian" turn="2" />   <g>     <calvary ranged="0" number="2" bonus="0" />   </g> </units> and transforms it into: <units>   <info />   <g>     <calvary />   </g> </units> However, I had origianlly tested the script with the XML file sitting on the server and using the fromFile and toString and that worked fine.  Any ideas why it's removing all the attributes from the XML? Thanks, Mike
  13. You can do this from a simple formula for an n-sided polygon.  I'm not sure exactly sure what determines what, but it seems that Str, Combo, Stam, and Dex are the determining stats for the other 4, IE, the combo of those results int the other?  maybe not. If not, you can just do something like take the first stat (lets say STR), and see what it's value is.  Lets say 2, so the line polygon starts at 2*(space between each value) in the -y direction (assuming the center as the origin).  Take the next stat, lets say SPECIAL.  Check how far that goes out.  Now, let's say 4.  It's end point is 4cos(roughly 240) in the x, and 4sin(roughly 240) in the y.  That's two verticies.  Just continue around until you get all the verticies and have the first one as the last one too.  You'll have to know the angle that each point out from , or transform the verticies at the end.
  14. I just have a column int he database with timestamp and then for the upload, $timestamp = time(); Then it's just a simple SQL query mysql_query("update `rare_items` set last_occurance = $timestamp"); or something like that
×
×
  • 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.