tubyou 0 Denunciar post Postado Julho 27, 2007 :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!!! <? ## v5.24 -> jun. 02, 2006 ?> <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/)<br> <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/</td> </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> Compartilhar este post Link para o post Compartilhar em outros sites
hinom 5 Denunciar post Postado Julho 27, 2007 tubyou é melhor você postar as mensagems de erro que aparecem Compartilhar este post Link para o post Compartilhar em outros sites
tubyou 0 Denunciar post Postado Julho 27, 2007 Amigo ... é este erros::::Warning: mysql_query(): Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 24Warning: mysql_query(): A link to the server could not be established in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 24Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 25Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 39Warning: main(themes//header.php): failed to open stream: No such file or directory in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 48Warning: main(): Failed opening 'themes//header.php' for inclusion (include_path='.;./includes;./pear') in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 48Warning: main(themes//mainpage.php): failed to open stream: No such file or directory in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 49Warning: main(): Failed opening 'themes//mainpage.php' for inclusion (include_path='.;./includes;./pear') in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 49Warning: main(themes//footer.php): failed to open stream: No such file or directory in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 50Warning: main(): Failed opening 'themes//footer.php' for inclusion (include_path='.;./includes;./pear') in C:\Inetpub\vhosts\tubyou.com.br\httpdocs\mt\Index.php on line 50 Compartilhar este post Link para o post Compartilhar em outros sites
Leandro Nunes 0 Denunciar post Postado Julho 27, 2007 <?/* config.php */$db = "mtubyou";$user = "base";$password = "dnstuff"$host = "localhost";$conecta = mysql_connect($host,$user,$password);$sel_bco = mysql_select_db($db,$conecta);?> Assim, na primeira linha de cada página, você coloca: require_once "config.php";e no final, na última linha de cada página q você chamou o config, você coloca mysql_close(); Compartilhar este post Link para o post Compartilhar em outros sites
tubyou 0 Denunciar post Postado Julho 28, 2007 <?/* config.php */$db = "mtubyou";$user = "base";$password = "dnstuff"$host = "localhost";$conecta = mysql_connect($host,$user,$password);$sel_bco = mysql_select_db($db,$conecta);?>Assim, na primeira linha de cada página, você coloca: require_once "config.php";e no final, na última linha de cada página q você chamou o config, você colocamysql_close(); Amigo... fiz de acordo com que está escrito aqui.Ví que encontrou a base de dados mais porém dá erro.Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/tubyou/public_html/mt/index.php on line 25Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tubyou/public_html/mt/index.php on line 39Warning: main(themes//header.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 48Warning: main(themes//header.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 48Warning: main(themes//header.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 48Warning: main() [function.include]: Failed opening 'themes//header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tubyou/public_html/mt/index.php on line 48Warning: main(themes//mainpage.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 49Warning: main(themes//mainpage.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 49Warning: main(themes//mainpage.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 49Warning: main() [function.include]: Failed opening 'themes//mainpage.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tubyou/public_html/mt/index.php on line 49Warning: main(themes//footer.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 50Warning: main(themes//footer.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 50Warning: main(themes//footer.php) [function.main]: failed to open stream: No such file or directory in /home/tubyou/public_html/mt/index.php on line 50Warning: main() [function.include]: Failed opening 'themes//footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tubyou/public_html/mt/index.php on line 50mysql_close();me ajudem! Compartilhar este post Link para o post Compartilhar em outros sites
Tellys Castro 12 Denunciar post Postado Julho 28, 2007 pelo que vi ai ou você nao tem o bando de dados em sua base , pq ele retornou argumento invalido na contagem de linhas de retorno mysql_num_rows(): e seu path ainda falta alguma pasta ou esta incorreto, pq ta retornando // juntas o que deduzimos que sua string esta vazia!!! verifica esses dois o path e o nome do banco de dados , se esta certo ou se precisa de algum nome antes dele.... Compartilhar este post Link para o post Compartilhar em outros sites
hinom 5 Denunciar post Postado Julho 29, 2007 o primeiro erro ocorreu porque provavelmente tem algum erro na sintaxe SQLvocê precisa debugar antes de executar. Compartilhar este post Link para o post Compartilhar em outros sites