Ucp problem Need help
#1

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\AppServ\www\ucpp\S32_Admin UCP\connect.php on line 3
Access denied for user 'root'@'localhost' (using password: NO)



there is code


<?php

$connect = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("root") or die(mysql_error());

function BBCode($text)
{
$text = strip_tags($text, '<br>');
$source = array(
'/\[b\](.+?)\[\/b\]/i',
'/\[u\](.+?)\[\/u\]/i',
'/\[i\](.+?)\[\/i\]/i',
'/\[s\](.+?)\[\/s\]/i',
'/\[img\](.+?)\[\/img\]/i',
'/\[url=(.+?)\](.+?)\[\/url\]/i',
'/\[color=(.+?)\](.+?)\[\/color\]/i',
'/\[size=(.+?)\](.+?)\[\/size\]/i',
'/\[center\](.+?)\[\/center\]/i',
'/\[left\](.+?)\[\/left\]/i',
'/\[right\](.+?)\[\/right\]/i',
'/\[sup\](.+?)\[\/sup\]/i',
'/\[sub\](.+?)\[\/sub\]/i',
'/\[glow=(.+?),(.+?)\](.+?)\[\/glow\]/i',
'/\[shadow=(.+?),(.+?)\](.+?)\[\/shadow\]/i',
'/\[font=(.+?)\](.+?)\[\/font\]/i',
'/\[move\](.+?)\[\/move\]/i',
'/\[hr\]/i',
);
$new = array(
'<strong>$1</strong>',
'<u>$1</u>',
'<i>$1</i>',
'<s>$1</s>',
'<img src="$1"></img>',
'<a href="$1" target="_blank">$2</a>',
'<span style="color: $1">$2</span>',
'<span style="font-size: $1">$2</span>',
'<div align="center">$1</div>',
'<div align="left">$1</div>',
'<div align="right">$1</div>',
'<sup>$1</sup>',
'<sub>$1</sub>',
'<span style="text-shadow: 0 0 $1px $2;">$3</span>',
'<span style="text-shadow: $1px 0 1px $2;">$3</span>',
'<span style="font-family: $1">$2</span>',
'<marquee>$1</marquee>',
'<hr>',
);
$text = stripslashes($text);
$text = preg_replace($source, $new, $text);
$text = nl2br($text);
return $text;
}

?>
Reply
#2

You should be using PDO so it's safer. Anyway replace the (.+?) with (.*?)

What are you testing this on? a webhost? or your local host? (own pc)

If you are doing it on a webhost (which i suspect your doing) you need to make a database in the cp and change the database settings to that.
Reply
#3

Access denied for user 'root'@'localhost'

It can't get more obvious than that
Reply
#4

The credentials to the MySQL database ain't correct. Have you even created a database yet?
Reply
#5

Quote:
Originally Posted by sscarface
Посмотреть сообщение
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\AppServ\www\ucpp\S32_Admin UCP\connect.php on line 3
Access denied for user 'root'@'localhost' (using password: NO)



there is code


<?php

$connect = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("root") or die(mysql_error());
?>
MySQL login credentials are wrong probably, it's clearly saying that it's not using password.. So make sure your password is correct.

Off Topic - ROFL at your signature!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)