Jump to content

Paradoxz

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Paradoxz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Excellent script as well, I am trying to get better at Regex (hence the more complicated approach I took) Thanks for your help!
  2. The end of line modifier is working great and limiting it at 12. See code below, you can also try it here: http://failbet.com/acct/add.php // password validator $passpattern = "/^(\d|[a-z]){8,12}$/"; if(!preg_match($passpattern, $_POST['pass'])) { header("location:add.php?errorcode=5"); die(''); } Thanks again everyone!
  3. Fugix, great advice on the /i Not sure why, but on my email validator and password validator I don't use /i and I only specify a-z not a-zA-Z and it works fine for upper or lower case, so I always omit the /i and A-Z
  4. Ah yes, the ^ begins with and $ ends with. It works now that they are added, how dumb of me to forget them. /^(\d|[a-z]){8,12}$/ is what I used. it's the same as you wrote, except \d is identical to 0-9 I guess having to throw | in there makes it the same amount of characters though, and probably the same speed. thank you.
  5. Yes, Regex.. everyone's most feared topic. I hope some brave soul can help. Trying for password validation, numbers and letters only allowed and 8-12 characters. I have tried hundreds of combinations, the one below is the closest I have gotten. The issue is anything under 8 doesn't work but everything over 12 still does for some reason. /(\d|[a-z]){8,12}/ also tried: (same results) /\d|[a-z]{8,12}/ Anyone know why the 12 isn't registering? // password validator $passpattern = "/(\d|[a-z]){8,12}/"; if(!preg_match($passpattern, $_POST['pass'])) { header("location:add.php?errorcode=5"); die(''); }
  6. I am working on a site that is going to have hundreds of polls that people can vote on. Once any user creates a new poll (vote: Hayden Panettiere vs. Kristen Bell as an example) I want to have the database remember what member voted on what, for each poll. So user 1 voted Hayden, user 327 voted Kristen.. etc.. I expect up to 500 users to vote on each topic, but a new column to store each username that voted seems insane. I was thinking arrays, but am not sure if that would work. I don't think that a new table per poll would be very efficient either, it would be like 500++ tables on one database. To explain better, my username is Paradox and I vote for Kristen Bell. When I look at this database I want to see: ID Title Option1 Option2 People who voted option 1(27 people) People who voted option 2(783 people) 1 Heroes 27 783 {Blah, Blah, Blah} {Paradox, Blah, Blah} Is an array a good way to go about this? Because I also want to be able to expand the array to notify each member they voted with the winning or losing team once the poll expires.
  7. Well, still no luck at this. So I guess time to start from the beginning. Just as a general question, if someone was to do a mysql query and wanted to be able to search a database for multiple things how would you do that? so I have dogs, cats, frogs, mice, chimps, etc. some are black, white, green, purple and some are tame or not tame. If this doesn't work: Then how would you search for multiple specific properties at the same time as saying let one of them be a wildcard. if I want to search breed=% so i pull up all Red and Tame animals then how?
  8. You can use an if fail ! for anything, even to redirect here is an example of one I use $v2 = $_GET['v2']; //This takes a variable from a url (i.e. .php?v2=1) if(!$v2) { $v2 = '1'; } So all that this says is if $v2 is blank then it makes $v2 = 1 You can do this with a header to redirect as well.
  9. I am new so don't take this to heart, but $count = 0; is 0 $countfinal = $count+1; is 0 + 1 echo $countfinal; is going to say 1 I think you need to count the rows. Don't remember the script though.
  10. I actually downloaded a login script and broke it down to learn all about sessions, it's actually a really nice script. You can find the breakdown and even the source files here: http://phpsense.com/php/php-login-script.html
  11. (sorry for the delay in this, took me 20 min to write this, work got busy) I apologize, your right I didn't explain that very good. So basically I am trying to build a database for a tool store of a friends, I have all the tools on a database, and want the customers to be able to sort by some unique properties, (i.e.: id: 1 hammerp - duralast: 1 rubber: 1 highquality: 1 id: 2 hammerb - duralast: 1 rubber: 1 highquality: 0 id: 3 hammerj - duralast: 1 rubber: 0 highquality: 0 ) so I made a script that everything after WHERE = is dynamic, if I want them to only retreive high quality hammers then I want to do `THIS`.`duralast` = 0 or `THIS`.`duralast` = 1 AND `THIS`.`rubber` = 0 or `THIS`.`rubber` = 1 AND `THIS`.`highquality` = 1 my original plan was wildcards, but that did not work `THIS`.`duralast` = % `THIS`.`rubber` = % `THIS`.`highquality` = 1 so wildcards basically since the only two options are 0 or 1 for the first two variables but variable 3(high quality) has to be 1 %%1 or %%% or 11% or %11, etc.. any combination.
  12. You know, I don't understand why order of operations is neccessary, since it's not math it's just saying to query the database where ***1 or 111* or what not, just switches, on or off. But your definately a pro not me so i'm trying your idea, I have tried $result = mysql_query("SELECT * FROM $tableid WHERE (`THIS`.`red` = 0 or `THIS`.`red` = 1) AND (`THIS`.`white` = 0 or `THIS`.`white` = 1) AND (`THIS`.`blue` = 0 or `THIS`.`blue` = 1) AND (`THIS`.`orange` = 1) "); and $result = mysql_query("SELECT * FROM $tableid WHERE (`THIS`.`red` = 0 or `THIS`.`red` = 1 AND (`THIS`.`white` = 0 or `THIS`.`white` = 1 AND (`THIS`.`blue` = 0 or `THIS`.`blue` = 1 AND (`THIS`.`orange` = 1 "))))); And multiple other variations with no luck. If only I knew algebra or even basic math for that matter. :-\
  13. Thanks for the quick response, I tried that and am missing something I guess, because what I tried was and that was a failure, I am not good with the parenthesis, does it need to just be a ( after before each one and then )))) at the end?
  14. This is probably something simple I am missing, the below code works: So red, white and blue must = 1 but orange can = 0 or 1 Here is my problem, if I do that same code backwards to where red, white, or blue = 0 or 1 but orange must = 1 then it still pulls up one of the rows that have 0 for THIS.orange but not all (weird right?) Is the code that should pull up ***1 but is pulling up a one row that has 0 for orange and one row that has 1 for orange, in my database I have 3 rows and under orange there are two with 0 and one with 1 so why is it only showing one 0 and one 1? it makes no sense! lol help me. Also, I am using OR instead of >=0 because everything after WHERE = is dynamically generated so I can't change the = sign.
×
×
  • 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.