Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/12/2020, 11:20
rafaxusirati
 
Fecha de Ingreso: julio-2010
Ubicación: Cerca Sitges (Barcelona)
Mensajes: 98
Antigüedad: 13 años, 9 meses
Puntos: 4
actualizaciones versión código

Hola, buenas tardes,

Tengo una web, creada con código PHP basado en la versión 5.5.38.

Me comentan, que debería actualizarlo a la última versión, pero desconozco que tengo que actualizar.

El archivo que me dá conexión a la Base de datos (contactos.php)

Código PHP:
Ver original
  1. <?php
  2. # FileName="Connection_php_mysql.htm"
  3. # Type="MYSQL"
  4. # HTTP="true"
  5. $hostname_contactos = "dbXXXXXXcom";
  6. $database_contactos = "dbXXXXXX";
  7. $username_contactos = "dboXXXXXX";
  8. $password_contactos = "XXXXXX";
  9. $contactos = mysql_pconnect($hostname_contactos, $username_contactos, $password_contactos) or trigger_error(mysql_error(),E_USER_ERROR);
  10. ?>

por otra banda, el archivo que recoge los datos de la BD y poder mostrarlos.


Código PHP:
Ver original
  1. <?php
  2.   if(isset($_SERVER[HTTP_ACCEPT_ENCODING]) && substr_count($_SERVER[HTTP_ACCEPT_ENCODING], gzip)) ob_start(ob_gzhandler); else ob_start();
  3.   ?>
  4.  
  5. <?php
  6.     header("Cache-Control: max-age=86400"); //30days (60sec * 60min * 24hours * 30days)
  7. ?>
  8.  
  9. <?php require_once('../../Connections/contactos.php'); ?>
  10.  
  11. <?php
  12. if (!function_exists("GetSQLValueString")) {
  13. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  14. {
  15.   if (PHP_VERSION < 6) {
  16.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  17.   }
  18.  
  19.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  20.  
  21.   switch ($theType) {
  22.     case "text":
  23.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24.       break;    
  25.     case "long":
  26.     case "int":
  27.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  28.       break;
  29.     case "double":
  30.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  31.       break;
  32.     case "date":
  33.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  34.       break;
  35.     case "defined":
  36.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  37.       break;
  38.   }
  39.   return $theValue;
  40. }
  41. }
  42.  
  43. $currentPage = $_SERVER["PHP_SELF"];
  44.  
  45.  
  46. $maxRows_Recordset2 = 5;
  47. $pageNum_Recordset2 = 0;
  48. if (isset($_GET['pageNum_Recordset2'])) {
  49.   $pageNum_Recordset2 = $_GET['pageNum_Recordset2'];
  50. }
  51. $startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2;
  52.  
  53. mysql_select_db($database_contactos, $contactos);
  54. $query_Recordset2 = "SELECT * FROM contactos WHERE categoria_anuncio = 'zapatos' ORDER BY fechaentrada DESC ";
  55.  
  56. $query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);
  57. $Recordset2 = mysql_query($query_limit_Recordset2, $contactos) or die(mysql_error());
  58. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  59.  
  60. if (isset($_GET['totalRows_Recordset2'])) {
  61.   $totalRows_Recordset2 = $_GET['totalRows_Recordset2'];
  62. } else {
  63.   $all_Recordset2 = mysql_query($query_Recordset2);
  64.   $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);
  65. }
  66. $totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;
  67.  
  68. _...._
  69.  
  70. mysql_select_db($database_contactos, $contactos);
  71. $query_Recordset4 = "SELECT * FROM combo WHERE tipo = '7' ";
  72. $Recordset4 = mysql_query($query_Recordset4, $contactos) or die(mysql_error());
  73. $row_Recordset4 = mysql_fetch_assoc($Recordset4);
  74. $totalRows_Recordset4 = mysql_num_rows($Recordset4);
  75.  
  76. _...._
  77.  
  78. $queryString_Recordset2 = "";
  79. if (!empty($_SERVER['QUERY_STRING'])) {
  80.   $params = explode("&", $_SERVER['QUERY_STRING']);
  81.   $newParams = array();
  82.   foreach ($params as $param) {
  83.     if (stristr($param, "pageNum_Recordset2") == false &&
  84.         stristr($param, "totalRows_Recordset2") == false) {
  85.       array_push($newParams, $param);
  86.     }
  87.   }
  88.   if (count($newParams) != 0) {
  89.     $queryString_Recordset2 = "&" . htmlentities(implode("&", $newParams));
  90.   }
  91. }
  92. $queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);
  93. ?>


y en la zona del Body


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
...



Código PHP:
Ver original
  1. <?php do { ?>
  2. ...  
  3.  
  4. <?php echo $row_Recordset2['idempleado']; ?>">
  5. ...
  6.  
  7. <div align="center">
  8.  
  9. <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?>
  10. <a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, 0, $queryString_Recordset2); ?>" title="xxx" style="color: #000">Primero</a>
  11.  
  12.  
  13. <?php } // Show if not first page ?></td>
  14. <td style="font-size: small">
  15. <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?>
  16.  
  17.  
  18.  
  19. </body>
  20. </html>
  21.  
  22. <?php
  23. mysql_free_result($Recordset2);
  24. mysql_free_result($Recordset4);
  25. ?>

Un saludo, y muchas gracias.