deadlySniper
09-17-2012, 06:03 PM
I have made my own vbulletin powered page (link) and it only allows certain usergroups to access it. Basically the page is used to submit data to a database that is on another server. I have made a couple of php scripts that do all of this but every time I submit it, it gives syntax errors. Now if I move everything into its own directory and use them as normal php files, they work fine. So I dont know what I am doing wrong with vbulletin part.
The data.php contains the connection to the database.
vbulletin page
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">
<vb:if condition="$show['guest']">
<span style="color:red; font-weight:bold;">You are a guest and not part of Admin Team</span>
<vb:elseif condition="is_member_of($bbuserinfo, 6,7)" />
<form name="whitelist" method="post" action="http://survivedayz.com/whitelist/connection.php">
<p><label>GUID</label><br />
<input type="text" name="guid" /></p>
<p><label>In-game Name</label><br />
<input type="text" name="name" /></p>
<input type="submit" name="submit" value="Submit" />
<INPUT TYPE="button" VALUE="Write New Whitelist" ONCLICK="window.location.href='http://survivedayz.com/whitelist/writewhitelist.php'"">
</form>
<vb:else />
<span style="color:red; font-weight:bold;">You must be part of the Admin Team to view this page</span>
</vb:if>
</div>
</div>
{vb:raw footer}
</body>
</html>
connection.php
<?php
include('data.php');
$name = $_POST['name'];
$guid = $_POST['guid'];
//Database Connection
$con=@mysql_connect("$ip", "$user", "$pass")
or die(mysql_error());
//Select Database
$dbcon=@mysql_select_db($db, $con)
or die(mysql_error());
//Query Data Into Whitelist Table
$sql="INSERT INTO $table (name, guid) VALUES ('$name', '$guid')";
//Submit Data into Whitelist Table
$result=@mysql_query($sql, $con) or die(mysql_error());
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>White List Updated</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
redirTime = "3000";
redirURL = "http://survivedayz.com/forums/whitelist.php";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
// End -->
</script>
<style type="text/css">
#space {
padding-left: 20px;
padding-right: 20px;
}
#guid {
color:#FF0000;
font-weight:bold;
}
#name {
color:#00FF00;
font-weight:bold;
body {
background:#000;
}
</style>
</head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<body>
<table>
<td id="guid">
GUID: <? echo "$guid"; ?>
</td>
<div id="space">-</div>
<td id="name">
Username: <? echo "$name"; ?>
</td>
</tr>
</table>
</body>
</html>
writewhitelist.php
<?php
include('data.php');
//Database Connection
$con=@mysql_connect("$ip", "$user", "$pass")
or die(mysql_error());
//Select Database
$dbcon=@mysql_select_db($db, $con)
or die(mysql_error());
$sql="SELECT guid, comments FROM $table ORDER BY id INTO OUTFILE 'whitelist.txt' LINES TERMINATED BY '\n'";
$result=@mysql_query($sql, $con) or die(mysql_error());
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>White List Updated</title>
<style type="text/css">
#space {
padding-left: 20px;
padding-right: 20px;
}
#guid {
color:#FF0000;
font-weight:bold;
}
#name {
color:#00FF00;
font-weight:bold;
body {
background:#000;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
redirTime = "3000";
redirURL = "http://survivedayz.com/forums/whitelist.php";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
// End -->
</script>
</head>
<body onLoad="redirTimer()">
<p id="guid">File Has Been Written</p>
</body>
</html>
The data.php contains the connection to the database.
vbulletin page
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">
<vb:if condition="$show['guest']">
<span style="color:red; font-weight:bold;">You are a guest and not part of Admin Team</span>
<vb:elseif condition="is_member_of($bbuserinfo, 6,7)" />
<form name="whitelist" method="post" action="http://survivedayz.com/whitelist/connection.php">
<p><label>GUID</label><br />
<input type="text" name="guid" /></p>
<p><label>In-game Name</label><br />
<input type="text" name="name" /></p>
<input type="submit" name="submit" value="Submit" />
<INPUT TYPE="button" VALUE="Write New Whitelist" ONCLICK="window.location.href='http://survivedayz.com/whitelist/writewhitelist.php'"">
</form>
<vb:else />
<span style="color:red; font-weight:bold;">You must be part of the Admin Team to view this page</span>
</vb:if>
</div>
</div>
{vb:raw footer}
</body>
</html>
connection.php
<?php
include('data.php');
$name = $_POST['name'];
$guid = $_POST['guid'];
//Database Connection
$con=@mysql_connect("$ip", "$user", "$pass")
or die(mysql_error());
//Select Database
$dbcon=@mysql_select_db($db, $con)
or die(mysql_error());
//Query Data Into Whitelist Table
$sql="INSERT INTO $table (name, guid) VALUES ('$name', '$guid')";
//Submit Data into Whitelist Table
$result=@mysql_query($sql, $con) or die(mysql_error());
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>White List Updated</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
redirTime = "3000";
redirURL = "http://survivedayz.com/forums/whitelist.php";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
// End -->
</script>
<style type="text/css">
#space {
padding-left: 20px;
padding-right: 20px;
}
#guid {
color:#FF0000;
font-weight:bold;
}
#name {
color:#00FF00;
font-weight:bold;
body {
background:#000;
}
</style>
</head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<body>
<table>
<td id="guid">
GUID: <? echo "$guid"; ?>
</td>
<div id="space">-</div>
<td id="name">
Username: <? echo "$name"; ?>
</td>
</tr>
</table>
</body>
</html>
writewhitelist.php
<?php
include('data.php');
//Database Connection
$con=@mysql_connect("$ip", "$user", "$pass")
or die(mysql_error());
//Select Database
$dbcon=@mysql_select_db($db, $con)
or die(mysql_error());
$sql="SELECT guid, comments FROM $table ORDER BY id INTO OUTFILE 'whitelist.txt' LINES TERMINATED BY '\n'";
$result=@mysql_query($sql, $con) or die(mysql_error());
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>White List Updated</title>
<style type="text/css">
#space {
padding-left: 20px;
padding-right: 20px;
}
#guid {
color:#FF0000;
font-weight:bold;
}
#name {
color:#00FF00;
font-weight:bold;
body {
background:#000;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
redirTime = "3000";
redirURL = "http://survivedayz.com/forums/whitelist.php";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
// End -->
</script>
</head>
<body onLoad="redirTimer()">
<p id="guid">File Has Been Written</p>
</body>
</html>