NameSilo

What am I doing wrong??? Namebucks reward for help.

Spaceship Spaceship
Watch

johnny6

Old GuyVIP Member
Impact
80
Can anyone tell me what I'm doing wrong? I'm trying to install cplinks on a website i'm revamping - spotlightsoccer.com As far as I can tell I followed the installation instructions exactly - http://www.cplinks.com/guide.html - however, when I try to log on or edit in the admin section - http://www.spotlightsoccer.com/admin/ - i get all sorts of errors like these -

SQL/DB Error -- [
Error selecting database spotligh_spotty!
Are you sure it exists?
Are you sure there is a valid database connection?
]

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/spotligh/public_html/includes/mysql.php:99) in /home/spotligh/public_html/admin/index.php on line 69

If anyone can fix this problem and tell me how they fixed it/what i did wrong, I'll give you 40 namebucks.

I'm baffled. Thanks,

John
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
This is usually the most common problem for an error like this with clients, but did you remember to grant permissions for the user in the DB? I'm assuming you use cPanel because of the username, but I could be wrong. It's the most common oversight of all and that looks to be the issue.

If that doesn't work, verify that the db name, username, and password are all correct.
 
0
•••
johnny6 said:
Can anyone tell me what I'm doing wrong? I'm trying to
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/spotligh/public_html/includes/mysql.php:99) in /home/spotligh/public_html/admin/index.php on line 69

This one is easy, you need to do things in a specific order on the page, and it looks like one of your includes is sending headers before the cookies have been sent.

Use the setcookie() function before you send any headers.
Use the header() function before you send any page text.
 
0
•••
I'm not sure it's either of these problems.... I appreciate the thoughts though. If anyone has an idea of how to fix it and wants to do it, I'll pay or something. please pme me.
 
0
•••
I think monaco is correct.cookie must be sent before the headers.Can u post the code ?
 
0
•••
phoenixd said:
I think monaco is correct.cookie must be sent before the headers.Can u post the code ?

Ok, that would be good if that's the problem - don't know how to fix it though. Here's the code for the file monaco pointed out.

////////////////////////////////// Start of functions ///////////////////////////

function user_set_tokens()
{
session_start();
$_SESSION['logged_in'] = "true";
}


function user_login( $admin_username, $password )
{
global $feedback;
global $db;

if ( !$admin_username || !$password )
{
return array('error' => true, 'error_msg' => "Incorrect Username or Password" );
}

$password = md5 ( strtolower ( $password ) );

$query = "SELECT admin_username FROM mnl_admin WHERE admin_username='$admin_username' AND admin_password= '$password'";
$user = $db->get_row( $query );
if ( $db->num_rows < 1 )
{
return array('error' => true, 'error_msg' => "User not found or Password incorrect" );
}

user_set_tokens();
return array('error' => false, 'error_msg' => "" );
}

////////////////////////////////// End of functions ///////////////////////////

require ( "../config.php" );
require ( "../includes/mysql.php" );

//Do not show the login form if the admin session exists
session_start();
if ( $_SESSION['logged_in'] == "true" )
{
header ( "location: admin_welcome.php" );
exit;
}

$mode = $_GET['mode'];

if ( $mode == "confirm" )
$admin_username = $_POST['admin_username'];
$password = $_POST['password'];
{
$result = user_login( $admin_username, $password );
if ( $result['error'] == false )
{
header ( "location: admin_welcome.php" );
exit;
}
}

require ( "admin_common.php" );
require ( "../global_config.php" );
require ( "admin_interface.php" );
require ( "admin_validate_form.php" );

$bgcolour = MAIN_COLOUR;

$header = "LOG IN HERE";

if ( $mode == "confirm" )
$admin_username = $_POST['admin_username'];
$password = $_POST['password'];
{
$result = user_login( $admin_username, $password );
if ( $result['error'] == false )
{
header ( "location: admin_welcome.php" );
exit;
}
}

admin_page_header();
echo "<p> </p>\n";
echo "<p> </p>\n";
echo "<form action=\"index.php?mode=confirm\" method=\"post\">";
echo "<table width=\"50%\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\" bgcolor=\"#555555\" align=\"center\">\n";
echo "<tr bgcolor=\"$bgcolour\">\n";
echo "<td class=\"tbody\" colspan=\"2\" align=\"center\"><b>" . $header . "</b></td>\n";
echo "</tr>\n";

$bgcolour = "#FFFFFF";
$column1_width = "30%";
$column2_width = "70%";
$field_width = "35";

// The username
text_input( $bgcolour, "text", $column1_width, $column2_width, "<b>User name</b>", "admin_username", "", $field_width );

// The password
text_input( $bgcolour, "Password", $column1_width, $column2_width, "<b>Password</b>", "password", "", $field_width );

echo "<tr bgcolor=\"$bgcolour\">\n";
echo "<td class=\"tbody\" colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Log In\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";

admin_page_footer( $cplinks_version );
?>
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer

We're social

Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back