vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Some help please? (https://vborg.vbsupport.ru/showthread.php?t=42966)

Chris M 08-30-2002 08:41 PM

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

NTLDR 08-30-2002 08:43 PM

Whats the database error you are getting?

g-force2k2 08-30-2002 08:47 PM

hellsatan try changing::

PHP Code:

userid <> $userid 

to

PHP Code:

userid != $userid 

regards... as for the member issue ouch ;)

g-force2k2

Chris M 08-30-2002 08:49 PM

Thanks gforce...I shall try that;)

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

Satan

g-force2k2 08-30-2002 08:52 PM

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

Chris M 08-30-2002 08:59 PM

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

g-force2k2 08-30-2002 09:02 PM

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

Chris M 08-30-2002 09:07 PM

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

g-force2k2 08-30-2002 09:11 PM

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

Chris M 08-30-2002 09:24 PM

Thanks...

It sorta works...

Now when I try to update someone, I get :

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

Satan


All times are GMT. The time now is 10:06 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01130 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete