[ Index ] |
|
Code source de e107 0.7.8 |
1 <? 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_files/import/mambo.php,v $ 14 | $Revision: 1.1 $ 15 | $Date: 2005/05/12 21:34:56 $ 16 | $Author: e107coders $ 17 +----------------------------------------------------------------------------+ 18 */ 19 require_once ("../../class2.php"); 20 require_once(e_ADMIN."auth.php"); 21 22 if(!isset($_POST['do_conversion'])) 23 { 24 25 $text = " 26 <table style='width: 100%;' class='fborder'> 27 <tr> 28 <td class='forumheader3' style='text-align: center; margin-left: auto; margin-right: auto;'> 29 This script will import your Mambo database to e107. It will copy over users only.<br /><br /></b> 30 31 <br /><br />\n 32 33 34 <form method='post' action='".e_SELF."'> 35 Please enter the details for your Mambo database ...<br /><br /> 36 37 <table style='width: 50%;' class='fborder'> 38 <tr> 39 <td style='width: 50%; text-align: right;'>Host </td> 40 <td style='width: 50%; text-align: left;'><input class='tbox' type='text' name='mamboHost' size='30' value='localhost' maxlength='100' /> 41 </tr> 42 <tr> 43 <td style='width: 50%; text-align: right;'>Username </td> 44 <td style='width: 50%; text-align: left;'><input class='tbox' type='text' name='mamboUsername' size='30' value='' maxlength='100' /> 45 </tr> 46 <tr> 47 <td style='width: 50%; text-align: right;'>Password </td> 48 <td style='width: 50%; text-align: left;'><input class='tbox' type='text' name='mamboPassword' size='30' value='' maxlength='100' /> 49 </tr> 50 <tr> 51 <td style='width: 50%; text-align: right;'>Database </td> 52 <td style='width: 50%; text-align: left;'><input class='tbox' type='text' name='mamboDatabase' size='30' value='mambo' maxlength='100' /> 53 </tr> 54 <tr> 55 <td style='width: 50%; text-align: right;'>Table Prefix </td> 56 <td style='width: 50%; text-align: left;'><input class='tbox' type='text' name='mamboPrefix' size='30' value='mos_' maxlength='100' /> 57 </tr> 58 </table> 59 <br /><br /> 60 <input class='button' type='submit' name='do_conversion' value='Continue' /> 61 </td> 62 </tr> 63 </table>"; 64 65 $ns -> tablerender("mambo to e107 Conversion Script", $text); 66 require_once(e_ADMIN."footer.php"); 67 exit; 68 } 69 70 if(!isset($_POST['mamboHost']) || !isset($_POST['mamboUsername']) || !isset($_POST['mamboPassword']) || !isset($_POST['mamboDatabase'])){ 71 echo "Field(s) left blank, please go back and re-enter values."; 72 require_once(e_ADMIN."footer.php"); 73 exit; 74 } 75 76 extract($_POST); 77 78 $text .= "<table style='width: 100%;' class='fborder'> 79 <tr> 80 <td class='forumheader3' style='text-align: center; margin-left: auto; margin-right: auto;'> 81 Attempting to connect to Mambo database [ {$mamboDatabase} @ {$mamboHost} ] ...<br />\n"; 82 flush(); 83 84 $phpbbConnection = mysql_connect($mamboHost, $mamboUsername, $mamboPassword, TRUE); 85 if(!mysql_select_db($mamboDatabase, $phpbbConnection)){ 86 goError("Error! Cound not connect to Mambo database. Please go back to the previous page and check your settings"); 87 } 88 89 $e107Connection = mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword, TRUE); 90 if(!mysql_select_db($mySQLdefaultdb, $e107Connection)){ 91 goError("Error! Cound not connect to e107 database."); 92 } 93 94 echo "Successfully connected to Mambo and e107 databases ...<br><br />"; 95 96 97 $phpbb_res = mysql_query("SELECT * FROM {$mamboPrefix}users", $phpbbConnection); 98 if(!$phpbb_res){ 99 goError("Error! Unable to access ".$mamboPrefix."users table."); 100 } 101 102 103 104 $text = "<div><table class='fborder'>"; 105 $text .= "<tr>"; 106 $text .= "<td class='fcaption'>name</td>"; 107 $text .= "<td class='fcaption'>username</td>"; 108 $text .= "<td class='fcaption'>email</td>"; 109 $text .= "<td class='fcaption'>password</td>"; 110 $text .= "<td class='fcaption'>usertype</td>"; 111 $text .= "<td class='fcaption'>block</td>"; 112 $text .= "<td class='fcaption'>sendEmail</td>"; 113 $text .= "<td class='fcaption'>gid</td>"; 114 $text .= "<td class='fcaption'>regDate</td>"; 115 $text .= "<td class='fcaption'>lvDate</td>"; 116 $text .= "</tr>"; 117 118 $result = mysql_query("SELECT name,username,email,block,sendEmail,gid,password,usertype,UNIX_TIMESTAMP(registerDate) AS regDate,UNIX_TIMESTAMP(lastvisitDate) AS lvDate FROM mos_users", $phpbbConnection); 119 while ($mos = mysql_fetch_array($result, MYSQL_ASSOC)) { 120 $text .= "<tr>"; 121 $text .= "<td class='forumheader3'>".$mos['name']."</td>"; 122 $text .= "<td class='forumheader3'>".$mos['username']."</td>"; 123 $text .= "<td class='forumheader3'>".$mos['email']."</td>"; 124 $text .= "<td class='forumheader3'>".$mos['password']."</td>"; 125 $text .= "<td class='forumheader3'>".$mos['usertype']."</td>"; 126 $text .= "<td class='forumheader3'>".$mos['block']."</td>"; 127 $text .= "<td class='forumheader3'>".$mos['sendEmail']."</td>"; 128 $text .= "<td class='forumheader3'>".$mos['gid']."</td>"; 129 $text .= "<td class='forumheader3'>".$mos['regDate']."</td>"; 130 $text .= "<td class='forumheader3'>".$mos['lvDate']."</td>"; 131 $text .= "</tr>"; 132 133 $block = ($mos['block']) ? 2 : 0; 134 $admin = ($mos['usertype'] == "superadministrator") ? 1 : 0; 135 $query = "INSERT INTO ".$mySQLprefix."user VALUES ("; 136 $query .= "0, \"".$mos['name']."\", \"".$mos['username']."\", '', \"".$mos['password']."\", '', \"".$mos['email']."\", '', '', '', '', '', '', '', '', '', \"1\", \"".$mos['regDate']."\", \"".$mos['lvDate']."\", \"\", \"\", \"\", \"\", \"\", \"\", \"$block\", '', '', '', '', \"$admin\", \"".$mos['name']."\", \"$class\", 0, 0, 0 "; 137 $query .= ")"; 138 $message = mysql_query($query, $e107Connection) ? LAN_CREATED: LAN_CREATED_FAILED; 139 140 } 141 $text .= "</table></div>"; 142 143 echo $text."<br /><br /></div>"; 144 echo "<div style='text-align:center'>$message</div>"; 145 146 147 148 function goError($error){ 149 echo "<b>{$error}</b></td></tr></table>"; 150 require_once(e_ADMIN."footer.php"); 151 exit; 152 } 153 154 155 require_once(e_ADMIN."footer.php"); 156 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |