Jump to content

supertrucker

Members
  • Posts

    171
  • Joined

  • Last visited

About supertrucker

  • Birthday 07/24/1978

Previous Fields

  • Languages
    Learning, forgetting, and learning again: Java,PHP, HTML/XHTML, SQL, Pascal

Profile Information

  • Location
    The sticks, Michigan!
  • Interests
    Gadgets that beep and make noise, my children, my bike, and getting lost on the internet.

supertrucker's Achievements

Member

Member (2/7)

0

Reputation

  1. Wow, I feel a little dumb now! I was calling the method with '::' instead of '->', thanks!
  2. Hello,I have written a custom class that is going to handle all of my CRUD operations for my "user" table. Below is the class: <?php class UserDb { const TABLE = "users"; const KEY_ID = "Id"; const KEY_EMAIL = "email"; const KEY_JOIN_DATE = "joinDate"; const KEY_VERIFIED = "verified"; const KEY_LAST_LOGIN = "lastLogin"; const KEY_FIRST_NAME = "firstName"; const KEY_LAST_NAME = "lastName"; const KEY_PASSPHRASE = "passphrase"; private $db = null; public function __construct() { $this->db = new PDO( 'mysql:host=' . HOST_NAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USER, DATABASE_PASS ); $this->db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } public function userExists($email) { $sql = $this->db->prepare("SELECT * FROM " . self::TABLE . " WHERE " . self::KEY_EMAIL . " = :email"); $sql->execute(array(':email' => $email)); $row_count = $sql->rowCount(); if ($row_count > 0) { return true; } else { return false; } } public function insertUser($user = null) { if (is_null($user)) { $user = new User(); } } } ?> When I run this, I get: Can anyone tell me what I've done wrong? I've never worked with classes in php before.Thank you in advance!
  3. Can anybody help me code out some PHP that will return just the last 10 rows/records of a table? I'm stumped!Thanks in advance,Supertrucker
  4. Also, since I couldn't tell if you're doing so in your code or not already, you could encrypt your users passwords using MD5. Check it out on www.php.net and type md5 into the functions search box. That's what I use for encryping my users passwords, then you can use a simple check to see if a users password is correct, but their real password is actually an MD5 hash string stored in your database. Using MD5 for that sort of application is relatively easy.Peace,Supertrucker
  5. Well, I can't speak for everybody, but I know that I would use it. Most cellular companies offer low cost internet packages for unlimited downloading nowadays. I use it quite frequently actually, and have made the mobile internet the basis for my site. If you're curious about what's really going on in the wireless world, have a look around! Most of the major networks, newspapers, and major web sites have realized the importance of the mobile web in their publications and have put out mobile versions of their sites. So obviously I'm not the only mobile user, or they wouldn't be making any money doing so! I just thought a mobile version of w3schools forums would become a valuable asset for us mobile programmers, and I can't think it would be that difficult to implement. I've already started putting together a WAP site, and when I started this a month or two ago, I knew nothing about web page building/programming.Peace yall!Supertrucker,
  6. Just a suggestion. I know that W3Schools has a couple things that you could view from a mobile device, but how about mobilizing these forums? I find these forums a great resource, and I would love to see them mobilized, so I could read/respond/add posts on the go.Peace,Supertrucker
  7. Thank you, that worked beautifully! Was rackin' my brains out with that one, most of the stuff I need to do I can find in the tutorials, but every so often, I work myself into a corner, and can't figure a way out!Thanks a bundle,Supertrucker
  8. Maybe somebody here can give me an idea of what I am doing wrong. I have a form that posts to itself to validate. The part of the form that I'm having trouble with is this: Home<input type="checkbox" name="tags" value="home" /><br />Horoscopes<input type="checkbox" name="tags" value="horoscopes" /><br />Language<input type="checkbox" name="tags" value="languages" /><br />Law<input type="checkbox" name="tags" value="law" /><br />Local<input type="checkbox" name="tags" value="local" /><br /> The idea with having the "name" attributes the same is that when the form is validated, the selected values could be plugged into an array. My dillemma is, how do I retrieve these values into an array?? I figured I could just use this code: $tags = $_REQUEST['tags']; But it's not working, the $tags variable is only returning one of the selected values, but I can see from passed URL that all of the selected checkboxes were passed along correctly. How do I use PHP to retrieve multiple values from a POST/GET form that have the same name, as in the code up above?Thanks for your help,Supertrucker
  9. If that doesn't work, you could always to this too:echo "<a href='descrip.php?accountnum=".$accountnum."'>";
  10. Thank you, I appreciate the help! I'll let you know how it works out in case anybody else is looking for the same answer as I am!Supertrucker,
  11. Here's what I want, an SQL database that I can use to see what state somebody is in, via their zip code. I would hate to have to program these in myself as there are virtually HUNDREDS of US zip codes out there. I could really use some advice from somebody on this one!Thanks,Supertrucker
  12. To answer my own question again, for others that are interested in this topic, WordPress uses a very simple password encyption process, utilizing the md5() function in php. Here's an example using the md5() function straight from php.net: <?php$str = 'apple';if (md5($str) === '1f3870be274f6c49b3e31a0c6728957f') { echo "Would you like a green or red apple?"; exit;}?> I don't entirely understand the underlying purpose of the md5() function, but the above code is enough for somebody to make use of their WordPress user database in their applications. If anybody can give me a better explanation of what the md5() function is really for, I'd like to know!----------------------WordPress uses MySQL to store it's user data. The users are stored in a table called wp_users. Here are the column fields that are in the wp_users table: user_login user_pass user_nicename user_url user_registered user_activation_key user_status display_name If you don't yet have WordPress installed on your server, you can get it from www.wordpress.com. Installation is a snap, and it's well worth it if you want a good blogging solution for your website. It's 100% free, and there are tons of free plug-ins available for it.I hope this helps somebody out!Regards,Supertrucker
  13. supertrucker

    Word Press

    I have installed Wordpress on my server and was wondering if anybody could give me any advice. I would like to use the the same logons that wordpress uses for my website. In other words, I would like users to be able to create one account that they can use to access the wordpress portion of my web site, and the rest of my web site. Wordpress encrypts the passwords, and I don't even want to start taking apart the wordpress code to figure out what they do. If anybody has any advice, it would be greatly appreciated!Regards,Supertrucker
  14. I wish I saw this post last night when I was trying to figure out how to update my database from my code. I was making the exact same mistake!! At least I know I'm not alone!
  15. Thanks, I need it! Now I need to figure out how to create a script that will allow only specific users to logon for administrative functions.
×
×
  • Create New...