hi i am new in PHP ,i am doing my job in a company and there are some existing project they tell to me plz check and remove errors ,i m trying more and more to remove this error but i m failure....plz help me.
<?php require("header.inc.php");
session_start();
if(($useradmin)=='')
{
//header( "Location: error.php" );
}
?>
<html>
<head>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="colors.css">
<title>Admin Area : Users</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<SCRIPT language=javaScript type="text/javascript">
function D(url)
{
window.open(url,"data","width=550,height=600,scrollbars=no,resizable=no");
}
</SCRIPT>
</head>
<body>
<?
//This variable is for date
$dfrom="$year/$month/$day";
$dto="$year1/$month1/$day1";
function getnextt($result,$qwery){
global $uid,$msex,$mgsm,$memail,$mstep,$mname,$medu,$mcheq,$msale,$amm,$mtitle,$mfirst,$mmiddle,$mlast,$mtype,$tott,$mlogin,$mrefer,$mcountry,$mbranch,$mnation,$mnation2,$mdate,$mend,$mphone,$midno,$midnodate,$midplace,$mbirtharabic,$mbirthplace,$mbirth,$mmarital,$domain,$domainx;
if(!$qwery){
$row=mysql_fetch_array($result);
if($row)
{
$mnation2=$row["mnation2"];
$midnodate=$row["midnodate"];
$midplace=$row["midplace"];
$midno=$row["midno"];
$mbirtharabic=$row["mbirtharabic"];
$mbirthplace=$row["mbirthplace"];
$mbirth=$row["mbirth"];
$mcheq=$row["mcheq"];
$medu=$row["medu"];
$mname=$row["mname"];
$mstep=$row["mstep"];
$mmarital=$row["mmarital"];
$msex=$row["msex"];
$mgsm=$row["mgsm"];
$uid=$row["uid"];
$msale=$row["msale"];
$mtype=$row["mtype"];
$amm=$row["amm"];
$tott=$row["tott"];
$mlogin=$row["mlogin"];
$mtitle=$row["mtitle"];
$mfirst=$row["mfirst"];
$mmiddle=$row["mmiddle"];
$mlast=$row["mlast"];
$mrefer=$row["mrefer"];
$memail=$row["memail"];
$mphone=$row["mphone"];
$mstreet=$row["mstreet"];
$mcity=$row["mcity"];
$mcountry=$row["mcountry"];
$mnation=$row["mnation"];
$mbranch=$row["mbranch"];
$mdate=$row["mdate"];
$mend=$row["mend"];
$mbank=$row["mbank"];
$mip=$row["mip"];
$domain=$row["domain"];
$domainx=$row["domainx"];
}
return $row;
}
$qw=quotemeta($qwery);
while($row=mysql_fetch_array($result))
{
if(preg_match("/$qw/i",$row["mlogin"])||preg_match("/$qw/i",$row["mfirst"])||preg_match("/$qw/i",$row["memail"])||preg_match("/$qw/i",$row["mcountry"])||preg_match("/$qw/i",$row["mcity"])||preg_match("/$qw/i",$row["mstreet"])||preg_match("/$qw/i",$row["mbank"])||preg_match("/$qw/i",$row["mip"])||preg_match("/$qw/i",$row["mdate"])||preg_match("/$qw/i",$row["mname"])||preg_match("/$qw/i",$row["mstep"])||preg_match("/$qw/i",$row["msale"])||preg_match("/$qw/i",$row["msex"])||preg_match("/$qw/i",$row["mgsm"])||preg_match("/$qw/i",$row["medu"])||preg_match("/$qw/i",$row["mcheq"]) )break;
}
if($row)
{
$mnation2=$row["mnation2"];
$midnodate=$row["midnodate"];
$midplace=$row["midplace"];
$mbirtharabic=$row["mbirtharabic"];
$mbirthplace=$row["mbirthplace"];
$mcheq=$row["mcheq"];
$medu=$row["medu"];
$mname=$row["mname"];
$mstep=$row["mstep"];
$mmarital=$row["mmarital"];
$msex=$row["msex"];
$mgsm=$row["mgsm"];
$uid=$row["uid"];
$msale=$row["msale"];
$mtype=$row["mtype"];
$amm=$row["amm"];
$tott=$row["tott"];
$mlogin=$row["mlogin"];
$mtitle=$row["mtitle"];
$mfirst=$row["mfirst"];
$mmiddle=$row["mmiddle"];
$mlast=$row["mlast"];
$mrefer=$row["mrefer"];
$memail=$row["memail"];
$mphone=$row["mphone"];
$mstreet=$row["mstreet"];
$mcity=$row["mcity"];
$mcountry=$row["mcountry"];
$mnation=$row["mnation"];
$mbranch=$row["mbranch"];
$mdate=$row["mdate"];
$mend=$row["mend"];
$mbank=$row["mbank"];
$mip=$row["mip"];
$domain=$row["domain"];
$domainx=$row["domainx"];
$mbirth=$row["mbirth"];
}
return $row;
}
?>
<br>
<?
$sno=1;
?>
<a href="javascript:history.go(-1)">Back</a>
<? echo "<center><strong>Data of Registration/ Expiration</strong></center>" ; ?>
<? if($ac=="search"){ ?>
<? if ($pcert!=NULL) { ?>
<form action="certificatedown.php" method="post">
<div align="right">
<input name="Submit" type="submit" class="markx" value="For Certificate">
<br>
<br>
</div>
<? } else { ?>
<form action="search_mail.php" method="post">
<div align="right">
<input name="Submit2" type="submit" class="markx" value="Mail" >
<br>
<br>
</div>
<? } ?>
<table width="100%" bgcolor="#00CCCC" cellspacing="0" cellpadding="0" border="1">
<tr>
<td>
<table width="100%" bgcolor="#00CCCC"height="90" border="1" cellpadding="0"cellspacing="1" >
<tr bgcolor="#CC3333" >
<td class="txt3" style3><div align="center"><strong>SerialNo</strong></div></td>
<? if ($user!=NULL) echo "<td class=txt3 style3><div align=center><strong>UserID</strong></div></td> ";?>
<? if ($ufirst!=NULL) echo "<td class=txt3 style3><div align=center><strong>UserName</strong></div></td> ";?>
<? if ($certname!=NULL) echo "<td class=txt3 style3><div align=center><strong>CertificateName</strong></div></td> ";?>
<? if ($umobile!=NULL) echo " <td class=txt3 style3><div align=center><strong>UserMobile</strong></div></td> "; ?>
<? if ($uphone!=NULL) echo " <td class=txt3 style3><div align=center><strong>UserPhone</strong></div></td> "; ?>
<? if ($refer!=NULL) echo " <td class=txt3 style3><div align=center><strong>Refer</strong></div></td> "; ?>
<? if ($rfirst!=NULL) echo " <td class=txt3 style3><div align=center><strong>ReferName</strong></div></td> "; ?>
<? if ($rmobile!=NULL) echo " <td class=txt3 style3><div align=center><strong>ReferMobile</strong></div></td> "; ?>
<? if ($rphone!=NULL) echo " <td class=txt3 style3><div align=center><strong>ReferPhone</strong></div></td> "; ?>
<? if ($cr!=NULL) echo " <td class=txt3 style3><div align=center><strong>Type</strong></div></td> "; ?>
<? if ($mf!=NULL) echo " <td class=txt3 style3><div align=center><strong>Sex</strong></div></td> "; ?>
<? if ($nat!=NULL) echo " <td class=txt3 style3><div align=center><strong>Nationality</strong></div></td> "; ?>
<? if ($regdate!=NULL) echo " <td class=txt3 style3><div align=center><strong>Registration</strong></div></td> "; ?>
<? if ($expdate!=NULL) echo " <td class=txt3 style3><div align=center><strong>Expiry</strong></div></td> "; ?>
<? if ($ammount!=NULL) echo " <td class=txt3 style3><div align=center><strong>Amount</strong></div></td> "; ?>
<? if ($dom!=NULL) echo " <td class=txt3 style3><div align=center><strong>Domain</strong></div></td> "; ?>
<? if ($doba!=NULL) echo " <td class=txt3 style3><div align=center><strong>Dateofbirth</strong></div></td> "; ?>
<? if ($pob!=NULL) echo " <td class=txt3 style3><div align=center><strong>Placeofbirth</strong></div></td> "; ?>
<? if ($idnum!=NULL) echo " <td class=txt3 style3><div align=center><strong>IDNumber</strong></div></td> "; ?>
<? if ($iddate!=NULL) echo " <td class=txt3 style3><div align=center><strong>IDDate</strong></div></td> "; ?>
<? if ($idplace!=NULL) echo " <td class=txt3 style3><div align=center><strong>IDPlace</strong></div></td> "; ?>
<? if ($lcheque!=NULL) echo " <td class=txt3 style3><div align=center><strong>Lastcheque</strong></div></td> "; ?>
<? if ($lcdate!=NULL) echo " <td class=txt3 style3><div align=center><strong>LastDate</strong></div></td> "; ?>
<? if ($nmchek!=NULL) echo " <td class=txt3 style3><div align=center><strong>Namecheque</strong></div></td> "; ?>
<? if ($nlchek!=NULL) echo " <td class=txt3 style3><div align=center><strong>NumberCheque</strong></div></td> "; ?>
<? if ($center!=NULL) echo " <td class=txt3 style3><div align=center><strong>Branch</strong></div></td> "; ?>
<? if ($tstep!=NULL) echo " <td class=txt3 style3><div align=center><strong>Step</strong></div></td> "; ?>
<? if ($dc!=NULL) echo " <td class=txt3 style3><div align=center><strong>D-C</strong></div></td> "; ?>
<? if ($uemail!=NULL) echo "<td class=txt3 style3><div align=center><strong>Email</strong></div></td>"; ?>
<? if ($sig!=NULL){
for ($s=0; $s<$signum; $s++) { //This is increasing the signature column
echo " <td class=txt3 style3><div align=center><strong>Signature</strong></div></td> "; } } ?>
<?
if($strt=="") $strt=0;
if($radio=='sreg') { $qw="mdate";}
if($radio=='sexpir') { $qw="mend";}
if($member=='cu') { $q1="and mtype='cu'"; }
if($member=='re') { $q1="and mtype='re'"; }
if($sex2=='male') { $q2="and msex='male'"; }
if($sex2=='female') { $q2="and msex='female'"; }
if ($center_name=='all') {$q3="";}
else { $q3="and mbranch='$center_name'";}
if($step!=NULL) { $q4= "and mstep>='$step'"; }
if($step2!=NULL) { $q5= "and mstep<='$step2'"; }
if($direct!=NULL) { $q6= "and msale>='$direct'"; }
if($direct2!=NULL) { $q7= "and msale<='$direct2'"; }
$result=mysql_query("select * from members where $qw between '$dfrom' and '$dto' $q1 $q2 $q3 $q4 $q5 $q6 $q7");
for($x=0;$x<$strt;$x++) getnextt($result,$search);
$x=0;
while($x++<$rpage&&getnextt($result,$search))
{
$result1=mysql_query("SELECT * FROM members where mlogin='$mrefer'");
$rows1 = @mysql_num_rows($result1);
while ($row = mysql_fetch_array($result1))
{
$rfirst1=$row["mfirst"];
$rfirst2=$row["mlast"];
$rmobile1=$row["mgsm"];
$rphone1=$row["mphone"];
}
$result12 = mysql_query("select * from checks where user='$mlogin' and cdeliver=1");
$rows12 = @mysql_num_rows($result12);
while ($row = mysql_fetch_array($result12))
{
$ldate=$row["ddeliver"];
$lamm=$row["amm"];
$numcheq=$row["cheqno"];
}
?>
</tr>
<tr bgcolor="#00CCCC" >
<td class="txt3" style3><div align="center"><? echo $sno;$sno++;?></div></td>
<? if ($user!=NULL) echo "<td class='txt3'><div align='center'> $mlogin </div></td>" ; ?>
<? if ($ufirst!=NULL) echo "<td class='txt3'><div align='center'> $mfirst $mlast </div></td>"; ?>
<? if ($certname!=NULL) echo "<td class='txt3'><div align='center'> $mname </div></td>" ; ?>
<? if ($umobile!=NULL) echo "<td class='txt3'><div align='center'> $mgsm </div></td>" ; ?>
<? if ($uphone!=NULL) echo "<td class='txt3'><div align='center'> $mphone </div></td>" ; ?>
<? if ($refer!=NULL) echo "<td class='txt3'><div align='center'> $mrefer </div></td>" ; ?>
<? if ($rfirst!=NULL) echo "<td class='txt3'><div align='center'> $rfirst1 $rfirst2 </div></td>" ; ?>
<? if ($rmobile!=NULL) echo "<td class='txt3'><div align='center'> $rmobile1 </div></td>" ; ?>
<? if ($rphone!=NULL) echo "<td class='txt3'><div align='center'> $rphone1 </div></td>" ; ?>
<? if ($cr!=NULL) echo "<td class='txt3'><div align='center'> $mtype </div></td>" ; ?>
<? if ($mf!=NULL) echo "<td class='txt3'><div align='center'> $msex </div></td>" ; ?>
<? if ($nat!=NULL) echo "<td class='txt3'><div align='center'> $mnation2 </div></td>" ; ?>
<? if ($regdate!=NULL) echo "<td class='txt3'><div align='center'> $mdate </div></td>" ; ?>
<? if ($expdate!=NULL) echo "<td class='txt3'><div align='center'> $mend </div></td>" ; ?>
<? if ($ammount!=NULL) echo "<td class='txt3'><div align='center'> $amm </div></td>" ; ?>
<? if ($dom!=NULL) echo "<td class='txt3'><div align='center'> $domain.$domainx </div></td>" ; ?>
<? if ($doba!=NULL) echo "<td class='txt3'><div align='center'> $mbirtharabic </div></td>" ; ?>
<? if ($pob!=NULL) echo "<td class='txt3'><div align='center'> $mbirthplace </div></td>" ; ?>
<? if ($idnum!=NULL) echo "<td class='txt3'><div align='center'> $midno </div></td>" ; ?>
<? if ($iddate!=NULL) echo "<td class='txt3'><div align='center'> $midnodate </div></td>" ; ?>
<? if ($idplace!=NULL) echo "<td class='txt3'><div align='center'> $midplace </div></td>" ; ?>
<? if ($lcheque!=NULL) echo "<td class='txt3'><div align='center'> $lamm </div></td>" ; ?>
<? if ($lcdate!=NULL) echo "<td class='txt3'><div align='center'> $ldate </div></td>" ; ?>
<? if ($nmchek!=NULL) echo "<td class='txt3'><div align='center'> $mcheq </div></td>" ; ?>
<? if ($nlchek!=NULL) echo "<td class='txt3'><div align='center'> $numcheq </div></td>" ; ?>
<? if ($center!=NULL) echo "<td class='txt3'><div align='center'> $mbranch </div></td>" ; ?>
<? if ($tstep!=NULL) echo "<td class='txt3'><div align='center'> $mstep </div></td>" ; ?>
<? if ($dc!=NULL) echo "<td class='txt3'><div align='center'> $msale </div></td>" ; ?>
<? if ($uemail!=NULL) echo "<td class='txt3'><div align='center'> $memail </div></td>" ; ?>
<? if ($sig!=NULL) {
for ($s=0; $s<$signum; $s++) {
echo "<td class='txt3'><div align='center'> </div></td>" ; } }
/******************* Data Array for Certificates ***********************/
$a[]=$mname;
$b[]=$mnation2;
$c[]=$midno;
$d[]=$midnodate;
//This is for statistics
if ($mtype=='cu') { $cno=$cno+1; }
if ($mtype=='re') { $rno=$rno+1; }
if ($msex=='male') { $mno=$mno+1; }
if ($msex=='female') { $fno=$fno+1; }
if ($mmarital=='single') { $singno=$singno+1; }
if ($mmarital=='married') { $marno=$marno+1; }
if ($medu=='10th') { $tenth=$tenth+1; }
if ($medu=='12th') { $twth=$twth+1; }
if ($medu=='Bachelor') { $bache=$bache+1; }
if ($medu=='Master') { $mast=$mast+1; }
if ($medu=='Phd') { $phd=$phd+1; }
if ($medu=='') { $non=$non+1; }
$tyear= date ("Y-m-d");
$datediff= $tyear - $mbirth ;
if ($datediff >50) { $a50=$a50+1; }
if (($datediff >40)and ($datediff <=50)){ $a40=$a40+1; }
if (($datediff >35)and ($datediff <=40)){ $a35=$a35+1; }
if (($datediff >30)and ($datediff <=35)){ $a30=$a30+1; }
if (($datediff >25)and ($datediff <=30)){ $a25=$a25+1; }
if (($datediff >20)and ($datediff <=25)){ $a20=$a20+1; }
if ($datediff <=20) { $b20=$b20+1; }
//this is for clearing the chache value
$ldate=NULL;
$lamm=NULL;
$numcheq=NULL;
}
for($i=0;$i<$sno;$i++)
{
echo"<input type='hidden' name='aa[]' value='$a[$i]'>";
echo"<input type='hidden' name='bb[]' value='$b[$i]'>";
echo"<input type='hidden' name='cc[]' value='$c[$i]'>";
echo"<input type='hidden' name='dd[]' value='$d[$i]'>";
}
?>
</table></td>
</tr></table>
<input name="serial" type="hidden" id="serial" value="<? echo $sno-1?>">
</form>
<br>
<table bgcolor="#B8CEF0"width="100%">
<tr>
<td align="left">
<?
if($strt>0){
$sstr=$strt-$rpage;
print "<a href='search_adv1.php?ac=search&strt=$sstr&search=".urlencode($search)."'>Prev";
}
?>
</td>
<td align="right">
<?
if(getnextt($result,$search)){
$sstr=$strt+$rpage;
print "<a href='search_adv1.php?ac=search&strt=$sstr&search=".urlencode($search)."'>Next";
}
}
?>
</td></tr></table>
<p><a href="javascript:history.go(-1)">Back</a></p>
<table width="600" border="1" align="center">
<? if ($stype!=NULL) { ?>
<tr>
<td width="23%"><div align="right"><strong>Member Type </strong></div></td>
<td width="22%"><div align="right">Customers :</div></td>
<td width="10%"><? echo $cno; ?> </td>
<td colspan="2"><div align="right">Representative : </div></td>
<td width="9%"><? echo $rno; ?></td>
</tr>
<? } ?>
<? if ($ssex!=NULL) { ?>
<tr>
<td><div align="right"><strong>Sex</strong></div></td>
<td><div align="right">Male : </div></td>
<td><? echo $mno; ?> </td>
<td colspan="2"><div align="right">Female : </div></td>
<td><? echo $fno; ?> </td>
</tr>
<? } ?>
<? if ($smstatus!=NULL) { ?>
<tr>
<td><div align="right"><strong>Maritial Statues </strong></div></td>
<td><div align="right">Single : </div></td>
<td><? echo $singno; ?> </td>
<td colspan="2"><div align="right">Married : </div></td>
<td><? echo $marno; ?></td>
</tr>
<? } ?>
<? if ($sedu!=NULL) { ?>
<tr>
<td><div align="right"><strong>Education </strong></div></td>
<td><div align="right">None :</div></td>
<td><? echo $non; ?> </td>
<td width="23%"><div align="right">10th : </div></td>
<td width="13%"><? echo $tenth; ?></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><div align="right">12th : </div></td>
<td><? echo $twth; ?></td>
<td><div align="right">Graduate : </div></td>
<td><? echo $bache; ?></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><div align="right">Post Graduate : </div></td>
<td><? echo $mast; ?> </td>
<td><div align="right">PhD/ Doctors : </div></td>
<td><? echo $phd; ?></td>
<td> </td>
</tr>
<? } ?>
<? if ($sage!=NULL) { ?>
<tr>
<td><div align="right"><strong>Age :</strong> </div></td>
<td><div align="right">Below 20 : </div></td>
<td><? echo $b20; ?> </td>
<td><div align="right">20 - 25 : </div></td>
<td><? echo $a20; ?> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><div align="right">25 - 30 : </div></td>
<td><? echo $a25; ?> </td>
<td><div align="right">30 - 35 : </div></td>
<td><? echo $a30; ?> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><div align="right">35 - 40 : </div></td>
<td><? echo $a35; ?> </td>
<td><div align="right">40 - 50 : </div></td>
<td><? echo $a40; ?> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><div align="right">Above 50 : </div></td>
<td><? echo $a50; ?> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<? } ?>
</table>
</body>
</html>