Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2013
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation STUPID syntax error

    Here is my php code?

    every time i run it, i get
    Parse error: syntax error, unexpected T_IF in /home/omenaa/public_html/day01.php on line 74
    WHATS WRONG??

    PHP Code:
    <?php
    /*
    Page set in Affiliate Panel has to containt a URL parameter ref - just add ?ref={$refid} to the URL
    */

    $displaycode false;

    /* //This is the pare which you should uncomment in case you wanted this page to be displayed only from the affiliate panel:
    if (empty($_GET['ref'])) {
      $displaycode = false;
    }
    */

    if ($displaycode) {
      
    // include API file so we can work with it
      
    require_once('/home/omenaa/public_html/affiliate/api/PapApi.class.php');

      
    // check if we have to save any of the values from the form
      
    function processFormRequest(Pap_Api_Affiliate $affiliate) {
        
    $save false;
        if (!empty(
    $_POST['znzone']) && ($_POST['znzone'] != $affiliate->getData(10))) { // if a value was set and the value is different from the one we already stored before
          
    $affiliate->setData(10,$_POST['znzone']);
          
    $save true;
        }

        
    $error '';
        if (
    $save) { // if any previous check changed $save to true, we will save it
          
    try {
            
    $affiliate->save();
          }
          catch (
    Exception $e) {
            
    $error "Error saving data: ".$affiliate->getMessage();
          }
        }
        return 
    $error;
      }

      
    // authenticate as merchant so the API could work
      
    $session = new Gpf_Api_Session("http://omenaa.ws/affiliate/scripts/server.php");
      if(!
    $session->login("api@api.com""v6gcGH5whd")) {
        die(
    "Cannot load any info from the application, please contact your Affiliate Manager. Error Message: ".$session->getMessage());
      }

      
    // load affiliate based on the ref param sent from the affiliate panel
      
    $refid $_GET['ref'];
      
    $affiliate = new Pap_Api_Affiliate($session);
      
    $affiliate->setRefid($refid);

      try {
        
    $affiliate->load();
        
    $error processFormRequest($affiliate); // call the processFormRequest function

        // load values to be set in the page froms
        
    $znz $affiliate->getData(10);

        
    $parent = new Pap_Api_Affiliate($session);
        
    $parent->setUserid($affiliate->getParentUserId());
        try { 
    // load parent values
          
    $parent->load();
          
    // load parent values to be set in the page froms
          
    $p_znz $parent->getData(10);
        }
        catch (
    Exception $e) {
          
    // no parent affiliate
        
    }

      }
      catch (
    Exception $e) {
        die(
    "We could not load your affiliate account, please contact your Affiliate Manager. Error Message: ".$affiliate->getMessage());
      }

      
    // ---------------

      // if any of the parent values are empty, set the default one there (Dornessa's)
      
    if (empty($p_znz)) {$p_znz '195262';}
    ?>

  • #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,444
    Thanks
    11
    Thanked 310 Times in 309 Posts
    PHP Code:

      
    }
    Off the top of my head, that i looks pretty odd....

  • #3
    New Coder
    Join Date
    Apr 2013
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tracknut View Post
    PHP Code:

      
    }
    Off the top of my head, that i looks pretty odd....
    You are awesome, i dont know how can i be that stupid sometimes

  • #4
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,444
    Thanks
    11
    Thanked 310 Times in 309 Posts
    No worries. I've been finding bugs for a very long time

  • #5
    New Coder
    Join Date
    Sep 2013
    Posts
    41
    Thanks
    0
    Thanked 1 Time in 1 Post
    If you get an unexplained T_* error, always look at the characters before it. In this case you are missing a semicolon at the end of your last line.
    Hope this helps.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •