Parse error: syntax error, unexpected '<'

Discussion in 'PHP' started by jwzzr, Apr 16, 2010.

  1. #1
    i can not figure out whats is causing this

    It is on line 11

    <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=free'>";?> 100% Free</a></li>

    
    <?
    session_start();
    global $ui,$count;
    $page = "offers";
    include "header.php";
    include "mysql.php";
    include "config.php";
    ?>
    <h1 class="pagetitle">Offers List</h1><br>
    <?php
    <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=free'>";?> 100% Free</a></li>
    					<li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=submit'>";?>1-2 Page Submit</a></li>
    					<li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=quiz'>";?>Quizes</a></li>
    			<li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=trial'> ";?>Trials</a></li>
    			<li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=download'> ";?>Downloads</a></li>
    			<li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=daily'>"; ?>Daily Offers</a></li>
    			<li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=cpc'> ";?>Daily PTC</a></li>
    ?>
    <?
    $_GET['out'] = strip_tags($_GET['out']);
    $_GET['out'] = mysql_real_escape_string($_GET['out']);
    if ($_GET['out'] != "") {
        mysql_query("update offers set visits=visits+1 where id={$_GET['out']}", $c);
        $geturl = mysql_query("select * from offers where id={$_GET['out']}", $c);
        $out    = mysql_fetch_array($geturl);
        if ($_SESSION['loggedin'] == 1) {
            print "
    <h2>Please wait..</h2>
    <p>
    <center>
    Please continue to this Offer by clicking below<br>
    <a href=\"{$out['url']}{$ui['username']}\" target=\"blank\">click here</a>.
    </center>
    </p>
    ";
            include "footer.php";
            exit;
        } else
            echo '<script type="text/javascript">alert("You must login before you can complete this offer!")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=login.php">';
    } {
        $money        = 0;
        $getoffercash = mysql_query("select * from offers where active=1", $c);
        while ($oc = mysql_fetch_array($getoffercash)) {
            $money = $money + $oc['reward'];
        }
    }
    if ($_SESSION['loggedin'] == 1) {
        $refer = "<br>Refer your friends: $siteurl/?ref={$ui['username']}<br>and receive an instant $$refbonus bonus per referral!";
    } else {
        $refer = "";
    }
    ?>
    
    <?php
    if ($_SESSION['loggedin'] == 0) {
    echo "<h2><center>You must be logged in.</center></h2> ";
    } else {
    $pp = mysql_query("select * from users where `paypal`='0' and `username`='{$ui['username']}'", $c);
    if (mysql_num_rows($pp) >= 1) {
    print"
    <center>Please update your <a href=\"/stats.php?do=paypal\">Paypal E-Mail address</a><br></center>";
    }else{
    if (isset($_GET["country"])) {
        $area = $_GET["country"];
    } else {
        $area = US; {
        }
    }
    if (isset($_GET["type"])) {
        $type = $_GET["type"];
    } else {
        $type = free; {
        }
    }
    }
    }
    $getcountry = mysql_query("select * from users where `username`='{$ui['username']}' and `country`='{$ui['country']}'", $c);
    while ($count = mysql_fetch_array($getcountry))
    if ($_GET['country'] == $count['country']) {
    ?>
    <table width="100%">
    <tr>
    <th width="50%">Offer</th>
    <th width="9%">Reward</th>
    <th width="20%">Completed?</th>
    <th width="17%">Last Completed by a User</th>
    </tr>
    <?
    $_GET['offer'] = strip_tags($_GET['offer']);
    $_GET['offer'] = mysql_real_escape_string($_GET['offer']);
    if (isset($_GET["page"])) {
        $page = $_GET["page"];
    } else {
        $page = 1; {
        }
    }
    $start_from    = ($page - 1) * 15;
    $getoffers     = mysql_query("select * from offers  where `type`='$type' and active=1 and `country`='$area' order by reward desc limit $start_from, 15", $c);
    $sql           = "SELECT COUNT(Name) FROM offers where `country`='$area' AND `type`='$type'";
    $rs_result     = mysql_query($sql);
    $row           = mysql_fetch_row($rs_result);
    $total_records = $row[0];
    $total_pages   = ceil($total_records / 15);
    if (mysql_num_rows($getoffers) == 0) {
        print "<tr><td colspan=\"3\">There are currently no free offers available</td></tr>";
    } else {
        while ($off = mysql_fetch_array($getoffers)) {
            if ($_GET['offer'] == $off['id']) {
                $color = "style=\"background-color: #a2e250;\"";
                $front = "<font color=\"black\"><b>";
                $back  = "</b></font>";
            } else {
                $color = "";
                $front = "";
                $back  = "";
            }
            if ($_SESSION['loggedin'] == 1) {
                $form = "<form action=\"completed.php\" method=\"get\">Not yet Completed<input type=\"hidden\" name=\"offer\" value=\"{$off['id']}\"></form>";
            } else {
                $form = "<font color=\"red\"><b>Please Login</b></font>";
            }
            $checkcompleted = mysql_query("select * from completed where offer_id={$off['id']} and user_id='{$_SESSION['userid']}'", $c);
            if (mysql_num_rows($checkcompleted) != 0) {
                $form = "<font color=\"green\"><b>You've completed this.</b></font>";
            }else{
    		$form = "Not yet completed.";
            if (mysql_num_rows($checkcompleted) != 0) {
                $link = "<a href=\"offers.php?out={$off['id']}\">$front{$off['name']}$back";
            } else {
                $link = "<a href=\"offers.php?out={$off['id']}\">$front{$off['name']}$back";
                
            }
    
    
    $sql = "SELECT * FROM completed WHERE offer_id = '{$off['id']}' ORDER BY date_submitted DESC"; 
    $result = mysql_query($sql,$c);
    $row = mysql_fetch_row($result); 
    {
    $now = time(); 
    $then = $row[3];
    $elapsed_time = $now - $then;
    
    if ($elapsed_time > 604799) 
    {
    
    $one_week = '604800'; 
    $weeks = floor($elapsed_time / $one_week);
    if($weeks == 1) 
    { 
    $time = 'One week ago'; 
    } 
    elseif ($weeks > 1) 
    { 
    $time = ""; 
    }
    
    } elseif ($elapsed_time > 86399){
    
    $one_day = '86400'; 
    $days = floor($elapsed_time / $one_day); 
    if($days == 1) 
    { 
    $time = 'One day ago'; 
    } 
    elseif ($days > 1) 
    { 
    $time = "$days days ago"; 
    }
    
    } else if ($elapsed_time > 3599) {
    
    $one_hour = '3600'; 
    $hours = floor($elapsed_time / $one_hour); 
    if($hours == 1) 
    { 
    $time = 'One hour ago'; 
    } 
    elseif ($hours > 1) 
    { 
    $time = "$hours hours ago"; 
    }
    
    } else if ($elapsed_time > 60){
    
    $one_minute = '60'; 
    $minutes = floor($elapsed_time / $one_minute); 
    if($minutes == 1) 
    { 
    $time = 'One minute ago'; 
    } 
    elseif ($minutes > 1) 
    { 
    $time =  "$minutes minutes ago"; 
    }
    
    } else { 
    
    $one_second = '1'; 
    $seconds = floor($elapsed_time / $one_second); 
    if($seconds == 1) 
    { 
    $time = 'Right now'; 
    } 
    elseif ($seconds > 1) 
    { 
    $time = "$seconds seconds ago"; 
    }
    }	
    }
    
    echo "
    <tr>
    <td width=\"80%\"><b>$link</b></a><br><i>{$off['info']}</i></td>
    <td align=\"center\">$front\${$off['reward']}$back</font></td>
    <td width=\"80%\" align=\"center\">$form<br><a href='offers.php?do=report&id={$off['id']}'>Report</a></td>
    <td width=\"80%\" align=\"center\">$time</td>
    </tr>
    ";
        }
    }
    print "</table>";
    Print "<p align=\"center\">Page";
    for ($i = 1; $i <= $total_pages; $i++) {
        echo "<a href='offers.php?page=" . $i . "&country=" . $area . "&type=" . $type . "'>[" . $i . "]</a>";
    }
    Print "</p>";
    Print "<center><h2>Advertise here for 5$ Send a Message to ADMIN</h2></center>";
    ?>
    <?
    }if($_GET["country"] !== $getcountry) { 
    echo "";
    }else{
    ?>
    <?
    }
    $user = $ui['username'];
    $email = $ui['email'];
    $reason = mysql_real_escape_string($_POST['reason']);
    if ($_GET['do'] == "report" && $_GET['id'] != ""){
        $offers = $_GET['id'];
        $checkoffer = 'SELECT * from report where username="' . $user . '" AND offer_id="' . $offers . '"';
        if (mysql_num_rows(mysql_query($checkoffer,$c)) >= 1){
        print "<h2>You have already reported this offer</h2";
        }elseif($_POST['report'] == 1){
        //Get offer name from ID
        $offer = mysql_query("select * from offers where `id`='".$_GET['id']."'",$c);
        $getname = mysql_fetch_row($offer);
        //Send Admin Email
        mail($adminemail, "Offer Reported ", "
        username : $user 
        reported : {$getname['1']}
        Reason : $reason ", "From: $email");
        $add = 'INSERT INTO report (username, offer_id, reason) VALUES ("'.$user.'", "'.$offers.'", "'.$reason.'")';
        mysql_query($add,$c) OR die(mysql_error());
        echo "Offer Reported.";
        }else{
        print "
        <h2>Report an Offer</h2>
        <form action=offers.php?do=report&id={$_GET['id']} method=post>
        <input type=hidden name=report value=1>
        <input type=text name=reason>
        <input type=submit class=submit>";
        
        }
    
    } 
    }
    ?>
    <?
    include "side.php";
    include "footer.php";
    ?>   
    PHP:
     
    jwzzr, Apr 16, 2010 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    You have an erroneous PHP opening tag.

    <?php
    <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=free'>";?> 100% Free</a></li>
    PHP:
     
    lukeg32, Apr 16, 2010 IP
  3. Andrew E.

    Andrew E. Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Change line 11 to start with:

    <li><?php
     
    Andrew E., Apr 16, 2010 IP
  4. trickyshaun

    trickyshaun Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    nah ... :))
    
    <?php
    <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=free'>";?> 100% Free</a></li>
                        <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=submit'>";?>1-2 Page Submit</a></li>
                        <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=quiz'>";?>Quizes</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=trial'> ";?>Trials</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=download'> ";?>Downloads</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=daily'>"; ?>Daily Offers</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=cpc'> ";?>Daily PTC</a></li>
    ?>
    
    Code (markup):
    see this snippet :D . The correct one is
    
    <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=free'>";?> 100% Free</a></li>
                        <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=submit'>";?>1-2 Page Submit</a></li>
                        <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=quiz'>";?>Quizes</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=trial'> ";?>Trials</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=download'> ";?>Downloads</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=daily'>"; ?>Daily Offers</a></li>
                <li><? echo "<a href='offers.php?page=1&country=" . $ui['country'] . "&type=cpc'> ";?>Daily PTC</a></li>
    
    Code (markup):
     
    trickyshaun, Apr 17, 2010 IP
  5. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #5
    As has already been pointed out :p
     
    lukeg32, Apr 17, 2010 IP