Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. no that did not work at all, it just says my new class name. (in the error)
  2. na, I asked the coder, its php4 no that did not work, let me rename it.
  3. I downloaded this script (its a year old) I been using it, but I get some errors when I use php5 If I wanna switch back I can just edit my .htaccess thanks I will try that.
  4. no, well the reason I did not post code was because I think people get turned off when helping someone with a message that contains code. well anyways I did try that on a test.php I did not get an error at all! here is database.php <? include("constants.php"); class MySQLDB { var $connection; //The MySQL database connection var $num_active_users; //Number of active users viewing site var $num_active_guests; //Number of active guests viewing site var $num_members; //Number of signed-up users /* Note: call getNumMembers() to access $num_members! */ /* Class constructor */ function MySQLDB(){ /* Make connection to database */ $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $this->connection) or die(mysql_error()); /** * Only query database to find out number of members * when getNumMembers() is called for the first time, * until then, default value set. */ $this->num_members = -1; if(TRACK_VISITORS){ /* Calculate number of users at site */ $this->calcNumActiveUsers(); /* Calculate number of guests at site */ $this->calcNumActiveGuests(); } } /** * confirmUserPass - Checks whether or not the given * username is in the database, if so it checks if the * given password is the same password in the database * for that user. If the user doesn't exist or if the * passwords don't match up, it returns an error code * (1 or 2). On success it returns 0. */ function confirmUserPass($username, $password){ /* Add slashes if necessary (for query) */ if(!get_magic_quotes_gpc()) { $username = addslashes($username); } /* Verify that user is in database */ $q = "SELECT password FROM ".TBL_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); if(!$result || (mysql_numrows($result) < 1)){ return 1; //Indicates username failure } /* Retrieve password from result, strip slashes */ $dbarray = mysql_fetch_array($result); $dbarray['password'] = stripslashes($dbarray['password']); $password = stripslashes($password); /* Validate that password is correct */ if($password == $dbarray['password']){ return 0; //Success! Username and password confirmed } else{ return 2; //Indicates password failure } } /** * confirmUserID - Checks whether or not the given * username is in the database, if so it checks if the * given userid is the same userid in the database * for that user. If the user doesn't exist or if the * userids don't match up, it returns an error code * (1 or 2). On success it returns 0. */ function confirmUserID($username, $userid){ /* Add slashes if necessary (for query) */ if(!get_magic_quotes_gpc()) { $username = addslashes($username); } /* Verify that user is in database */ $q = "SELECT userid FROM ".TBL_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); if(!$result || (mysql_numrows($result) < 1)){ return 1; //Indicates username failure } /* Retrieve userid from result, strip slashes */ $dbarray = mysql_fetch_array($result); $dbarray['userid'] = stripslashes($dbarray['userid']); $userid = stripslashes($userid); /* Validate that userid is correct */ if($userid == $dbarray['userid']){ return 0; //Success! Username and userid confirmed } else{ return 2; //Indicates userid invalid } } /** * usernameTaken - Returns true if the username has * been taken by another user, false otherwise. */ function usernameTaken($username){ if(!get_magic_quotes_gpc()){ $username = addslashes($username); } $q = "SELECT username FROM ".TBL_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); return (mysql_numrows($result) > 0); } /** * usernameBanned - Returns true if the username has * been banned by the administrator. */ function usernameBanned($username){ if(!get_magic_quotes_gpc()){ $username = addslashes($username); } $q = "SELECT username FROM ".TBL_BANNED_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); return (mysql_numrows($result) > 0); } /** * addNewUser - Inserts the given (username, password, email) * info into the database. Appropriate user level is set. * Returns true on success, false otherwise. */ function addNewUser($username, $password, $email){ $time = time(); /* If admin sign up, give admin user level */ if(strcasecmp($username, ADMIN_NAME) == 0){ $ulevel = ADMIN_LEVEL; }else{ $ulevel = USER_LEVEL; } $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)"; return mysql_query($q, $this->connection); } /** * updateUserField - Updates a field, specified by the field * parameter, in the user's row of the database. */ function updateUserField($username, $field, $value){ $q = "UPDATE ".TBL_USERS." SET ".$field." = '$value' WHERE username = '$username'"; return mysql_query($q, $this->connection); } /** * getUserInfo - Returns the result array from a mysql * query asking for all information stored regarding * the given username. If query fails, NULL is returned. */ function getUserInfo($username){ $q = "SELECT * FROM ".TBL_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); /* Error occurred, return given name by default */ if(!$result || (mysql_numrows($result) < 1)){ return NULL; } /* Return result array */ $dbarray = mysql_fetch_array($result); return $dbarray; } /** * getNumMembers - Returns the number of signed-up users * of the website, banned members not included. The first * time the function is called on page load, the database * is queried, on subsequent calls, the stored result * is returned. This is to improve efficiency, effectively * not querying the database when no call is made. */ function getNumMembers(){ if($this->num_members < 0){ $q = "SELECT * FROM ".TBL_USERS; $result = mysql_query($q, $this->connection); $this->num_members = mysql_numrows($result); } return $this->num_members; } /** * calcNumActiveUsers - Finds out how many active users * are viewing site and sets class variable accordingly. */ function calcNumActiveUsers(){ /* Calculate number of users at site */ $q = "SELECT * FROM ".TBL_ACTIVE_USERS; $result = mysql_query($q, $this->connection); $this->num_active_users = mysql_numrows($result); } /** * calcNumActiveGuests - Finds out how many active guests * are viewing site and sets class variable accordingly. */ function calcNumActiveGuests(){ /* Calculate number of guests at site */ $q = "SELECT * FROM ".TBL_ACTIVE_GUESTS; $result = mysql_query($q, $this->connection); $this->num_active_guests = mysql_numrows($result); } /** * addActiveUser - Updates username's last active timestamp * in the database, and also adds him to the table of * active users, or updates timestamp if already there. */ function addActiveUser($username, $time){ $q = "UPDATE ".TBL_USERS." SET timestamp = '$time' WHERE username = '$username'"; mysql_query($q, $this->connection); if(!TRACK_VISITORS) return; $q = "REPLACE INTO ".TBL_ACTIVE_USERS." VALUES ('$username', '$time')"; mysql_query($q, $this->connection); $this->calcNumActiveUsers(); } /* addActiveGuest - Adds guest to active guests table */ function addActiveGuest($ip, $time){ if(!TRACK_VISITORS) return; $q = "REPLACE INTO ".TBL_ACTIVE_GUESTS." VALUES ('$ip', '$time')"; mysql_query($q, $this->connection); $this->calcNumActiveGuests(); } /* These functions are self explanatory, no need for comments */ /* removeActiveUser */ function removeActiveUser($username){ if(!TRACK_VISITORS) return; $q = "DELETE FROM ".TBL_ACTIVE_USERS." WHERE username = '$username'"; mysql_query($q, $this->connection); $this->calcNumActiveUsers(); } /* removeActiveGuest */ function removeActiveGuest($ip){ if(!TRACK_VISITORS) return; $q = "DELETE FROM ".TBL_ACTIVE_GUESTS." WHERE ip = '$ip'"; mysql_query($q, $this->connection); $this->calcNumActiveGuests(); } /* removeInactiveUsers */ function removeInactiveUsers(){ if(!TRACK_VISITORS) return; $timeout = time()-USER_TIMEOUT*60; $q = "DELETE FROM ".TBL_ACTIVE_USERS." WHERE timestamp < $timeout"; mysql_query($q, $this->connection); $this->calcNumActiveUsers(); } /* removeInactiveGuests */ function removeInactiveGuests(){ if(!TRACK_VISITORS) return; $timeout = time()-GUEST_TIMEOUT*60; $q = "DELETE FROM ".TBL_ACTIVE_GUESTS." WHERE timestamp < $timeout"; mysql_query($q, $this->connection); $this->calcNumActiveGuests(); } /** * query - Performs the given query on the database and * returns the result, which may be false, true or a * resource identifier. */ function query($query){ return mysql_query($query, $this->connection); } }; /* Create database connection */ $database = new MySQLDB; ?> constants.php <? /** * Database Constants - these constants are required * in order for there to be a successful connection * to the MySQL database. Make sure the information is * correct. */ define("DB_SERVER", "..."); define("DB_USER", "..."); define("DB_PASS", "..."); define("DB_NAME", "..."); /** * Database Table Constants - these constants * hold the names of all the database tables used * in the script. */ define("TBL_USERS", "users"); define("TBL_ACTIVE_USERS", "active_users"); define("TBL_ACTIVE_GUESTS", "active_guests"); define("TBL_BANNED_USERS", "banned_users"); /** * Special Names and Level Constants - the admin * page will only be accessible to the user with * the admin name and also to those users at the * admin user level. Feel free to change the names * and level constants as you see fit, you may * also add additional level specifications. * Levels must be digits between 0-9. */ define("ADMIN_NAME", "admin"); define("GUEST_NAME", "Guest"); define("ADMIN_LEVEL", 9); define("USER_LEVEL", 1); define("GUEST_LEVEL", 0); /** * This boolean constant controls whether or * not the script keeps track of active users * and active guests who are visiting the site. */ define("TRACK_VISITORS", true); /** * Timeout Constants - these constants refer to * the maximum amount of time (in minutes) after * their last page fresh that a user and guest * are still considered active visitors. */ define("USER_TIMEOUT", 10); define("GUEST_TIMEOUT", 5); /** * Cookie Constants - these are the parameters * to the setcookie function call, change them * if necessary to fit your website. If you need * help, visit www.php.net for more info. * <http://www.php.net/manual/en/function.setcookie.php> */ define("COOKIE_EXPIRE", 60*60*24*100); //100 days by default define("COOKIE_PATH", "/"); //Avaible in whole domain /** * Email Constants - these specify what goes in * the from field in the emails that the script * sends to users, and whether to send a * welcome email to newly registered users. */ define("EMAIL_FROM_NAME", "noreply@lamezz.com"); define("EMAIL_FROM_ADDR", "Lamez's Site"); define("EMAIL_WELCOME", true); /** * This constant forces all users to have * lowercase usernames, capital letters are * converted automatically. */ define("ALL_LOWERCASE", false); ?>
  5. well I looked, and it is not there twice. I just got my webhost to switch my PHP from 5 to 4. would this have done it? It was less than a hour ago.
  6. here is line 14 { lol I am not to sure what that means.
  7. Alright here is the thing, I have a site that is coded in PHP, well it outputs in HTML. If you are logged in it will output something, but if you are not it will out something else. here is my problem, on my website if you are not logged in some pages do not appear right here are the pages: http://www.lamezz.com/info/info.php http://www.lamezz.com/info/trlogin.php http://www.lamezz.com/user/members.php but if you are logged it, it looks great. here is the HTML output for the first link: http://www.lamezz.com/info/info.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="../style/default.css"/> <link rel="shortcut icon" href="../style/img/favicon.ico"> <title>Lamez's Corner - Information</title> </head> <body> <div class="body"> <div class="logo"><img src="../style/img/logo.png" alt="Lamez's Corner Logo" border="0"/></div> <div class="bar"></div> <div class="navc"> <div class="headb">Viewing Site</div> <p> Lamez is <font color="#FF0000">Offline</font><br />Registered Members: 0 <br />Guests: 1<br /><br /></p> <div class="headb">Navigation</div> <a href="../index.php"><img src="../style/img/home.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Home</a> <a href="../login.php"><img src="../style/img/login.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Login</a> <a href="../register.php"><img src="../style/img/reg.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Register</a> <a href="../info/info.php"><img src="../style/img/info.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Info</a> <div class="headb">Quick Links</div> <a href="../user/forgotpass.php">Forgot Password</a></div> </div> <div class="box"> <h2>Info Area</h2> <a href="trlogin.php">Having Trouble Logging In? </a><br /> </div> <div class="footer"> Site Template & Original Site Content<br /> © 2007-2008 <a href="mailto:wizkid916@yahoo.com">James Little</a> </div> </div> </body> </html> here is the code for the second link: http://www.lamezz.com/info/trlogin.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="../style/default.css"/> <link rel="shortcut icon" href="../style/img/favicon.ico"> <title>Lamez's Corner - Information</title> </head> <body> <div class="body"> <div class="logo"><img src="../style/img/logo.png" alt="Lamez's Corner Logo" border="0"/></div> <div class="bar"></div> <div class="navc"> <div class="headb">Viewing Site</div> <p> Lamez is <font color="#FF0000">Offline</font><br />Registered Members: 0 <br />Guests: 1<br /><br /></p> <div class="headb">Navigation</div> <a href="../index.php"><img src="../style/img/home.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Home</a> <a href="../login.php"><img src="../style/img/login.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Login</a> <a href="../register.php"><img src="../style/img/reg.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Register</a> <a href="../info/info.php"><img src="../style/img/info.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Info</a> <div class="headb">Quick Links</div> <a href="../user/forgotpass.php">Forgot Password</a></div> </div> <div class="box"> <h2>Having Trouble Logging In? </h2> <div class="box"> 1. Make sure you have <a href="../register.php">registered</a> an account.<br> 2. Attempt to <a href="../login.php">login</a>.<br> 3. If you login, but are not redirect, and cannot view the <a href="../user/members.php">members area</a><br> then choose a browser below and follow the instructions.<br> <br> <br> <a href="trlogin.php?browser=ff">FireFox</a> or <a href="trlogin.php?browser=ie">Internet Explorer 6</a> </div> <div class="footer"> Site Template & Original Site Content<br /> © 2007-2008 <a href="mailto:wizkid916@yahoo.com">James Little</a> </div> </div> </body> </html> what am I doing wrong in the coding for the pages to look like poop? thanks guys, and I have gone over these pages time and time again. Some one with fresh eyes would help. and here is the last page: http://www.lamezz.com/user/members.php
  8. lol sorry, I should have caught that. thanks for the help. I guess I had my brain fart for the night.
  9. I am getting this error in my side.php or my navigation with view active page. anyways I am getting this error: Parse error: syntax error, unexpected $end in /mounted-storage/home48c/sub007/sc33591-LWQU/www/style/include/cons/side.php on line 47 line 47 is my last line, I cannot find any missing } or { anywhere here is my code, any help would be great: <?php include "style/include/session.php"; ?> <div class="navc"> <div class="headb">Viewing Site</div> <p> <?php /** * Just a little page footer, tells how many registered members * there are, how many users currently logged in and viewing site, * and how many guests viewing site. Active users are displayed, * with link to their user information. */ include "style/include/cons/online.php"; echo "<br />Registered Members: $database->num_active_users <br />"; echo "Guests: $database->num_active_guests<br /><br />"; //include("style/include/view_active.php"); ?> </p> <div class="headb">Navigation</div> <?php if($session->logged_in){ print <<<LOG <a href="index.php"><img src="style/img/home.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Home</a> <a href=user/members.php><img src=style/img/user.png hspace=3 vspace=3 border=0 align=absmiddle /> Members*</a> <a href="style/include/process.php"><img src="style/img/login.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Logout</a> <a href="info/info.php"><img src="style/img/info.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Info</a> <div class="headb">Quick Links</div> <a href="user/forgotpass.php">Forgot Password</a></div> print LOG; } else { print <<<LOGI <a href="index.php"><img src="style/img/home.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Home</a> <a href="user/members.php"><img src="style/img/user.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Members</a> <a href="login.php"><img src="style/img/login.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Login</a> <a href="register.php"><img src="style/img/reg.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Register</a> <a href="info/info.php"><img src="style/img/info.png" hspace="3" vspace="3" border="0" align="absmiddle" /> Info</a> <div class="headb">Quick Links</div> <a href="user/forgotpass.php">Forgot Password</a></div> LOGI; } ?>
  10. alright the login and registration works!
  11. alright gotcha, I am actually working on the login page again. it is giving me all sorts of problems. thanks for the heads up lol
  12. I am not too sure what you are talking about it looks great. lol and also my template is mainly based off of DIV's.
  13. I love it! Its very clean, modern. I do not see any cons at all. good job.
  14. your navigation is a eye soar that does not even fit. its ok.
  15. fixed! you can now register
  16. lol I am uploading it sorry. I did not think anyone would be on.
  17. I am mostly done with Lamez's Corner, well I have let is to add the special features. the about me, under the edit profile is not working. any everything else works. Tell me what you think: http://www.lamezz.com/ please report any bugs, missing links, etc.
  18. Thanks a billion, that did work. I was reading the code, and was wondering why there was no certain username. thanks again
  19. no not this time . you are not including a username at all, you are just saying any username. I am no PHP or MySQL expert here, but shouldn't ya include some the username we want online or offline? -thanks a bunch, I really do thank you for your time and help.
  20. ok I lied, it says online to anyone who logs on. how can I make it just one user?
  21. omg, thank you so much! If I had a virtual dollar, I would give you it. Thanks once again.
×
×
  • 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.