All pastes #625577 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-19 01:05 UTC
rendered paste body

PHP Formatter 3.0 BETA - Made by Gerben VV
Home - Features - Style manager - Register - Login - Profile - Forum - Advertise on this website!
Output
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
	<?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);
?>