Jump to content

ScrollMaster

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ScrollMaster's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have 3 Tables Posts Message User Posts contains a message id and a user id In order to grab the data I want do I have to make two seperate queries Post Message, Post User and then use php to match up the data or is it possible with MySQL Statements to Select all the data at once. I am unsure how to do this.
  2. MySql 5, PHP 5 Hello, I am working on a forum system and I have a question to ask. I had tried mysqlfreaks but there forum system is down. I am working on generating all the posts for a thread. I have two tables, a table for users and a table for posts. I would like to know if it would be better to create a column with the userid and username in the post table so I do not have to make a call to the user table and extract that username that matches the userid. I think that creating a redundant column would be a waste of space in the database but having it there would make the query faster. So what do I do? Option 1: Make the Call to the user table to find the user name to save database space Option 2: Make a Redundant Column in the post table to save query time Option 3: Someone tells me of a magical way of making a call to both database in one query? Option 4: I write my code where it can access itself that the user table is so big that to make a call to it everytime for the posts is expensive and It should add that secound column to the post table. Which Option should I choose?
  3. I do not know what the @ Type is for. I tried the Manual but it seems as if their hidden or I have poor searching skills. so for example what would @mysql_query() be doing that is so different from mysql_query()?
  4. Hello,   I am currently working on my own PHP Project that will be a simple Time Based Strategy Games where a user can login, build an army, and attack other users.   I have a question about about User Awareness; Knowing when the user is logged in and whether that it is the same user and I am not being hijacked.   I am unsure what would be a good method to implement user awareness with security. Should I have a Table that Stores Session Id's of currently logged in user? Should I have a Cookie that is sent to the user that they can send back to me so I know they are the same user? What Should I be Checking For?
  5. Well Im pretty much new to this and the examples I have seen uses the PASSWORD function. Though I know there is another function that can salt it or I guess I could use md5 and then pass the function into the database. I just thought it be easier if I used one of mysql encpytion functions. Could you sujest a better method?
  6. Hello PHP Freaks, I am working on building my User Authentication System unforently I am having Trouble. I created a Register Function that takes care of signing up the user. [code]         function register($username, $password, $email)         {             $username = dbC::clean($username);             $password = dbC::clean($password);             $email = dbC::clean($email);             $bUsername = false;             $bEmail = false;             $hp = "Breath deep in the SaltMines OmenKing, So you can feel the sting that you placed on others";             #Check User Name-------------------------------------------------------------------             $check = dbC::query("SELECT usr_ID FROM sm_User WHERE usr_Name='$username'");             if(mysql_num_rows($check) == 0 )                 $bUsername = true;             else                 echo 'Sorry the User Name '. $username . ' has Already Taken' . '<br />';             #Check Email Address---------------------------------------------------------------             $check = dbC::query("SELECT usr_ID FROM sm_User WHERE usr_Email='$email'");             if(mysql_num_rows($check) == 0 )                 $bEmail = true;             else                 echo 'Sorry the Email Address ' . $email . ' has Already been Used' . '<br />';                         #Register the New User-------------------------------------------------------------             if( $bUsername && $bEmail )                 dbC::query("INSERT INTO sm_User (usr_Name, usr_Password, usr_Register, usr_Email) VALUES( '$username' , PASSWORD('$password') , NOW(), '$email' )");             } [/code] The Register Function Works with No Problems. The Problem I am having with is loggin in. Here is my Login Function [code]         function login($username, $password, $remember)         {             $username = dbC::clean($username);             $password = dbC::clean($password);             $check = dbC::query("SELECT usr_ID FROM sm_User WHERE usr_Name='$username' AND usr_Password=PASSWORD('$password') ");                 echo mysql_num_rows($check);             if(mysql_num_rows($check) == 1 )             {                 $_SESSION['LoggedIn'] = true;                 echo 'Logged In';             }             else                 echo 'Sorry the User Name '. $username . ' with the Given Password Does not Match' . '<br />';                     }     [/code] When I attempt to Login it does not Work. I am for some reason having a hardtime matching up the the Password. If I stip away the PASSWORD() mysql function then it works correctly. Is there something I don't know about PASSWORD() mysql function?
  7. help for I am a exterme php newb and I need some freaky php freak to come and pwn me with the anwser to my problem. Here is my code: [code] <?php #================================================================   class FlyBehaviour   {     public function Fly()     {       print "<p>"."Duck is Flying!, Almost!"."</p>"."\n";     }   } #================================================================   class QuackBehaviour   {     public function Quack()     {       print "<p>"."Duck is Quacking!, Almost!"."</p>"."\n";     }   } #================================================================   class Duck   {      # Variables ------------------------------------------------      public $fly;      public $quack;      # Functions ------------------------------------------------      public function __construct()      {          print "<p>"."Created a Duck!"."</p>"."\n";      }      public function performFly()      {        $fly->Fly();      }      public function performQuack()      {        $quack->Quack();      }   } #================================================================   $duck = new Duck();   $duck->performFly();   $duck->performQuack(); ?> [/code] Output: Created a Duck! Fatal error: Call to a member function Fly() on a non-object in E:\Program\www\localhost\simUduck\index.php on line 33 and Above is my error... What have I done wrong? What rule have I missed? What Syntax have I wrong? Please Help!
  8. I was just making a simple test page to see if I could get a variable to carry from one page to another using $_POST but no matter what I attempt I never see the result. I do not have javascript disabled and I using PHP 5. Now to show you my code index.html (The page with one feild) [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">     <head>         <meta http-equiv="content-type" content="text/html;charset=utf-8" />         <meta name="generator" content="Notepad++" />         <title>Post Test</title>         <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" />     </head>     <body>             <div class="container">                             <form id="frm_test" action="results.php" method="POST">                     <fieldset>                             <legend>Use Post!</legend>                         <input type="text" id="test"/>                         <input type="submit" id="sbt_results" value="Query"/>                     </fieldset>                                 </form>         </div>     </body> </html> [/code] results.php [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">     <head>         <meta http-equiv="content-type" content="text/html;charset=utf-8" />         <meta name="generator" content="Notepad++" />         <title>Post Results</title>         <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" />     </head>     <body>             <div class="container">                         <?php                 $test = $_POST['test'];                 echo $test;             ?>         </div>     </body> </html> [/code] Am I forgetting something? EDIT: SOLVED! I have spent too much time not knowing what was wrong when I thought of adding in the NAME attribute and not everything works. I did not know name was responsible as the variable. I think this confusion all lead because of the new 1.1 Strict standards. Name is no longer used in 1.1 and if you have it in validation your page will fail. Even though I do not use the 1.1 Strict bceause 1.0 Strict the the current standard being use I had in mind to omit it anyway always because it would not be used in the future.
×
×
  • 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.