Jump to content

Stickybomb

Members
  • Posts

    133
  • Joined

  • Last visited

    Never

Everything posted by Stickybomb

  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
  14. I never intended to omit the columns, I just want to know why i get this error any thoughts or suggestions
  15. i am getting an error when trying to add a user to my database the error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource this is the call for the statment: $db->query('INSERT INTO users (user_pass, user_name, user_lvl, user_email, user_timestamp, user_sid, user_ip) VALUES ("'.$pass.'","'.$user.'","1",,"'.$email.'","'.$time.'","'.$sid.'","'.$ip.'")'); i do not see whats causeing the poblem
  16. ok I am trying to make a login system. i have all the classes made up to perform the basics of the system. but when i run a simple script i wrote to add a user it makes through with no errors, but it does not create the user. i ran the following to make sure it was working and to give me a default user to work with. <?php include('inc/security.php'); $reg = new Registration('myemail@mysite.com','username','pass'); $reg->addUser(); echo "<strong>CONGRADULATIONS</strong>"; ?> i am using four files in the system. config.php <- contains my global connection variables which are all correctly entered. security.php <- contains the bulk of the processing for the system. db.php <- contains the database connection and a few methods to handle interaction with the database. mysql.php <- contains all the querys on the database. DB.php <?php //include constant variables include('config.inc.php'); class Db { var $sql_database; var $sql_user; var $sql_pass; var $sql_host; var $sql_tbl_prefix; var $theQuery; /* ================================================================= | #1 - Constructor | ********************************************************* | Description: | aquires variables for database connection. ================================================================= */ function Db(){ $this->sql_database = DB_NAME; $this->sql_user = DB_USER; $this->sql_pass = DB_PASS; $this->sql_host = DB_SERVER; $this->sql_tbl_prefix = TBL_PREFIX; $host = $this->sql_host; $db = $this->sql_database; $user = $this->sql_user; $pass = $this->sql_pass; $this->link = mysql_connect($host, $user, $pass) or die(mysql_error()); mysql_select_db($db, $this->link) or die(mysql_error()); register_shutdown_function(array(&$this, 'close')); } /* ================================================================= | #2 - Query | ********************************************************* | @q - string: a query to be carried out | [-------------------------------------------------------] | Description: | carrys out the given query ================================================================= */ function query($q){ $this->theQuery = $q; return mysql_query($q, $this->link); } ?> the MySql class <?php include('db.php'); class MySql extends Db { function insertUser($user,$pass,$email,$sid,$time) { $sql = 'INSERT INTO users (user_pass, user_name, user_lvl, user_email, user_timestamp, user_sid, user_ip) VALUES ("'.$pass.'","'.addslashes($name).'","1",,"'.addslashes($email).'","'.$time.'","'.$sid.'","'.$_SERVER['REMOTE_ADDR'].'")'; Db::query($sql); } ?> parts of Security.php pertaining to the script <?php //include files used for querys include('mysql.php'); include('config.inc.php'); $q = new MySql; //core class for the security/login system contains all the core methods and vaiables class Security { //header injection check variables public $hi_check = array ( "%0A", "%0D", "bcc:", "cc:", "mime-type:", "content-type:" , "from:", "to:", "Bcc:", "Cc:", "Mime-Type:", "Content-Type:", "From:", "To:", "\\r", "\\n", "\\" ); //strip header injections public function stripHeaders($value) { $value = str_replace($this->hi_check, "", $value); return $value; } //clean user submitted data public function cleanValue($data) { $clean = htmlspecialchars(stripslashes(trim($data))); return $clean; } //create sid public function generateSid() { $sid = substr(md5(sha1(mt_rand(1,)),0,32); return $sid; } //hash data public function hashValue($data){ $hash = substr(md5(sha1($data)),0,32); return $hash; } //create a timestamp public function generateTimestamp() { $stamp = date(m.'-'.d.'-'.Y.' / '.g.':'.i.' '.A); return $stamp; } } //class is used to register a new user class Registration extends Security { //values for registering/ from query var $values = array ("name" => '', "pass" => '', "email" => '', "sid" => '' ); //constructor function Registration($email,$user,$pass) { //clean $user = Security::cleanValue($user); $email = Security::cleanValue($email); //strip headers $user = Security::stripHeaders($user); //set values $this->values['name'] = $user; $this->values['pass'] = Security::hashValue($pass); $this->values['email'] = $email; $this->values['sid'] = Security::generateSid(); } //add user function addUser() { global $q; $email = $this->values['email']; $sid = $this->values['sid']; $pass = $this->values['pass']; $user = $this->values['name']; $time = Security::generateTimestamp(); $q->insertUser($user,$pass,$email,$sid,$time); switch(VALIDATION_METHOD) { case 0: $this->generateEmail(); break; case 1: $this->generateValidEmail(); break; case 2: $this->generateAdminValidEmail(); break; } } //create validation email function generateValidEmail() { $to = $this->values['email']; $subject = SITE_NAME.' registration'; $headers = 'FROM:'.ADMIN_EMAIL; $headers = 'Bcc: '; $headers = 'Cc: '; $msg = 'Thank you for registering with '.SITE_NAME."\n\n"; $msg .= 'USERNAME:'.$this->vaules['user']."\n"; $msg .= 'PASSWORD:'.$pass."\n\n"; $msg .= 'Please keep your username and password in a safe place, you will need them to login'."\n\n"; $msg .= 'The administrator requires further activation before you are able to login. Please click the link below to activate your account.'."\n\n"; $msg .= 'http://www.'.SITE_URL.'?sid='.$this->values['sid']."\n\n"; $msg .= 'Thank you again for your interest in '.SITE_NAME."\n"; $msg .= '-: '.ADMIN.' :-'."\n"; mail($to,$subject,$msg,$headers); } //create non-validation welcome email function generateEmail() { $to = $this->values['email']; $subject = SITE_NAME.' registration'; $headers = 'FROM:'.ADMIN_EMAIL; $headers = 'Bcc: '; $headers = 'Cc: '; $msg = 'Thank you for registering with '.SITE_NAME."\n\n"; $msg .= 'USERNAME:'.$this->vaules['user']."\n"; $msg .= 'PASSWORD:'.$pass."\n\n"; $msg .= 'Please keep your username and password in a safe place, you will need them to login'."\n\n"; $msg .= 'The administrator requires further activation please allow up to 24hrs for the administrator to activate your account'."\n\n"; $msg .= 'Thank you again for your interest in '.SITE_NAME."\n"; $msg .= '-: '.ADMIN.' :-'."\n"; mail($to,$subject,$msg,$headers); } //create admin-validation welcome email function generateAdminValidEmail() { $to = $this->values['email']; $subject = SITE_NAME.' registration'; $headers = 'FROM:'.ADMIN_EMAIL; $headers = 'Bcc: '; $headers = 'Cc: '; $msg = 'Thank you for registering with '.SITE_NAME."\n\n"; $msg .= 'USERNAME:'.$this->vaules['user']."\n"; $msg .= 'PASSWORD:'.$pass."\n\n"; $msg .= 'Please keep your username and password in a safe place, you will need them to login'."\n\n"; $msg .= 'Thank you again for your interest in '.SITE_NAME."\n"; $msg .= '-: '.ADMIN.' :-'."\n"; mail($to,$subject,$msg,$headers); } } i have done an echo after each line and what not it is getting the data and sending the email, it just does not insert to the database. any help is appriciated, also keep in mind I am new to oop in php. This is my first attempt so If I have made some flaws in my implementation please point me in the right direction so I can avoid them in the future thks.
  17. yes, i even tried moving where i declared it and still got the same error.
  18. hi i am working on my first really project using oop in php and have come across an error i do not under stand Fatal error: Call to a member function insertUser() on a non-object in /home/sticky/public_html/cms/inc/security.php on line 204 this is the function it is refernceing [code=php] function insertUser($user,$pass,$email,$sid,$time) { $sql = 'INSERT INTO users (user_pass, user_name, user_lvl, user_email, user_timestamp, user_sid, user_ip) VALUES ("'.$pass.'","'.addslashes($name).'","1",,"'.addslashes($email).'","'.$time.'","'.$sid.'","'.$_SERVER['REMOTE_ADDR'].'")'; $db->query($sql); } //add user function addUser() { $email = $this->value['email']; $sid = $this->value['sid']; $pass = $this->value['pass']; $user = $this->value['user']; $time = Security::generateTimestamp(); $q->insertUser($user,$pass,$email,$sid,$time); //<-----This is the line from the error switch(VALIDATION_METHOD) { case 0: $this->generateEmail(); break; case 1: $this->generateValidEmail(); break; case 2: $this->generateAdminValidEmail(); break; } } [/code] any help pls?
  19. ok hmm that does not sound good. How exactly would they get the password, as long as its encrypted and I am not testing weather it already exsists? do you have a suggestion of a secure way to do this dynamically without having to submit first? and i tried it as get and post, get gives me js errors
  20. @emehrkay: hmm well i will be validating on submit as well this is merely an additionall method of assistence for the users to get the data correct. I am not going to be using it on all fields only specific ones mainly for registration checking if a user exsists or formating of the username and password etc... so thanks for your assistence but I need to perfect this method @MadTechie: this is my implmentation of it, you can see for yourself how it runs, or does not rather here
  21. @emehrkay: basically onblur it ill validate if it fails it will display a red x and a red field contianing errors, if it passes it will display a green check mark. I have it working in the first post you can see it working, I am just trying to fix my php code to be more efficient by using functions and what not. @MadTechie: no it still does not seem to work. I am certain that the globals are not nessecary. like I stated the problem seems to be in the last two functions.
×
×
  • 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.