Jump to content

txmedic03

Members
  • Posts

    313
  • Joined

  • Last visited

About txmedic03

  • Birthday 07/20/1983

Contact Methods

  • AIM
    firerescuenremt
  • MSN
    w5firefighter@msn.com
  • Website URL
    http://www.trap-nine.com
  • ICQ
    70184804
  • Yahoo
    FireRescueNREMT
  • Skype
    txmedic03

Profile Information

  • Gender
    Male
  • Location
    Call, TX, USA

txmedic03's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. [!--quoteo(post=360338:date=Mar 31 2006, 06:42 AM:name=gzabriskie)--][div class=\'quotetop\']QUOTE(gzabriskie @ Mar 31 2006, 06:42 AM) [snapback]360338[/snapback][/div][div class=\'quotemain\'][!--quotec--] To txmedic03, I have been scratching my head for about a week trying to come up with a solution to limiting the number of logins a user can have, and this little forum topic did the trick. Your examples worked great. I already had an authentication for logging in I just added the sessions table and the checks by adding the first part of your code at the top of each page. I use PEAR so I had to make adjustments to the code for my queries but all in all it was pretty simple. It works great! Thanks for your contributions, you saved me a lot of time! [/quote] I'm glad I could help. As soon as I get a change I'm going to write the "lite" version as well as possibly some improvements I think I might be able to make to the existing code.
  2. Well as soon as I find the time to put a proper tutorial together, I'll drop it in your e-mail.
  3. [!--quoteo(post=360138:date=Mar 30 2006, 02:34 PM:name=steelmanronald06)--][div class=\'quotetop\']QUOTE(steelmanronald06 @ Mar 30 2006, 02:34 PM) 360138[/snapback][/div][div class=\'quotemain\'][!--quotec--] You can submit code to the PHP Code Library. You just can't currently submit tutorials. Thanks for the info, steelmanronald06, I'll submit some codes later. I still look forward to the tutorial submition being opened up.
  4. It wouldn't be hard for the forums to show most recent 5 threads started by the user, but would it be useful? In my humble opinion, no. I'm sorry, but I'm not going to change my signature if I ever ask a question. I stay far too busy to worry about forum signatures. Now, would I follow a link to a forum thread to answer a question?...yes, I probably would, but only if it were formatted something like this: -------------- Unsolved Problem: http://Session Problem on PHP Newbie Help {date} I don't want to click on it and end up wasting time looking at a topic I am not well versed in myself. The date thing tells me how fresh the link is, if it is 2 months old I can assume that you just haven't changed your signature and it was probably already solved. Anything you can do to make sure you get the help you need without annoying everyone or breaking forum rules is a great thing, but I can tell you right now personally I would not click on a link to some topic if I didn't know what I was getting into.
  5. Two problems marker5a. 1) I believe that Spycat was refering to the forums here, not on a personal server so they can't change the php.ini file. 2) You should try to eliminate as much load time as possible. If you just keep cranking up your execution time out you could have an excessive load time that your users will not hang around for. 30 seconds should be more than enough. If your script executes longer than 30 seconds I strongly recommend you rethink your code.
  6. Akregator + RSS feed = quick and easy. I like it.
  7. I too would like to post some tutorials and/or scripts. If at all possible, I would like to know a time frame or possibly let me know if there is anything I could do to help expedite the process. Any feedback would be nice.
  8. I'll have to look over your code to be able to make suggestions on changes, but don't fear session_start(). session_start() does not mean that the user is logged in. It only means that you have a session where you can store information that will carry throughout the domain. With my particular script the session is not used for anything except creating a unique identifier for the individual that comes to the site. I think I'll probably work on a "lite" version later.
  9. The sessions table has three user levels admin, user and guest (on my particular setup anyway). When someone visits the page it creates a "guest" session for the live counter to use. Since I wrote this to be integrated with a live counter, you would need to make some modifications so you do not need the session_start on the login page. It seems that you found something I overlooked when I wrote this code. When the user does not previously exist it returns an invalid query result. I have made the needed changes in my earlier post to fix the code. I look forward to any more questions or comments you may have. [code]if (mysql_num_rows(mysql_query("SELECT username FROM users WHERE username='".$_POST['username']."' LIMIT 1", $conn)) == 1) $error .= "Username already taken.<br />\r\n";[/code]
  10. I do what I can, and incidently, yes I do stay very busy. Okay, so down to business... You will need a table for all of your users and the information about each one you need to have access to for whatever reason. Let's just go over the basic layout of the table you'll need and then we can get down to the registration coding. You will have to excuse me because I formatted my box when I upgraded and I didn't keep my files on this topic, so everything is coming off the top of my head. Well you will need a unique identifier that will auto_increment...we'll call this field id and it will be int(11). It will be the primary unique identifier. A username of course is a must so we'll call it name and make it a text field (you can specify a max size if you like). We can't let them login without a password so let's call this next one pass and make it text as well (you can use password type, but for the moment we won't get into any encryption). Now you may want your users to supply extra information like an e-mail address or something, but I leave that at your discretion. You now have the basics of this table setup and you can have registered users. We have a table, but now we need a way to put the information in it...let's create separate pages for the moment so as not to get confused with too much code on one page. First we need a registration form to write information to the users table. [code]<form action="doreg.php" method="POST">   <label for="username">Username:</label> <input type="text" name="username" id="username" /><br />   <label for="password">Password:</label> <input type="password" name="password" id="password" /><br />   <label for="confirmpass">Confirm Password:</label> <input type="password" name="confirmpass" id="confirmpass" /><br />   <input type="submit" value="Register" /> </form>[/code] I put two password fields so you can make sure they typed the same thing twice. You don't have to do this and can leave the confirmation code out of the doreg.php page. The <label></label> is just for standard compliance and for people who use screen readers and such to help them navigate the site better. Now for the fun part. Let's do something with the username and password they just gave us. [code]<?php // Need to create a connection to the database again $conn = mysql_connect([db host], [username], [password]) or die(mysql_error()); mysql_select_db([db name], $conn) or die(mysql_error()); // Let's setup an empty variable to hold our error messages. $error = ""; // Let's make sure that they typed the same password twice if ( $_POST['password'] != $_POST['confirmpass'] ) $error .= "Your passwords did not match.<br />\r\n"; // Now let's see if there were anymore problems like empty fields. if ( $_POST['username'] == "" ) $error .= "You must enter a username.<br />\r\n"; if ( $_POST['password'] == "" ) $error .= "You must enter a password.<br />\r\n"; //Now we must make sure no one else is using that username if (mysql_num_rows(mysql_query("SELECT name FROM users WHERE name='".$_POST['username']."' LIMIT 1", $conn)) == 1) $error .= "Username already taken.<br />\r\n"; // Okay let's make sure we didn't have any errors or if we did then tell the people what went wrong. if ( $error != "" ) die($error); // Well since none of the errors we accounted for occured let's create a new entry in the database for our user. if (mysql_query("INSERT INTO users values ('', '".$_POST['username']."', '".$_POST['password']."')", $conn)) {   header('Location: index.php'); // You successfully registered the user now let's send them back to the main page.  Alternatively you could just echo a message here saying something like "Success! You have been registered click [here] to go to the login page. } else {   die(mysql_error()); // Something went wrong with the registration. } ?>[/code] I think that pretty much covers everything. If you have any questions or if you feel I skipped something you really needed, then just let me know. Alternatively if anyone has any better ideas on this matter or if you see a mistake in my coding, I would really like to know. Otherwise have fun and happy coding!
  11. Though that would be a wonderful tool for those that do not understand (x)html, but would like to make minor changes to their premade scripts, I have no knowledge of such a thing. My suggestion to you is to spend a little time studying xhtml, php and css. Then, if you insist on using a WYSIWYG editor, you will be able to design the page in the editor and go to code view and insert php snippets. It won't look right in the editor, but then you can view it on the server.
  12. I like ken's method...simplicity... :-)
  13. Who said anyone was mad? I was simply showing them their mistake. Why should I sit back and watch someone continue on misinformed? I never said the conference was a bad idea. Anytime you can teach someone else something they do not know, you should. Which is what I was doing, teaching them the difference between programmers/programs and scripters/scripts. I am sorry that you took it the wrong way. I am not here to be rude or mean simply to inform.
  14. Yes, shortj, it is easier to include a separate page...you figured me out. :-D I use header.php and footer.php on my pages to propigate my layout and the code that goes on every single page across my entire site. The portion of the code I said goes on every page is just a snippet from header.php. I seem to have lost my mind...have any of you seen it? Things have been so crazy around here the last few days with upgrading systems and such. I was supposed to write a registration page, right? Was there something else besides that? I'll post tomorrow. New System: AMD64 Athlon 3200+ (2,000 Mhz) 512MB DDR Western Digital 300GB 7200RPM 8MB Cache nVidia 6600GT 128MB SuSE Linux 10.0 ASUS A8V-E SE
  15. Not quite. See your logic is flawed. If there have been no new pictures in three months but today is the 9th day of the 4th month and there were new pictures on the 6th day of the 1st month...9-6=3 3<=5....which means new pictures, right?...need to make sure the months and years are appropriate too.
×
×
  • 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.