Jump to content

Nav


eaglelegend

Recommended Posts

Hi, I was editing my nav bar thing, and this is the issiue that has cropped up after I saved it and put it live:

 

Parse error: syntax error, unexpected $end in /home/webredev/public_html/left_index.php on line 156

 

 

Please help, im not sure what to do. thanks!

<?php
function left()
{
$rs0=mysql_fetch_array(mysql_query("select * from config"));
$recperpage=$rs0["recinpanel"];
if ( isset($_SESSION["userid"]) && $_SESSION["userid"]!="" )
{
?>
		<h4>Member Menu</h4>
		<p>Welcome <?php echo $_SESSION["name"] ?></p>
		<ul>
			<li><a href="logout.php" title="Logout of the site">Logout</a></li>
		</ul>
		<?php
  }
  ?>
		<h4>Featured</h4>
		<ul>
			<li><?php
		  $featured=mysql_query("select id,s_name from softwares where featured='yes'  and approved='yes'");
		  $cnt=1;
		  while( ($rst=mysql_fetch_array($featured)) & ($cnt<=$recperpage) )
		  {			  
		  ?></li>
		  <li><a class="sidelink" href="software-description.php?id=<?php echo $rst["id"];?>"><?php echo $rst["s_name"];?></a></td></li>
		  <li>        <?php
		 $cnt++;
		 }//end while
		  ?></li>
		</ul>
		<h4>Most Popular</h4>
		<ul>
			<li><?php
		  $most_pop=mysql_query("select id,hits_dev_site,downloads,page_views from softwares ");
		  $cnt=1;
		  $popularity=0.0;
		  while($rst=mysql_fetch_array($most_pop) )
		  {
		  	if($rst["page_views"]==0)
			$popularity=0;
			else
			$popularity=(($rst["hits_dev_site"]+$rst["downloads"])/$rst["page_views"]);
			$popularity*=50;
			if($popularity>50)
			$popularity=50;
			mysql_query("update softwares set popularity=".$popularity." where id=".$rst["id"]);			  
		  }
		  $most_pop=mysql_query("select id,popularity,s_name from softwares where  approved='yes'    order by popularity desc");
		  $cnt=1;
		  
		  while( ($rst=mysql_fetch_array($most_pop) ) && ($cnt<=$recperpage) )
		  {
		  ?></li>
			<li><a  class="sidelink"  href="software-description.php?id=<?php echo $rst["id"];?>"> <?php echo $rst["s_name"];?></a></li>
			<li><?php
		 $cnt++;
		 }//end while
		  ?></li>
		</ul>
		<h4>Newsletter</h4>
        <script language=javascript> 

function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
alert("Email address seems incorrect (check @ and .'s)")
return false
}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.")
    return false
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
  for (var i=1;i<=4;i++) {
    if (IPArray[i]>255) {
        alert("Destination IP address is invalid!")
	return false
    }
    }
    return true
}
var domainArray=domain.match(domainPat)
if (domainArray==null) {
alert("The domain name doesn't seem to be valid.")
    return false
}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("The address must end in a three-letter domain, or two letter country.")
   return false
}
if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}
return true;
}

  function formValidate(form) {
if ( form.username.value == "" ) {
       	   alert('Please enter your name!');
   return false;
   }
   if(!form.useremail.value.match(/[a-zA-Z\.\@\d\_]/)) {
           alert('Please provide valid email address');
           return false;
           }

if (!emailCheck (form.useremail.value) )
{
return (false);
}

return true;
  }
</script>
		<ul>
<li><FORM name=register onsubmit=return(formValidate(this)); 
                  method=post action="insert_mailinglist.php">
              <table width="125" border="0" align="center" cellpadding="2" cellspacing="0">
                <tr> 
                  <td><font color="#000000" size="2" >Name:</font></td>
                </tr>
                <tr> 
                  <td> <input name="username" type="text" class="keyword" width="1"></td>
                </tr>
                <tr> 
                  <td><font color="#000000" size="2" >Email:</font></td>
                </tr>
                <tr> 
                  <td> <input name="useremail" type="text"  class="myinputstyle" width="1"></td>
                </tr>
                <tr> 
                  <td> <input type="submit" name="Submit" value="subscribe" width="1" class="button"></td>
                </tr>
              </table>
            </form>
            </li>
            </ul>

Link to comment
https://forums.phpfreaks.com/topic/129780-nav/
Share on other sites

You've missed the ?> to end your PHP script. Replace your file with the following...

 

<?php
function left()
{
$rs0=mysql_fetch_array(mysql_query("select * from config"));
$recperpage=$rs0["recinpanel"];
if ( isset($_SESSION["userid"]) && $_SESSION["userid"]!="" )
{
?>
		<h4>Member Menu</h4>
		<p>Welcome <?php echo $_SESSION["name"] ?></p>
		<ul>
			<li><a href="logout.php" title="Logout of the site">Logout</a></li>
		</ul>
		<?php
  }
  ?>
		<h4>Featured</h4>
		<ul>
			<li><?php
		  $featured=mysql_query("select id,s_name from softwares where featured='yes'  and approved='yes'");
		  $cnt=1;
		  while( ($rst=mysql_fetch_array($featured)) & ($cnt<=$recperpage) )
		  {			  
		  ?></li>
		  <li><a class="sidelink" href="software-description.php?id=<?php echo $rst["id"];?>"><?php echo $rst["s_name"];?></a></td></li>
		  <li>        <?php
		 $cnt++;
		 }//end while
		  ?></li>
		</ul>
		<h4>Most Popular</h4>
		<ul>
			<li><?php
		  $most_pop=mysql_query("select id,hits_dev_site,downloads,page_views from softwares ");
		  $cnt=1;
		  $popularity=0.0;
		  while($rst=mysql_fetch_array($most_pop) )
		  {
		  	if($rst["page_views"]==0)
			$popularity=0;
			else
			$popularity=(($rst["hits_dev_site"]+$rst["downloads"])/$rst["page_views"]);
			$popularity*=50;
			if($popularity>50)
			$popularity=50;
			mysql_query("update softwares set popularity=".$popularity." where id=".$rst["id"]);			  
		  }
		  $most_pop=mysql_query("select id,popularity,s_name from softwares where  approved='yes'    order by popularity desc");
		  $cnt=1;
		  
		  while( ($rst=mysql_fetch_array($most_pop) ) && ($cnt<=$recperpage) )
		  {
		  ?></li>
			<li><a  class="sidelink"  href="software-description.php?id=<?php echo $rst["id"];?>"> <?php echo $rst["s_name"];?></a></li>
			<li><?php
		 $cnt++;
		 }//end while
		  ?></li>
		</ul>
		<h4>Newsletter</h4>
        <script language=javascript> 

function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
alert("Email address seems incorrect (check @ and .'s)")
return false
}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.")
    return false
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
  for (var i=1;i<=4;i++) {
    if (IPArray[i]>255) {
        alert("Destination IP address is invalid!")
	return false
    }
    }
    return true
}
var domainArray=domain.match(domainPat)
if (domainArray==null) {
alert("The domain name doesn't seem to be valid.")
    return false
}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("The address must end in a three-letter domain, or two letter country.")
   return false
}
if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}
return true;
}

  function formValidate(form) {
if ( form.username.value == "" ) {
       	   alert('Please enter your name!');
   return false;
   }
   if(!form.useremail.value.match(/[a-zA-Z\.\@\d\_]/)) {
           alert('Please provide valid email address');
           return false;
           }

if (!emailCheck (form.useremail.value) )
{
return (false);
}

return true;
  }
</script>
		<ul>
<li><FORM name=register onsubmit=return(formValidate(this)); 
                  method=post action="insert_mailinglist.php">
              <table width="125" border="0" align="center" cellpadding="2" cellspacing="0">
                <tr> 
                  <td><font color="#000000" size="2" >Name:</font></td>
                </tr>
                <tr> 
                  <td> <input name="username" type="text" class="keyword" width="1"></td>
                </tr>
                <tr> 
                  <td><font color="#000000" size="2" >Email:</font></td>
                </tr>
                <tr> 
                  <td> <input name="useremail" type="text"  class="myinputstyle" width="1"></td>
                </tr>
                <tr> 
                  <td> <input type="submit" name="Submit" value="subscribe" width="1" class="button"></td>
                </tr>
              </table>
            </form>
            </li>
            </ul>
?>

Link to comment
https://forums.phpfreaks.com/topic/129780-nav/#findComment-672813
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.