vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   why won't this thing insert?! (https://vborg.vbsupport.ru/showthread.php?t=45435)

N!ck 11-05-2002 10:45 PM

why won't this thing insert?!
 
i've got a bit of a problem with a php script i'm working on:

PHP Code:

<?
require("./global.php");
$uinfo=$DB_site->query("SELECT userid,password FROM user WHERE username = '$USER'");
if ($uinfo[password]!=$PASS) exit;
$DB_site->query("INSERT INTO nowplaying (nowplayingid,userid,song,artist,album,dateline) VALUES ('0','".$uinfo[userid]."','$SONG','$ARTIST','$ALBUM','".time()."'");
$DB_site->query("UPDATE user SET npsong = '$SONG' AND npartist = '$ARTIST'");
?>

it's not inserting anything into the "nowplaying" table and it's not updating the user table like it should. any ideas?

thanks.

JulianD 11-06-2002 01:46 AM

First, make sure this bit of code isn't stopping the execution:

Code:

if ($uinfo[password]!=$PASS) exit;
I'd suspect that you aren't encrypting the $PASS value, so you might be comparing an encrypted password, with a non-encrypted password... So the execution is stopped.

Lesane 11-06-2002 10:29 AM

Use: $uinfo=$DB_site->query_first

N!ck 11-06-2002 12:17 PM

here's what i've got:

PHP Code:

<?
require("./global.php");
$uinfo=$DB_site->query_first("SELECT userid, password FROM user WHERE username = '$USER'");
if ($uinfo[password]!=$PASS) exit;
$SONG=addslashes($SONG);
$ARTIST=addslashes($ADDSLASHES);
$ALBUM=addslashes($ALBUM);
$DB_site->query("INSERT INTO nowplaying (nowplayingid, userid, song, artist, album, dateline) VALUES ('0', '".$uinfo[userid]."', '$SONG', '$ARTIST', '$ALBUM', '".time()."')");
?>

it still won't insert, and it seems $ARTIST is not being set from the query string as it should, because i got it to insert once when i used $bbuserinfo rather than my own query and the artist field was blank. however, i need to use my own query.

Lesane 11-06-2002 12:59 PM

Shouldn't be this:

PHP Code:

$ARTIST=addslashes($ARTIST); 

Instead of:

PHP Code:

$ARTIST=addslashes($ADDSLASHES); 

And like 'JulianD' already said, u probably compare an encrypted password with a non-encrypted password.

Where is $PASS coming from?

N!ck 11-06-2002 05:51 PM

oops! yeah, thanks for pointing that out.

but $PASS is already md5()'ed


All times are GMT. The time now is 07:08 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.01118 seconds
  • Memory Usage 1,721KB
  • 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
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete