Jump to content

supertrucker

Members
  • Posts

    171
  • Joined

  • Last visited

Everything posted by supertrucker

  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.
  16. Cool, thanks. And can variables from the main script be accessed in the called function still, by declaring them global in the called function? In other words do the included functions act as if they were coded into the main script? Thanks again and in advance!Supertrucker
  17. I appreciate it a lot! I am still learning, but I feel I already the grade school stuff down, I'm just trying to read a high school level book in 6th grade! But really, your explanation did help. I kind of understood what classes were, as I've now implemented a mail function into my code using a mail-class I downloaded. I just didn't understand the code that called it, it makes a lot more sense now!Thanks again,Supertrucker
  18. supertrucker

    Error in PHP

    This is a useless topic, but I figured I'd give some of you experienced php'ers a laugh.Is it possible to write code in php without generating at least one script error? I've been playing around in PHP for about a month or two now and have not yet found that to be the case!Peace,Supertrucker
  19. Thank you, I will give that a shot!Supertrucker
  20. Sorry about the questions one after another, inquiring minds want to know!Can somebody explain to me what this code means? I'm still learning here, and I'm trying to take apart a mail script I downloaded, so i can figure out how to use it correctly, but the examples use this: $pop3 = new POP3; // <------------------- What does this mean???// Get office status $status = $pop3->get_office_status(); // <-------------- and what does this mean/do??? Thanks for your help!Supertrucker
  21. How do you call a function from a different PHP script? I'm a little confused on this topic. Thanks,Supertrucker
  22. How do you call a function from a different PHP script? I'm a little confused on this topic. Thanks,Supertrucker
  23. Thank you! I forgot about the refresh method! I'm kind of learning PHP here on-the-fly, so still I'm trying to get the kinks out! I will also look into the session function. Thank you,Supertrucker
  24. To answer my own question, after much digging on the internet I found a website with some good examples. There's a class available for download that has a lot of functions I was looking for. If other people are reading this and need pop3 in their applications, here's where I found a good example:www.phpit.netThe downloadable class allows you to read email off of a pop server.All you have to do is download a class and install it on your server. The examples do a fairly good job of walking you through the process. I hope this helps somebody! Took me forever to dig useful stuff out of all the useless crap online!Supertrucker
  25. I created a php page that has a form that posts back to the same page, index.php. However, if someone clicks the browser reload button on the "Thank you for submitting!" page, the data is resubmitted. As long as they sit there and keep hitting reload, it will keep resubmitting. I tried the unset() function, but that doesn't actually clear the data from the browser bar that get's reloaded. I pass the data from the original form to the submit page using the "get" attribute. Would changing it to "post" deliver me from evil!? Simply putting a note, I'm afraid, on the web form that says "submit only once" is just asking for trouble! Help!Supertrucker
×
×
  • Create New...