File: showsource.php

package info (click to toggle)
htcheck 1%3A1.2.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,836 kB
  • ctags: 2,885
  • sloc: cpp: 14,380; sh: 7,363; php: 3,089; ansic: 1,068; makefile: 303
file content (116 lines) | stat: -rw-r--r-- 2,323 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php

//    showsource.php
//    Shows the source of a retrieved URL
//
//    Part of the ht://Check package
//
//    Copyright (c) 1999-2004 Comune di Prato - Prato - Italy
//    Author: Gabriele Bartolini - Prato - Italy <angusgb@users.sourceforge.net>
//
//    For copyright details, see the file COPYING in your distribution
//    or the GNU General Public License version 2 or later 
//    <http://www.gnu.org/copyleft/gpl.html>
//
//    $Id: showsource.php,v 1.9 2003/12/30 09:39:23 angusgb Exp $

///////
   //    Global settings
///////

include ("./include/global.inc.php");


include ("./include/header.inc.php"); 

if (!isset($dbname))
{
   // Error
   DisplayErrMsg($strErrorNoDBSelected);
   die;
}
else
{
   if (!isset($IDUrl))
   {
      DisplayErrMsg($strErrorNoUrlSelected);
      die;
   }

   // Retrieve Information from the DB
   $strSQL = "Select Url, Contents" .
      " FROM Url" .
      " WHERE IDUrl=" . $IDUrl . ' AND Contents IS NOT NULL';

   $result=$MyDB->Query($dbname, $strSQL);
   
   if ($result)
   {
      DisplayErrMsg($MyDB->errmsg);
      die;
   }
   
   if ($MyDB->NumRows()>1)
   {
      DisplayErrMsg($strErrorDuplicateKey);
      die;
   }
   else if ($MyDB->NumRows()==0)
   {
?>
<p><?php echo $strNoOccurrencies; ?></p>
<?php
   }
   else
   {

      // Information retrieved
      $row = $MyDB->FetchArray();
      $MyDB->Free();

      $URLName = WriteHTML($row["Url"]);
      $pagetitle = "Database: $dbname - " . $strShowUrlSource . ": " . $URLName;
      
?>
<?php

      // A database and a URL have been selected

?>
<h3><?php echo $URLName; ?></h3>

<table>
<?php
	$row_number = 1;
    $oldpos=0;

	while ( $newtok = substr($row['Contents'], $oldpos) )
	{
       $newpos = strpos($newtok, "\n");
       if ($newpos)
          $str_row = WriteHTML(substr($newtok, 0, $newpos));
       else
          $str_row = '&nbsp;';

       $oldpos += $newpos + 1;

       if ($row_number == $RowNumber)
          $trclass='row';
       else
          ($row_number % 2)? $trclass='odd':$trclass='even';

?>
 <tr class="<?php echo $trclass; ?>">
 <td align="center"><a name="<?php echo $row_number; ?>"><?php echo $row_number; ?></a></td>
 <td><?php echo $str_row; ?></td>
 </tr>
<?php
		++$row_number;
	}
?>
</table>
<?php
   }
}
?>
<?php include ("./include/footer.inc.php"); ?>