Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. Ahh I didnt see your use of the list function. It seems valid to me, but try changing this while (list($vname, $vday) = mysql_fetch_row($venuer)) { $venue = $vname . '-' . $vday; to something like while ($row = mysql_fetch_row($venuer)) { $vname = $row['vname']; $vday = $row['vday']; $venue = $vname . '-' . $vday; And see if the issue is still there. If not you can eliminate your use of the list() as the culprit
  2. I don't think there is a way to create more than one value attribute for a html form, and pass that into PHP. You can create your own attributes I believe, but I think Javascript is the only thing that can do stuff with them. What you can do is create a value that is something like value="hello:5:50" and when you get the value in PHP, do an explode() on it (in my case, the delimiter would be ":", which will turn it into an array of each of the values. Beyond that I don't see a way for you to create different values for the same selection
  3. Oh dude... my bad.... Sorry been doing a lot of javascript lately so I mix them up alot, hold on lemme find a function thats equivalent yeah use intval() instead of parseInt. again my bad lol, been mixing php and javascript a lot lately so they both have kind of meshed together in my brain.
  4. create a few session vars, for whatever data you need to keep and update. like #after you get the monster stuff $_SESSION['mon_health'] = $monster_health; $_SESSION['mon_name'] = $monster_name; #etc. as far as get goes, its mad ease. say I have a URL that goes www.mysite.com/food.php?id=tacobell id is the get variable, and tacobell is the value of said get variable. To access the variable, on food.php you write something like $fastfood = $_GET['id']; echo "You are eating at " . $fastfood; Usually to pass get variables to a page you have to create a hyperlink, and write it as the URL i wrote above, so for example, If I made a link that looked like <a href="food.php?id=tacobell">Taco Bell</a> the food.php page would look like: You are eating at tacobell. if I changed the URL to say food.php?id=Mcdonalds the page would then say You are eating at Mcdonalds Make sense?
  5. yeah that HTML is completely valid. I don't see how it would be echoing incorrectly, its obviously your if statement thats causing it to output HTML that will leave it unchecked. echo both variables that are being tested in that if statement and make sure that they are what you expect them to be.
  6. stick or die("NO :" . mysql_error()); at the end of your query and see if you get an error
  7. As roopurt said, if you are afraid of the user modifying the information, then both POST and GET would probably be a bad idea as the user could easily modify both if they have the know how. I would suggest using javascript to make it much more dynamic, so the user doesn't have to refresh the page everytime he does one attack. However, judging from the fact that you don't know javascript, and you have trouble with get variables, this may be a daunting task. I would suggest trying a smaller project to get the fundamentals of PHP down before you try tackling an RPG, but if you must make an RPG, I would strongly suggest some sort of Javascript/Ajax attack system. but I guess you could always use sessions too... just create session vars for the health and damage or whatever else you need, and whenever you preform an attack, decrement the value of the session variable
  8. I have read somewhere (I think in these forums) that using things like die and exit can cause vulnerabilities in your scripts, and it is best to handle errors via exception handling. Well I wrote a very simple exception handler for a class I am writing, which is below //custon exception class class qaExceptions extends Exception { public function error(){ $errorMsg = 'Error on line '.$this->getLine().' in '.$this->getFile() .': <b>'.$this->getMessage().'</b>'; return $errorMsg; } }//end custom exceptions class I understand that I probably could have used the standard exception class with the same results, but I plan to add more things to this class once I grasp the basics of exception handling. My question is, even though I have this exception handler, I want my script to completely stop every time an exception is caught. Right now, I still use the exit() function to quit the script after the exception is caught, because the script will continue to run, but still echo the error message. Is this the only way to terminate the script (I can't imagine that it is), and if so are there any vulnerabilities or other bad things I should be aware of with this method? A typical try-catch block that I use would look like the following: try { if ($this->data == null || !is_array($this->data)){ throw new qaExceptions($this->errors['INVALID_DATA_TYPE']); } } catch (qaExceptions $e){ echo $e->error(); exit(); } Am I going about this correctly? Also, why exactly are functions like die and exit not best to use when error handling? Any info or links would be greatly appreciated. I have read a few tutorials on this topic, but I can't seem to grasp the logic behind exception handling
  9. Lynxus gave a pretty good example on the 1st page, so You could use that method to verify. Just make sure that you update your login page to not only check the username and password, but to also check that they are verified (or rather, they are active)
  10. dude... if you don't want to execute certain code, don't include the code. Having like 50 different include files isn't very good, but having like 2-3 is perfectly fine. Just make a file that needs to be included on every page, say a config.php file, and then include your class file on pages that you want need to include. Hell if you have a bunch of files you need to always include, to just make one file that includes all those files, and just include that one catch all file But the approach you are taking to a very simple problem is entirely convoluted and unnecessary.
  11. you cant compare strings as if they were numbers so $i < "20" won't work. It will compare it lexicographically (I think) which will result in unwanted results (Like 7 being greater than 100); if you want to compare a string as a number, I suggest you use the parseInt function. so instead of things like if ($i < "20") do if(parseInt($i) < 20)
  12. change your die to die('Error, insert query failed: ' . mysql_error()); and see what error you get. If some of those columns are integer or other numeric types of columns, I don't think you can have single quotes around their insert values
  13. thats the worst description of any code I have ever read ever... why don't you post what you have?
  14. im not really sure what you are trying to do... if you want to output something then... well... output it. What are your results that you want to output? what exactly does this loop do that currently prevents you from outputting things? you could always do echo "Working on it" before the loop and "done" after like echo "Executing script. Please wait..."; while(){ #your code #goes here } echo "Script Complete!";
  15. look at my post... It won't be an associative array, but it will become an array
  16. what happens when you run this? how exactly does it "not work" Does nothing enter into the database? incorrect values?
  17. and your email is not sending right? try making your from email address just the static address, not with the name information and stuff like that. Im not sure whether or not the mail function will accept a to address that is like that, and that may be screwing up the headers send_email("danielg@fleco.com", "$email", $subject , $messageee); ?> and have your function echo an error or something if the mail fails.
  18. This is more or less a CSS question. You will probably want to simply create a style that is however long, and however wide you want it to be, and have it be scrollable. here is a CSS tutorial: http://www.w3schools.com/Css/default.asp
  19. well iterating through the a mysql table is very simple $sql = "Select email from mytable"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ //mail script here } I'm assuming you already know how to get data through a form. if not here is a tutorial: http://www.tizag.com/htmlT/forms.php
  20. header is, I guess what you called a 301 style execution. it needs to be executed before any output is sent (IE at the top of the page). Beyond that, I don't think PHP has any other ways to redirect a user. You can use meta tags to redirect a user, as well as javascript, (but both of those can be disabled, so these may want to be avoided).
  21. yep! <?php include $_SERVER['DOCUMENT_ROOT'] . "loginform.php"; include $_SERVER['DOCUMENT_ROOT'] . "registerform.php"; ?> EDIT: Hold on thats wrong I think, lemme check EDIT AGAIN: Wait yeah I think thats right, nevermind
  22. you will want a column in your DB for the auth code, but as far as the rest of the Email information you don't really need it. Well, you probably want to store your users email in your DB but I assume you do that already.
  23. $grade = $_POST['Class']; ?
  24. I've never seen anyone do this in my life. Wouldn't it be much much much easier to just remove the variable out of the equation entirely, and just include the page. Thats what include is for dude...
×
×
  • 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.