Πρόβλημα στην σύνδεση php με SQL

Μια περιοχή για το phpBB, την δημοφιλή δωρεάν πλατφόρμα για forums

Συντονιστές: WebDev Moderators, Super-Moderators, PHP Moderators

Απάντηση
big_boy
Δημοσιεύσεις: 2
Εγγραφή: 13 Απρ 2006 11:57

Πρόβλημα στην σύνδεση php με SQL

Δημοσίευση από big_boy » 13 Απρ 2006 12:30

gia sas exw ena proplima prospa8o na sineso Subdreamer me phpbb kai exw to exis provlima pao sto control pane tou Subdreamer Forum Integration mou leei

Select Your Forum
By selecting integration, your members will be able to use their forum usernames and passwords to login to your Subdreamer website. They will also use their forum accounts for any member authentication on your website, such as sending articles, posting in the guestbook, sending links, etc...

PHPBB2 to dialego

apo kato mou grafi

Forum Folder Path
Enter the path from your main Subdreamer folder to your Forum's folder:
Only enter the path, do not enter the full URL! Example: forum/
vazo forum/

patao save settings

kai mou grafi ta exis
Database error in Subdreamer

cannot use database bbb
Error: Access denied for user: 'gmits@localhost' to database 'bbb'
Error number: 1044
Date: Thursday 13th of April 2006 08:19:24 AM
File: http://www.tester.gr/sub/admin/forumintegration.php


pao kai katevazo apo to forumintegration.php to phpbb2.php

to opio lei ta exis

Κώδικας: Επιλογή όλων

<?php

if&#40;!defined&#40;'IN_SUBDREAMER'&#41;&#41;
  die&#40;'Hacking attempt!'&#41;;



// ################################ SKIN FORUM #################################

function SkinForum&#40;$sdheader, $sdfooter&#41;
&#123;
  global $DB, $usersystem;

  $forumprefix = $usersystem&#91;'tblprefix'&#93;;
  $forumpath   = $usersystem&#91;'folderpath'&#93;;

  $sdheader = "</head><!--StartSdHeader-->\n" . $sdheader . "\n<!--EndSdHeader-->";
  $sdfooter = "<!--StartSdFooter-->\n" . $sdfooter . "\n<!--EndSdFooter--></body>";

  // get default style for phpBB2
  $getstyleid = $DB->query_first&#40;"SELECT config_value FROM ".$forumprefix."config WHERE config_name = 'default_style'"&#41;;
  $styleid    = $getstyleid&#91;'config_value'&#93;;

  // get folder name for phpBB2 default styles
  $getstylefolder = $DB->query_first&#40;"SELECT template_name FROM ".$forumprefix."themes WHERE themes_id = '$styleid'"&#41;;
  $stylefolder    = $getstylefolder&#91;'template_name'&#93;;

  // check if files are writable
  if&#40; &#40;!is_writable&#40;'../' . $forumpath . 'templates/' . $stylefolder . '/overall_header.tpl'&#41;&#41; OR &#40;!is_writable&#40;'../' . $forumpath . 'templates/' . $stylefolder . '/overall_footer.tpl'&#41;&#41; &#41;
  &#123;
    echo '<b>Before Subdreamer can skin your phpBB2 skin, you need to chmod both these files to 766&#58;</b>
          <br /><br />' . $forumpath . 'templates/' . $stylefolder . '/overall_header.tpl
          <br />' . $forumpath . 'templates/' . $stylefolder . '/overall_footer.tpl';

    return;
  &#125;

  // open up overall_header.tpl and get contents
  $filename = '../' . $forumpath . 'templates/' . $stylefolder . '/overall_header.tpl';
  $fp = fopen&#40;$filename, "r"&#41;;
  $forumheader = fread&#40;$fp, filesize&#40;$filename&#41;&#41;;
  fclose&#40;$fp&#41;;

  // check and erase previous subdreamer header
  $forumheader = preg_replace&#40;"'<!--StartSdHeader-->&#40;.*&#41;<!--EndSdHeader-->'ms", "", $forumheader&#41;;

  // add subdreamer header
  $newheader = preg_replace&#40;"'</head>'", $sdheader, $forumheader&#41;;
  $fp = fopen&#40;$filename, 'w'&#41;;
  fwrite&#40;$fp, $newheader&#41;;
  fclose&#40;$fp&#41;;

  // open up overall_footer.tpl
  $filename = '../' . $forumpath . 'templates/' . $stylefolder . '/overall_footer.tpl';
  $fp = fopen&#40;$filename, "r"&#41;;
  $forumfooter = fread&#40;$fp, filesize&#40;$filename&#41;&#41;;
  fclose&#40;$fp&#41;;

  // check and erase previous subdreamer footer
  $forumfooter = preg_replace&#40;"'<!--StartSdFooter-->&#40;.*&#41;<!--EndSdFooter-->'ms", "", $forumfooter&#41;;

  // add subdreamer skin footer
  $newfooter = preg_replace&#40;"'</body>'", $sdfooter, $forumfooter&#41;;
  $fp = fopen&#40;$filename, 'w'&#41;;
  fwrite&#40;$fp, $newfooter&#41;;
  fclose&#40;$fp&#41;;

  // override user stle
  $DB->query&#40;"UPDATE ".$forumprefix."config SET config_value = '1' WHERE config_name = 'override_user_style'"&#41;;

&#125;



// ############################ RESTORE FORUM SKIN #############################

function RestoreForumSkin&#40;&#41;
&#123;
  global $DB, $usersystem;

  $forumprefix = $usersystem&#91;'tblprefix'&#93;;
  $forumpath   = $usersystem&#91;'folderpath'&#93;;

  // get default style for phpBB2
  $getstyleid = $DB->query_first&#40;"SELECT config_value FROM ".$forumprefix."config WHERE config_name = 'default_style'"&#41;;
  $styleid    = $getstyleid&#91;'config_value'&#93;;

  // get folder name for phpBB2 default styles
  $getstylefolder = $DB->query_first&#40;"SELECT template_name FROM ".$forumprefix."themes WHERE themes_id = '$styleid'"&#41;;
  $stylefolder    = $getstylefolder&#91;'template_name'&#93;;

  // open up overall_header.tpl and get contents
  $filename = '../' . $forumpath . 'templates/' . $stylefolder . '/overall_header.tpl';
  $fp = fopen&#40;$filename, "r"&#41;;
  $forumheader = fread&#40;$fp, filesize&#40;$filename&#41;&#41;;
  fclose&#40;$fp&#41;;

  // erase subdreamer header
  $forumheader = preg_replace&#40;"'<!--StartSdHeader-->&#40;.*&#41;<!--EndSdHeader-->'ms", "", $forumheader&#41;;

  // restore forum header
  $fp = fopen&#40;$filename, 'w'&#41;;
  fwrite&#40;$fp, $forumheader&#41;;
  fclose&#40;$fp&#41;;


  // open up overall_footer.tpl
  $filename = '../' . $forumpath . 'templates/' . $stylefolder . '/overall_footer.tpl';
  $fp = fopen&#40;$filename, "r"&#41;;
  $forumfooter = fread&#40;$fp, filesize&#40;$filename&#41;&#41;;
  fclose&#40;$fp&#41;;

  // erase subdreamer footer
  $forumfooter = preg_replace&#40;"'<!--StartSdFooter-->&#40;.*&#41;<!--EndSdFooter-->'ms", "", $forumfooter&#41;;

  // restore forum footer
  $fp = fopen&#40;$filename, 'w'&#41;;
  fwrite&#40;$fp, $forumfooter&#41;;
  fclose&#40;$fp&#41;;

&#125;



// ############################# GET FORUM SYSTEM ##############################

function GetForumSystem&#40;$forumfolderpath, $sddbname, $cookiedomain, $cookiepath&#41;
&#123;
  global $DB;

  if&#40;is_file&#40;'../' . $forumfolderpath . 'config.php'&#41;&#41;
  &#123;
    include&#40;'../' . $forumfolderpath . 'config.php'&#41;;

    // connect to forum db for cookie timeout variable, and to update the forums cookiedomain and path
    $DB->select_db&#40;$dbname&#41;;

    $cookietimeout = $DB->query_first&#40;"SELECT config_value FROM " . $table_prefix . "config WHERE config_name = 'session_length'"&#41;;
    $cookieprefix  = $DB->query_first&#40;"SELECT config_value FROM " . $table_prefix . "config WHERE config_name = 'cookie_name'"&#41;;

    $DB->query&#40;"UPDATE " . $table_prefix . "config SET config_value = '$cookiedomain' WHERE config_name = 'cookie_domain'"&#41;;
    $DB->query&#40;"UPDATE " . $table_prefix . "config SET config_value = '$cookiepath'   WHERE config_name = 'cookie_path'"&#41;;

    // switch back to subdreamer db
    $DB->select_db&#40;$sddbname&#41;;

    $forumsystem = array&#40;'name'          => 'phpBB2',
                         'dbname'        => $dbname,
                         'tblprefix'     => $table_prefix,
                         'folderpath'    => $forumfolderpath,
                         'cookietimeout' => $cookietimeout&#91;'config_value'&#93;,
                         'cookieprefix'  => $cookieprefix&#91;'config_value'&#93;,
                         'extra'         => ''&#41;;
  &#125;

  return isset&#40;$forumsystem&#41; ? $forumsystem &#58; 0;
&#125;



?>
meta anigo kai to config apo to phpbb

Κώδικας: Επιλογή όλων

<?php


// phpBB 2.x auto-generated config file
// Do not change anything in this file!

$dbms = 'mysql';

$dbhost = 'localhost';
$dbname = 'bbb';
$dbuser = 'bb';
$dbpasswd = '12345678';

$table_prefix = 'phpbb_';

define&#40;'PHPBB_INSTALLED', true&#41;;

?>
mporite na mou pite ti akrivos mprepi na allaxo sto kodika gia na sonde8oune.

eyxaristo filika big_boy
*******************

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6230
Εγγραφή: 30 Νοέμ 2004 03:09

Πρόβλημα στην σύνδεση php με SQL

Δημοσίευση από fafos » 13 Απρ 2006 18:55

Yparxei h vash bbb? an nai exei dosei ta idia stoixeia gia tous admins (username & pass) sto phpbb kai sto subdreamer?

big_boy
Δημοσιεύσεις: 2
Εγγραφή: 13 Απρ 2006 11:57

Πρόβλημα στην σύνδεση php με SQL

Δημοσίευση από big_boy » 13 Απρ 2006 22:39

dikimasa kai allaxatou kodikous genika olli tin vasi alla ta idia :( :(

Απάντηση

Επιστροφή στο “phpBB”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες