Jump to content

radar

Members
  • Posts

    645
  • Joined

  • Last visited

Everything posted by radar

  1. First off try taking out the $logged_in = ''; out of it.. 'cause you've got it over-writing anything thats stored in the variable...  try that if it doesnt work come back and let us know whats actually happening.. 
  2. Okay try changing the query I gave you to this (both lines of $mem other than the result).. [CODE] $mem = "SELECT last_activity FROM users WHERE username = '$user_name'"; $mem = mysql_query($mem) or die("Error: ". mysql_error(). " with query ". $mem); // what's wrong? [/CODE] change it to that -- run it again and then tell me what it says...
  3. try swapping the order >= that might be the way...
  4. Yes I have MSN -- it is Justin@morphicdesigns.com -- (email address doesnt work anymore but the msn still does)...  and I can help ya out anyway possible...
  5. You can keep all your functions in a seperate file as is what I do.. Just put your require statement before you are going to call the function..  Thats all that needs to happen..  If its going to break your code -- you might re-think your coding style.
  6. okay so lets do it like this instead... <?php $time = time() - 15 * 60 $mem = "SELECT last_activity FROM users WHERE username = '$user_name'"; $mem = mysql_query($mem); $mem = mysql_result($mem, 0); if ($time => $mem) { echo '<img src="in.gif">'; } else { echo '<img src="out.gif">'; } ?> Then as said before you would use the UPDATE query command to update the last_activity with $time = time() ... this seem more like what you want?
  7. I went to your site and registed - I've also included a link to my forums which will contain tutorials for photoshop and many others design software and programming included (php and mysql in the list)..  You can visit there and I'll be able to help you with just about anything you need..  I can also hopefully teach you how to make your site templateable so that if you decide to re-template your site -- you don't have to mess with your coding much if at all...
  8. yeah this is gonna be easier.. much much much easier.. lol First off -- you'll need to be able to have a way to read the user of the profile or whatever..  some sort of a string that the username the online/offline image is going to show up under...  in the instance of my code imma use $user_name [CODE] <?php $time = time() - 15 * 60 $mem = "SELECT inout FROM users WHERE username = '$user_name'"; $mem = mysql_query($mem); $mem = mysql_result($mem, 0); if ($mem == "in") { echo '<img src="in.gif">'; } else { echo '<img src="out.gif">'; } ?> [/CODE] This should be more at what you are looking for...  The code before was trying to list all of their usernames.. lol...
  9. Okay now i have a question..  Do you want it so that when they log in there is an "online" or "offline" image or are you trying to list their usernames? maybe ive given you the wrong code....
  10. Let me see your page that your running..  And if you can -- attach the file for the page you're working on... and i'll take a look at it too...
  11. do it like this.. [CODE] <?php $time2 = time(); echo $time2; ?> [/CODE]
  12. time() gets you the ammount in seconds for the current date and time...  - 60 means minus 60 seconds.. and * 15 means 60 * 15 which is 15 minutes.. so basically $time = time() - 60 * 15; just makes the time it is now minus 15 minutes...
  13. In order to really help you should post the code for your headers_list function and your headers_sent function...  Give a little insight into what it is the code is doing and what it is not doing...
  14. Well you should already have a table that you have all your members listed in.. just add a field at the end called last_activity -- and then on every page have it update their last activity by using the mysql command UPDATE.. Then to get the time for the update just use $time = time();  this will give you a series of digits in seconds...  seconds are easier to work with... Once that is done, you impliment the code above wherever you want it to show on your site.
  15. Well if I am correct a hard link it like [CODE] <a href="http://www.mysite.com/images/sucka.gif"> [/CODE] and a soft link would be like [CODE] <a href="images/sucka.gif"> [/CODE] again I may not be correct but that would seem to be the obvious to me.
  16. Well not quite sure I understand what you are talking about here -- perhaps a little code snippet will help.
  17. ahh you want a list of names for those who are logged in.. okay how bout this code... [CODE] <?php $time = time() - 60 * 15; $mems = "SELECT * FROM members WHERE last_activity <= $time"; $mems = mysql_query($mems); $cnt = mysql_num_rows($mems); for ($i = 0; $i < $cnt && $rows = mysql_fetch_assoc($mems); $i++) { echo $rows['username'].', '; } ?> [/CODE] Something similar to this may be what you are looking for... Now also keep in mind I have not tested this and it may not work as planned but it should get you on your way to what you want... Breakdown of the code: Select * from database where last activity is 15 minutes ago or after.. $cnt - count how many entries are in the results... for loop -- i = 0 and is less than $cnt lets get an associative array and up it to the next info... echo $rows['username'].', ' will simply print out "Radar, "
  18. I am not the best programmer on here by far but I do know a lot about PHP and yes you are a bit confusing but thats okay most people are when they are first starting out... First off, to get any information from the mysql database you have to learn a few basic commands in both php and mysql..  Now so I don't just ramble on and go through a bunch of un needed stuff, how much php do you know and what do you know about mysql.. such as, do you know how to open and close php (using the tags), and do you know how to open up a connection to your database via php/mysql...
  19. I've done this before..  #1 thing you need to have a time stamp saved for every user logged in..  I generally do this in the members table in a field called last_activity #2 if You want to calculate how many guests are online -- you might want to make another table called "Online_Guests" with 1 field with the name of "Username" #3 -- how long do you want it delayed? and do you want to be able to change it?  If you want to change it then you'd be better off doing a database setup on that part and put say 15 in the delay for 15 minutes..  Once you have that -- this would be your basic code.. [CODE] <?php $time = time() - 60 * 15; $mems = "SELECT * FROM members WHERE last_activity <= $time"; $mems = mysql_num_rows(mysql_query($mems), 0); $guest = "SELECT * FROM online_guests"; $guest = mysql_num_rows(mysql_query($guest), 0); $tot = "SELECT * FROM members"; $tot = mysql_num_rows(mysql_query($tot), 0); echo $mems." members online"; echo $guest." guests online"; echo $tot." total members"; ?> [/CODE] Keep in mind i just threw that together -- it may have a few bugs but for the most part it could work..  you could also instead of using the mysql_num_rows command use the count(*) in the select query instead of just *..  Hope it has helped.. have fun...
  20. radar

    Classes

    First off it's been a while since I've visited here as I've been without the internet.  I must say I like the new design and the new setup you've got here..  It looks Great..  And now on with the Show.. I've just barely been getting into using classes and making a site templateable in php and I'm trying to incorporate this into my site though not having much luck... First off I must say I am not the best at programming functions and stuff like that so I robbed the class files from PHPBB2.. Perhaps a bad choice, but It works so far for what I need...  So here is what I am doing...  I am working on the Administration Console of my site first...  I am programming everything on my site from the front end, to the console and even the forums.  I want it all to be templatable so that I can easily switch interfaces if I ever decide to... So 2 Admins log in.. one is a Root Admin the other is a Forum Admin..  On my site the layout will be the exact same but I need 1 of 3 files to load on the left hand side..  these files are either.. left_root.tpl left_site.tpl left_forum.tpl This is strictly the Template itself for the navigation..  The main template is main.tpl  -- I can't figure out how to load the other tpl's within the other one where they need to go by like using {left_admin} where they should go...  here is my code thus far on just this part.. [CODE] include('../includes/template.php'); include('../includes/db.php'); include('../includes/functions.php'); $template = new Template(); $template->set_filenames(array( 'body' => '../templates/cesite/admin/main.php', ) ); $template->assign_vars(array( 'admin_note' => 'note: clicking any of the links at the top or bottom of this page will take you away from the admin console', 'left_admin' => 'I hate a gang of HTML here just for testing purposes' )); [/CODE] If you need me to attach the included files to look at the coding there please let me know and I will..  all the code above is in index.php -- So I need to figure out how to load other tpl files into the main.tpl file from index.php..  any help would be grateful.. and thank you in advance.
×
×
  • 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.