Jump to content

AtomicRax

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by AtomicRax

  1. Found the problem.. Thanks.
  2. I'm trying to authenticate user login information. Currently I have: if(isset($_POST[user])) { $user = $_POST[user]; $password = $_POST[password]; $saltedPassword = crypt($password, $mdsalt); $passQuery = mysql_query("SELECT * FROM user_accounts WHERE user='$user' LIMIT 1"); $password = mysql_result($passQuery,0,"password"); if($saltedPassword == $password) { // Login } else { // Error } How ever, I get this error message: mysql_result(): supplied argument is not a valid MySQL result resource I've double checked the information I'm trying to login with, it's all correct..but for some reason I still get this message.
  3. The solution at http://detectmobilebrowsers.mobi/ works great. Thanks for the advice!
  4. I'm trying to automatically redirect the user (to /mobile) if they're on a mobile device. For what I want, a simple check of the user_agent for the word "mobile" would suffice. My logical thinking would split the user_agent by individual spaces and check each word to see if it's the word "mobile." I know my method is not the best way... I was wondering if someone could help or maybe point out a better technique for redirecting mobile users. Any help would be appreciated. Thanks.
  5. For the record: http://codingforums.com/showthread.php?p=925902#post925974 Got it fixed over there.
  6. Is actually elseif ($cstring == $pin && $alert != '1') { flag($cstring); } // Flag regular word That was just a typo in the post...not me fixing the problem. (Couldn't modify the post anymore)
  7. I'm searching the $content string for certain words, and if those words are in there, my program flags it. The problem I'm having is that a couple of these words have the option of having a number behind them. I'm not trying to flag the ones with numbers after them.. Is there a way to to this? This is a rough example of what I'm trying to do... $content = "Crazy Random Apple 43 Left Apple Truck Plane Turtle Duck"; $needles = array("Random", "Apple", "Duck"); $spaced = split(" ", $content); foreach($needles as $pin) { foreach($spaced as $cstring) { if($cstring == "Apple") { $alert = '1'; } // Found a word with possible number afterwards elseif($alert == '1') { if(is_numeric($cstring)) { $alert = '0'; } // Not what I want, so I reset the marker else { flag($cstring); } // Flagged, and marker reset } elseif ($cstring == $needle && $alert != '1') { flag($cstring); } // Flag regular word }} My thought was to check to see if it's one with a possible number, then set an alert. The program would then go to the next word and since the alert was set, it would check to see if the next word is a number or not and respond accordingly, and then of course I'm still checking for the other word(s).. "Apple" still gets flagged twice... It should only be flagged once. No luck at all....
  8. With a single person, it could take a while to accept stories. And if you have other website visitors do this, it seems like the idea has been done by fmylife.com already
  9. I'm currently working on a project that allows registered users to post their own stories on a website. The stories go in the "story" field of my table, which has a type of "text" - which has a 65,000 byte limit. HTML is not allowed in these stories for several reasons, but I was wondering if there is a recommended size limit for the story field in my table? I know it depends on the application, but I don't want to allow users to post a TON of useless information- especially if it's not a true story for the website and just spam (storage limits and what not)... I would, however, like to give them enough space to completely tell it. So I was looking for comments about this situation... Should I leave it as 65,000, go larger, smaller..?
  10. Ok, here's what I have: A MySQL table named "settings" with two fields- "name" and "value" I have a query that looks like this: $query = mysql_query("SELECT * FROM settings"); $settings = mysql_fetch_array($query, MYSQL_ASSOC); (Currently there is only one result, but it will not stay this way.) What I want to do: Call any of the settings by their name... Like $settings[example] = "my value". How ever, with this current code, $settings[name] = "example" and $settings[value] = "my value" Any help? Thanks.
  11. Is this normal? I realize this is turning into an Apache discussion, not php configuration- should this topic be moved?
  12. I have an Ubuntu server running apache2 with PHP 5.2.6. I have a few scripts that parse $_SERVER['PATH_INFO'] so I can link to files like this: /index.php/query What I want to do is simply like to: /query The server would parse that as /index.php/query since index.php is default. I've done this before on another server, but don't know how it was configured....
  13. Thanks, that worked just fine for me!
  14. I'm trying to reverse a string, but I don't want it completely backwards... I have: $str = "10,8,6,4,2"; It is not an array, and can't be an array. It's simply a string with commas. I want to reverse it so it says "2,4,6,8,10". BUT, if I do a regular string reverse, it'll say "2,4,6,8,01" That's not what I'm looking for... How can I do this?
  15. Thanks! That worked! Now I have one more issue.... I have the entire URL, such as: http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&q=SEARCH_STRING&btnG=Google%20Search What is the easiest way to just get what q equals (the string searched for to find the site)? My way would be to split it at the & and then at the = and find the q and see what it equals... but there has to be an easier way...
  16. Ok, preg_match has me sooo confused... ??? I am working on a program that logs where visitors are coming from... Such as a website or search engine... Now, I have the common URLs for the more common search engines... And I want to see if the url is contains the basic address, to know what search engine it was... I just don't know how to fill in the preg_match statement correctly... Actually, I've come back to this project after a few hours of not working on it, and am now lost in where I was going.... But here's what I had... // $ref is the referring url switch(preg_match('SOMETHING', $ref)) { case "http://www.google.com/search": $line = "Google"; $found = 1; break; case "http://search.msn.com/results.aspx": $line = "MSN"; $found = 1; break; case "http://search.yahoo.com/search": $line = "Yahoo"; $found = 1; break; case "http://search.live.com/results.aspx": $line = "Windows Live"; $found = 1; break; } // If no match if($found != 1) { echo "Not Found"; } Like I said, no clue what I was thinking... but do you get the idea I have? Can you help? I'm lost...
×
×
  • 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.