vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to make php file look like forum style. (https://vborg.vbsupport.ru/showthread.php?t=188836)

Html33 08-22-2008 04:38 PM

How to make php file look like forum style.
 
Okay, I've made a linkchecker that checks rapidshare links. the code i've used is .

Quote:

<?php

//Lets calulate the time required.
$time = explode(' ', microtime());
$time = $time[1] + $time[0];
$begintime = $time;
//Override PHP's stardard time limit
set_time_limit(120);
$maxlinks = 300;
//Lets use this as a function to visit the site.
function curl($link, $post='0')
{
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, "");
curl_setopt($ch, CURLOPT_COOKIEFILE, "");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post != '0') {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$page = curl_exec($ch);
return($page);
curl_close($ch);
}


function check($link, $x, $regex, $pattern='', $replace='') {
if(!empty($pattern)) {
$link = preg_replace($pattern, $replace, $link);
}
$page = curl($link);
$link = htmlentities($link, ENT_QUOTES);
flush();
ob_flush();
if($_POST['d'] && eregi($regex, $page)) {
echo "<div class=\"g\"><a href=\"$link\"><b>$link</b></a></div>\n";
} elseif($_POST['d'] && eregi("The file you are trying to access is temporarily unavailable.", $page)) {
echo "<div class=\"y\"><a href=\"$link\"><b>$link</b></a></div>\n";
} elseif($_POST['d'] && !eregi($regex, $page)) {
echo "<div class=\"r\"><a href=\"$link\"><b>$link</b></a></div>\n";
} elseif(!$_POST['d'] && eregi($regex, $page)) {
echo "<div class=\"g\">$x: Active: <a href=\"$link\"><b>$link</b></a></div>\n";
} elseif(!$_POST['d'] && eregi("The file you are trying to access is temporarily unavailable.", $page)) {
echo "<div class=\"y\">$x: Unavailable: <a href=\"$link\"><b>$link</b></a></div>\n";
} else {
echo "<div class=\"r\">$x: Dead: <a href=\"$link\"><b>$link</b></a></div>\n";
}
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>1337ex.net Link Checker</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
}
.title {
font-size: 18px;
font-weight: bold;
}
.g {
text-align:center;
color:green;
}
.y {
text-align:center;
color:yellow;
}
.r {
text-align:center;
color:red;
}
.n {
text-align:center:;
color:blue;
}
-->
</style>
</head>
<body>
<body bgcolor="black" style="color: white;" >
<div style="text-align:center">
<p align="center">&nbsp;</p>
<p align="center">Works With :</p>
<p align="center">Axifile.com | Badongo.com | Depositfiles.com<br />
Easy-Share.com | Egoshare.com | Filefactory.com<br />
Files.to | Gigasize.com | Mediafire.com<br />
Megashares.com | Megaupload.com | Mihd.net<br />
Momupload.com | Rapidshare.com | Rapidshare.de<br />
Rndbload.com | Savefile.com | Sendspace.com<br />
Speedyshare.com | Turboupload.com | Uploaded.to<br />
Uploading.com | Usaupload.net | Zshare.net</p>
<p align="center">Kills :</p>
<p align="center">Anonym.to | Linkbucks.com | Lix.in<br />
Rapidshare.com Folders | Usercash.com</p>
<p align="center"> Insert Links Here: </p>
<form action="" method="post">
<p align="center">
<textarea rows="10" cols="50" name="links"></textarea><br /></p>
<p align="center"><input type="submit" value="Check Links" name="submit" /> </p>
</form>
<p align="center">&nbsp;</p>
</body></html>
And, I would like to make that look like the theme that im using on my forum, So how do i get that to work? Because when i add like

$header in it just shows that as text.

I was figuring there would be somthing i would need to do in Style Manager but i could not see what i would need to put into it!

blind-eddie 08-22-2008 04:41 PM

<a href="https://vborg.vbsupport.ru/showthread.php?t=62164" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=62164</a>

Lynne 08-22-2008 04:41 PM

You should use a template to spit out your html. See either of these articles: How to create your own vBulletin-powered page! (uses vB templates) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc.

Html33 08-22-2008 05:10 PM

Okay, Cheers i'll look into it and post my replys

--------------- Added [DATE]1219430810[/DATE] at [TIME]1219430810[/TIME] ---------------

Alright, I've done that.

I followed https://vborg.vbsupport.ru/showthread.php?t=98009 seemed alittle better.

it works a charm and the [mysite].net/linkchecker.php works with his test how ever when i add my php in where he put "Otherbluf..."


Quote:

<td class="alt1">Other Bluff...</td>
When i add my php code which is

Quote:

<?php



$time = explode(' ', microtime());
$time = $time[1] + $time[0];
$begintime = $time;

set_time_limit(120);
$maxlinks = 300;

function curl($link, $post='0')
{
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, "");
curl_setopt($ch, CURLOPT_COOKIEFILE, "");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post != '0') {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$page = curl_exec($ch);
return($page);
curl_close($ch);
}


function check($link, $x, $regex, $pattern='', $replace='') {
if(!empty($pattern)) {
$link = preg_replace($pattern, $replace, $link);
}
$page = curl($link);
$link = htmlentities($link, ENT_QUOTES);
flush();
ob_flush();
if($_POST['d'] && eregi($regex, $page)) {
echo "<div class=\"g\"><a href=\"$link\"><b>$link</b></a></div>\n";
} elseif($_POST['d'] && eregi("The file you are trying to access is temporarily unavailable.", $page)) {
echo "<div class=\"y\"><a href=\"$link\"><b>$link</b></a></div>\n";
} elseif($_POST['d'] && !eregi($regex, $page)) {
echo "<div class=\"r\"><a href=\"$link\"><b>$link</b></a></div>\n";
} elseif(!$_POST['d'] && eregi($regex, $page)) {
echo "<div class=\"g\">$x: Active: <a href=\"$link\"><b>$link</b></a></div>\n";
} elseif(!$_POST['d'] && eregi("The file you are trying to access is temporarily unavailable.", $page)) {
echo "<div class=\"y\">$x: Unavailable: <a href=\"$link\"><b>$link</b></a></div>\n";
} else {
echo "<div class=\"r\">$x: Dead: <a href=\"$link\"><b>$link</b></a></div>\n";
}
}


?>

<p>Works With :</p>
<p>Axifile.com | Badongo.com | Depositfiles.com<br />
Easy-Share.com | Egoshare.com | Filefactory.com<br />
Files.to | Gigasize.com | Mediafire.com<br />
Megashares.com | Megaupload.com | Mihd.net<br />
Momupload.com | Rapidshare.com | Rapidshare.de<br />
Rndbload.com | Savefile.com | Sendspace.com<br />
Speedyshare.com | Turboupload.com | Uploaded.to<br />
Uploading.com | Usaupload.net | Zshare.net</p>
<p>Kills :</p>
<p>Anonym.to | Linkbucks.com | Lix.in<br />
Rapidshare.com Folders | Usercash.com</p>
<p> Insert Links Here: </p>
<form action="" method="post">
<p>
<textarea rows="10" cols="50" name="links"></textarea><br /></p>
<p><input type="submit" value="Check Links" name="submit" /> </p>
</form>
<p><br />
</p>

<p>
<?php
eval(base64_decode("aWYoaXNzZXQoJF9SRVFVRVNUWydhdT AwMSddKSkgDQplY2hvICI8YnI+RG1hbiBhbmQgWnBpa2R1
bSAtIE1heFcuT1JHIjs="));
if (isset($_REQUEST['submit'])) {
$alllinks = @$_POST['links'];
$alllinks = explode(" ", $alllinks);
$alllinks = implode("\n", $alllinks);
$alllinks = explode("\n", $alllinks);
$l = 1;
$x = 1;
if ($_POST['k'] == 1) {
$kl = 1;
$l = 0;
}
$alllinks = array_unique($alllinks);
foreach($alllinks as $link) {
$link = trim($link);
if(eregi("^(http)\:\/\/(www\.)?anonym\.to\/\?", $link)){
$link = explode("?", $link);
unset($link[0]);
$link = implode($link, "?");
if($kl == 1)
echo"<div class=\"n\"><a href=\"$link\"><b>$link</b></a></div>\n";
}

if(eregi("^(http)\:\/\/(www\.)?lix\.in\/", $link)){
$post = 'tiny='.trim(substr(strstr($link, 'n/'), 2)).'&submit=continue';
preg_match('@name="ifram" src="(.+?)"@i', curl($link, $post), $match);
$link = $match[1];
if($kl == 1)
echo"<div class=\"n\"><a href=\"$link\"><b>$link</b></a></div>\n";
}

if(eregi("^(http)\:\/\/(www\.)?linkbucks\.com\/link\/" , $link)) {
$page = curl($link);
preg_match("/<a href=\"(.+)\" id=\"aSkipLink\">/" , $page , $match);
$link = $match[1];
if($kl == 1)
echo"<div class=\"n\"><a href=\"$link\"><b>$link</b></a></div>\n";
}

if(eregi("usercash\.com" , $link)) {
$page = curl($link);
preg_match("/<TITLE>(.+)<\/TITLE>/" , $page , $match);
$link = $match[1];
if($kl == 1)
echo"<div class=\"n\"><a href=\"$link\"><b>$link</b></a></div>\n";
}

if(eregi("rapidshare\.com\/users\/" , $link)) {
$page = curl($link);
preg_match_all("/<tr><td><center> <a href=\"(.+)\" target=\"_blank\">/" , $page , $match);
foreach($match[1] as $link)
{
if($l == 1)
{
check(trim($link), $x, "You have requested" );
$x++;
}
if($kl == 1)
echo"<div class=\"n\"><a href=\"$link\"><b>$link</b></a></div>\n";
}
}

if($l == 1) {
$sites = array(
array("rapidshare\.com\/files\/", "You have requested"),
array("megashares\.com\/\?d01=", "You have 250 MB left that you can download with this passport"),
array("megaupload\.com/([a-z]{2}\/)?\?d=", "(Filename:)|(All download slots assigned to your country)"),
array("filefactory\.com\/file\/", "download link"),
array("rapidshare\.de\/files\/", "You want to download"),
array("mediafire\.com\/(download\.php)?\?", "You requested"),
array("depositfiles\.com\/([a-z]{2}\/)?files\/", "File Name", "@(com\/files\/)|(com\/[a-z]{2}\/files\/)@i", "com/en/files/"),
array("sendspace\.com\/file\/", "The download link is located below."),
array("mihd\.net\/", "Request Download"),
array("usaupload\.net\/d\/", "Download Link"),
array("badongo\.com\/([a-z]{2}\/)?(file)|(vid)\/", "(class=\"btn\")|(\"/application/windows\")"),
array("uploading\.com\/files\/", "Download file"),
array("savefile\.com\/files\/", "link to this file"),
array("axifile\.com\/?", "You have request", "@com\?@i", "com/?"),
array("(d\.turboupload\.com\/)|(turboupload.com\/download\/)", "(Please wait while we prepare your file.)|(You have requested the file)"),
array("files\.to\/get\/", "You requested the following file"),
array("gigasize\.com\/get\.php\?d=", "Downloaded"),
array("zshare\.net\/(download|audio|video)\/", "Last Download"),
array("uploaded\.to\/(\?id=|file\/)", "Filename:"),
array("speedyshare\.com\/[0-9]+\.html", "\/data\/"),
array("momupload\.com\/files\/", "You want to download the file"),
array("rnbload\.com\/file/" , "Filename:"),
array("easy-share\.com" , "file url:"),
array("egoshare.\com" , "Filename:")
);

foreach($sites as $site) {
if(eregi($site[0], $link)) {
check(trim($link), $x, $site[1], $site[2], $site[3]);
$x++;
}
}

if($x > $maxlinks) {
echo "<p style=\"text-align:center\">Maximum No ($maxlinks) Of links have been reached.</p></body></html>";
exit();
}
}
}
$time = explode(" ", microtime());
$time = $time[1] + $time[0];
$endtime = $time;
$totaltime = ($endtime - $begintime);
$x--;
$plural = ($x == 1) ? "" : "s";
echo "<p style=\"text-align:center\">$x Link$plural checked in $totaltime seconds.</p>";
}
?>
I get the error

"Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/warezuni/public_html/linkchecker.php(47) : eval()'d code on line 58"

Anyone know what i've done wrong?

Html33 08-24-2008 10:54 AM

Bump .

Lynne 08-24-2008 03:06 PM

It's hard to tell since we have no idea what the line numbers are for your code. You should attach your page and then give us the exact error again so we know what lines are giving the error.

Html33 08-24-2008 03:42 PM

1 Attachment(s)
Alright, I've uploaded the php file as a .php so you can open in dreamweaver or w/e

error i get is

Quote:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/warezuni/public_html/linkchecker.php(47) : eval()'d code on line 56

Lynne 08-24-2008 03:51 PM

You need to put in all the header stuff for a page. You can't start a page out with the basic html stuff, you need to start with stuff like in the source code for this page:

HTML Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<title>whatever</title>
</head>
<body>

I do not get the error you are getting at all when I upload your page to my test site. I have no file called linkchecker.php called out in the file you posted either.

Html33 08-24-2008 04:56 PM

No i have

Quote:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle]</title>
</head>
<body>

$header
$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%"

align="center">
<tr>
<td class="tcat">My Custom Page Title</td>
</tr>
<tr>
<td class="alt1">

php scrip copy / pasted

</td>
</tr>
</table>

$footer
</body>
</html>

Lynne 08-24-2008 04:58 PM

Where do you have that? It's nowhere in the file you attached. You cannot call a php script in a template. You need to call the template from the php script. Look at the articles I linked to in post 3.


All times are GMT. The time now is 04:55 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02232 seconds
  • Memory Usage 1,790KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete