Skip to content

Instantly share code, notes, and snippets.

@sandeepwisetr
Created January 21, 2015 17:19
Show Gist options
  • Save sandeepwisetr/da211b63e0476ca7deae to your computer and use it in GitHub Desktop.
Save sandeepwisetr/da211b63e0476ca7deae to your computer and use it in GitHub Desktop.
<div style="float:right">
<?php
$i=0;
$sqllist="select count(slip) from totalsale";
$n=mysql_query($sqllist) or die("list".mysql_error());
$r=mysql_fetch_array($n);
$c=$r['count(slip)']/30;
$c=$c+1;
for($i=1;$i<=$c;$i++)
{
?>
<a class='pager' style=""href='earning.php?limit1=<?php echo(30*($i-1));?>&limit2=<?php echo(30);?>'><?php echo($i);?></a>
<?php
}
?>
</div>
<body bgcolor="#f4f4f4">
<table>
<tr>
<h2>Software Center</h2>
<?php
require('database.php');
$count=0;
$dir="hd videos";
if(is_dir($dir))
{
if($dh=opendir($dir))
{
while(($filename=readdir($dh))!=false)
{
if(($filename!=".")&&($filename!=".."))
{
$count++;
$file=$dir.'/'.$filename;
$size=filesize($file);
$type=filetype($file);
$path="hd videos/".$filename;
$sql_check="select count(id) from video where path='$path'";
$sc=mysql_query($sql_check) or die("not run check".mysql_error());
$rsc=mysql_fetch_array($sc);
//echo($rsc['count(id)']);
if($rsc['count(id)']==1)
{
echo("file exist <span style='color:red'>".$path."</span><br>");
}
else{
$sql="insert into video values('','$filename','$size','$type','$path','1')";
$rcinsert=mysql_query($sql) or die('not run'.mysql_error());
if($rcinsert){
echo("file updates<span style='color:green'>".$path."</span><br>");}
else{
echo("not inserted");
}
}
?>
<!--li><a href="<?php echo $dir.'/'.$filename.''?>"><img src="<?php echo $dir.'/'.$filename.''?> " height=50 width=50></a> <?php echo(filesize($file))?> Bytes</li-->
<?php
}
}
closedir($dh);
}
}
?>
</tr>
</table>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment