Jump to content

iyeru42

Members
  • Content Count

    231
  • Joined

  • Last visited

Everything posted by iyeru42

  1. The bridge is now fixed... mybb had to change its cookie path to get sessons right.
  2. I need help with correcting the following MyBB 1.4.1 partial Bridge... <?php/************************* Coppermine Photo Gallery ************************ Copyright © 2003-2008 Dev Team v1.1 originally written by Gregory DEMAR This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. ******************************************** Coppermine version: 1.4.19 $HeadURL: [url="https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/bridge/mybb.inc.php"]https://coppermine.svn.sourceforge.net/svnr...ge/mybb.inc.php[/url] $ $Revision: 4392 $ $Author: gaugau $ $Date: 2008-04-16 09:25:35 +0200 (Mi, 16 Apr 2008) $**********************************************/if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');// Switch that allows overriding the bridge manager with hard-coded valuesdefine('USE_BRIDGEMGR', 1);require_once 'bridge/udb_base.inc.php';class cpg_udb extends core_udb { function cpg_udb() { global $BRIDGE; if (!USE_BRIDGEMGR) { // the vars that are used when bridgemgr is disabled // URL of your punbb $this->boardurl = 'http://localhost/mybb'; // local path to your punbb config file require_once('../mybb/inc/config.php'); $this->use_post_based_groups = 1; } else { // the vars from the bridgemgr $this->boardurl = $BRIDGE['full_forum_url']; require_once($BRIDGE['relative_path_to_config_file'] . 'config.php'); $this->use_post_based_groups = $BRIDGE['use_post_based_groups']; } $this->multigroups = 0; $this->group_overrride = 0; // Database connection settings $this->db = array( 'name' => $config['database']['database'], 'host' => $config['database']['hostname'], 'user' => $config['database']['username'], 'password' => $config['database']['password'], 'prefix' =>$config['database']['table_prefix'] ); // Board table names $this->table = array( 'users' => 'users', 'groups' => 'usergroups', 'sessions' => 'sessions', ); // Derived full table names $this->usertable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['users']; $this->groupstable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['groups']; $this->sessionstable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['sessions']; // Table field names $this->field = array( 'username' => 'username', // name of 'username' field in users table 'user_id' => 'uid', // name of 'id' field in users table 'password' => 'loginkey', // name of 'password' field in users table 'email' => 'email', // name of 'email' field in users table 'regdate' => 'regdate', // name of 'registered' field in users table 'location' => "''", // name of 'location' field in users table 'website' => 'website', // name of 'website' field in users table 'usertbl_group_id' => 'usergroup', // name of 'group id' field in users table 'grouptbl_group_id' => 'gid', // name of 'group id' field in groups table 'grouptbl_group_name' => 'title' // name of 'group name' field in groups table ); // Pages to redirect to $this->page = array( 'register' => '/member.php?action=register', 'editusers' => '/memberlist.php', 'edituserprofile' => "/member.php?action=profile&uid=" ); // Group ids $this->admingroups = array(4); $this->guestgroup = $this->use_post_based_groups ? 101 : 3; // Connect to db $this->connect(); } // definition of how to extract id, name, group from a session cookie function session_extraction() { if (!isset($_COOKIE['sid'])) return false; $this->sid = addslashes($_COOKIE['sid']); if (!$this->sid) return false; $this->ipaddress = $this->getip(); $result = cpg_db_query("SELECT u.{$this->field['user_id']}, u.{$this->field['password']} FROM {$this->sessionstable} AS s INNER JOIN {$this->usertable} AS u ON u.uid = s.uid WHERE sid='".$this->sid."' AND ip='".$this->ipaddress."'", $this->link_id); if (!mysql_num_rows($result)) return false; $row = mysql_fetch_row($result); return $row; } // definition of how to extract an id and password hash from a cookie function cookie_extraction() { return isset($_COOKIE['mybbuser']) ? array_map('addslashes', explode("_", $_COOKIE['mybbuser'], 2)) : false; } // imported function function getip() { if($_SERVER['HTTP_X_FORWARDED_FOR']) { if(preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses)) { while(list($key, $val) = each($addresses[0])) { if(!preg_match("#^(10|172\.16|192\.168)\.#", $val)) { $ip = $val; break; } } } } if(!$ip) { if($_SERVER['HTTP_CLIENT_IP']) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } } return $ip; } // definition of actions required to convert a password from user database form to cookie form function udb_hash_db($password) { return $password; } // Login function login_page() { $this->redirect('/member.php?action=login'); } // Logout function logout_page() { $this->redirect('/member.php?action=logout&uid=' . USER_ID . '&sid=' . $this->sid); } function view_users() { if (!$this->use_post_based_groups) $this->redirect($this->page['editusers']); } function get_users($options = array()) { } function view_profile($uid) { }}// and go !$cpg_udb = new cpg_udb;?> to work with the new MyBB 1.4.1 Config.php... <?php/** * Database configuration * * Please see the MyBB Wiki for advanced * database configuration for larger installations * [url="http://wiki.mybboard.net/"]http://wiki.mybboard.net/[/url] */$config['database']['type'] = 'mysqli';$config['database']['database'] = '';$config['database']['table_prefix'] = 'mybb_';$config['database']['hostname'] = 'localhost';$config['database']['username'] = '';$config['database']['password'] = '';/** * Admin CP directory * For security reasons, it is recommended you * rename your Admin CP directory. You then need * to adjust the value below to point to the * new directory. */$config['admin_dir'] = 'admin';/** * Hide all Admin CP links * If you wish to hide all Admin CP links * on the front end of the board after * renaming your Admin CP directory, set this * to 1. */$config['hide_admin_links'] = 0;/** * Data-cache configuration * The data cache is a temporary cache * of the most commonly accessed data in MyBB. * By default, the database is used to store this data. * * If you wish to use the file system (cache/ directory), MemCache or eAccelerator * you can change the value below to 'files', 'memcache' or 'eaccelerator' from 'db'. */$config['cache_store'] = 'db';/** * Memcache configuration * If you are using memcache as your data-cache, * you need to configure the hostname and port * of your memcache server below. * * If not using memcache, ignore this section. */$config['memcache_host'] = 'localhost';$config['memcache_port'] = 11211;/** * Super Administrators * A comma separated list of user IDs who cannot * be edited, deleted or banned in the Admin CP. * The administrator permissions for these users * cannot be altered either. */$config['super_admins'] = '1';/** * Database Encoding * If you wish to set an encoding for MyBB uncomment * the line below (if it isn't already) and change * the current value to the mysql charset: * [url="http://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html"]http://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html[/url] */$config['database']['encoding'] = 'utf8';/** * Automatic Log Pruning * The MyBB task system can automatically prune * various log files created by MyBB. * To enable this functionality for the logs below, set the * the number of days before each log should be pruned. * If you set the value to 0, the logs will not be pruned. */$config['log_pruning'] = array( 'admin_logs' => 365, // Administrator logs 'mod_logs' => 365, // Moderator logs 'task_logs' => 30, // Scheduled task logs 'mail_logs' => 180, // Mail error logs 'user_mail_logs' => 180, // User mail logs 'promotion_logs' => 180 // Promotion logs); ?> Also note, that a simple edit of the database config (in array $this->db) won't be the only thing that needs fixing. I cannot be logged in with my forum information for some reason. (You can also see the bad things that ensued from it.)Table structure of the mybb 1.4 if needed: CREATE TABLE IF NOT EXISTS `mybb_usergroups` ( `gid` smallint(5) unsigned NOT NULL auto_increment, `type` smallint(2) NOT NULL default '2', `title` varchar(120) NOT NULL default '', `description` text NOT NULL, `namestyle` varchar(200) NOT NULL default '{username}', `usertitle` varchar(120) NOT NULL default '', `stars` smallint(4) NOT NULL default '0', `starimage` varchar(120) NOT NULL default '', `image` varchar(120) NOT NULL default '', `disporder` smallint(6) unsigned NOT NULL, `isbannedgroup` int(1) NOT NULL default '0', `canview` int(1) NOT NULL default '0', `canviewthreads` int(1) NOT NULL default '0', `canviewprofiles` int(1) NOT NULL default '0', `candlattachments` int(1) NOT NULL default '0', `canpostthreads` int(1) NOT NULL default '0', `canpostreplys` int(1) NOT NULL default '0', `canpostattachments` int(1) NOT NULL default '0', `canratethreads` int(1) NOT NULL default '0', `caneditposts` int(1) NOT NULL default '0', `candeleteposts` int(1) NOT NULL default '0', `candeletethreads` int(1) NOT NULL default '0', `caneditattachments` int(1) NOT NULL default '0', `canpostpolls` int(1) NOT NULL default '0', `canvotepolls` int(1) NOT NULL default '0', `canusepms` int(1) NOT NULL default '0', `cansendpms` int(1) NOT NULL default '0', `cantrackpms` int(1) NOT NULL default '0', `candenypmreceipts` int(1) NOT NULL default '0', `pmquota` int(3) NOT NULL default '0', `maxpmrecipients` int(4) NOT NULL default '5', `cansendemail` int(1) NOT NULL default '0', `maxemails` int(3) NOT NULL default '5', `canviewmemberlist` int(1) NOT NULL default '0', `canviewcalendar` int(1) NOT NULL default '0', `canaddevents` int(1) NOT NULL default '0', `canbypasseventmod` int(1) NOT NULL default '0', `canmoderateevents` int(1) NOT NULL default '0', `canviewonline` int(1) NOT NULL default '0', `canviewwolinvis` int(1) NOT NULL default '0', `canviewonlineips` int(1) NOT NULL default '0', `cancp` int(1) NOT NULL default '0', `issupermod` int(1) NOT NULL default '0', `cansearch` int(1) NOT NULL default '0', `canusercp` int(1) NOT NULL default '0', `canuploadavatars` int(1) NOT NULL default '0', `canratemembers` int(1) NOT NULL default '0', `canchangename` int(1) NOT NULL default '0', `showforumteam` int(1) NOT NULL default '0', `usereputationsystem` int(1) NOT NULL default '0', `cangivereputations` int(1) NOT NULL default '0', `reputationpower` bigint(30) NOT NULL default '0', `maxreputationsday` bigint(30) NOT NULL default '0', `candisplaygroup` int(1) NOT NULL default '0', `attachquota` bigint(30) NOT NULL default '0', `cancustomtitle` int(1) NOT NULL default '0', `canwarnusers` int(1) NOT NULL default '0', `canreceivewarnings` int(1) NOT NULL default '0', `maxwarningsday` int(3) NOT NULL default '3', `canmodcp` int(1) NOT NULL default '0', PRIMARY KEY (`gid`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8;CREATE TABLE IF NOT EXISTS `mybb_users` ( `uid` int(10) unsigned NOT NULL auto_increment, `username` varchar(120) NOT NULL default '', `password` varchar(120) NOT NULL default '', `salt` varchar(10) NOT NULL default '', `loginkey` varchar(50) NOT NULL default '', `email` varchar(220) NOT NULL default '', `postnum` int(10) NOT NULL default '0', `avatar` varchar(200) NOT NULL default '', `avatardimensions` varchar(10) NOT NULL default '', `avatartype` varchar(10) NOT NULL default '0', `usergroup` smallint(5) unsigned NOT NULL default '0', `additionalgroups` varchar(200) NOT NULL default '', `displaygroup` smallint(5) unsigned NOT NULL default '0', `usertitle` varchar(250) NOT NULL default '', `regdate` bigint(30) NOT NULL default '0', `lastactive` bigint(30) NOT NULL default '0', `lastvisit` bigint(30) NOT NULL default '0', `lastpost` bigint(30) NOT NULL default '0', `website` varchar(200) NOT NULL default '', `icq` varchar(10) NOT NULL default '', `aim` varchar(50) NOT NULL default '', `yahoo` varchar(50) NOT NULL default '', `msn` varchar(75) NOT NULL default '', `birthday` varchar(15) NOT NULL default '', `birthdayprivacy` varchar(4) NOT NULL default 'all', `signature` text NOT NULL, `allownotices` int(1) NOT NULL default '0', `hideemail` int(1) NOT NULL default '0', `subscriptionmethod` int(1) NOT NULL default '0', `invisible` int(1) NOT NULL default '0', `receivepms` int(1) NOT NULL default '0', `pmnotice` int(1) NOT NULL default '0', `pmnotify` int(1) NOT NULL default '0', `remember` int(1) NOT NULL default '0', `threadmode` varchar(8) NOT NULL default '', `showsigs` int(1) NOT NULL default '0', `showavatars` int(1) NOT NULL default '0', `showquickreply` int(1) NOT NULL default '0', `showredirect` int(1) NOT NULL default '0', `ppp` smallint(6) NOT NULL default '0', `tpp` smallint(6) NOT NULL default '0', `daysprune` smallint(6) NOT NULL default '0', `dateformat` varchar(4) NOT NULL default '', `timeformat` varchar(4) NOT NULL default '', `timezone` varchar(4) NOT NULL default '', `dst` int(1) NOT NULL default '0', `dstcorrection` int(1) NOT NULL default '0', `buddylist` text NOT NULL, `ignorelist` text NOT NULL, `style` smallint(5) unsigned NOT NULL default '0', `away` int(1) NOT NULL default '0', `awaydate` int(10) unsigned NOT NULL default '0', `returndate` varchar(15) NOT NULL default '', `awayreason` varchar(200) NOT NULL default '', `pmfolders` text NOT NULL, `notepad` text NOT NULL, `referrer` int(10) unsigned NOT NULL default '0', `reputation` bigint(30) NOT NULL default '0', `regip` varchar(50) NOT NULL default '', `lastip` varchar(50) NOT NULL default '', `longregip` int(10) NOT NULL default '0', `longlastip` int(10) NOT NULL default '0', `language` varchar(50) NOT NULL default '', `timeonline` bigint(30) NOT NULL default '0', `showcodebuttons` int(1) NOT NULL default '1', `totalpms` int(10) NOT NULL default '0', `unreadpms` int(10) NOT NULL default '0', `warningpoints` int(3) NOT NULL default '0', `moderateposts` int(1) NOT NULL default '0', `moderationtime` bigint(30) NOT NULL default '0', `suspendposting` int(1) NOT NULL default '0', `suspensiontime` bigint(30) NOT NULL default '0', `coppauser` int(1) NOT NULL default '0', `classicpostbit` int(1) NOT NULL default '0', PRIMARY KEY (`uid`), UNIQUE KEY `username` (`username`), KEY `usergroup` (`usergroup`), KEY `birthday` (`birthday`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2;CREATE TABLE IF NOT EXISTS `mybb_sessions` ( `sid` varchar(32) NOT NULL default '', `uid` int(10) unsigned NOT NULL default '0', `ip` varchar(40) NOT NULL default '', `time` bigint(30) NOT NULL default '0', `location` varchar(150) NOT NULL default '', `useragent` varchar(100) NOT NULL default '', `anonymous` int(1) NOT NULL default '0', `nopermission` int(1) NOT NULL default '0', `location1` int(10) NOT NULL default '0', `location2` int(10) NOT NULL default '0', `loginattempts` tinyint(2) NOT NULL default '1', `failedlogin` bigint(30) NOT NULL default '0', PRIMARY KEY (`sid`), KEY `location1` (`location1`), KEY `location2` (`location2`), KEY `time` (`time`), KEY `uid` (`uid`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  3. Thanks, but now I have a new problem. Seems autoparse is being gotten, null. Which it isn't, it's 1.Also, your regex makes my whole posts go blank. // Convert links to clickable links.function clickableLinks($post){ // Regex Match $regex = "((?:http|ftp|https)://(?:\w+\.)+\w+\.?(?:/[\w.])*/?)(?!\]|\)|[\.;] )"; // Replace foo' $post = preg_replace($regex, '<a href="$1">$1</a>', $post); return $post;} Using this instead: $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $text); and editing appropriately makes it work.
  4. So, how do I put this into php? do I use ereg_replace? No, I would use preg_replace if I used this.Example: <?php$string = 'April 15, 2003';$pattern = '/(\w+) (\d+), (\d+)/i';$replacement = '${1}1,$3';echo preg_replace($pattern, $replacement, $string);?> But I don't know how to incorporate your match.
  5. I still would rather have JUST the regex, I don't need a whole extra extension. I already have bbcode functions, and they work fine. Now I need to auto-parse links that people have not used bbcode with.I need it to check a variable, $iAutoParse and see if it's true (since I already have this variable defined, then search the post itself, $strPostBody, for any http:// and auto-parse them with <a href="$link[]">$link[]</a> or something.
  6. I don't manage my php installation, so I can't. I'm also no good at "compiling" either, just like on Linux.
  7. I need it so that it checks if the URL is within BBCode and if it is, won't parse it. Also, it should end the link if there's a ) or . or ; or ] and don't parse if there's a URL= attached to the front of http:// (IE: URL=http://)Basically, I want http://www.this.com to parse like IPB, etc. does automatically. Of course, not all URLs will have www. in front.
  8. I'm having a problem with this, well... sort of. $usergroup_sql = mysql_query("SELECT * FROM `usergroups` WHERE `id`='".$_SESSION['usergroup']."'"); $userg_sql_array = mysql_fetch_assoc($usergroup_sql); $_SESSION['permissions']['cmakethreads'] = $userg_sql_array['cmakethreads']; In a blank PHP Document (manually defining $_SESSION['usergroup']), this works fine, but when I put it into my message board... Everything in $usergroup_sql is blank when its line executes. Note $_SESSION['usergroup'] DOES exist and is set to a number (meaning a session IS set) when I'm browsing around. (I echo'd it to make sure.)No, no MySQL Errors nor PHP Errors within the apache/mysql logs. I need to take that session variable though. There is no other way to read the current userid that I am logged in as.Anyway, you guys can download it from this folder (they're 7z files) and see what you make of it. Note, the setup and skin folders should be ignored. Most of those things have already been fixed.loadConfigs.php in the includes folder is where this all is being setup (check init.inc.php too, since it requires loadConfigs in a function.)You can also set up the board as well (but you need to delete dbinfo.inc.php), there shouldn't be any issues during setup. (Make sure that after you do the install.php you don't go back to it, it won't allow you to use it again as long as dbinfo.inc.php exists.)
  9. Another issue, but it focuses on two variables, one dependant off of a previous one. // Load Style Configs... // Get the default style first! $sql2 = mysql_query("SELECT `name`,`id` FROM `styles` WHERE `default`='1'"); $row2 = mysql_fetch_array($sql2); // Grab The style configs for that style. $sql3 = mysql_query("SELECT `content`,`name` FROM `style_config` WHERE `styleid`='{$row2['id']}'"); $style_cfg = Array(); while($row3 = mysql_fetch_array($sql3)){ $style_cfg[$row3['name']] = $row3['content']; } $CFG['style']['table']['bgcolor'] = $style_cfg['tbl-bg']; $CFG['style']['table']['cella'] = $style_cfg['tbl-cella']; $CFG['style']['table']['cellb'] = $style_cfg['tbl-cellb']; These three output blank. Not sure how to modify the loop above to make it work with this. Because, editing it like below... // Grab The style configs for that style. $sql3 = mysql_query("SELECT `content`,`name` FROM `style_config` WHERE `styleid`='{$row2['id']}'"); while($row3 = mysql_fetch_array($sql3)){ if($row3['name'] == "tbl-bg") $CFG['style']['table']['bgcolor'] = $row3['content']; else if($row3['name'] == "tbl-cella") $CFG['style']['table']['cella'] = $row3['content']; else if($row3['name'] == "tbl-cellb") $CFG['style']['table']['cellb'] = $row3['content']; } still outputs the three as blank. Although I don't really need it right now, since I'm going the roundabout way... // Grab The style configs for that style. $sql3 = mysql_query("SELECT `content`,`name` FROM `style_config` WHERE `name`='tbl-bg' OR `name`='tbl-cella' OR `name`='tbl-cellb' OR `name`='page-bg' OR `name`='forum-bg'"); while($row3 = mysql_fetch_array($sql3)){ if($row3['name'] == "tbl-bg") // Table BG $CFG['style']['table']['bgcolor'] = $row3['content']; else if($row3['name'] == "tbl-cella") // Cell A $CFG['style']['table']['cella'] = $row3['content']; else if($row3['name'] == "tbl-cellb") // Cell B $CFG['style']['table']['cellb'] = $row3['content']; else if($row3['name'] == "page-bg") // Page BG $CFG['style']['page']['bgcolor'] = $row3['content']; else if($row3['name'] == "forum-bg") // Forum BG $CFG['style']['forum']['bgcolor'] = $row3['content']; } but it would still be nice to know how to optimize the loop.
  10. I finally got it fixed by using this: <?phpif( ( $result = mysql_query( "SELECT name,data FROM maxlen" ) ) ){ while( $row = mysql_fetch_assoc( $result ) ) { $CFG['maxlen'][$row['name']]=$row['data']; } mysql_free_result( $result );}?>
  11. using these instead... $CFG['maxlen']['username'] = mysql_fetch_object(mysql_query("SELECT `data` FROM `maxlen` WHERE `name`='username'"), "data"); $CFG['maxlen']['password'] = mysql_fetch_object(mysql_query("SELECT `data` FROM `maxlen` WHERE `name`='password'"), "data"); $CFG['maxlen']['email'] = mysql_fetch_object(mysql_query("SELECT `data` FROM `maxlen` WHERE `name`='email'"), "data"); $CFG = Array(); $CFG['maxlen'] = mysql_fetch_array(mysql_query("SELECT `data` FROM `maxlen`"), MYSQL_ASSOC); Give out errors: Fatal error: Class 'data' not found in installDB.php on line 201 Notice: Undefined index: username in installDB.php on line 235Notice: Undefined index: username in installDB.php on line 237 second uses $CFG['maxlen']['username']respectively.
  12. I'm having a problem getting STRING data from a MySQL query.using the following: $CFG['maxlen']['username'] = mysql_fetch_object(mysql_query("SELECT `data` FROM `maxlen` WHERE `name`='username'")); $CFG['maxlen']['password'] = mysql_fetch_object(mysql_query("SELECT `data` FROM `maxlen` WHERE `name`='password'")); $CFG['maxlen']['email'] = mysql_fetch_object(mysql_query("SELECT `data` FROM `maxlen` WHERE `name`='email'")); gives me an error later stating that a class cannot be converted to a string.I used this instead: $CFG = Array(); $CFG['maxlen'] = mysql_fetch_array(mysql_query("SELECT `data` FROM `maxlen`")); But $CFG['maxlen']['username'] (a valid row in the select statement above) is not a valid index.I don't NEED to get an array, how do I just parse the data correctly so it doesn't output some useless data like "Resource id #4"?mysql_fetch_object, mysql_fetch_array, mysql_fetch_assoc won't work, they all get arrays and/or rows (and I know specifically WHAT row I want. So I don't NEED to get a row.) Using the plain mysql_query results in resource id #4 even though it should be resulting in 32 (username row value) $CFG['maxlen']['username'] = mysql_query("SELECT `data` FROM `maxlen` WHERE `name`='username'");
  13. Man, am I so stupid... I forgot a comma
  14. iyeru42

    Blank PHP Error

    After I fixed another error stating $dbConn wasn't a valid variable, the error page I created that set display_errors on no longer displays errors, and still shows a blank page.Seems it was the "return" in the if/else down south where ExecuteSQL was executed. (It isn't a function, so the if/else cannot return anything.) Well, thanks for trying you guys.
  15. iyeru42

    Blank PHP Error

    Actually, I have narrowed it down finally. // Executes a given file as semicolon-terminated SQL statements.function ExecuteSQL($filename){ global $filename; // Get contents of the file. $filedata = file_get_contents($filename); if($filedata === FALSE) { return FALSE; } // Explode statements into elements of an array. $aSQL = explode(';', $filedata); // Execute each of the queries. foreach($aSQL as $strSQL) { if(trim($strSQL)) { if(!mysql_query(trim($strSQL))) { return FALSE; } } } return TRUE;} and // Execute the installation SQL script. if(ExecuteSQL("./includes/install.{$aDBInfo['type']}")) { // Mark us as having executed the SQL script. $sql_complete = TRUE; } else { // Couldn't execute install.sql. return("Could not execute <code>install.{$aDBInfo['type']}</code>.<br /><b>Database says</b>: ".$dbConn->geterror()); } are the problems. Removing them makes the php file work. having these in, causes my PHP file to output blank after it got to actually executing ExecuteSQL. But I need to execute huge amounts of queries... huge tables... etc.I tried the following instead: // Execute the installation SQL script. function parse_mysql_dump($url){ /* $link = mysql_connect($nowhost, $nowuser, $nowpass); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db /* $db_selected = mysql_select_db($nowdatabase, $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } */ $file_content = file($url); foreach($file_content as $sql_line){ if(trim($sql_line) != "" && strpos($sql_line, "--") === false){ //echo $sql_line . '<br>'; mysql_query($sql_line); } } } But it didn't work, no tables, etc. were created, nothing was inserted into, and no errors resulted. Why? Because the above function doesn't find anything, since it isn't looking for semicolons. That stuff is all commented out because I connected to the DB beforehand (no, no DB errors resulted.)Here's example data with install.mysql: CREATE TABLE `filetypes` ( `name` varchar(255) NOT NULL default '', `image` varchar(255) NOT NULL default '', `mime` varchar(255) NOT NULL default '', PRIMARY KEY (`name`));INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('bmp', 'bmp.png', 'image/bmp');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('gif', 'image.png', 'image/gif');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('jpg', 'image.png', 'image/jpeg');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('jpeg', 'image.png', 'image/jpeg');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('png', 'image.png', 'image/png');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('txt', 'text.png', 'text/plain');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('zip', 'zip.png', 'application/zip');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('rar', 'rar.png', 'application/x-rar-compressed');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('gz', 'gzip.png', 'application/x-gzip');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('7z', '7zip.png', 'application/x-7z-compressed');
  16. iyeru42

    Blank PHP Error

    No wait, that was a previous error. Sorry, there is no error log data for this. There's an error, but it's just blank. Not even the error log has the information.
  17. iyeru42

    Blank PHP Error

    ((See post under Deirdre's Dad's, still not fixed yet though))
  18. Nevermind, I'll just use separate files for different access and configuration.P.S: Since the code is over 20000 characters, I'm editing it out. But if you still want to know the problem...1.] The installer is split into two files: index.php and includes/install.inc.php2.] install.inc.php and index.php within the setup folder here give out two different db connection outputs. (however, install.inc.php alone gives out two different connections between certain steps)3.] However, install.inc.php doesn't carry over session/request data for DB information between steps (at least since I changed it.) This causes MySQL to connect using ODBC user instead of the specified user that the installer session data sent earlier.To get around this, I'm going to break this all up, into separate files. The initial install file (index.php) will creade dbinfo.inc.php in the includes directory in the forum's root dir. After that, index.php will ask the user to go on. When the user presses Next, the user will be redirected to another file, installDB.php, from there, the data will be sent to the database using dbinfo.inc.php data rather than session stored data.Previously, the installer used serialize to install a table, so I'm using roundabout ways to make it not use as such. I'll have to re-code the installer from scratch because I need it to do things it couldn't do before.
  19. Read reply under/after justsomeguy's post.
  20. Thanks man, it works now :3
  21. PHP gives the error... $fh = fopen("../includes/dbinfo.inc.php", "w"); if ($fh==false) { die("unable to create ../includes/dbinfo.inc.php. Make sure the includes directory within the forum root dir is CHMOD to 0777."); } else { $strWriteData = "<?php\n$aDBInfo['type'] = '".$aDBInfo['type']."';\n$aDBInfo['address'] = '".$aDBInfo['address']."';\n$aDBInfo['username'] = '".$aDBInfo['username']."';\n$aDBInfo['password'] = '".$aDBInfo['password']."';\n$aDBInfo['database'] = '".$aDBInfo['database']."';\n$aDBInfo['email'] = '".$aDBInfo['email']."';\n?>"; fwrite($fh, $strWriteData); fclose($fh); } How do I make it so I can still write this? (I need the line breaks in the destination file, so I cannot remove the \ns, and I cannot remove the variables that are inside the strings nor the beginning and ending <?php and ?>)
  22. Nevermind, I'm going to use a different method.
  23. I'd give you the flash, but it's that gallery thing again. So here's what I got...In Scene 1, first frame, 3rd layer: stop();function matureField() {gotoAndPlay("mature");}function normalField() {gotoAndPlay("normal");} On my mature_btn within Selectors MC: on(press) { _root.matureField();} On my normal_btn within Selectors MC: on(press) { _root.normalField();} These two buttons are the same object, two different instances. Clicking on normal_btn calls forth matureField() instead of normalField(); Besides my preloader, I have like, no other actionScript to interfere with this.
×
×
  • Create New...