Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
:unsure:Boa Noite a todos...
Por favor me ajudem configurar meu arquivo config.php ...
Ou seja: existe um arquivo install.php que cria a config.php ... mais só que dá erros em algumas linhas mesmo colocando os dados certo da base de dados MYSQL.
Me ajudem! este abaixo script é o arquivo install.php que cria config.php dentro da pasta config.
Me ajudem criar esta config manualmente para poder acessar minha base de dados.
db: mtubyou
user: base
password: dnstuff
host: localhost
Obrigado!!!
<?
?>
<html>
<head>
<title>xxxxxxxxxxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="install.css" rel="stylesheet" type="text/css">
</head>
<?
include_once("config/version.php");
$error=0;
if (isset($_POST['installok'])) {
if ($_POST['admuser']==""||$_POST['admpass']==""||$_POST['admpass']!=$_POST['admpassconfirm']) {
$error=1;
} else if (file_exists("config/config.php")) {
$error=2;
} else {
$fp=fopen("config/config.php","w");
$content = "<?php \n";
$content.= "\$dbhost = '".$_POST['hostname']."'; \n";
$content.= "\$dbuser = '".$_POST['db_user']."'; \n";
$content.= "\$dbpass = '".$_POST['db_pass']."'; \n";
$content.= "\$dbname = '".$_POST['db_name']."'; \n";
$content.= " \n";
$content.= "\$dbh = mysql_connect(\$dbhost,\$dbuser,\$dbpass) \n";
$content.= " or die (mysql_error()); \n";
$content.= " \n";
$content.= "mysql_select_db(\$dbname); \n";
$content.= " \n";
$content.= "function cleanData() { \n";
$content.= " foreach(\$_GET as \$k => \$v) { \n";
$content.= " if (is_array(\$_GET[\$k])) { \n";
$content.= " for (\$i=0; \$i<count(\$_GET[\$k]); \$i++) { \n";
$content.= " if (!get_magic_quotes_gpc()) \$_GET[\$k][\$i] = addslashes(htmlspecialchars(\$_GET[\$k][\$i])); \n";
$content.= " else \$_GET[\$k][\$i] = htmlspecialchars(\$_GET[\$k][\$i]); \n";
$content.= " } \n";
$content.= " } else { \n";
$content.= " if (!get_magic_quotes_gpc()) \$_GET[\$k] = addslashes(htmlspecialchars(\$v)); \n";
$content.= " else \$_GET[\$k] = htmlspecialchars(\$v); \n";
$content.= " } \n";
$content.= " } \n";
$content.= " foreach(\$_POST as \$k => \$v) { \n";
$content.= " if (is_array(\$_POST[\$k])) { \n";
$content.= " for (\$i=0; \$i<count(\$_POST[\$k]); \$i++) { \n";
$content.= " if (!get_magic_quotes_gpc()) \$_POST[\$k][\$i] = addslashes(htmlspecialchars(\$_POST[\$k][\$i])); \n";
$content.= " else \$_POST[\$k][\$i] = htmlspecialchars(\$_POST[\$k][\$i]); \n";
$content.= " } \n";
$content.= " } else { \n";
$content.= " if (!get_magic_quotes_gpc()) \$_POST[\$k] = addslashes(htmlspecialchars(\$v)); \n";
$content.= " else \$_POST[\$k] = htmlspecialchars(\$v); \n";
$content.= " } \n";
$content.= " } \n";
$content.= " foreach(\$_REQUEST as \$k => \$v) { \n";
$content.= " if (is_array(\$_REQUEST[\$k])) { \n";
$content.= " for (\$i=0; \$i<count(\$_REQUEST[\$k]); \$i++) { \n";
$content.= " if (!get_magic_quotes_gpc()) \$_REQUEST[\$k][\$i] = addslashes(htmlspecialchars(\$_REQUEST[\$k][\$i])); \n";
$content.= " else \$_REQUEST[\$k][\$i] = htmlspecialchars(\$_REQUEST[\$k][\$i]); \n";
$content.= " } \n";
$content.= " } else { \n";
$content.= " if (!get_magic_quotes_gpc()) \$_REQUEST[\$k] = addslashes(htmlspecialchars(\$v)); \n";
$content.= " else \$_REQUEST[\$k] = htmlspecialchars(\$v); \n";
$content.= " } \n";
$content.= " } \n";
$content.= "} \n";
$content.= " \n";
$content.= "#### turn off magic_quotes_gpc \n";
$content.= "##ini_set('magic_quotes_gpc', 'Off'); \n";
$content.= " \n";
$content.= "cleanData(); \n";
$content.= " \n";
$content.= "\$doc_directory=\$_SERVER['DOCUMENT_ROOT']; \n";
$content.= " \n";
$content.= "define('INCLUDED', 1); \n";
$content.= " \n";
$content.= "if (file_exists(\"config/config.php\")) \$fileExtension = \"\"; \n";
$content.= "else \$fileExtension = \"../\"; \n";
$content.= " \n";
$content.= "include_once (\$fileExtension.\"config/settings.php\"); \n";
$content.= "include_once (\$fileExtension.\"config/functions.php\"); \n";
$content.= "include_once (\$fileExtension.\"config/datecalc.php\"); \n";
$content.= "include_once (\$fileExtension.\"config/fees.php\"); \n";
$content.= "include_once (\$fileExtension.\"config/version.php\"); \n";
$content.= " \n";
$content.= "if (\$setts['is_ssl']==1) \$path=\$setts['ssl_address']; \n";
$content.= "else \$path=\$setts['siteurl']; \n";
$content.= "?>";
fputs($fp,$content);
fclose($fp);
$inc="yes";
### here we'll enter the site and admin info in the DB
//include ("config/config.php");
$dbhost = $_POST['hostname'];
$dbuser = $_POST['db_user'];
$dbpass = $_POST['db_pass'];
$dbname = $_POST['db_name'];
$dbh = mysql_connect($dbhost,$dbuser,$dbpass)
or die (mysql_error());
mysql_select_db($dbname);
$insertConfiguration = mysql_query("UPDATE probid_gen_setts SET
sitename='".$_POST['sitename']."',siteurl='".$_POST['siteurl']."',
adminemail='".$_POST['adminemail']."',default_theme='default',lkey='".$_POST['lkey']."'") or die(mysql_error());
$deleteAdmins = mysql_query("DELETE FROM probid_admins");
$insertDefaultAdminUser = mysql_query("INSERT INTO probid_admins
(username, password, created, lastlogin) VALUES
('".$_POST['admuser']."','".md5($_POST['admpass'])."',NOW(),'NULL')") or die(mysql_error());
}
} ?>
<body>
<?
if ($error==2) {
echo "<p class=contentfont>ERROR: The cofiguration file already exists.<br>
For security reasons, you cannot overwrite that file.<br>
If you want to reinstall the script, please delete the configuration file, as
stated on the installation guide you were provided. <br>Thank you.</p>";
} else if ($inc=="yes") {
echo "<p class=contentfont align=center>Installation Complete. <br>
<br>
<a href=index.php>Proceed to the site's main page</a><br>
<a href=admin/index.php>Proceed to the site's admin area</a>
</p>";
} else {
?>
<form name="install" method="post" action="install.php">
<table width="700" border="0" align="center" cellpadding="3" cellspacing="3" class="contentfont border">
<tr>
<td bgcolor="orange" class="title" align="center" width="25">»</td>
<td class="title c3">PHP PRO BID v5 INSTALLATION ( v<?=$currentVersion;?> )</td>
</tr>
</table>
<br>
<table width="700" border="0" align="center" cellpadding="3" cellspacing="3" class="contentfont border">
<tr>
<td class="c1" colspan="3"><strong>» Database Setup</strong></td>
</tr>
<tr>
<td colspan="3" class="errormessage" align="center">IMPORTANT: If the database settings are incorrect, the software won't install. </td>
</tr>
<tr class="c2">
<td align="right" width="130">Host Name</td>
<td><input name="hostname" type="text" class="contentfont" id="hostname" value="localhost"></td>
<td>Enter the host's name (in most cases, it's localhost)</td>
</tr>
<tr class="c3">
<td align="right">Database Name</td>
<td><input name="db_name" type="text" class="contentfont" id="db_name"></td>
<td>Enter the database's name, as you have chosen it when you installed the database on the server</td>
</tr>
<tr class="c2">
<td align="right">Database User</td>
<td><input name="db_user" type="text" class="contentfont" id="db_user"></td>
<td>Enter the database's username</td>
</tr>
<tr class="c3">
<td align="right">Database Password</td>
<td><input name="db_pass" type="password" class="contentfont" id="db_pass"></td>
<td>Enter the database's password</td>
</tr>
</table>
<br>
<table width="700" border="0" align="center" cellpadding="3" cellspacing="3" class="contentfont border">
<tr>
<td class="c1" colspan="3"><strong>» Site Setup</strong></td>
</tr>
<tr>
<td colspan="3" class="errormessage" align="center">NOTE: The Site Settings and Default Admin Settings can be changed from the site's admin area at any time</td>
</tr>
<tr class="c2">
<td align="right" width="130">Site Name</td>
<td><input name="sitename" type="text" class="contentfont" id="sitename"></td>
<td>Enter your site's name (eg. PHP Pro Bid)</td>
</tr>
<tr class="c3">
<td align="right">Site URL</td>
<td><input name="siteurl" type="text" class="contentfont" id="siteurl" value="http://"></td>'>http://"></td>
<td>Enter your site's URL (eg. [http://www.mywebpage.com/)
](http://www.mywebpage.com/))
<strong>NOTE:</strong> You must enter the "http://" statement before your address, and a slash at the end of the address;<br>
for eg www.mywebpage.com is invalid!<br>
<strong>Correct Value: </strong>[http://www.mywebpage.com/](http://www.mywebpage.com/)
</tr>
<tr class="c2">
<td align="right">Admin Email</td>
<td><input name="adminemail" type="text" class="contentfont" id="adminemail"></td>
<td>Enter your admin email (eg. admin@mywebpage.com)<br>
NOTE: This email will be used by the script to send emails, so all your users will reply to this email</td>
</tr>
</table>
<br>
<table width="700" border="0" align="center" cellpadding="3" cellspacing="3" class="contentfont border">
<tr>
<td class="c1" colspan="3"><strong>» Default Admin User Setup</strong></td>
</tr>
<? if ($error==1) { ?>
<tr>
<td colspan="3" class="errormessage" align="center">ERROR: The admin information you have submitted is invalid! </td>
</tr>
<? } ?>
<tr class="c2">
<td align="right">Username</td>
<td><input name="admuser" type="text" class="contentfont" id="admuser" value="admin"></td>
<td>Enter the default username to access the site's admin area</td>
</tr>
<tr class="c3">
<td align="right">Password</td>
<td><input name="admpass" type="password" class="contentfont" id="admpass"></td>
<td>Enter the password for the default admin user</td>
</tr>
<tr class="c2">
<td align="right">Confirm Password</td>
<td><input name="admpassconfirm" type="password" class="contentfont" id="admpassconfirm"></td>
<td> </td>
</tr>
<tr align="center">
<td colspan="3" class="c4"><input name="installok" type="submit" class="contentfont" id="installok" value="Process Settings"></td>
</tr>
</table>
</form>
<? } ?>
</body>
</html>Carregando comentários...