...

View Full Version : works on host but not on locslhost



jdimino
10-22-2009, 07:17 PM
Hi Everyone,

Iím having big problem which I cannot figure out what the problem is
My delema is is this: I have this script that work fine on my web serve, however when I try to use it with microweb server, itís doesnít work the way it should, does anyone have any suggestions what might cause this. ? Could it be php version ?

P.S IF SOMEONE IS WILLING TO HELP, I COULD SEND THE CODE

Fumigator
10-22-2009, 07:46 PM
How bout you tell us what the problem is first, and maybe even post some code snippets that may be relevant to the problem.

Phil Jackson
10-22-2009, 07:46 PM
Should really send the code first my man so we know what we are dealing with ;-)

jdimino
10-22-2009, 07:59 PM
ok you guys a right!
Here is the problem I'm having, hope It's not so confusing.
On the following code on
/* No 3 Hybridiser */ /* No 4 Origin */ and /* No 5 Leaf */

it ignores this code

echo '<td width="17%" height="7" bgcolor="#CCCC99" align="center">';
if (file_exists($partpath3)){
if ($img3=="Unknown"){
echo '<img width="120" height="120" src="'.$fullpath3.'">';

and Goes to the else code

echo '<img width="120" height="120" src="'.$imgpath3.'H/HNP.jpe">';
}
echo '<br><font color="#000000" face="Trebuchet MS"><b>'.$img_3."</b></font></td>";



<?PHP
function alert($alert) {
$out .='<script type="text/javascript">
alert("'.$alert.'");
</script>
';

print $out;

}

function find($name, $view){
global $link;

switch($view){
case '1': $column = 'Bloom_Name'; break;
case '2': $column = 'Pod_Name'; break;
case '3': $column = 'Pollen_Name'; break;
case '4': $column = 'Hybridiser'; break;
case '5': $column = 'Origin'; break;
case '6': $column = 'Grower'; break;
case '7': $column = 'Color_Group'; break;
case '8': $column = 'Bloom_Type'; break;
case '9': $column = 'Reg_Mini'; break;
case '10': $column = 'Size_Range'; break;
case '11': $column = 'Propagation'; break;
case '12': $column = 'Bloom_Color'; break;
case '13': $column = 'Bloom_Characteristics'; break;
case '14': $column = 'Leaf_Characteristics'; break;
case '15': $column = 'Bush_Characteristics'; break;
case '24': $column = 'Cross_Made'; break;
case '25': $column = 'date'; break;
default: $column = 'Bloom_Name'; break;

}

$connection = mysql_connect("localhost","root","")or die(mysql_error());
$db_select =mysql_select_db('internb7', $connection) or die ("Couldn't select database.");

$SQL = "SELECT Bloom_Name, Pod_Name, Pollen_Name, Hybridiser, Origin, approve, Leaf_Image " .
"FROM ihsreg " .
"WHERE " . $column . " LIKE '" . $name . "' AND $column != '' " .
"ORDER BY Bloom_Name ASC";

$result = mysql_query($SQL);
$num=mysql_num_rows($result);
$results = array();
while($row = mysql_fetch_row($result)){

$results[] = $row;
}

return $results;
}


$noimagemessage = "No Photo Available";
if(isset($_GET['search'])){
$search = urldecode(urldecode($_GET['search']));
$y = 0;
$results[0]=Array();
$results[1]=Array();
$results[2]=Array();
$results[3]=Array();
$results[4]=Array();
$results[5]=Array();
$results[6]=Array();

$results = find($search,$_GET['view']);

$y = sizeof($results);

}
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
img{
border:0;
}
</style>
<script type="text/javascript">
function open_win(img){
window.open("cvdata1.php?search="+img);
}
</script>
</head>
<body bgcolor="#FFFFFF" BACKGROUND="http://localhost/cvimages/b2a.jpg"><body>
<div align="center"><img src="http://localhost/SEimages/CVtittle.gif" width="320" height="65">
<br>
<b><font face="Trebuchet MS">Click On Image For Details</font></b><br>
<table border=2 width="100%" bordercolor="#006666" cellpadding="1" cellspacing="1" bordercolorlight="#999900" bordercolordark="#CCCC00">
<?PHP
for($x=0; $x<count(@$results); $x++){
echo '<tr>';
echo '<th width="17%" height="7" align="center" bgcolor="#CCFFCC"><font color="#000000" face="Trebuchet MS">Cultivar</font></th>';
echo '<th width="16%" height="7" align="center" bgcolor="#339999"><font color="#000000" face="Trebuchet MS">Pod Parent</font></th>';
echo '<th width="17%" height="7" align="center" bgcolor="#99CCCC"><font color="#000000" face="Trebuchet MS">Pollen Parent</font></th>';
echo '<th width="17%" height="7" align="center" bgcolor="#CCCC99"><font color="#000000" face="Trebuchet MS">Hybridizer</font></th>';
echo '<th width="16%" height="7" align="center" bgcolor="#CCCC33"><font color="#000000" face="Trebuchet MS">Origin</font></th>';
echo '<th width="17%" height="7" align="center" bgcolor="#009900"><font color="#000000" face="Trebuchet MS">Leaf</font></th>';
echo '</tr>';
echo '<tr>';

$pathroot="http://localhost/";
$imgpath=$pathroot."";
$imgpath3=$pathroot."Hybridizer/";
$imgpath4=$pathroot."Origin/";
$imgpath5=$pathroot."Leaf/";

$img0=ucwords(trim($results[$x][0]));
$img1=ucwords(trim($results[$x][1]));
$img2=ucwords(trim($results[$x][2]));
$img3=ucwords(trim($results[$x][3]));
$img4=ucwords(trim($results[$x][4]));
$img5=ucwords(trim($results[$x][6]));
$img_1=ucwords(trim($results[$x][1]));
$img_2=ucwords(trim($results[$x][2]));
$img_3=ucwords(trim($results[$x][3]));
$img_4=ucwords(trim($results[$x][4]));
$img_4=ucwords(trim($results[$x][4]));
$img_5=substr($img5,0,-4);
$appr=strtoupper(trim($results[$x][5]));
$subpath0=substr($img0,0,1)."/";
$subpath1=substr($img1,0,1)."/";
$subpath2=substr($img2,0,1)."/";
$subpath3=substr($img3,0,1)."/";
$subpath4=substr($img4,0,1)."/";
$subpath5=substr($img5,0,1)."/";
$partpath0=$subpath0.$img0.".jpg";
$partpath1=$subpath1.$img1.".jpg";
$partpath2=$subpath2.$img2.".jpg";
$partpath3="../Hybridizer/".$subpath3.$img3.".jpe";
$partpath4="../Origin/".$subpath4.$img4.".jpe";
$partpath5="../Leaf/".$subpath5.$img5;
$fullpath0=$imgpath.$partpath0;
$fullpath1=$imgpath.$partpath1;
$fullpath2=$imgpath.$partpath2;
$fullpath3=$imgpath3.$partpath3;
$fullpath4=$imgpath4.$partpath4;
$fullpath5=$imgpath5.$partpath5;

// This section is in for my testing
/* $imgpath="";
$imgpath3="";
$imgpath4="";
$imgpath5="";
$partpath3=$subpath3.$img3.".jpe";
$partpath4=$subpath4.$img4.".jpe";
$partpath5=$subpath5.$img5.".jpg";
$fullpath0=$partpath0;
$fullpath1=$partpath1;
$fullpath2=$partpath2;
$fullpath3=$partpath3;
$fullpath4=$partpath4;
$fullpath5=$partpath5;*/

/* No 0 Bloom */
echo '<td width="17%" height="7" bgcolor="#CCFFCC" align="center">';
if (trim($appr) == "True" || trim($appr)=="TRUE") {
if (file_exists($partpath0)){
echo '<a href="cvdata1.php?search='.$img0.'"'.'target="_blank"><img width="120" height="120" src="'.$fullpath0.'"></a>';
}else{
echo '<img width="120" height="120" src="'.$imgpath.'N/NBA.jpe">';
}
} else {
echo '<img width="120" height="120" src="'.$imgpath.'B/BRP.jpe">';
}
echo '<br><font color="#000000" face="Trebuchet MS"><b>'.$img0."</b></font></td>";

/* No 1 Pod */
echo '<td width="16%" height="7" bgcolor="#339999" align="center">';
if (file_exists($partpath1)){
if ($img1=="Unknown"){
echo '<img width="120" height="120" src="'.$fullpath1.'">';
}else{
echo '<a href="cvdata1.php?search='.$img1.'"'.'target="_blank"><img width="120" height="120" src="'.$fullpath1.'"></a>';
}
}else{
echo '<img width="120" height="120" src="'.$imgpath.'N/NBA.jpe">';
}
echo '<br><font color="#000000" face="Trebuchet MS"><b>'.$img_1."</b></font></td>";

/* No 2 Pollen */
echo '<td width="17%" height="7" bgcolor="#99CCCC" align="center">';
if (file_exists($partpath2)){
if ($img2=="Unknown"){
echo '<img width="120" height="120" src="'.$fullpath2.'">';
}else{
echo '<a href="cvdata1.php?search='.$img2.'"'.'target="_blank"><img width="120" height="120" src="'.$fullpath2.'"></a>';
}
}else{
echo '<img width="120" height="120" src="'.$imgpath.'N/NBA.jpe">';
}
echo '<br><font color="#000000" face="Trebuchet MS"><b>'.$img_2."</b></font></td>";

/* No 3 Hybridiser */
echo '<td width="17%" height="7" bgcolor="#CCCC99" align="center">';
if (file_exists($partpath3)){
if ($img3=="Unknown"){
echo '<img width="120" height="120" src="'.$fullpath3.'">';
}else{
echo '<a href="cvdata1.php?search='.$img3.'"'.'target="_blank"><img width="120" height="120" src="'.$fullpath3.'"></a>';
}
}else{
echo '<img width="120" height="120" src="'.$imgpath3.'H/HNP.jpe">';
}
echo '<br><font color="#000000" face="Trebuchet MS"><b>'.$img_3."</b></font></td>";

/* No 4 Origin */
echo '<td width="16%" height="7" bgcolor="#CCCC33" align="center">';
if (file_exists($partpath4)){
if ($img4=="Unknown"){
echo '<img width="120" height="120" src="'.$fullpath4.'">';
}else{
echo '<a href="cvdata1.php?search='.$img4.'"'.'target="_blank"><img width="120" height="120" src="'.$fullpath4.'"></a>';
}
}else{
echo '<img width="120" height="120" src="'.$imgpath4.'O/ONP.gif">';
}
echo '<br><font color="#000000" face="Trebuchet MS"><b>'.$img_4."</b></font></td>";

/* No 5 Leaf */
echo '<td width="17%" height="7" bgcolor="#009900" align="center">';
if (file_exists($partpath5)){
echo '<img width="120" height="120" src="'.$fullpath5.'">';
}else{
echo '<img width="120" height="120" src="'.$imgpath5.'N/NPA.jpg">';
}
echo '<br><font color="#000000" face="Trebuchet MS"><b>'.$img_5."</b></font></td>";

echo '</tr>';
echo '<tr><td colspan=5>&nbsp;</td></tr>';
}
if(count(@$results[0])==0){
echo '<tr><td width="100%" colspan=5 align="center">No results found.</td></tr>';
}
?> </table>
<font size="2"><b></b></font></div>
</body>
</html>

CFMaBiSmAd
10-22-2009, 08:09 PM
Where in the posted code is the variable $appr being set at?

I fear that your code is dependent on register_globals being on. You need to set $appr from the correct source (post/get/cookie/session) so that your code will work on all php configurations and versions (register_globals have been completely removed in php6.)

godofreality
10-22-2009, 08:16 PM
ok i have noticed more than one line in your script there that look like this line right here which i copied from above where u mentioned where the problem was occuring

echo '<img width="120" height="120" src="'.$imgpath3.'H/HNP.jpe">';

please note the file type ur trying to place onto the page it is .jpe which i have never heard of and i am quite sure that is ur problem right there try changing it to .jpg and see if it works now

things u need to change:
$partpath3="../Hybridizer/".$subpath3.$img3.".jpe";
$partpath4="../Origin/".$subpath4.$img4.".jpe";

/* No 0 Bloom */
echo '<img width="120" height="120" src="'.$imgpath.'N/NBA.jpe">';
echo '<img width="120" height="120" src="'.$imgpath.'B/BRP.jpe">';


/* No 1 Pod */

echo '<img width="120" height="120" src="'.$imgpath.'N/NBA.jpe">';


/* No 2 Pollen */

echo '<img width="120" height="120" src="'.$imgpath.'N/NBA.jpe">';


/* No 3 Hybridiser */

echo '<img width="120" height="120" src="'.$imgpath3.'H/HNP.jpe">';

jdimino
10-22-2009, 09:09 PM
How do you set register_globals on ?

CFMaBiSmAd
10-22-2009, 09:17 PM
It is better to fix your code because register globals were turned off by default in php4.2 over 7 years ago and they have been completely removed in php6. The sooner you correct your code the sooner you can stop wasting time every time you switch to a different server where register_globals are not turned on.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum