Jump to content

blueman378

Members
  • Posts

    888
  • Joined

  • Last visited

    Never

Everything posted by blueman378

  1. hi guys, well as we all know floating point math is not exact, so i need to create an if statement to check equality of a number within a given error range eg we are looking for the equality of .99 with an error margin of .0001 so i need to find out if the difference between a and b is less than .0001 what do i need for this?
  2. so your using the buttons as links? are there any actual inputs on the form? if not you *could* put each button in its own form element. though id probably suggest you use JavaScript on the buttons to change the forms action
  3. it owuld be easier if you could tell us the exact errors?
  4. Yes, though if it is a case of any users can sign up you might want to factor games played in to avoid second accounters im not sure what level the points are but im going to make a few assumptions a game is worth 50 points with no level bias if two players in a ranking range of a difference of 500 play and the higher ranked player wins then no bonus points are awarded ( to avoid newbie preying) the most bonus points a user can gain is 100 so lets try some pseudo code shall we? assign 6200 to total players assign ranking 1500 to playerA assign ranking 1300 to playerB assign winner to playerB ranking diff equals difference = loser ranking( playerA 1500 ) minus winner ranking ( playerB 1300 ) = 200 * TRUE: calculate bonus points * FALSE: no bonus points if ranking diff GREATER THAN 0 AND ranking diff LESS THAN OR EQUAL to 500 total players INT DIVISION winner ranking = 4 * Higher ranked players should get less bonus points so give the player 4% of the difference points = 8 points points = 50 + 8 else points = 50 so the winning player gets 58 points total now lets retry this PlayerA being ranked 600 playerB being ranked 100 so loser ranking( playerA 600 ) minus winner ranking ( playerB 100 ) = 500 so 62% so now we give them 62% of 500 so thats 310 points so now playerB gets 360 points this allows the new players to rise faster while stopping the "Big Guys" preying onthe little guys. Just an idea.
  5. How else should I explain it? Shall I put an assay down so that you can read through each time and understand the complete system? Please tell me how else shall I tell people what OpenBlog is in a few words or in a way that does not repel them? XD another "HELP ME - SCREW YOU" type of person. for a start makes no logical sense. And sometimes it is useful to describe a system in full detail instead of one word, especially if you are trying to get it critiqued. how do you expect us to critique it if we dont know fully what it is. Ill assume its this Bob will assume its that And Mary will assume its another thing. We apologies for offending you by asking for more details about your site.
  6. Good advice, ATM it seems all your data is static which is fine except you would have to manually create a list for every single tag and update it manually, the other option which is more practical is to follow the above advice, dynamics are the core of a good php app.
  7. well, your articles you mentioned, how are they stored & retrieved? Database?
  8. can we see your attempt at either part of the problem?
  9. hmm.... interesting site either way for that you dont even need to login users, you could just track it based off IP
  10. your welcome interesting looking project btw.
  11. if ($a AND $b AND $c AND $d AND $e) { $sql = "INSERT INTO classes (id, teacher_username, teacher_code, class_id, student_name, student_email, date) VALUES ('0', '$_POST[teacher_username]', '$_POST[teacher_code]', '$_POST[class_id]', '$_POST[student_name]', '$_POST[student_email]', NOW())"; if (mysql_query($query)) { shouldnt the bottom line be if(mysql_query($sql)) {
  12. btw i get what you mean about the only instance of the class being $settings but how would i pass that into the scope of userm, i mean i dont want to use global lol one option would be to make userm extend constant i guess but i really dont want to.
  13. Hi guys, Well heres the error: Fatal error: Call to a member function build_url() on a non-object in E:\xampp\htdocs\test\extends\users.php on line 27 Yet it should work. Heres the code: <?php /** * FILENAME: index.php * DESCRIPTION: The main page users will see * DATE: June 2009 */ include("extends/users.php"); ?> <html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <head> <title><?php echo $settings->get_setting(sitename); ?></title> </head> <body> <?php echo $settings->build_url(); ?> </body> </html> <?php /** * FILENAME: constants.php * DESCRIPTION: holds user defined variables * DATE: June 2009 */ class constants { private $sitename = 'NZ EVOX\'s Login Script'; private $site_root = 'localhost/test/'; private $site_prefix = 'http://'; private $nondefined = "NOT DEFINED"; //-------------------------------------------------------------------- // FUNCTION: __construct() // INPUTS: // RETURN: //-------------------------------------------------------------------- function __construct() { } //-------------------------------------------------------------------- // FUNCTION: get_setting( $setting ) // INPUTS: $setting: name of setting that you wish to read(MUST EXIST) // RETURN: value of setting or null defined //-------------------------------------------------------------------- public function get_setting( $setting ) { if(isset($this->$setting)) return $this->$setting; else return $nondefined; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // FUNCTION: set_setting( $setting, $value ) // INPUTS: $setting: name of setting that you wish to set(MUST EXIST) // RETURN: either nothing or null defined //-------------------------------------------------------------------- public function set_setting( $setting, $value = "" ) { if(isset($this->$setting)) $this->$setting = $value; else return $nondefined; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // FUNCTION: build_url( $page = "" ) // INPUTS: $setting: name of setting that you wish to set(MUST EXIST) // RETURN: either nothing or null defined //-------------------------------------------------------------------- public function build_url( $page = "" ) { $url = $this->site_prefix; $url .= $this->site_root; $url .= $page; return $url; } //-------------------------------------------------------------------- } $settings = new constants; ?> <?php /** * FILENAME: users.php * DESCRIPTION: holds the class for managing the users * DATE: June 2009 */ include("constants.php"); class userm { private $userid; private $userlevel; private $from; private $nondefined = "NOT DEFINED"; //-------------------------------------------------------------------- // FUNCTION: __construct() // INPUTS: // RETURN: //-------------------------------------------------------------------- function __construct() { if(isset($_REQUEST['from'])) $this->from = $_SESSION['from'] = $_REQUEST['from']; elseif(isset($_SESSION['from'])) $this->from = $_SESSION['from']; else $this->from = $settings->build_url(); } } $user = new userm; ?> im obviously missing something simple... just dont know what...
  14. ah right, heh guess thats wht i get for being sleepy ae, CHeers.
  15. i know what - and + are, but when used in combonation with the < inside an if statment what is the condition? eg <= condition is: less than or equal to, So what is <+ or <-
  16. Hi guys, i accidentially typed in one of these operators and it worked, so im wondering what it is acctually doing. Heres a table i made, maybe someone knows or can gather what <+ and +- means ---------------------------------------------------- POSITIVES "<" ---------------------------------------------------- if( 3 <+ 3 ) false if( 3 <- 3 ) false if( 3 <+ 2 ) false if( 3 <- 2 ) false if( 3 <+ 1 ) false if( 3 <- 1 ) false if( 2 <+ 3 ) true if( 2 <- 3 ) false if( 1 <+ 3 ) true if( 1 <- 3 ) false <+ only true if first number less than than second <- never true? ---------------------------------------------------- NEGATIVES "<" ---------------------------------------------------- if( -3 <+ -3 ) false if( -3 <- -3 ) true if( -3 <+ -2 ) true if( -3 <- -2 ) true if( -3 <+ -1 ) true if( -3 <- -1 ) true if( -2 <+ -3 ) false if( -2 <- -3 ) true if( -1 <+ -3 ) false if( -1 <- -3 ) true <+ only true if second number is less than first <- always true?
  17. or a simplier way would be to store all inputs in sessions, then reload them in the value="" param
  18. what look would you suggest instead of the bubble look? possibly a "metallic" style?
  19. Hi guys, well im making a new ecommerce site (for an assignment) and heres a pic of what i have for the theme so far, any pointers? [attachment deleted by admin]
  20. well then, check the array length, then use the rand function to generate a random number between 0 and arraylength, then replace that word into the file by way of its index, ,do this for each word you want replaced.
  21. well how are your "random pool of words" stored?
×
×
  • 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.