PDA

View Full Version : why are my php custom files not working


r5mjh
12-30-2015, 01:32 PM
hi there, im playing around with a upgrade of vb to maybe 4.2.3 and have found that it requires php 5.4, problem is if i change from 5.2.17 to 5.4 my custom php files wont work

is there a easy fix for this??
or do i need to go 4.2.2 as this is 5.2.17 friendly

any help appreciated thanx:up:

Dragonsys
12-30-2015, 04:06 PM
we would have to be able to see your custom files code to figure out what is wrong with them, but it sounds like you are using deprecated functions.

Without at least errors, we can only guess.

r5mjh
12-30-2015, 04:43 PM
basically the code controls many different php pages, also the custom software has to require 2 other modified files header.php,global.php

but if i change the php to 5.4 nothing works

4.2.3 requires 5.4 and 3.8.9 requires 5.3 or above we are currrently on 3.7.1

i can provide some code which is from the home.php file which works on 5.2.17 but not 5.4

<?php

// number of news items to show on home page:
$news_items = 5;

//########################

require_once("header.php"); // header calls /boards/global.php

$username=$vbulletin->userinfo['username'];
$userid=$vbulletin->userinfo['userid'];
$usergroupid=$vbulletin->userinfo['usergroupid'];
$totalposts=vb_number_format($vbulletin->userinfo['posts']);
$token=$vbulletin->userinfo['securitytoken'];

function is_member()
{
// are we a member ?
if($GLOBALS['usergroupid'] != "1" AND $GLOBALS['usergroupid'] != "2" AND $GLOBALS['usergroupid'] != "3") return TRUE; else return FALSE;
}

if(is_member)
{
$chat_link = "http://www/chat/login.php";
$shop_link = "/shop/";
$class_link = "/boards/forumdisplay.php?f=14";
$articles_link = "/boards/forumdisplay.php?f=17";
$club_link = "/club/";
} else
{
$chat_link = "/guest.php";
$shop_link = "/guest.php";
$class_link = "/guest.php";
$articles_link = "/guest.php";
$club_link = "/guest.php";
}

$files_link = "/files/";

// go html:
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>RTOC - Renault Turbo Owners Club</title>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name="generator" content="RTOC">
<meta name="keywords" content="rtoc,renault,turbo,owners,club,r5gtt,turbo,r9,r11, r21,forum">
<!-- CSS Stylesheet -->
<style type="text/css">
body
{
background: #FFFFFF;
color: #000000;;
margin: 0px 0px 0px 0px;
padding: 0px;
font: 11px Verdana, Helvetica, sans-serif;
}
.rtoc_nav
{
background: #6080c0;
color: #FFFFFF;
font: 10px Verdana, Helvetica, sans-serif;
}
.rtoc_nav a:link, .rtoc_nav_alink
{
color: #ffffff;
text-decoration: none;
}
.rtoc_nav a:visited, .rtoc_nav_avisited
{
color: #ffffff;
text-decoration: none;
}
.rtoc_nav a:hover, .rtoc_nav a:active, .rtoc_nav_ahover
{
color: #FFFFFF;
text-decoration: underline;
}
.home_nav a:link, .home_nav_alink
{
color: #000000;
text-decoration: none;
}
.home_nav a:visited, .home_nav_avisited
{
color: #000000;
text-decoration: none;
}
.home_nav a:hover, .home_nav a:active, .home_nav_ahover
{
color: #000000;
text-decoration: underline;
}
.box
{
border: 1px #888888 solid;
}
</style>
<!-- / CSS Stylesheet -->
</head>
<body text="#000000" bgcolor="#FFFFFF">
<?

// show page header
show_page_header();

?>
<table border="0" cellspacing="2" cellpadding="0"><tr><td width="100%"></td></tr></table>
<!-- MAIN TABLE -->
<table width="100%" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0">
<tr>
<!-- LEFT COLUMN -->
<td align="left" valign="top" width="180" bgcolor="#CCCCD2">
<?
show_left_nav();
?>
<table border="0" width="175" cellpadding="3" cellspacing="0"><tr>
<td align="left" width="175">
<?
// visitor counter removed, forever re-setting for some reason :-( Scoff
//Visits: <?
// do counter:
//$fh = fopen('main_page_counter.dat', 'r') or die("Can't open counter file!");
//$line = fgets($fh);
//$data = explode("|",$line);
//fclose($fh);
//$data[1] ++;
//$fh = fopen('main_page_counter.dat', 'w') or die("Can't write to counter file!");
//fputs($fh,"|".$data[1]."|");
//fclose($fh);
//print $data[1];
?>
<br><br><br><br><br><br><br><br><br><br><br><br><br></td></tr></table>
<br><br>
</td>
<td width="2" bgcolor="#BBBBBB"></td>
<td width="10"></td>
<td valign="top">
<!-- CENTER COLUMN -->
<!-- MAIN TABLE -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top">
<? if($userid!="0"){ print "<b>Hi $username</b>, w";} else { print "W"; } ?>elcome to the internet home of the Renault Turbo owners club, the largest collection of Renault turbo enthusiasts on the internet. Catering for all types of Renault turbo including the 5 GT Turbo, 9 Turbo, 11 turbo, 21 Turbo, 25 V6 turbo, R5 Turbo 1 and 2's, Alpine, Gordini, Twingo turbo, Megane Sport Turbo and other one-off's and modern Renault Turbo variants too.
<br><br>
<img src="/images/a.gif"><img src="/images/a.gif">&nbsp;&nbsp;<img src="/images/latest-news.gif">
<br><br>
<!-- NEWS SCRIPT OUTPUT -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<?

// open news file:
$fh = fopen('news/news.txt', 'r') or die("Can't open news file!");

// loop to fetch top news items:
$count = 0;
while (($count < $news_items) AND !feof($fh))
{
$data = fgets($fh);
list($junk,$title,$image,$short,$long,$on_off,$img _on_off) = split('\|',$data);

// are we showing this item ?
if ($on_off=="ON")
{
// start TD:
$count++;
print "<!-- NEWS ITEM " . $count . "-->\n";
print "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n";
// are we showing an image ?
if ($img_on_off=="ON")
{
print "<td align=\"left\" valign=\"top\" width=\"150\"><img src=\"$image\"></td><td width=\"8\"></td>\n";
}

print "<td align=\"left\" valign=\"top\">\n";
print "<b><u>$title</u></b><br><br>\n";
print $short . "\n</td>\n</tr>\n</table>\n<br>\n";
print "<!--- / NEWS ITEM " . $count . "-->\n";
}

}

// close the file:
fclose($fh);

?>
</td></tr></table>
</td>
</tr>
</table>
</td>
<td width="10"></td>
<td align="right" valign="top" width="202">
<!-- RIGHT COLUMN -->
<?

// show join-now to non-paid members:
if (($usergroupid == "1") OR ($usergroupid == "2"))
{
?>
<!-- JOIN NOW -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="/club/?show=join"><img src="/images/join-now.gif" border="0"></a>
<br>
<a href="/club/?show=join"><font color="#000000">Join RTOC today!</font></a>
</td>
</tr>
</table>
<br>
<?
}
?>
<!-- BOARDS -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="/boards/"><img src="/images/boards.gif" border="0"></a>
<br>
The club message boards lets you chat with other members and send & receive private messages.
</td>
</tr>
</table>
<br>
<!-- EVENTS -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="/boards/events.php"><img src="/images/events.gif" border="0"></a>
<br>
Check out forthcoming events in our club calendar.
</td>
</tr>
</table>
<br>
<!-- ARTICLES -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="<? print $articles_link; ?>"><img src="/images/articles.gif" border="0"></a>
<br>
Technical advice, data and other interesting stuff.
</td>
</tr>
</table>
<br>
<!-- CLASSIFIEDS -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="<? print $class_link; ?>"><img src="/images/classifieds.gif" border="0"></a>
<br>
Renault turbo related classifieds<br>for sale and wanted.
</td>
</tr>
</table>
<br>
<!-- FILES -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="<? print $files_link; ?>"><img src="/images/files.gif" border="0"></a>
<br>
Files area - pictures, technical images, members files, etc.
</td>
</tr>
</table>
<br>
<!-- WIZARD -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="/wizard/"><img src="/images/wizard.gif" border="0"></a>
<br>
The Wizard - on hand to answer your technical questions.
</td>
</tr>
</table>
<br>
<!-- CONTACTS -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="/contacts/"><img src="/images/contacts.gif" border="0"></a>
<br>
Contact directory - see which companies offer you Discount!
</td>
</tr>
</table>
<br>
<!-- CONTACT -->
<table border="0" cellpadding="5" cellspacing="0" width="200">
<tr>
<td align="left" valign="top" bgcolor="#EEEEF0" class="box">
<img src="/images/a.gif">&nbsp;<a href="/contact.php"><img src="/images/contact.gif" border="0"></a>
<br>
Visit our contact page if you'd like to get in touch with the club.
</td>
</tr>
</table>

</td>
<td width="4"></td>
</tr>
</table>
</body>
</html>

Dragonsys
12-30-2015, 05:11 PM
Please enclose that PHP in the PHP bbcode, to make it more readable.
Also, whe you change to PHP v5.4 does it give any errors, or just nothing at all?

Also, try changing all the <? to <?php

r5mjh
12-30-2015, 06:48 PM
ok im not a total noob lol but im not up on the bbcode part, ive just duplicated on another part of the server using a different forum database all works correctly on 5.2.17 but as soon as i put it on 5.4 the custom php pages stop working not the vb itself

we have loads of custom tabs that all work with vb and none work with 5.4 php

Dragonsys
12-30-2015, 09:05 PM
ok im not a total noob lol but im not up on the bbcode part, ive just duplicated on another part of the server using a different forum database all works correctly on 5.2.17 but as soon as i put it on 5.4 the custom php pages stop working not the vb itself

we have loads of custom tabs that all work with vb and none work with 5.4 php

No worries :)
Right, I understand that vBulletin works, but your custom pages do not. However, do they generate any errors, or just blank pages?

Also, in your PHP pages change <? to <?php some installs are strict requiring the full tag

r5mjh
12-31-2015, 09:26 AM
No worries :)
Right, I understand that vBulletin works, but your custom pages do not. However, do they generate any errors, or just blank pages?

Also, in your PHP pages change <? to <?php some installs are strict requiring the full tag

got ya matey yep it gives a server 500 error on 5.4 saying it not on the server or somrthing else

but is fine with 5.2.17 ill give that a try matey and report back

--------------- Added 1451570200 at 1451570200 ---------------

well done dragon that worked for php 5.4 but some pages dont work 5.2.17 now lol but if we are upgrading thats not a problem thanx for your help sir apprec:)

can these php custom pages be used in 4.2.3 still??

Dragonsys
12-31-2015, 02:51 PM
well done dragon that worked for php 5.4 but some pages dont work 5.2.17 now lol but if we are upgrading thats not a problem thanx for your help sir apprec:)

can these php custom pages be used in 4.2.3 still??

Strange, that change shouldn't affect it in PHP 5.2
I'm not sure if they will still work on vb v4 since they were written for v3. I would copy your forums to a test site and try the upgrade see what errors you get, if any

r5mjh
01-01-2016, 03:17 PM
thanx matey ill do that next

1 more question, does vb only use 1 database even if you choose to put albumpictures to the database? ive got 2 they look linked

Dragonsys
01-01-2016, 03:21 PM
thanx matey ill do that next

1 more question, does vb only use 1 database even if you choose to put albumpictures to the database? ive got 2 they look linked

Yes, vb only uses 1 DB, unless you have a custom mod which changes this