Re: problem with include.
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sun, 06 Jan 2008 16:20:15 -0500
SoulIntruder wrote:
I don't see anything going on, which leads me to believe its workingThanks I did, what you said and still nothing. Let me tell you the
fine. Add error_reporting(E_ALL | E_STRICT) inside common and run a
function inside the IF block that was icluded in common.
long story, instead of the short one;)
I've installed phpBB3 forum on my webserwer. I wanted to generate
posts automatically by running PHP script.
Here is the full script:
<?php
$User = $_POST['User'];
$Password = $_POST['Password'];
$Database = $_POST['Database'];
if (isset($User, $Password, $Database))
{
$link = mysql_connect('localhost', $User, $Password) or
die('Problems with connection occured: ' . mysql_error());
$db_selected = mysql_select_db($Database, $link);
if (!$db_selected)
{
mysql_close($link);
die( "Unable to select database");
}
$Result = mysql_query("SELECT topic_id FROM phpbb_topics,
phpbb_forums
WHERE topic_title = 'test tematu' AND phpbb_topics.forum_id =
phpbb_forums.forum_id
AND phpbb_forums.forum_name = 'PGIHASPFunctions' ");
if (!$Result) { print mysql_error() . "\n"; }
else {
if (mysql_num_rows($Result) > 1)
{
die("More than one record found, cannot update.\n");
}
elseif (mysql_num_rows($Result) == 1)
{
echo "Updating existing topic...\n";
}
else {
echo "Creating new topic...\n";
$Date = time() + 3600; //GMT + 1
$Result = mysql_query("SELECT forum_id FROM phpbb_forums WHERE
forum_name = 'PGIHASPFunctions' ");
if (!$Result) {
mysql_close($link);
die('Problems with finding forum.' . mysql_error() . "\n");
}
$ForumRow = mysql_fetch_array($Result);
$Forum_Id = $ForumRow['forum_id'];
// Create a topic
$TopicInsertQuery = "INSERT INTO phpbb_topics
( forum_id, icon_id, topic_attachment, topic_approved,
topic_reported, topic_title, topic_poster,
topic_time, topic_time_limit, topic_views, topic_replies,
topic_replies_real, topic_status,
topic_type, topic_first_post_id, topic_first_poster_name,
topic_first_poster_colour,
topic_last_post_id, topic_last_poster_id, topic_last_poster_name,
topic_last_poster_colour,
topic_last_post_subject, topic_last_post_time,
topic_last_view_time, topic_moved_id,
topic_bumped, topic_bumper, poll_title, poll_start, poll_length,
poll_max_options,
poll_last_vote, poll_vote_change)
VALUES ('$Forum_Id', '0', '0', '1', '0', 'test tematu', '2',
'$Date', '0', '0', '0', '0', '0', '0',
'0', 'Wodzu', 'AA0000', '0', '2', 'Wodzu', 'AA0000', '',
'$Date', '$Date', '0', '0', '0', '',
'0', '0', '1', '0', '0')";
$Result = mysql_query($TopicInsertQuery);
if (!$Result) {
mysql_close($link);
die('Problems with creating topic.' . mysql_error() . "\n");
}
$TopicSelectQuery = "SELECT topic_id FROM phpbb_topics WHERE
forum_id = '$Forum_Id' AND topic_time = '$Date'";
$Result = mysql_query($TopicSelectQuery);
if (!$Result) {
mysql_close($link);
die('Problems with finding newly inserted topic_id!.' .
mysql_error() . "\n");
}
$uid = $bitfield = $options = '';
$text = utf8_normalize_nfc(request_var('cos tutaj sobie napisalem',
'', true));
$text = generate_text_for_storage($text, $uid, $bitfield, $options,
true, true, true);
}
}
mysql_close($link);
}
else {
echo 'One or more of the connection parameters has not been set
up.';
}
?>
Everyting went fine until function :utf8_normalize_nfc.
I've received such error:
"Fatal error: Call to undefined function: utf8_normalize_nfc()"
So I was browsing internet and find out that I had to include
common.php file.
Unfortunately I can't define include_path, my webserver provider
doesn't allow that.
So I've copied my script into the folder where common.php exists.
I've included it at the top of the file and from now on I got silence
as a respone from server.
And nothing after include "common.php" doesn't execute.
Ah - new and very critical information.
You can't just include common.php and expect it to work. It depends on the PHPBB3 environment being set up correctly. And, in fact, it has tests to ensure that is the case.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- problem with include.
- From: SoulIntruder
- Re: problem with include.
- From: Jonas Werres
- Re: problem with include.
- From: jonKushner@xxxxxxxxx
- Re: problem with include.
- From: SoulIntruder
- problem with include.
- Prev by Date: Re: problem with include.
- Next by Date: Re: Eclipse PDT and EasyEclipse for PHP
- Previous by thread: Re: problem with include.
- Next by thread: Re: problem with include.
- Index(es):
Relevant Pages
|