Jump to content

Stickybomb

Members
  • Posts

    133
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.3dmonic.com

Profile Information

  • Gender
    Not Telling

Stickybomb's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for being completely oblivious and bumping a topic that was solved a month ago with a link to another topic of mine on the same topic!
  2. oops i knew i forgot something lol here i have a doctype!
  3. ok I am not really up on safari's issues, but for some reason some of my text in firefox and safari do not match up. example i have a div with a background image applied to it. I am trying to align the text over a specific part of the background. However in safari the palcement is always higher or lower than that of safari. if you take a look at the top left of the page there are two links where you see "Dealers, Click here to login." for some reason the links align properly in firefox but not safari. I tried setting an explicit line-height and all that but no luck. any help on what I can do to fix this issue as well as prevent it in the future is surely welcome.
  4. ok I am working on a that will be controlled by wordpress. I am rather new to wordpress usage so I am having some trouble I am trying to display the articles on the main page, but I want to only display those in specific categories. Is there a simple method for doing this? I would like to be abe to specify a page for each categories content, as well as list recent posts from certain categories in the sidebar. any help or suggestions.
  5. I am working on a login system. this is the code i am using to validate and process the login. <?php if($_POST['submitted']=='yes'){ $user = $_POST['userid']; $pass = $_POST['pass']; $remember = $_POST['remember']; require_once('inc/sentry.php'); require_once('inc/validator.php'); $sentry = new Sentry; $validate = new Validator; //check if empty $validate->validateGeneral($user, "* You must enter a UserID<br /><br />"); $validate->validateGeneral($user, "* You must enter a Password<br /><br />"); //check length minimums $validate->validateMinLen($user, '3', "* UserID must be at least 3 characters<br /><br />"); //$validate->validateMinLen($pass, '6', "* Password must be at least 6 characters<br /><br />"); //check length maximums $validate->validateMaxLen($user, '30', "* UserID can not be more than 30 characters<br /><br />"); $validate->validateMaxLen($pass, '16', "* Password can not be more than 16 characters<br /><br />"); //check for password format //$validate->validateNumber($pass, "* Your Password must contain at least 1 letter and 1 number toataling 6-16 characters in length.<br /><br />"); //$validate->validateTextOnly($pass, "* Your Password muct contain at least 1 letter and 1 number toataling 6-16 characters in length.<br />"); if($validate->foundErrors()){ echo '<div id="errors"><p>'; $validate->listErrors($delim = '<br />'); echo '</p></div>'; include('templates/loginform.tpl'); exit(); }else{ echo 'Processing Login...'; //strip slashes and spaces $user = $validate->cleanValue($user); $pass = $validate->cleanValue($pass); //strip headers $user = $validate->stripHeaders($user); $pass = $validate->stripHeaders($pass); //validate login attempt $sentry->checkLogin($user,$pass,$remember); } }else{ include('templates/loginform.tpl'); } ?> basically if there are errors during validation it will display the errors above the login form, if there are no errors it should process the login. for some reason it is ignoring the else statement and displaying validation errors and still carrying out processing the login. anyone help me to figure this out thanks
  6. I mean like slidein and slideout effect for mootools. Also a div has a set height if you apply a background color to it you can see it with no content.
  7. ok so i am making a php login system and I am wanting to use mootools to check for problems before processing the login. basically I have a div to contain any errors. I wan it to be collapsed, but if there are errors have it expand and append the returned error msgs to it. I know what I am doing as far as the php goes but Im not really up on mootools and would like some help. this is what i have so far my login template: <script type="text/javascript"> window.addEvent.('domready', function(){ $('errors').setStyle('visibility','hidden').empty() var form = $('loginForm'); var url = 'inc/process/validate.php?' + form.toQueryString(); form.addEvent('submit', function(e){ e = new Event(e).stop(); new Ajax(url,{ evalScripts: true, }); }); }); </script> <div id="errors"></div> <form method="post" id="loginForm" action="index.php?section=process&action=login"> <table align="center" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td width="120"> <div align="left"><strong> <label for="userid">UserID:</label> </strong></div> </td> <td> <div align="left" class="string"> <input name="userid" type="text" class="input" id="userid" value="" size="32" /> </div> </td> </tr> <tr> <td width="120"> <div align="left"><strong> <label for="pass">Password:</label> </strong></div> </td> <td> <div align="left"> <input name="pass" type="password" class="input" id="pass" value="" size="32" /> </div> </td> </tr> <tr> <td width="120"> <div align="left"><strong> <label for="pass">Remember me:</label> </strong></div> </td> <td> <div align="left"> <input name="remember" type="checkbox" id="remember" value="" /> </div> </td> </tr> <tr> <td colspan="3"> <div align="right"> <input type="image" name="submit" id="submit" class="submit-btn" src="http://www.roscripts.com/images/btn.gif" alt="submit" title="submit" /> </div> </td> </tr> </table> </form> the validation script: <?php require_once('../validator.php'); $validate = new Validator; //get posted variables $user = $_POST['userid']; $pass = $_POST['pass']; $remember = isset($_POST['remember']) ? $_POST['remember'] : unchecked; //check if empty $validate->validateGeneral($user, "* You must enter a UserID<br /><br />"); $validate->validateGeneral($user, "* You must enter a Password<br /><br />"); //check length minimums $validate->validateMinLen($user, '3', "* UserID must be at least 3 characters<br /><br />"); $validate->validateMinLen($pass, '6', "* Password must be at least 6 characters<br /><br />"); //check length maximums $validate->validateMaxLen($user, '30', "* UserID can not be more than 30 characters<br /><br />"); $validate->validateMaxLen($pass, '16', "* Password can not be more than 16 characters<br /><br />"); //check for password format $validate->validateNumber($pass, "* Your Password must contain at least 1 letter and 1 number toataling 6-16 characters in length.<br /><br />"); //$validate->validateTextOnly($pass, "* Your Password muct contain at least 1 letter and 1 number toataling 6-16 characters in length.<br />"); if($validate->foundErrors()){ ?> <script type="text/javascript"> window.addEvent('domready', function(){ $('errors').setStyle('visibility','visible').empty().appendText('<?php $validate->listErrors('<br />'); ?>'); }); </script> <?php }else{ echo "<meta http-equiv='refresh' content='5;url=index.php?section=process&action=login&userid=".$user."&pass=".$pass."&remember=".$remember."&".strip_tags(session_id()); } ?> basically the way my validation class works is that for every check that i run it adds the specified error msg to an error error if it fails validation. I then do a check if the array contains anything and list each of the values. My problems: how do i set the div to be collapsed and not visible initally. then if there are errors make it expand and add the errors. if no make it go on to process the login. any help with this please
  8. ok for some reason i am getting warings saying that Warning: supplied argument is not a valid MySQL result resource when ever i try to run my scripts. for all my functions. this is my class <?php //////////////////////////////////////////////////////////////////////////////////////// // Class: Db // Purpose: Connect to a database, MySQL version /////////////////////////////////////////////////////////////////////////////////////// require_once 'core.php'; class Db extends Core { var $theQuery; var $link; //*** Function: DbConnector, Purpose: Connect to the database *** function Db(){ // Load settings from parent class $settings = Core::getSettings(); require_once('mysql.php'); // Get the main settings from the array we just loaded $host = $settings['dbhost']; $db = $settings['dbname']; $user = $settings['dbusername']; $pass = $settings['dbpassword']; // Connect to the database $this->link = mysql_connect($host, $user, $pass); mysql_select_db($db); } //*** Function: query, Purpose: Execute a database query *** function query($query) { $this->theQuery = $query; return mysql_query($query, $this->link) or die(mysql_error()); } //*** Function: getQuery, Purpose: Returns the last database query, for debugging *** function getQuery() { return $this->theQuery; } //*** Function: getNumRows, Purpose: Return row count, MySQL version *** function getNumRows($result){ return mysql_num_rows($result); } //*** Function: fetchArray, Purpose: Get array of query results *** function fetchArray($result) { return mysql_fetch_array($result); } //*** Function: close, Purpose: Close the connection *** function close() { mysql_close($this->link); } } ?> Bascially I got this class directly from a tutorial that I am following so can some please help me figure out what is happening. I am running it in a login class. I query the database to check for the user and if the rows is greater than 0 i validate otherwise i return to the login page.
  9. ok well this is the query i am running function selectByUser($user) { $sql = 'SELECT user_name,user_level,user_sid,user_id,user_pass FROM users WHERE user_name = "'.addslashes($name).'" LIMIT 1'; return $sql;
  10. ok I am having problems with my login system. basically i am getting the following Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sticky/public_html/cms/inc/sentry.php on line 123 and the login does not process. this is the function i use to check mylogin <? // Log in, and either redirect to pass or fail depending on success function checkLogin($user = '',$pass = '',$group = 10,$remember = ''){ // Include database and validation classes, and create objects require_once('functions.php'); require_once('db.php'); $db = new Db(); $results = $db->query(selectByUser($user)); if ($results){ $user = mysql_fetch_array($results); $active = $db->query(getActive($user['user_id'])); //check if user has been activated if(!$avtive){ echo "<meta http-equiv='refresh' content='5;url=index.php?section=activate&userid=".$user['user_sid']."&".strip_tags(session_id()); } //hash the pass $pass = hashValue($pass); //create submitted check string $user_check = $pass.$user['user_sid']; //get stored check string $db_check = $user['user_pass'].$user['user_sid']; if($user_check==$db_check){ $sid = generateSid(); //update timestamp and generate new sid $db->query(updateonLogin(generateTimestamp(),$sid,$id)); // Existing user ok, continue echo "<meta http-equiv='refresh' content='5;url=index.php?section=cms'".strip_tags(session_id())." />"; return true; } }else{ // Login BAD $this->logout(); echo "<meta http-equiv='refresh' content='5;url=index.php?section=login'".strip_tags(session_id())." />"; return false; } } ?> any help or suggestions?
  11. there was a spelling error in my statement
  12. ok so i need to put the authentication before the html tags ??? i reworked my sentry class seperating the login function into a login function a session authentication function and a cookie authentication function. in the index.php file i include a new file called auth.inc.php that basically checks if the section is process. if so it checks the login. else it checks if session varibles are set and validates the session if not it checks if cookies are set and validates them. now i am given the following errors i am still getting one header error, yet all of my processing is done prior to declaring the html tags. its pointing to the last header relocation statement in my checkLogin function. // Login BAD $this->logout(); header("Location: index.php?section=login&".strip_tags(session_id())); return false; as for the other error it does not like the following function for some reason even though its one directly from the tutorial i was following. //*** Function: getNumRows, Purpose: Return row count, MySQL version *** function getNumRows($result){ return mysql_num_rows($result); } can you help with this.
  13. hi I am rather new to oop, trying to learn it and get the hang of it. I have started writting a login system to help me practice and learn it better. basically i plan on building onto it to make a cms for myself. I have been using a good tutorial I have fond for creating a cms in oop to basis it off of as I go. its the tutorial used for creating the lutra_basic Otter Cms if your familiar with it. I am having some issues with headers and what not. when I try and log in it gives me the following errors my structure is as follows... I have 6 main scripts core.php <- contains my system settings . db.php <- class that handles the connection working with the database. functions.php <- contains some misc. functions used for now until i find a better place for them. mysql.php <- contains functions returning the sql statment needed (IE getUser() = SELECT * FROM users) sentry.php <- contains the class for hanling the login and authentication procedures. validator.php <- contains class to validate the input. for sake of figuring out these errors i am not validating the input and am using the user admin with pass admin for testing db.php// <?php //////////////////////////////////////////////////////////////////////////////////////// // Class: Db // Purpose: Connect to a database, MySQL version /////////////////////////////////////////////////////////////////////////////////////// require_once 'core.php'; class Db extends Core { var $theQuery; var $link; //*** Function: DbConnector, Purpose: Connect to the database *** function Db(){ // Load settings from parent class $settings = Core::getSettings(); require_once('mysql.php'); */ // Get the main settings from the array we just loaded $host = $settings['dbhost']; $db = $settings['dbname']; $user = $settings['dbusername']; $pass = $settings['dbpassword']; // Connect to the database $this->link = mysql_connect($host, $user, $pass); mysql_select_db($db); register_shutdown_function(array(&$this, 'close')); } //*** Function: query, Purpose: Execute a database query *** function query($query) { $this->theQuery = $query; return mysql_query($query, $this->link) or die(mysql_error()); } //*** Function: getQuery, Purpose: Returns the last database query, for debugging *** function getQuery() { return $this->theQuery; } //*** Function: getNumRows, Purpose: Return row count, MySQL version *** function getNumRows($result){ return mysql_num_rows($result); } //*** Function: fetchArray, Purpose: Get array of query results *** function fetchArray($result) { return mysql_fetch_array($result); } //*** Function: close, Purpose: Close the connection *** function close() { mysql_close($this->link); } } ?> sentry.php// <?php //////////////////////////////////////////////////////////////////////////////////////// // Class: sentry // Purpose: Control access to pages //////////////////////////////////////////////////////////////////////////////////////// class Sentry { function sentry(){ session_start(); header("Cache-control: private"); } //check if user is banned function isBanned() { $result = $db->query(ipBanCheck()); if($db->getNumRows($result)==1){ header("Location: index.php?section=banned&".strip_tags(session_id())); } $result = $db->query(userBanCheck($this->login['user'])); if($db->getNumRows($result)==1){ header("Location: index.php?section=banned&".strip_tags(session_id())); } } //sets a cookie for auto login function setCookie($sid,$pass) { require_once('functions.php'); //generate cookie values $expire = time() + 1728000; // Expire in 20 days $cookie_string = hashValue(hashValue($pass).hashValue($sid)); //set cookie //setcookie('user', $user, $expire); setcookie('pass', $cookie_string, $expire); } //destroy the current session function logout() { session_destroy(); unset($_SESSION['id']); unset($_SESSION['pid']); unset($_SESSION['logedin']); unset($_SESSION['lid']); return true; } // Log in, and either redirect to pass or fail depending on success function checkLogin($user = '',$pass = '',$group = 10,$remember = ''){ // Include database and validation classes, and create objects require_once('functions.php'); require_once('db.php'); $db = new Db(); // If user is already logged in then check credentials if ($_SESSION['id'] && $_SESSION['logedin']){ $results = $db->query(sessionAuth($_SESSION['id'])); if ($db->getNumRows($results) > 0){ // Existing user ok, continue header("Location: index.php?section=cms&".strip_tags(session_id())); return true; }else{ // Existing user not ok, logout $this->logout(); return false; } }else{ $results = $db->query(selectByUser($user)); if ($db->getNumRows($results) > 0){ $user = $db->fetchArray($results); $active = $db->query(getActive($user['user_id'])); $active = $db->fetchArray($active); //check if user has been activated if($avtive['user_active']!=1){ header("Location: index.php?section=activate&userid=".$user['user_sid']."&".strip_tags(session_id())); } //hash the pass $pass = hashValue($pass); //create submitted check string $user_check = $pass.$user['user_sid']; //get stored check string $db_check = $user['user_pass'].$user['user_sid']; if($user_check==$db_check){ $sid = generateSid(); //update timestamp and generate new sid $db->query(updateonLogin(generateTimestamp(),$sid,$id)); //set cookie if($remember=='checked'){ $this->setCookie($user,$pass); } //set session varialbles $_SESSION['id'] = $sid; $_SESSION['pid'] = $pass.$sid; $_SESSION['logedin'] = 1; $_SESSION['lid'] = hashValue($user['user_level']).$sid; // Existing user ok, continue header("Location: index.php?section=cms&".strip_tags(session_id())); return true; } }else{ // Login BAD $this->logout(); header("Location: index.php?section=login&".strip_tags(session_id())); return false; } } } } ?> mysql.php// <?php function updateonLogin($timestamp,$sid,$id) { $sql = 'UPDATE users SET users_sid = "'.$sid.'", users_timestamp = "'.$timestamp.'", users_ip = "'.$_SERVER['REMOTE_ADDR'].'" WHERE user_id = "'.$id.'" LIMIT 1'; return $sql; } function authCheck($sid) { $sql = 'SELECT user_sid FROM users WHERE user_sid = "'.$sid.'" LIMIT 1'; return $sql; } function getActive($id) { $sql = 'SELECT user_id FROM active_users WHERE user_id = "'.$id.'" LIMIT 1'; return $sql; } function selectByUser($user) { $sql = 'SELECT user_name,user_level,user_sid,user_id,user_pass FROM users WHERE user_name = "'.addslashes($name).'" LIMIT 1'; return $sql; } function sessionAuth($sid) { $sql = 'SELECT user_pass, user_lvl FROM users WHERE user_sid = "'.$sid.'" LIMIT 1'; return $sql; } function selectByEmail($email) { $sql = 'SELECT user_name FROM users WHERE user_email = "'.addslashes($email).'" LIMIT 1'; return $sql; } function insertUser($user,$pass,$email,$sid,$time,$ip) { $sql = 'INSERT INTO users (user_pass, user_name, user_level, user_email, timestamp, user_sid, user_ip) VALUES ("'.$pass.'","'.addslashes($user).'",1,"'.addslashes($email).'","'.$time.'","'.$sid.'","'.$ip.'")'; return $sql; } function userGetIdBySid($sid) { $sql = 'SELECT user_id FROM users WHERE user_sid = "'.$sid.'" LIMIT 1'; return $sql; } function activateUser($id,$time) { $sql = 'INSERT INTO users (user_id, timestamp) VALUES ("'.$id.'","'.$time.'")'; return $sql; } function newSid($id,$nid) { $sql = 'UPDATE users SET users_sid = "'.$nid.'" WHERE user_id = "'.$id.'" LIMIT 1'; return $sql; } function ipBanCheck() { $sql = 'SELECT * FROM banned_users WHRE user_ip = "'.$_SERVER['REMOTE_ADDR'].'" LIMIT 1'; return $sql; } function emailBanCheck($email) { $sql = 'SELECT * FROM banned_users WHRE user_email = "'.addslashes($email).'" LIMIT 1'; return $sql; } function userBanCheck($name) { $sql = 'SELECT * FROM banned_users WHRE user_name = "'.addslashes($name).'" LIMIT 1'; return $sql; } ?> for calling i am using a simple php template system with the variable $section I have two pages login.tpl and process.tpl for handling the login login.tpl// <?php if(isset($_COOKIE['pass'])){ require_once('inc/sentry.php'); $sentry = new Sentry; //validate login attempt $sentry->checkLogin($_COOKIE['pass'],'10',$remember); } ?> <form method="post" id="registerForm" action="index.php?section=process&action=login"> <table align="center" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td width="120"> <div align="left"><strong> <label for="userid">UserID:</label> </strong></div> </td> <td> <div align="left" class="string"> <input name="userid" type="text" class="input" id="userid" value="" size="32" /> </div> </td> </tr> <tr> <td width="120"> <div align="left"><strong> <label for="pass">Password:</label> </strong></div> </td> <td> <div align="left"> <input name="pass" type="password" class="input" id="pass" value="" size="32" /> </div> </td> </tr> <tr> <td colspan="3"> <div align="right"> <input type="image" name="register" class="submit-btn" src="http://www.roscripts.com/images/btn.gif" alt="submit" title="submit" /> </div> </td> </tr> </table> </form> process.tpl// <?php $section=$_GET['action']; switch($section){ case 'login': //get posted variables $user = $_POST['userid']; $pass = $_POST['pass']; require_once('inc/sentry.php'); $sentry = new Sentry; //validate login attempt $sentry->checkLogin($user,$pass,'10',$remember); break; case 'logout': require_once('inc/sentry.php'); $sentry = new Sentry; $sentry->logout(); break; } ?> on a success full login i am just including the words congradulations for now contained in a cms.tpl file any help on how to improve, fix or go about this would be greatly appriciated. As I said this is my first attempt at oop in php so any tips and points are helpful as well. thks Sticky
×
×
  • 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.