All pastes #625578 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-19 01:06 UTC
rendered paste body
<?php
  require('../Connections/laptop.php');
?>
<?php
  require_once('../Connections/laptop.php');
?>
<?php
  //initialize the session
  if (!isset($_SESSION)) {
      session_start();
  }
  
  // ** Logout the current user. **
  $logoutAction = $_SERVER['PHP_SELF'] . "?doLogout=true";
  if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")) {
      $logoutAction .= "&" . htmlentities($_SERVER['QUERY_STRING']);
  }
  
  if ((isset($_GET['doLogout'])) && ($_GET['doLogout'] == "true")) {
      //to fully log out a visitor we need to clear the session varialbles
      $_SESSION['MM_Username'] = null;
      $_SESSION['MM_UserGroup'] = null;
      $_SESSION['PrevUrl'] = null;
      unset($_SESSION['MM_Username']);
      unset($_SESSION['MM_UserGroup']);
      unset($_SESSION['PrevUrl']);
      
      $logoutGoTo = "index.php";
      if ($logoutGoTo) {
          header("Location: $logoutGoTo");
          exit;
      }
  }
?>
<?php
  if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      {
          $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
          
          $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
          
          switch ($theType) {
              case "text":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;
              case "long":
              case "int":
                  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                  break;
              case "double":
                  $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
                  break;
              case "date":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;
              case "defined":
                  $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                  break;
          }
          return $theValue;
      }
  }
  
  // insere na base de dados
  
  if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "voting")) {
      $insertSQL = sprintf("INSERT INTO pic_votes (picid, vote1) VALUES (%s, %s)", GetSQLValueString($_POST['pic_id'], "int"), GetSQLValueString($_POST['1'], "int"));
      
      // fim
      
      
      mysql_select_db($database_laptop, $laptop);
      $Result1 = mysql_query($insertSQL, $laptop) or die(mysql_error());
      
      $insertGoTo = "comments.php";
      if (isset($_SERVER['QUERY_STRING'])) {
          $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
          $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
  }
  
  if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      {
          $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
          
          $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
          
          switch ($theType) {
              case "text":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;
              case "long":
              case "int":
                  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                  break;
              case "double":
                  $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
                  break;
              case "date":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;
              case "defined":
                  $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                  break;
          }
          return $theValue;
      }
  }
  
  mysql_select_db($database_laptop, $laptop);
  $query_Creative = "SELECT * FROM cms_gallery_pics, ad_gallery_country WHERE cms_gallery_pics.Pic_Gallery=ad_gallery_country.Gal_ID AND cms_gallery_pics.Pic_Cat = 1 limit 10";
  $Creative = mysql_query($query_Creative, $laptop) or die(mysql_error());
  $row_Creative = mysql_fetch_assoc($Creative);
  $totalRows_Creative = mysql_num_rows($Creative);
  
  $colname_User = "-1";
  if (isset($_SESSION['MM_Username'])) {
      $colname_User = $_SESSION['MM_Username'];
  }
  mysql_select_db($database_laptop, $laptop);
  $query_User = sprintf("SELECT * FROM judges WHERE username = %s", GetSQLValueString($colname_User, "text"));
  $User = mysql_query($query_User, $laptop) or die(mysql_error());
  $row_User = mysql_fetch_assoc($User);
  $totalRows_User = mysql_num_rows($User);
  
  $colname_Categories = "-1";
  if (isset($_GET['category'])) {
      $colname_Categories = $_GET['category'];
  }
  mysql_select_db($database_laptop, $laptop);
  $query_Categories = sprintf("SELECT * FROM categories WHERE cat_id = %s", GetSQLValueString($colname_Categories, "int"));
  $Categories = mysql_query($query_Categories, $laptop) or die(mysql_error());
  $row_Categories = mysql_fetch_assoc($Categories);
  $totalRows_Categories = mysql_num_rows($Categories);
  
  $colname_picvotes = "-1";
  if (isset($_POST['picid'])) {
      $colname_picvotes = $_POST['picid'];
  }
  mysql_select_db($database_laptop, $laptop);
  $query_picvotes = sprintf("SELECT * FROM pic_votes WHERE picid = %s", GetSQLValueString($colname_picvotes, "int"));
  $picvotes = mysql_query($query_picvotes, $laptop) or die(mysql_error());
  $row_picvotes = mysql_fetch_assoc($picvotes);
  $totalRows_picvotes = mysql_num_rows($picvotes);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Metro Global Creative Awards</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>


<div id="contentor">
<div id="judge_horizontal_bar">You are loged in as <strong><?php
  echo $row_User['judgename'];
?></strong> | <a href="<?php
  echo $logoutAction
?>">log out</a></div>


<div id="header"></div>
<div id="banner_header"></div>
<div id="banner_footer"></div>


<div id="menu_bar">

  <div class="categories">
    
    <a title="" href="http://metrocreativeawards.com/index.php?MBheight=616">Category: </a>
    
    <a title="" href="#">Creative</a>
    |  
    Creative
    |
    Integrated</div>
  
    <div class="user_menu">


    </div>
    

    
    
</div>

<div id="center">

<div class="actual_category">BEST CREATIVE FORMAT AD</div>

<form action="creativecomments.php" method="POST" name="voting" id="voting">

<input name="categoria" type="hidden" id="categoria" value="<?php
  echo $row_Categories['cat_id'];
?>" />

<?php
  do {
?>
    <div class="canditate">
      
      <div class="info_holder">
      
      <div class="pic">
        <input name="picid" type="hidden" id="picid" value="<?php
      echo $row_Creative['Pic_ID'];
?>" />
        <img name="thumbnail" src="../gal_imgs/<?php
      echo $row_Creative['Gal_Name'];
?>/thumbs/<?php
      echo $row_Creative['Pic_Pic'];
?>" alt="" /><br />
      </div>
        
        
        
        <div class="titulo">
    
    <?php
      $picTitle = substr($row_Creative['Pic_Name'], 0, 20);
      echo $picTitle;
      if (strlen($picTitle) >= 20) {
          echo "&hellip;";
      }
?>
    
    
    </div>
        
        
                
        
        <div class="canditate_details">
        
          <div class="country"><img src="../site_images/flags/<?php
      echo $row_Creative['Gal_Name'];
?>.gif" alt="Flag" width="17" height="11" /><strong><?php
      echo $row_Creative['Gal_Name'];
?></strong></div>
          
          <div class="media"><strong>Media Agency:</strong> <?php
      echo $row_Creative['Pic_Media'];
?></div>
          
          <div class="creative"><strong>Creative Agency:</strong> <?php
      echo $row_Creative['Pic_Creative'];
?></div>
          
          <div class="format"><strong>Format:</strong> <?php
      echo $row_Creative['Pic_Format'];
?></div>
          
        </div>
        

        
        </div>
        
        
        <div class="voting">
          <fieldset id="<?php
      echo $row_Creative['Pic_ID'];
?>">
            <input type="radio" value="1" name="<?php
      echo $row_Creative['Pic_ID'];
?>"> 1
            <input type="radio" value="2" name="<?php
      echo $row_Creative['Pic_ID'];
?>"> 2
            <input type="radio" value="3" name="<?php
      echo $row_Creative['Pic_ID'];
?>"> 3
            
        </fieldset>

        </div>
        
        
      </div>
<?php
  } while ($row_Creative = mysql_fetch_assoc($Creative));
?>

<p>
  
   

  <input name="vote" type="submit" value="vote" />
</p>
<a href="creativecomments.php">comments</a>
</form>
      
    <div id="footer">
      
      <div class="terms">Terms &amp; Conditions | Privacy policy<br />
        Copyright Metro, 2007<br />
        <img src="../site_images/metro_logo.jpg" alt="metro_logo" width="127" height="40" /><img src="../site_images/media_marketing.jpg" alt="media marketing" width="119" height="42" /><br />
      </div>
      
      </div>
      
</div>
      
      
      
</div>
</body>
</html>
<?php
  mysql_free_result($User);
  
  mysql_free_result($Categories);
  
  mysql_free_result($picvotes);
  
  mysql_free_result($Creative);
?>