Jump to content

spelltwister

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by spelltwister

  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
  15. I use phpAdsNew. You can probably have each banner with a unique identifier and a script that loads in the banner (checking it's identifier) and increment that... But I'd say phpAdsNew is probably easier.  I'm not sure how the click through would be affected though.
  16. you can either increase the random number or do something like... $chars = array('a','b','c','d',...'1','2'...'0'...'A','B'...) $top = sizeof($chars); $mystring = $chars[random(0,$top-1)]+$chars[random(0,$top-1)]+$chars[random(0,$top-1)]...... for as many characters as you want if($mystring == "aA120"){   //find first item } if($mystring == "114BZx"){   //find second item } obviously each addition character in the string will decrese the likely hood a bit.
  17. It's very hard to follow what you're saying, but I think include the page and the pictures do not show up, it's probably referencing that's bad.  IE, relative links vs. absolute links.
  18. Hey all, Is there any advantage to using pass by reference over global declaration in the function? Here's what I have: $myArray; function alterMyArray(){   global $myArray;   //do something to my array } function alterMyArray(&$myArray){   //do something to my array } alterMyArray($myArray); The function will only ever have the $myArray variable passed in so, is there any reason to use pass by reference? Lastly, does the & go in the function signature or in the function call (IE function A(&$byRef){} OR A(&$byRef);) Thanks a bunch! Mike
  19. well, it will execute assuming it is met, which it's not possible.  though they are in my script anyway ( just didn't list them ).  Umm... So, can I return multiple things and if I return it does the variable have to be outside the function or is it then initialized and set outside.  Good point about passing the $current_day, i forgot about that.  everything inside the function needs to be passed or it's a local variable correct? Thanks, Mike
  20. Hey all, I was wondering... say that this is my function: function find_game_day(){   $game_day = "";   switch($current_day){     case "Mon":       $game_day = 6;     case "Tue":       $game_day = 0;     case "Wed":       $game_day = 1;     case "Thu":       $game_day = 2;     case "Fri":       $game_day = 3;     case "Sat":       $game_day = 4;     case "Sun":       $game_day = 5;     default:       $game_day = "";   } } this is my code: <?php $current_day = date("D",time()); get_game_day(); echo $game_day; ?> when I call the function, does it import all the code including variables to the main code or do I have to leave the variables outside for later referencing because it's out of scope in the function. Thanks, Mike
  21. use the time() function and then use the date() function to convert it to something that is more friendly example $now = time(); 'put this into the database $joined = date("M j Y", $now); '$now from the database
  22. can you please say what groups are? Also, is there a way that in the script i can make it as thought the webserver is doing the writing.  I know that the only way to wirte right now is 777
  23. owner is already r/w/e.  Here's two example of what I want:  I go to a page, fill out a form, hit submit and i want to generate xml files. (if this has to be full write access on the folder, I'll figure something else out). Secondly:  I upload an xml file to a page, it parses it, runs calcs, etc, and then writes another one.  Is this able to be done with just owner r/w/e? Thanks
  24. I have a remote host and it's using, I believe, Unix and Apache.  I'll find out for sure when I can get a hold of them.
×
×
  • 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.