Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. I would suggest using a virus protection program for viruses. As far as "bad" files... what would you call "bad?"
  2. not really sure what you're trying to accomplish here, but if you are trying to make a form that submits with the GET method and you have other vars you want to pass via the GET method as well...just pass those other vars with a hidden input field.
  3. hmm.... It seems to me what you are saying is that you have a list of files and you want to search for a file that contains for instance "dam" and that there's only going to be one file with that in it, and it's going to be for example (1)damien_full.txt so you want to be able to extract "damien" from that, but the catch is that file won't necessarily look like that, it could look like (1)damien_full.txt damien_full.txt (1)damienfull.txt damien.txt etc... Only way regex really works is if there are, well, regular expressions to work with. If you are telling us that beyond using glob, virtually everything else in that filename could be variable, then there's really no way to extract your info from it. edit: Okay well apparently that's not exactly what you're saying, as something seemed to work out for you...
  4. perhaps glob might be of some use?
  5. Oh also you don't need to declare vars in php like with the DIM in asp, unless you for instance want to declare a var as global so it can be used inside functions or whatever.
  6. Nope, apparently not. Seems kind of odd that there doesn't seem to be a built-in array_insert function to insert a key=>value or even just value into a specific position of an array, like after or before a specified element. I figured out a bunch of alternate methods to achieve the same thing, using various other array manipulation functions, but overall, ^^ seemed to be the quickest and simplest method, imo.
  7. switch is the equivalent of select case and $_GET['variablenamehere'] is the equivalent of Request.QueryString('variablenamehere')
  8. One thing I can think of is it would mean the difference between having to manually echo out things in a specific order and just looping. Anyways, here's my take: <?php $array1 = array('color'=>'green', 'size'=>'big'); foreach ($array1 as $key => $val) { if ($key == 'size') { $newarray['weight'] = 'heavy'; } $newarray[$key] = $val; } print_r($newarray); ?> 'weight' => 'heavy' is hardcoded into the condition because I don't really know where that's coming from. You'll have to insert your own var there.
  9. Tell you what, you hook me up with free heart surgery and I'll hook you up with free coding
  10. mail($to, $subject, $content); The 3rd argument is where you put your email content. $content is just a string that holds the content. So if you want to add more stuff to the email.... $content = "something"; $content .= " and something else"; or $content = "My name is " . $_POST['name'] . "\r\n"; $content .= "My address is " . $_POST['address']; Basic string concatenation...
  11. well i don't know much about sockets, but I think with sockets, the file is sent to you through the socket and then when you use fopen you are using it locally, so that whole allow_url_fopen shouldn't apply. I could be wrong; as I said, I don't know much about sockets.
  12. or maybe sockets.
  13. what's wrong with sprintf()?
  14. Perhaps you should explain what you're trying to accomplish because that doesn't really make sense. Are you wanting to be able to have the title displayed, and then have a variable ($pagetitle) so you can somehow use it later on? <?php $pagetitle = "State Search"; echo "<title>$pagetitle</title>"; ?> <!-- lots of stuff here --> <?php // do something with $pagetitle here ?> I mean, I suppose you could like, use file_get_contents to have the file read itself and use some regex to grab what's between <title>..</title> or something but I mean, I hope you see how that sounds kind of ridiculous. So uh...perhaps you should paint a picture of what you're overall goal here is...
  15. <?php echo "State Search"; ?> or <?php echo "<title>State Search</title>"; ?> Though if you're making a hardcoded echo like that, no point in really putting it inside the tags. Unless you were wanting that title to be dynamic, in which case you're going to have to come up with code to set $pagetitle to something.
  16. $pagetitle is not being set anywhere, so nothing is being printed out. Are you wanting to print out "State Search" inside your php tags?
  17. Most immediate fix: mysql_query($sql) or die("<body onload=\"parent.main.location.href='http://<?=$_SERVER[HTTP_HOST]?>/pages/mpl_error.php'\">"); But you should know that die() stops the script, so anything after that won't be executed. If that's a problem for you, look into using trigger_error() instead.
  18. as disco said, turn your error reporting on. I think the more likely thing is that $attacker and/or $defender is not being instantiated somehow or maybe they are not within the scope of that script there (not passed to a function, etc...) so it's ending up basically saying $dodge = 0 - 0; or even $dodge = 0 - 100; causing the if to evaluate as true. Just a thought. Try echoing out $attacker->dexterity and $defender->dexterity after you set them.
  19. What you should do is use session vars like I told you in your other thread.
  20. If you really want to go that route then you might as well just declare a global var, instead. But using global vars (including session vars, since they are global) in different scopes like that is bad programming practice. Not to mention that the whole point of session vars is to make data persist across pages. There's no reason to use a session var for one page like that. It's like creating an array when you're only going to use 1 element of it. It's overkill. The better route would indeed be to use a class.
  21. /shrug hrmm my bad. I thought I saw mysql_query not mysqli_query. I guess even if I did notice that, I would have assumed that since it's (string, link) with mysql_ it would have been the same with mysqli_. Learn somethin' new everyday. As far as your current problem, your header is sending userid as a GET var, not user_name, so $_GET['user_name'] doesn't exist. Try changing your header to uderid=$row[user_name] Just got to say though it would be better to pass it through session vars. It's more secure.
  22. imagemagick Though I don't think that's going to be very useful to you, if you don't really know how to program.
  23. getItem($id) { // some code here $x = prevItem($id); // do something with $x } prevItem($id) { // use $id here return $something; } getItem($id); You mean like that?
  24. $result = mysqli_query($cxn,$query) or die("can' execute query"); you have $cxn and $query backwards, argument is (query string, connection source). If there is still a problem, then do this: $result = mysqli_query($query, $cxn) or die(mysql_error()); and post the error (notice the args are still switched, because that's how they are supposed to be).
  25. if you want a cookie to expire at the end of a session, just use session vars, cuz that's the diff between session vars and cookies.
×
×
  • 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.