PDA

View Full Version : How i can insert a phpcode


Solar08
08-16-2008, 09:33 AM
I Create a new page like they say below :
https://vborg.vbsupport.ru/showthread.php?t=62164

but i have a phpcode and I dont know how i can do this perfectly ?

--------------- Added 1218883156 at 1218883156 ---------------

and is there any doc for the API for the Forum ?

Marco van Herwaarden
08-16-2008, 09:49 AM
1. You will need to insert your code into the file. We can not tell you where/how you should add 'a phpcode'.

2. Documentation available in our articles section and vBulletin API Documentation (http://members.vbulletin.com/api/index.html)

Solar08
08-16-2008, 10:24 AM
I already insert the code ....the code work nearly perfect but the problem I have ... is when permission is not allowed the code is OK and the style shows ... but when the permission is ok and u go through the code the phpcode I have insert it shows but the style doesnot !

Marco van Herwaarden
08-16-2008, 10:26 AM
We can not guess what script you have created and also not guess what is wrong with it.

Solar08
08-16-2008, 11:02 AM
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vbu'); // change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(

);

// get special data templates from the datastore
$specialtemplates = array(

);

// pre-cache templates used by all actions
$globaltemplates = array(
'orange',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
}

if (!is_member_of($vbulletin->userinfo, 6) AND !is_member_of($vbulletin->userinfo, 7) AND !

is_member_of($vbulletin->userinfo, 11))
{
print_no_permission();
}

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

$navbits = array();
$navbits[$parent] = 'إضافة عضو';

$navbits = construct_navbits($navbits);


require_once('Connections/connection.php');
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue =

"")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE user SET usergroupid=%s, membergroupids=%s, displaygroupid=%s,

username=%s, password=%s, passworddate=%s, email=%s, styleid=%s, parentemail=%s, homepage=%s,

icq=%s, aim=%s, yahoo=%s, msn=%s, skype=%s, showvbcode=%s, showbirthday=%s, usertitle=%s,

customtitle=%s, joindate=%s, daysprune=%s, lastvisit=%s, lastactivity=%s, lastpost=%s,

lastpostid=%s, posts=%s, reputation=%s, reputationlevelid=%s, timezoneoffset=%s, pmpopup=%s,

avatarid=%s, avatarrevision=%s, profilepicrevision=%s, sigpicrevision=%s, options=%s,

birthday=%s, birthday_search=%s, maxposts=%s, startofweek=%s, ipaddress=%s, referrerid=%s,

languageid=%s, emailstamp=%s, threadedmode=%s, autosubscribe=%s, pmtotal=%s, pmunread=%s,

salt=%s, ipoints=%s, infractions=%s, warnings=%s, infractiongroupids=%s, infractiongroupid=%

s, adminoptions=%s, profilevisits=%s, friendcount=%s, friendreqcount=%s, vmunreadcount=%s,

vmmoderatedcount=%s, socgroupinvitecount=%s, socgroupreqcount=%s, pcunreadcount=%s,

pcmoderatedcount=%s, gmmoderatedcount=%s WHERE userid=%s",
GetSQLValueString($_POST['usergroupid'], "int"),
GetSQLValueString($_POST['membergroupids'], "text"),
GetSQLValueString($_POST['displaygroupid'], "int"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['passworddate'], "date"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['styleid'], "int"),
GetSQLValueString($_POST['parentemail'], "text"),
GetSQLValueString($_POST['homepage'], "text"),
GetSQLValueString($_POST['icq'], "text"),
GetSQLValueString($_POST['aim'], "text"),
GetSQLValueString($_POST['yahoo'], "text"),
GetSQLValueString($_POST['msn'], "text"),
GetSQLValueString($_POST['skype'], "text"),
GetSQLValueString($_POST['showvbcode'], "int"),
GetSQLValueString($_POST['showbirthday'], "int"),
GetSQLValueString($_POST['usertitle'], "text"),
GetSQLValueString($_POST['customtitle'], "int"),
GetSQLValueString($_POST['joindate'], "int"),
GetSQLValueString($_POST['daysprune'], "int"),
GetSQLValueString($_POST['lastvisit'], "int"),
GetSQLValueString($_POST['lastactivity'], "int"),
GetSQLValueString($_POST['lastpost'], "int"),
GetSQLValueString($_POST['lastpostid'], "int"),
GetSQLValueString($_POST['posts'], "int"),
GetSQLValueString($_POST['reputation'], "int"),
GetSQLValueString($_POST['reputationlevelid'], "int"),
GetSQLValueString($_POST['timezoneoffset'], "text"),
GetSQLValueString($_POST['pmpopup'], "int"),
GetSQLValueString($_POST['avatarid'], "int"),
GetSQLValueString($_POST['avatarrevision'], "int"),
GetSQLValueString($_POST['profilepicrevision'], "int"),
GetSQLValueString($_POST['sigpicrevision'], "int"),
GetSQLValueString($_POST['options'], "int"),
GetSQLValueString($_POST['birthday'], "text"),
GetSQLValueString($_POST['birthday_search'], "date"),
GetSQLValueString($_POST['maxposts'], "int"),
GetSQLValueString($_POST['startofweek'], "int"),
GetSQLValueString($_POST['ipaddress'], "text"),
GetSQLValueString($_POST['referrerid'], "int"),
GetSQLValueString($_POST['languageid'], "int"),
GetSQLValueString($_POST['emailstamp'], "int"),
GetSQLValueString($_POST['threadedmode'], "int"),
GetSQLValueString($_POST['autosubscribe'], "int"),
GetSQLValueString($_POST['pmtotal'], "int"),
GetSQLValueString($_POST['pmunread'], "int"),
GetSQLValueString($_POST['salt'], "text"),
GetSQLValueString($_POST['ipoints'], "int"),
GetSQLValueString($_POST['infractions'], "int"),
GetSQLValueString($_POST['warnings'], "int"),
GetSQLValueString($_POST['infractiongroupids'], "text"),
GetSQLValueString($_POST['infractiongroupid'], "int"),
GetSQLValueString($_POST['adminoptions'], "int"),
GetSQLValueString($_POST['profilevisits'], "int"),
GetSQLValueString($_POST['friendcount'], "int"),
GetSQLValueString($_POST['friendreqcount'], "int"),
GetSQLValueString($_POST['vmunreadcount'], "int"),
GetSQLValueString($_POST['vmmoderatedcount'], "int"),
GetSQLValueString($_POST['socgroupinvitecount'], "int"),
GetSQLValueString($_POST['socgroupreqcount'], "int"),
GetSQLValueString($_POST['pcunreadcount'], "int"),
GetSQLValueString($_POST['pcmoderatedcount'], "int"),
GetSQLValueString($_POST['gmmoderatedcount'], "int"),
GetSQLValueString($_POST['userid'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());

$updateGoTo = "vbu2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE user SET usergroupid=%s WHERE userid=%s",
GetSQLValueString($_POST['usergroupid'], "int"),
GetSQLValueString($_POST['userid'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_connection, $connection);
$query_Recordset1 = "SELECT * FROM `user` where usergroupid = 4";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1,

$maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $connection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<body>
<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>
<p align="center"><strong>لايوجد

أعضاء في قائمة

الإنتظار </strong></p>
<?php } // Show if recordset empty ?>
<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>

<p></p>
<form method="post" name="form2" action="<?php echo $editFormAction; ?>">
<input type="hidden" name="MM_update" value="form2">
<input type="hidden" name="userid" value="<?php echo $row_Recordset1['userid']; ?>">
<table border="1">
<tr>
<td>userid</td>
<td>usergroupid</td>
<td>username</td>
<td>email</td>
<td>parentemail</td>
<td>homepage</td>
<td>skype</td>
<td>usertitle</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['userid']; ?></td>
<td><label>
<select name="usergroupid">
<option value="4" <?php if (!(strcmp(4, $row_Recordset1['usergroupid']))) {echo

"SELECTED";} ?>>في الإنتظار</option>
<option value="2" <?php if (!(strcmp(2, $row_Recordset1['usergroupid']))) {echo

"SELECTED";} ?>>تسجيل العضو</option>
</select>
</label></td>
<td><?php echo $row_Recordset1['username']; ?></td>
<td><?php echo $row_Recordset1['email']; ?></td>
<td><?php echo $row_Recordset1['parentemail']; ?></td>
<td><?php echo $row_Recordset1['homepage']; ?></td>
<td><?php echo $row_Recordset1['skype']; ?></td>
<td><?php echo $row_Recordset1['usertitle']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<input name="submit" type="submit" value="OK do it" />
</form>

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<p class="style1">programming by Sndan</p>
</form>
<?php } // Show if recordset not empty ?></body>
</html>
<?php
mysql_free_result($Recordset1);

?>
this is my phpcode... the file

Dismounted
08-16-2008, 11:38 AM
Can you explain your problem more clearly?

Solar08
08-16-2008, 12:51 PM
...
the problem is .. the style dosent show this is the problem as simple as i can say
-------
my code is perfectly run but without style

Lynne
08-16-2008, 03:09 PM
What does your template look like?

Solar08
08-16-2008, 04:36 PM
what u mean ?

Lynne
08-16-2008, 05:13 PM
Aren't you using a template called 'orange' to spit out the page?

MoT3rror
08-17-2008, 10:50 PM
Aren't you using a template called 'orange' to spit out the page?

He isn't using templates that is why. If you want to use a template like the rest of forums you can either make a template with this code or make your php page output like this.


$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<!-- end no cache headers -->
$headinclude
<title>title of the page</title>
</head>
<body>
$header
$navbar

your code

$footer
</body>
</html>

Also if you are just getting a blank page, you are probably getting a php error. Use this code at the top to get this error or check your error log.

ini_set("display_errors", 2);