Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/05/2007, 15:10
Darkcom13
 
Fecha de Ingreso: mayo-2007
Mensajes: 6
Antigüedad: 16 años, 11 meses
Puntos: 0
Re: Error de conexion

este es el codigo que estoy usando
Este codigo PHP lo tengo en un archivo zciconfig.php

<?
class masterconfig
{function dbconnect()
{return dbx_connect(DBX_MYSQL,"localhost", "root", "zci","");
}
}
?>

Y este me dispara el problema de conexion

<html>
<head>
<title>Registered Computers</title>
<meta http-equiv="Pragma" content="no-cache">
<link rel=stylesheet type=text/css href="content.css">
</head>

<body>
<table border=2 width=100%>
<tr><td class=contenttitle colspan=4>Registered Computers</td></tr>
<tr class=catgmenu>
<th width=25%><a href=registered_computer.php?type=all>All Computers</a></th>
<th width=25%><a href=registered_computer.php?type=active>Active Computers</a></th>
<th width=25%><a href=registered_computer.php?type=removed>Removed Computers</a></th>
<th width=25%><a href=registered_computer.php?type=reserved>Reserve d Computers</a></th>
</tr>
<tr class=catgmenu>
<th width=25%><a href=registered_computer.php?type=1000>Owned Computers</a></th>
<th width=25%><a href=registered_computer.php?type=2000>Leased Computers</a></th>
<th width=25%><a href=registered_computer.php?type=3000>Ownership End</a></th>
<th width=25%><a href=registered_computer.php?type=4000>Lease End</a></th>
</tr>
<tr><td colspan=4>
<form action=registered_computer.php?type=search method=post style=margin-bottom:0>
Hostname : <input type=text name=hostname>
User Name : <input type=text name=user>
Domain : <input type=text name=domain>
<input type=submit value=SEARCH>
</form>
</td></tr>
<tr><td colspan=4><span class=myremark>Change Type of View to</span> :&nbsp;
<button onclick="javascript:location.replace('registered_d evice.php?devtype=Monitor')">Monitor</button>
<button onclick="javascript:location.replace('registered_d evice.php?devtype=Peripheral')">Peripheral</button>
</td></tr>
</table>

<?
include "../zciconfig.php";
include "../engine/zciobject.php";

if (isset($_GET['type'])) {
echo "<table width=100% border=1><tr class=myth><th width=4%>Num.</th><th>Hostname</th><th>User Name</th><th>Domain</th><th>Registration<br>Date</th><th>Ownership</th><th>Ownerhip<br>Change Date</th><th>Reserved</th></tr>";


$masterconf = new masterconfig();
//make database connection
$mydbcon = $masterconf->dbconnect();


$sqlstr="";
$str1="";
$str2="a.removed is null and b.computerid=a.computerid ";
$str3="";

switch ($_GET['type']) {
case "all":
break;
case "active" :
$str1 = "a.modelid<2500 and ";
$str3="and b.reserved is null";
break;
case "removed" :
$str1 = "a.modelid>2500 and ";
break;
case "reserved":
$str1 = "a.modelid<2500 and ";
$str3 = "and b.reserved is not null";
break;
case "search":
$str2="(b.hostname like '%".$_POST['hostname']."%' and b.user like '%".$_POST['user']."%' and c.name like '%".$_POST['domain']."%') and a.computerid=b.computerid and a.removed is null";
break;
default :
$str1 = "a.modelid=".$_GET['type']." and ";
}
$sqlstr="select a.computerid,b.hostname,b.user,c.name,b.registerda te,d.name,a.registerdate,b.reserved from ownership a,computer_system b,domain_category c,ownership_category d where ".$str1.$str2.$str3." and c.modelid=b.domain and d.modelid=a.modelid order by b.hostname,b.user";
$result=dbx_query($mydbcon,$sqlstr);

for($i=0;$i<$result->rows;$i++)
echo "<tr><td>".($i+1)."</td><td><a target=_blank href=computer_details.php?compid=".$result->data[$i][0].">".$result->data[$i][1]."</a></td><td>".$result->data[$i][2]. "</td><td>".$result->data[$i][3]."</td><td>".$result->data[$i][4]."</td><td>".$result->data[$i][5]."</td><td>".$result-> data[$i][6]."</td><td>".$result->data[$i][7]."</td></tr>";
dbx_close($mydbcon);
echo "</table>";
}
?>
</body></html>