- Adres van je forum:http://radiosoundfm.atbhost.net/phpBB3/
Event. modificaties op je forum: geen
Wanneer ontstond het probleem? aan het scripten
phpBB versie: 3.0.4
Heb je onlangs iets veranderd aan je forum?nieuwe installatie
Wat is het probleem?
Nu wil ik een tabel maken.
De waarden komen uit een database.
Het lukt mij al wel om 1 regel te plaatsen middels het script.
Code: Selecteer alles
<?php
/********************************************************
*
* Author: Steve Kunitzer (FesterHead)
* ID: $Id: $
*
********************************************************
*
* Copyright Steve Kunitzer (FesterHead)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************
*
* FesterHead's phpBB3 automated topic posting secret sauce
*
********************************************************
*
* History:
* [2008-03-24] : Initial version
*
********************************************************/
// START OF CONFIGURATION
// YOUR WEB HOST PATH TO HTML FILE THAT SAM GENERATES AND
// UPLOADS ON EVERY SONG CHANGE.
DEFINE(htmlfile, '/XXX/public_html/twitter.html');
$phpbb_root_path = "/XXX/public_html/phpBB3/";
$restrict_posting = true;
$ip_that_can_post = "XX.171.11.XXX";
$header_redirect = "Location: http://<url to redirect IP failures goes here>/";
$botID = XXXBOT;
$forumID = X;
$postSubject = "Just Played";
// $postMessage = "Have to import from file[br]nieuwe regel[/br] or import directly from database";
// END OF CONFIGURATION
/************************************************
* EDITS BELOW THIS LINE ARE AT YOUR OWN RISK *
************************************************/
$da="";
$f=@fopen(htmlfile, "r");
if ($f!=0)
{
$da=@fread($f, 4096);
fclose($f);
}
else
{
echo ("Unable to locate and/or open the html file containing your SAM song data.");
exit;
}
$da=str_replace("\r", "\n", $da);
$da=str_replace("\n\n", "\n", $da);
$d=explode("\n", $da);
$d[0]=trim($d[0], "|"); // title
$d[1]=trim($d[1], "|"); // artist
$d[2]=trim($d[2], "|"); //songID
//====================================================
if ($d[0]=="" || $d[1]=="")
{
// IF WE COULD NOT GRAB THE ARTIST AND
// SONG TITLE FROM THE SAM-GENERATED HTML FILE,
// WE'LL BAIL OUT NOW WITHOUT SUBMITTING ANY TEXT
// TO TWITTER.
exit;
}
else
{
// SUCCESS IN GETTING ARTIST AND TITLE!
// WE'LL PROCEED WITH BUILDING A TEXT STRING TO SUBMIT TO TWITTER.
$postMessage = '[code]Now Playing: ' . strtoupper($d[1]) . ' - ' . strtoupper($d[0]).'
}
//====================================================
// $postMessage = urlencode("<html><table border='0' width='98%' cellspacing='0' cellpadding='4'>HALLO</table></html>");
//=====================================================
// Do we restrict posting and if so where to redirect if IP check fails
if ($restrict_posting && ($_SERVER['REMOTE_ADDR'] != $ip_that_can_post))
{
// redirect
header($header_redirect);
exit();
}
// phpBB hook
define( 'IN_PHPBB', true );
$phpEx = substr( strrchr( __FILE__, '.' ), 1 );
include( $phpbb_root_path . 'common.' . $phpEx );
// Start phpBB3 session management
$user->session_begin( );
$auth->acl( $user->data );
$user->setup( 'viewforum' );
// Include phpBB3 posting functions
require($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
// begin secret sauce
$user->session_create($botID, true, true, false);
$auth->acl($user->data);
// Extra variables
$the_bbcode_uid = '';
$the_bbcode_bitfield = '';
$the_options = '';
$the_poll = '';
// Normalize the post subject and message
$the_subject = utf8_normalize_nfc($postSubject);
// $the_message = utf8_normalize_nfc($postMessage);
$the_message = $postMessage;
// generate a phpBB3 compatible version to store the post subject and message
generate_text_for_storage($the_subject, $the_bbcode_uid, $the_bbcode_bitfield, $the_options, false, false, false);
generate_text_for_storage($the_message, $the_bbcode_uid, $the_bbcode_bitfield, $the_options, true, true, true);
$the_post_data = array(
'forum_id' => $forumID,
'icon_id' => false,
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => true,
'message' => $the_message,
'message_md5' => md5($the_message),
'bbcode_bitfield' => $the_bbcode_bitfield,
'bbcode_uid' => $the_bbcode_uid,
'post_edit_locked' => 0,
'topic_approved' => 0,
'post_approved' => 0,
'topic_title' => $the_subject,
'notify_set' => false,
'notify' => false,
'post_time' => 0,
'forum_name' => '',
'enable_indexing' => true,
);
submit_post('post', $the_subject, '', POST_NORMAL, $the_poll, $the_post_data);
?>
[/code]
Stukje waarin de html file wordt uitgelezen en klaar wordt gemaakt wil ik vervangen voor:
A. of een directe injectie vanuit de sql database
B. of een tekstfile uitlezen en die injecteren.
Hoe kan ik nu in BB een tabel maken (wat zijn de stuurcodes, zoals in html table)
Groet
Piet