Jump to content

SitdGames

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by SitdGames

  1. I think I know what you want... you want the trailing part, the "guid?=###" to be removed, right? This is a bit tricky, but here's how I would handle it: Have a landing php script, like redirect.php. Have it capture the variable, and after sanitation store it in the session. <?php session_start(); $link = filter_var($_REQUEST["guid"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); $_SESSION['guid'] = $link; header( 'Location: http://www.yoursite.com/index.php' ) ?> And then on your main index page, you'll have to pull the link out of the session with: <?php session_start() $link = $_SESSION['guid']; ... The only issues with this is that there's really no way to bookmark it, but it will give you the www.yoursite.com/ for all of your news articles. If you're looking for something else, please elaborate.
  2. Almighty, thanks for the info! I planned the code so that all of the AI and the individual ants were tied to the specific named nest, so that all I'd have to do to simulate it was iterate through each of the nests. I'm going to keep tinkering with it in my free time, see if I can optimize if further, but from the looks of It I may need to do some extensive rewriting. I have removed all the global declarations and replaced the overloaded functions with __construct. Is there a distinct advantage to using __construct over a overloaded function call, or is it more of a coding standard? I've looked over several articles on both Dependency Injection and IoC contaners, and I've plotted something I'm going to try out a bit latter, that hopefully will clean up some of the bigger problems I'm facing.
  3. What errors are you getting? Do you have error reporting on?
  4. Is there anything in particular you're having trouble with?
  5. Alright, I tinkered with your MySql syntax. $insert = "INSERT INTO `airline`.`surveys` ( `f_date` , `f_time` , `f_number` , `f_destination` , `f_friend` , `f_space` , `f_comfort` , `f_clean` , `f_noise` ) VALUES (\"$tmpVar1\", \"$tmpVar2\", \"$tmpVar3\", \"$tmpVar4\", \"$tmpVar5\", \"$tmpVar6\", \"$tmpVar7\", \"$tmpVar8\", \"$tmpVar9\");"; This should solve the input problems, and then you need to fix the next query like so: $SQLSelect = "SELECT * FROM `airline`.`surveys`"; Happy coding!
  6. It should. Your buttons need to have the (name=\'send\' ) line for it to send the data from the button during a refresh and sent to $_POST. Also, please add some error checking into your mysql. You're returning a error from it: $QueryResult = mysql_query($insert, $DBConnect) or die("Mysql error:" . mysql_error()); And here's the error: Notice: Undefined index: f_comfort in ***\testcode.php on line 30 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' Good, Excellent)' at line 12
  7. To delete the file, and all data, just use the unlink() function. For example: unlink('logs.html'); This should delete the entire file, and then depending on your write option the file will be recreated with the next pass. Then, it's just a matter of adding a button or link to the small php script with the function with a header back to this page. If you wanted to be super-fancy about it, you could just use java, and then refresh the page with DHTML. However, if you wanted to keep some of the data on the file, you'll have to parse it and build iterators, and all that mess.
  8. You have PHP installed on your server or your host supports it, correct? You should at least be getting back a connection error if it's failing... When you view the source(on the empty page), is there anything there? I just ran the file, and on line 130 you have a extra "}". After that, I'm getting this for output: Warning: mysql_connect(): Access denied for user '******'@'localhost' (using password: YES) in ***\testphpscript.php on line 3 Connection Error: Access denied for user '******'@'localhost' (using password: YES) action file.
  9. How is showerror() being called? Are you doing any type of error capture? A simple easy way to capture mysql errors is: mysql_query("YOUR QUERY") OR die("Error:".mysql_error()); or mysql_query("YOUR QUERY") OR die(showerror()); (I would recommend the first one, but the second one might work...) But you should probably use mysqli. It's honestly not that bad, and I've found it saves a tonne of time in the long run. Hope this helps!
  10. This script is in some desperate need of variable sanitation, but other then some security quirks about using strings the query should work for you. Some questions though... 1.)Why do you have a declaration for $createtable in the second half of the script, when it's not called? 2.)Usually when I work on projects that require database creation, I'll remove that part to another file and use include. Makes it a bit easier on the eyes, and when the script goes to production it's usually just a matter of copy/paste. It also makes it easy to get back errors. 3.)On that note, what errors are you getting? Are you getting any errors? 4.)I'm also really not sure what you're looking for for help. You're post needs a bit of clarification... and Notepad++ does not like this code.
  11. Hey guys, got a bit of a complicated question for you... I was challenged to build a Finite State Machine based game by a friend with some rudimentary AI in php. After doing a little research, planned it out to have the following classes in this structure -world --food --nest ---ant Where world would be the highest level class, and contain all the instances of different objects + save/load functionality and such. The problem I'm having is acessing items in the higher level class, without either adding the initial declaration of $world as a global variable or just including a reference in the initial instance of each class item. I have to working, but it's nothing what I'd like. for instance: To access and sort through all the posx/posy coords of the ants presently on screen, I have to go: $this->world->checklocation($this->posx , $this->posy) using a reference I passed to it in the constructor(the world item). Is there a easier way to access information from a higher level object other then passing a reference to it from the original? Right now the only reason that the lower level objects know about the highest one at the moment, is I used the global keyword... and I'd rather know the right way of doing this, rather then the duct-taped way I'm using. (I've included the source code... warning though, it's messy and undocumented)
×
×
  • 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.