Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. Form validation with javascript is not a good idea. People can just turn off javascript and happily go on their way sending your server whatever they want. You should only use javascript as a "feature" to help reduce requests to your server. Field left blank? use javascript to give a popup or something, before the form is sent. But check if it's blank with php just the same.
  2. yes, you have to have session_start() before accessing any session vars etc.. on every page you wish to have access to them.
  3. by "visit another page" do you mean some other external page, or something internal on your own site? If it's the first, you can set a cookie and check for it on page loads. If it's the second...do you have session_start() at the top of the page in question?
  4. Okay so you told us what you're trying to do, but you didn't tell us what the problem is, and you didn't show us any code.
  5. Would be helpful if you mentioned what script it is, and something more specific than "it won't install." On that note...moving to 3rd party forum.
  6. .josh

    PHP Gallery

    Really? I've only done some minimal gallery2 poking and prodding (coincidentally, I installed it for a friend last night), and the only "external" feel I get from it is the ability to add photos to a "cart" and then get them printed by 3rd parties. All pictures are stored locally, tons of features, etc.. can you be more specific about how it feels "external?" By "external" do you mean "smaller?" as in, something to be included in a div or frame on your own site?
  7. About 6 years ago my little brother was playing this browser text game where you attack other players and move up in ranks etc.. and this game had about 100k players, and I thought wow, this game isn't very complex..I could make something way better and grab those people. So I went down to the local Barnes and Noble and bought PHP In Easy Steps. It had just come out, cost me like $5, and covered the basics. After that, I referred directly to the manual.
  8. shady.
  9. well in my code, if you make $percent = 0; // 0%..no sales.. then it will return 0 on the scale. Or hell, even if you use a bit more than 0%, I do have a round wrapped around the equation, so you still might get 0 returned (for some odd reason I assumed he wanted whole numbers). I think he might wanna take out the round, because that might hurt someone's feelings if you say they are a zero when they sold something. But other than that, the equation/return is free to show .00000...1 out of 100. lol nah I was referencing his bitching about some girl nagging him at work
  10. no, ober
  11. lol maybe if you didn't have people constantly distracting you at work you woulda figured it out on your own
  12. Is this what you mean? <?php $maxpercent = 46; // 46% is the new 100% $percent = 23; // 23 would be 50% of 46 // scale of 1-100, 23 should be 50 // since 46 "equals" 100, we find out what it takes to make 46 turn // into 100, so divide 100 by 46. then we just take that number // and multiply it with $percent to scale it up $pos = round((100 / $maxpercent) * $percent); echo $pos; ?>
  13. Assuming that $city and $state actually hold something.. header("Location: index.php?c=$city&st=$state");
  14. look into curl
  15. LOL. Seriously, what kind of major university would have real world coding like that?
  16. $db->field1
  17. .josh

    Faster?

    my first guess is a page hit counter
  18. ummm...i don't really see how what you've done will work. your previous $mailcontent is still being written over every single loop iteration. Did you try my code? You said that everything works fine except all you're getting is the info from the last loop. That's because your overwriting the data every single time. All I did to that code was add a dot before the = in your $mailcontent assignment, so it concats the new info onto the previous info...which is what you 1/2 did right there. You broke it up and used the dot but on the next loop iteration, your first = will just overwrite it.
  19. .josh

    Faster?

    all you're going to do is read 1 digit? And you're concerned about performance? LoL...dude even with huge files like megabytes huge, we're talking microseconds difference in time here.. I can't even imagine how small of a difference we're talking about when reading 1 little character.
  20. code itself works fine. Problem is elsewhere. Sessions not being allowed, maybe cookies set not being allowed in your browser. edit: assuming that that's the entire contents of your file ^
  21. .josh

    Faster?

    well that's fine and dandy if all you're wanting to do is echo out the contents.
  22. need to put session_start before trying to use session variables.
  23. .josh

    Faster?

    nope. from the manual: ("the code above" is an example of how to use fread to get the contents of a file into a string).
  24. you can do a foreach loop on the array and do a strcasecmp on each needle/element, or if you look at in_array in the manual in the notes towards the bottom there's a function provided using preg_grep
  25. .josh

    Faster?

    well if you look at the manual for both file_get_contents and fread, they both say that file_get_contents is preferred because it gives much better performance. But that's if you're just wanting to get all the contents of the file. fread is more versatile. Depends on what it is you're trying to do.
×
×
  • 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.