Advertisement
contatowellington

Untitled

Aug 16th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. <?php require_once('Connections/ifoodbeer.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6. if (PHP_VERSION < 6) {
  7. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8. }
  9.  
  10. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12. switch ($theType) {
  13. case "text":
  14. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15. break;
  16. case "long":
  17. case "int":
  18. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19. break;
  20. case "double":
  21. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22. break;
  23. case "date":
  24. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25. break;
  26. case "defined":
  27. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28. break;
  29. }
  30. return $theValue;
  31. }
  32. }
  33.  
  34. $cep_Recordset1 = "-1";
  35. if (isset($_GET['cep'])) {
  36. $cep_Recordset1 = $_GET['cep'];
  37. }
  38. mysql_select_db($database_ifoodbeer, $ifoodbeer);
  39. $query_Recordset1 = sprintf("SELECT * FROM ifoodbeer WHERE %s BETWEEN cepinicio and cepfim ORDER BY id ASC", GetSQLValueString($cep_Recordset1, "text"));
  40. $Recordset1 = mysql_query($query_Recordset1, $ifoodbeer) or die(mysql_error());
  41. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  42. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  43. ?>
  44. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  45. <html xmlns="http://www.w3.org/1999/xhtml">
  46. <head>
  47. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  48. <title>Ibee's</title>
  49. <style type="text/css">
  50. <!--
  51. .logomarca {
  52. font-family: Arial, Helvetica, sans-serif;
  53. font-size: 40px;
  54. color: #FFF;
  55. }
  56. -->
  57. </style>
  58. </head>
  59.  
  60. <body>
  61. <table width="100%" border="0">
  62. <tr>
  63. <td>&nbsp;</td>
  64. </tr>
  65. <tr>
  66. <td bgcolor="#CC0000"><div align="center"><br />
  67. <span class="logomarca">Ibee's</span><br />
  68. <br />
  69. </div></td>
  70. </tr>
  71. <tr>
  72. <td><div align="left"><a href="testedelete/cep/index.php">Voltar</a></div></td>
  73. </tr>
  74. <tr>
  75. <td><div align="center">
  76. <form id="form1" name="form1" method="get" action="indexresp.php">
  77. <p>Cep consultado:
  78. <?php
  79. // Recebe os dados e guarda-os em vari&aacute;veis
  80. $nome = $_GET['cep'];
  81.  
  82. echo "$nome";
  83. ?>
  84. </p>
  85. </form>
  86. </div></td>
  87. </tr>
  88. <tr>
  89. <td><?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>
  90. Nada encontrado!
  91. <?php } // Show if recordset empty ?></td>
  92. </tr>
  93. </table>
  94. <?php do { ?>
  95. <?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
  96. <table width="21%" border="0">
  97. <tr>
  98. <td width="12%"><?php echo $row_Recordset1['id']; ?>&nbsp;&nbsp;&nbsp;</td>
  99. <td width="12%"><a href="<?php echo $row_Recordset1['link']; ?>"><?php echo $row_Recordset1['nomeloja']; ?></a></td>
  100. <td width="1%">&nbsp;</td>
  101. <td width="87%"><img src="images/<?php echo $row_Recordset1['logo']; ?>" width="100" height="100" /></td>
  102. </tr>
  103. </table>
  104. <?php } // Show if recordset not empty ?>
  105. <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  106. <p><!DOCTYPE html>
  107. <html lang="en">
  108. <head>
  109. <meta charset="UTF-8">
  110. <title>Buscando informações de um endereço através do CEP</title>
  111. <body>
  112. CEP: <input type="text" id="cep" value="<?php echo $_GET['cep']; ?>" maxlength="9" placeholder="Ex: 13483-087"/>
  113. <br/>
  114. <table width="100%" border="0">
  115. <tr>
  116. <td>&nbsp;</td>
  117. </tr>
  118. </table>
  119. </body>
  120. </html>
  121. <?php
  122. mysql_free_result($Recordset1);
  123. ?>
  124. &nbsp;</p>
  125. </body>
  126. </html>
  127. <?php $nome = $_GET['cep'];
  128. $nova = str_replace('-', '', $nome);
  129. echo "$nova";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement