Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-30-2002, 08:41 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Some help please?

I keep getting a database error whenever I try to update a user...

Can someone tell me what is wrong with this line?

PHP Code:
    if ($exists=$DB_site->query_first("SELECT userid FROM user WHERE username=".addslashes(htmlspecialchars($ausername))." AND userid <> $userid")) {
        echo 
"There is already an ".makelinkcode('user',"user.php?do=edit&userid=$exists[userid]",1)." named <b>".htmlspecialchars($ausername)."</b>";
        exit;
    } 
It keeps causing an error, and I dont know why...

Also - Our member numbers jumped from "386" or thereabouts, to something like "12123134"...

Could that be the cause of the error, and if so, how can I change it?

Satan
Reply With Quote
  #2  
Old 08-30-2002, 08:43 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Whats the database error you are getting?
Reply With Quote
  #3  
Old 08-30-2002, 08:47 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hellsatan try changing::

PHP Code:
userid <> $userid 
to

PHP Code:
userid != $userid 
regards... as for the member issue ouch

g-force2k2
Reply With Quote
  #4  
Old 08-30-2002, 08:49 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks gforce...I shall try that

@NTLDR - If gforce hasnt fixed it, I shall post it

Satan
Reply With Quote
  #5  
Old 08-30-2002, 08:52 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually hellsatan the coding doesn't look right at all from my pov... replace your code ::

PHP Code:
    if ($exists=$DB_site->query_first("SELECT userid FROM user WHERE username=".addslashes(htmlspecialchars($ausername))." AND userid <> $userid")) {
        echo 
"There is already an ".makelinkcode('user',"user.php?do=edit&userid=$exists[userid]",1)." named <b>".htmlspecialchars($ausername)."</b>";
        exit;
    } 
with::

PHP Code:
$exists $DB_site->query_first("SELECT username FROM user WHERE username='".addslashes(htmlspecialchars($ausername))."' AND userid != $userid");
  if(
$exists[username] == "$ausername") {
     echo 
"<p>[ error message here]</p>";
     exit;
  } 
regards... also you forgot the ' slashes around addslashes

g-force2k2
Reply With Quote
  #6  
Old 08-30-2002, 08:59 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It didnt fix it, even with gforce's attempt...

I now get this error :

Code:
Database error in vBulletin Control Panel 2.2.5:

Invalid SQL: SELECT username FROM user WHERE username='9Teen90Nine' AND userid != 
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064
Satan
Reply With Quote
  #7  
Old 08-30-2002, 09:02 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hell satan its because you have an empty $userid... the userid variable doesn't seem like its being selected... regards...

edit: what coding do you have that uses the $userid variable?

g-force2k2
Reply With Quote
  #8  
Old 08-30-2002, 09:07 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How do you mean gforce?

It is supposed to work in the user.php from the admin file...It is just not working, and I cannot start again, because it is hacked, and I have forgotten which ones I added

Satan
Reply With Quote
  #9  
Old 08-30-2002, 09:11 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hellsatan i just looked at admin/user.php

find:

PHP Code:
$exists $DB_site->query_first("SELECT username FROM user WHERE username='".addslashes(htmlspecialchars($ausername))."' AND userid != $userid"); 
replace with:

PHP Code:
$exists $DB_site->query_first("SELECT username FROM user WHERE username='".addslashes(htmlspecialchars($ausername))."'"); 
see if that works hellsatan... regards...

g-force2k2
Reply With Quote
  #10  
Old 08-30-2002, 09:24 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks...

It sorta works...

Now when I try to update someone, I get :

"There is already an [user] named 9Teen90Nine"

Satan
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:30 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06477 seconds
  • Memory Usage 2,292KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (7)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete