Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

my code

By: a guest on Oct 22nd, 2012  |  syntax: None  |  size: 3.77 KB  |  views: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <head>
  2.  
  3. <body background=pattern1.gif>
  4.  
  5.         <style type="text/css">
  6.                 a:link    {text-decoration: none; color: brown;}
  7.                 a:visited {text-decoration: none; color: green;}
  8.                 a:hover   {color: red;}
  9.         </style>
  10.        
  11.         <style>
  12.                 tr:nth-of-type(odd) { background-color: AZURE; }
  13.                 tr:nth-of-type(even) { background-color: CYAN; }
  14.         </style>
  15.        
  16.         <style>
  17.                 tr:hover{background-color:DEEPSKYBLUE;}
  18.         </style>
  19.        
  20.  
  21.  
  22.    <link rel="stylesheet" href="style.css" type="text/css" id="" media="print, projection, screen" />
  23.    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  24. <script type="text/javascript">
  25. $(function() {
  26.     $(".spoiler-label").click(function() {
  27.         $(this).parent().find(".spoiler-content").toggle();
  28.     });
  29. });
  30. </script>
  31.  
  32.    
  33.         <script type="text/javascript" src="jquery-latest.js"></script>
  34.         <script type="text/javascript" src="jquery.tablesorter.js"></script>
  35.                
  36.         <script type="text/javascript">
  37.                 $(function() {
  38.                         $("table").tablesorter({debug: true});
  39.                        
  40.                 });
  41.         </script>
  42.                
  43. </head>
  44.        
  45.  
  46.         <form action="risultati0.php" method="POST">
  47.     <b>Titolo</b>&nbsp;<input type="text" name="Titolo">&nbsp;&nbsp;
  48.     <b>Proprietà&nbsp;</b><input type="text" name="Proprietà">&nbsp;&nbsp;
  49.    
  50.     <input type="Submit">
  51.     </form>
  52.        
  53.  
  54.     <?php
  55.      
  56. echo "<table id='rowspan' cellspacing='0' class='tablesorter'>";  
  57. echo "<thead><tr>";
  58. echo "<th>&nbsp;<i>ID<i/></th>";  
  59. echo "<th>&nbsp;<i>Titolo<i/></th>";
  60. echo "<th>Proprietà</th>";
  61. echo "<th >Download</th>";
  62. echo "</tr></thead>";
  63.  
  64.        
  65.     define('DB_NAME', 'ost_scores_gamerip');
  66.     define('DB_USER', 'root');
  67.     define('DB_PASSWORD', '');
  68.     define('DB_HOST', 'localhost');
  69.      
  70.     $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  71.     if (!$link) {
  72.         die('Could not connect: ' . mysql_error());
  73.     }
  74.      
  75.     $db_selected = mysql_select_db(DB_NAME, $link);
  76.      
  77.     if (!$db_selected) {
  78.         die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
  79.     }
  80.         mysql_query('SET CHARACTER SET utf8');
  81.      
  82.     $Titolo = str_replace(' ', '%', $_POST['Titolo']);
  83.     $Proprietà = str_replace(' ', '%', $_POST['Proprietà']);
  84.    
  85.      
  86.     $arTitolo = str_split($Titolo);
  87.     $arProprietà = str_split($Proprietà);
  88.    
  89.      
  90.     $Titolo='';
  91.     foreach ($arTitolo as $value)
  92.     {
  93.        if ($value=='%') continue;
  94.        $Titolo.=$value.'%';
  95.      
  96.     }
  97.      
  98.     $Proprietà='';
  99.     foreach ($arProprietà as $value)
  100.     {
  101.        if ($value=='%') continue;
  102.        $Proprietà.=$value.'%';
  103.      
  104.     }
  105.      
  106.    
  107.      
  108.     $sql = mysql_query("SELECT * FROM microsoft WHERE Titolo LIKE '%$Titolo%' AND Proprietà LIKE '%$Proprietà%' UNION SELECT * FROM pc WHERE Titolo LIKE '%$Titolo%' AND Proprietà LIKE '%$Proprietà%' ORDER BY Titolo") or die(mysql_error());
  109.      
  110.      
  111.        
  112.            
  113.  
  114.     $i = 0; while($row=mysql_fetch_array($sql)){
  115.         $i++;
  116.                
  117.         echo "<tr>";
  118.                
  119.                  $row['3']=stripslashes($row['3']);
  120.     $row['3']=str_replace('<br />',"newline",$row['3']);
  121.     $row['3']=htmlentities($row['3']);
  122.     $ary=explode('newline',$row['3']);
  123.     $str="";
  124.     foreach($ary as $str2){
  125.         $str.="<a href=\"$str2\">$str2</a><br/>";
  126.     }
  127.     $row['3']=$str;
  128.                
  129.                 echo "<td width='auto' bgcolor=”#FF0000 &#8243;>" . "&nbsp;". "<b>"  . $i . "&nbsp;". "<b/>". "</td>";
  130.         echo "<td width='auto'>" . "&nbsp;" . $row[1] . "&nbsp;" . "</td>";
  131.         echo "<td width='auto'>". $row[2] . "</td>";
  132.         echo "<td>&nbsp;<a href=\"".$row[3]."\">".$row[3]."</a>&nbsp;</td>";
  133.                 echo '<td><span class="spoiler-label">'.$row[1].'</span><div class="spoiler-content" style="display: none"><br><a href='.$row[3].'>'.$row[3].'<a/></div><td>';
  134.                
  135.  
  136.                
  137.         echo "</tr>";
  138.        
  139.        
  140.     }
  141.        
  142.     mysql_close();
  143.     ?>