Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1359 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

what does this mean

Thread title: what does this mean
Closed Thread    
    Thread tools Search this thread Display Modes  
03-01-2007, 03:06 AM
#1
Taylor Hewitt is offline Taylor Hewitt
Taylor Hewitt's Avatar
Status: Member
Join date: Dec 2005
Location: Canada
Expertise:
Software:
 
Posts: 194
iTrader: 1 / 100%
 

Taylor Hewitt is on a distinguished road

Send a message via AIM to Taylor Hewitt Send a message via MSN to Taylor Hewitt

  Old  what does this mean

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/teeyaych/public_html/emogroups/test/admin/index.php on line 147

Warning: Cannot modify header information - headers already sent by (output started at /home/teeyaych/public_html/emogroups/test/admin/index.php:147) in /home/teeyaych/public_html/emogroups/test/admin/index.php on line 156

Warning: Cannot modify header information - headers already sent by (output started at /home/teeyaych/public_html/emogroups/test/admin/index.php:147) in /home/teeyaych/public_html/emogroups/test/admin/index.php on line 158

03-01-2007, 03:13 AM
#2
aLx is offline aLx
Status: Senior Member
Join date: Jan 2006
Location: USA
Expertise:
Software:
 
Posts: 922
iTrader: 13 / 100%
 

aLx is on a distinguished road

Send a message via AIM to aLx

  Old

Post up your script please.. or that page

03-01-2007, 03:16 AM
#3
Taylor Hewitt is offline Taylor Hewitt
Taylor Hewitt's Avatar
Status: Member
Join date: Dec 2005
Location: Canada
Expertise:
Software:
 
Posts: 194
iTrader: 1 / 100%
 

Taylor Hewitt is on a distinguished road

Send a message via AIM to Taylor Hewitt Send a message via MSN to Taylor Hewitt

  Old

Code:
function Logout($admin) {

    $cookie = explode("|", base64_decode($admin));
    $result = mysql_query("SELECT password FROM ".$prefix."_admin WHERE admin_name='$cookie[1]'");
    $row = mysql_fetch_array($result);
    $pass = $row['password'];
    if ($cookie[2] == $pass && $pass != "") {
	return $cookie;
    } else {
	unset($admin);
	unset($cookie);
    }
    
    setcookie("admin", false);
    $admin = "";
    header("Location: index.php");
    
}

03-02-2007, 02:10 PM
#4
bluesaga is offline bluesaga
Status: Member
Join date: Feb 2007
Location:
Expertise:
Software:
 
Posts: 137
iTrader: 1 / 100%
 

bluesaga is on a distinguished road

  Old

The first error message means the mysql query you are trying to run is errorneous, change it from:

PHP Code:
    $result mysql_query("SELECT password FROM ".$prefix."_admin WHERE admin_name='$cookie[1]'"); 
to:
PHP Code:
$result mysql_query("SELECT password FROM ".$prefix."_admin WHERE admin_name='$cookie[1]'")
   or die( 
mysql_error() ); 
This should give you a better error message telling you exactly what is wrong with the query. Could be anything, but its bugged


the latter is regarding setting your cookies and headers, because when creating a cookie or setting a location header to move to a different place, NO output should be produced before these functions are called, including a space at the top of your document so watch out for these

03-03-2007, 02:23 AM
#5
WarlordTony is offline WarlordTony
Status: I'm new around here
Join date: Dec 2005
Location: Athens, Greece
Expertise:
Software:
 
Posts: 23
iTrader: 0 / 0%
 

WarlordTony is on a distinguished road

  Old

I think the query is wrong because of $prefix var - it is not declared within the function and tries to query a non existent table "_admin".

03-03-2007, 02:39 AM
#6
Andrew R is offline Andrew R
Status: Request a custom title
Join date: Dec 2005
Location: Arizona
Expertise:
Software:
 
Posts: 5,200
iTrader: 17 / 95%
 

Andrew R is on a distinguished road

  Old

WarlordTony, I'm sure he declares it in a config.php file.
PHP Code:
$query sprintf("SELECT password FROM %s_admin WHERE admin_name='%s'"$prefix$cookie[1]);
$result mysql_query($query); 
Try that.

03-03-2007, 02:44 AM
#7
Jeff Andersen is offline Jeff Andersen
Status: Superstar
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 4,449
iTrader: 10 / 100%
 

Jeff Andersen is on a distinguished road

  Old

And as for the second/third error, you cannot set a cookie after any browser code (such as including a header or anything to do with the client side page) has been output.

03-03-2007, 02:16 PM
#8
bluesaga is offline bluesaga
Status: Member
Join date: Feb 2007
Location:
Expertise:
Software:
 
Posts: 137
iTrader: 1 / 100%
 

bluesaga is on a distinguished road

  Old

Originally Posted by Andrew R View Post
WarlordTony, I'm sure he declares it in a config.php file.
PHP Code:
$query sprintf("SELECT password FROM %s_admin WHERE admin_name='%s'"$prefix$cookie[1]);
$result mysql_query($query); 
Try that.
Warlord tony is correct, how can he declare a variable and call it WITHIN a function without using globals?

Id imagine this is the source of his errors aswell.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed