1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Parse Error: Parse error in

Discussion in 'PHP' started by Nuclear_Ice, Dec 1, 2009.

  1. elbeer

    elbeer Active Member

    Messages:
    619
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    70
    #21
    I wouldnt post anymore source code mate drop me a pm and i will talk with you tomorrow - if you have msn or aim give me that
    SEMrush
     
    elbeer, Dec 1, 2009 IP
    SEMrush
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Was just to test if you have any sort of extra code running due to htaccess file however that indicates not
    elbeer seems to be on it with one of those files being the case. post them all, and we should be able to get one to produce a parse error
     
    JAY6390, Dec 1, 2009 IP
  3. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #23
    JAY6390, Dec 1, 2009 IP
  4. Nuclear_Ice

    Nuclear_Ice Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    the database has a different error than anything

    Notice: Use of undefined constant local - assumed 'local' in /home/mysite.com/database.php on line 25


    local is the name of the mysql database im trying to connect with Is that a bad idea?

    here's that snapshot of the code

    
    
       function MySQLDB(){
          $this->connection = mysql_connect('localhost', 'user', 'pass') or die(mysql_error());
          mysql_select_db(local, $this->connection) or die(mysql_error());
    
    Code (markup):
    of course i replaced my host name user and pass so no one can know
     
    Nuclear_Ice, Dec 1, 2009 IP
  5. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #25
    I think you mean localhost. That shouldn't be causing the error however. Do any of the others have errors?
     
    JAY6390, Dec 1, 2009 IP
  6. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #26
    Also, your local or localhost should be enclosed with single or double quotes like so
    'local'
    'localhost'
    This will stop that error
     
    JAY6390, Dec 1, 2009 IP
  7. Nuclear_Ice

    Nuclear_Ice Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #27
    i created a database with the name local, should i change it and reimport my tables?
     
    Nuclear_Ice, Dec 1, 2009 IP
  8. Nuclear_Ice

    Nuclear_Ice Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #28
    ah it indeed cleared up that error, but im still getting that damn parse error on all my pages and no error on my database.php..
     
    Nuclear_Ice, Dec 1, 2009 IP
  9. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #29
    ok no error on database.php is good, it means its not that file at fault
    so its one of the others
    either mailer.php or form.php

    can you try both of those
     
    JAY6390, Dec 1, 2009 IP
  10. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #30
    And no you shouldnt change your table name, that is fine
     
    JAY6390, Dec 1, 2009 IP
  11. Nuclear_Ice

    Nuclear_Ice Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #31
    mailer.php
    can't find any problems here
    
    
    <?php 
     
    class Mailer
    {
       /**
        * sendWelcome - Sends a welcome message to the newly
        * registered user, also supplying the username and
        * password.
        */
       function sendWelcome($user, $email, $pass, $userid){
          $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
          $subject = "mysite.com - Welcome!";
          $body = $user.",\n\n"
                 ."Welcome! You've just registered at mysite.com "
                 ."with the following information:\n\n"
                 ."Username: ".$user."\n"
                 ."Password: ".$pass."\n\n"
                 ."Before you can login you need to activate your\n"
                 ."account by clicking on this link:\n\n"
                 ."http://www.mysitename.com/valid.php?qs1=".$user."&qs2=".$userid."\n\n"
                 ."If you ever lose or forget your password, a new "
                 ."password will be generated for you and sent to this "
                 ."email address, if you would like to change your "
                 ."email address you can do so by going to the "
                 ."My Account page after signing in.\n\n"
                 ."- mysite.com";
    
          return mail($email,$subject,$body,$from);
       }
       
       /**
        * sendConfirmation - Sends a confirmation to users
        * who click a "Send confirmation" button.  This
        * only needs to be used if the EMAIL_WELCOME constant
        * is changed to true and the user's 'valid' field is 0
        */
       function sendConfirmation($user, $userid, $email){
           $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
           $subject = "mysite.com - Welcome!";
           $body = $user.",\n\n"
                   ."We're sorry for the inconvenience.  We are making\n"
                   ."our website more secure for both your and our \n"
                   ."benefit.\n\n"
                   ."To activate your account you can either click on the\n"
                   ."following link or copy the link and paste it into your\n"
                   ."address bar.\n\n"
                   ."http://www.mysitename.com/valid.php?qs1=".$user."&qs2=".$userid."\n\n"
                   ."We here at mysite.com hope you continue to\n"
                   ."enjoy our wonderful service.\n\n"
                   ."Sincerely,\n\n"
                   ."- mysite.com";
                   
          return mail($email,$subject,$body,$from);
       }
       
       
       /**
        * sendNewPass - Sends the newly generated password
        * to the user's email address that was specified at
        * sign-up.
        */
       function sendNewPass($user, $email, $pass){
          $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
          $subject = "mysite.com - Your new password";
          $body = $user.",\n\n"
                 ."We've generated a new password for you at your "
                 ."request, you can use this new password with your "
                 ."username to log in to mysite.com.\n\n"
                 ."Username: ".$user."\n"
                 ."New Password: ".$pass."\n\n"
                 ."It is recommended that you change your password "
                 ."to something that is easier to remember, which "
                 ."can be done by going to the My Account page "
                 ."after signing in.\n\n"
                 ."- mysite.com";
                 
          return mail($email,$subject,$body,$from);
       }
    };
    
    /* Initialize mailer object */
    $mailer = new Mailer;
     
    ?>
    
    
    Code (markup):

    form.php
    same thing here

    
    <?php 
     
    class Form
    {
       var $values = array();  //Holds submitted form field values
       var $errors = array();  //Holds submitted form error messages
       var $num_errors;   //The number of errors in submitted form
    
       /* Class constructor */
       function Form(){
          /**
           * Get form value and error arrays, used when there
           * is an error with a user-submitted form.
           */
          if(isset($_SESSION['value_array']) && isset($_SESSION['error_array'])){
             $this->values = $_SESSION['value_array'];
             $this->errors = $_SESSION['error_array'];
             $this->num_errors = count($this->errors);
    
             unset($_SESSION['value_array']);
             unset($_SESSION['error_array']);
          }
          else{
             $this->num_errors = 0;
          }
       }
    
       /**
        * setValue - Records the value typed into the given
        * form field by the user.
        */
       function setValue($field, $value){
          $this->values[$field] = $value;
       }
    
       /**
        * setError - Records new form error given the form
        * field name and the error message attached to it.
        */
       function setError($field, $errmsg){
          $this->errors[$field] = $errmsg;
          $this->num_errors = count($this->errors);
       }
    
       /**
        * value - Returns the value attached to the given
        * field, if none exists, the empty string is returned.
        */
       function value($field){
          if(array_key_exists($field,$this->values)){
             return htmlspecialchars(stripslashes($this->values[$field]));
          }else{
             return "";
          }
       }
    
       /**
        * error - Returns the error message attached to the
        * given field, if none exists, the empty string is returned.
        */
       function error($field){
          if(array_key_exists($field,$this->errors)){
             return "<font size=\"2\" color=\"#ff0000\">".$this->errors[$field]."</font>";
          }else{
             return "";
          }
       }
    
       /* getErrorArray - Returns the array of error messages */
       function getErrorArray(){
          return $this->errors;
       }
    };
     
    ?>
    
    Code (markup):
     
    Nuclear_Ice, Dec 1, 2009 IP
  12. Nuclear_Ice

    Nuclear_Ice Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #32
    mysite.com/include/view_active.php


    The only thing it shows was the function if it errored. (I can post this code to if you want lol.)


    What I see when I go to view_active.php


    Error processing page



    how could it error? ugh
     
    Nuclear_Ice, Dec 1, 2009 IP
  13. Nuclear_Ice

    Nuclear_Ice Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #33
    view_active.php

    
    <?php
    if(!defined('TBL_ACTIVE_USERS')) {
      die("Error processing page");
    }
    
    $q = "SELECT username FROM ".TBL_ACTIVE_USERS
        ." ORDER BY timestamp DESC,username";
    $result = $database->query($q);
    /* Error occurred, return given name by default */
    $num_rows = mysql_numrows($result);
    if(!$result || ($num_rows < 0)){
       echo "Error displaying info";
    }
    else if($num_rows > 0){
       /* Display active users, with link to their info */
       echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo "<tr><td><font size=\"2\">\n";
       for($i=0; $i<$num_rows; $i++){
          $uname = mysql_result($result,$i,"username");
    
    
       }
       echo "</font></td></tr></table><br>\n";
    }
    ?>
    
    Code (markup):
     
    Nuclear_Ice, Dec 1, 2009 IP
  14. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #34
    That page is fine. This is very strange
     
    JAY6390, Dec 1, 2009 IP
  15. Nuclear_Ice

    Nuclear_Ice Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #35
    It sure is.
     
    Nuclear_Ice, Dec 1, 2009 IP
  16. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #36
    Yeah. Did you get my PM? I have about 15 mins to spare if you want me to look at the files directly and work out what the problem is
     
    JAY6390, Dec 1, 2009 IP
  17. elbeer

    elbeer Active Member

    Messages:
    619
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    70
    #37
    Its like trying to solve the davinci code - the error will be staring us n the face
     
    elbeer, Dec 2, 2009 IP
  18. elbeer

    elbeer Active Member

    Messages:
    619
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    70
    #38
    Did you ever get this resolved? If so, what was the issue
     
    elbeer, Dec 9, 2009 IP