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

Reply
 
Thread Tools Display Modes
  #1  
Old 05-27-2002, 08:46 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default not inserting?

this biznitch works fine with one exception. when a user tries to register, it returns that he has been successfully registered, but it doesn't seem to insert the user's information. help!

PHP Code:
<?
function dbstart () {
 mysql_connect("localhost", "xxxxxxx", "xxxxxxx");
 mysql_select_db("xxxxxxx");
}

function dbquit () {
 mysql_close();
}

if ($action=="register") {
 if ($yim=="YIM") {
  $yim="";
 }
 if ($aim=="AIM") {
  $aim="";
 }
 if ($icq=="ICQ") {
  $icq="";
 }
 if ($msn=="MSN") {
  $msn="";
 }
 $email=addslashes($email);
 $msn=addslashes($msn);
 $aim=addslashes($aim);
 $yim=addslashes($yim);
 dbstart();
 mysql_query("INSERT INTO shoutboxuser (userid, username, password, email, homepage, yim, aim, icq, msn) VALUES ('0', '$username', '$password', '$email', '$homepage', '$yim', '$icq', '$msn')");
 $msg="You have been successfully registered.  You may now post shouts.";
 dbquit();
}

if ($action=="regform") {
 $msg.="<form action=\"shoutbox.php?action=register\" method=\"post\"><table border=0 cellpadding=2 cellspacing=1>";
 $msg.="<tr><td bgcolor=\"#000033\" align=center><font color=\"#FFFFFF\" face=\"verdana, arial, sans-serif, helvetica, times\" size=2><b>sign up</b></font></td></tr>";
 $msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"username\" size=30 maxlength=20 value=\"username\"></td></tr>";
 $msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"password\" size=30 maxlength=20 value=\"password\"></td></tr>";
 $msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"email\" size=30 maxlength=150 value=\"your email\"></td></tr>";
 $msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"yim\" size=15 maxlength=50 value=\"YIM\"><input onFocus=\"this.value=''\" type=text name=\"aim\" size=15 maxlength=50 value=\"AIM\"></td></tr>";
 $msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"icq\" size=15 maxlength=50 value=\"ICQ\"><input onFocus=\"this.value=''\" type=text name=\"msn\" size=15 maxlength=50 value=\"MSN\"></td></tr>";
 $msg.="<tr><td align=center><input type=submit onClick=\"this.value=' please wait... '\" value=\" sign up \"></td></tr></table></form>";
}

if ($action=="shout" && $username!="" && $password!="") {
 dbstart();
 $uinfo = mysql_fetch_array(mysql_query("SELECT userid FROM shoutboxuser WHERE username = '$username' AND password = '$password'"));
 $uid = $uinfo[userid];
 if ($uid=="") {
  $msg="Error!  Your username and password combination were not accepted.";
 } else {
  $dateline=time();
  mysql_query("INSERT INTO shoutbox (id, uid, shout, dateline) VALUES ('0', '$uid', '$shout', '$dateline')");
  $msg="";
 }
 dbquit();
}
?>
<html>
<head>
<title>shoutbox - get back in the frames ;)</title>
</head>
<body bgcolor="#0099FF" text="#000033" link="#000099" vlink="#000099">
<img src="/images/titles/shoutbox.gif" width="225" height="67">
<p>
<font face="verdana, arial, sans-serif, helvetica, times" size="2">
<?
if ($msg!="") {
 echo "<center><font face=\"#0000FF\"><b>" . $msg . "</b></font></center><p>";
}
?>
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr><td bgcolor="#000033"><font face="verdana, arial, sans-serif, helvetica, times" size="1" color="#FFFFFF"><b>user</b></font></td><td bgcolor="#000033"><font face="verdana, arial, sans-serif, helvetica, times" size="1" color="#FFFFFF"><b>shout</b></font></td></tr>
<?
dbstart();
$sq=mysql_query("SELECT shoutbox.*,shoutboxuser.* FROM shoutbox LEFT JOIN shoutboxuser ON (shoutbox.uid = shoutboxuser.userid) ORDER BY shoutbox.id DESC LIMIT 30");
while ($shout=mysql_fetch_array($sq)) {
?>
<tr><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2"><? echo $shout[username]; ?></font></td><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2"><? echo $shout[shout]; ?></font></td></tr>
<?
}
?>
</table>
<p>
<center><form action="shoutbox.php?action=shout" method="post">
<table border="0" cellpadding="2" cellspacing="1">
<tr><td colspan="2" bgcolor="#000033" align="center"><font face="verdana, arial, sans-serif, helvetica, times" size="2" color="#FFFFFF"><b>Leave a Shout</b></font></td></tr>
<tr><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2">Username:</font></td><td bgcolor="#0066FF"><input type="text" name="username" size="30" maxlength="20"></td></tr>
<tr><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2">Password:</font></td><td bgcolor="#0066FF"><input type="password" name="password" size="30" maxlength="20"></td></tr>
<tr><td colspan="2" align="center" bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="1">Not registered?  <a href="shoutbox.php?action=regform">Click here.</a></font></td></tr>
<tr><td bgcolor="#0066FF" valign="top"><font face="verdana, arial, sans-serif, helvetica, times" size="2">Shout:</font></td><td bgcolor="#0066FF"><textarea rows="5" cols="28" name="shout" WRAP></textarea></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value=" shout! "></td></tr>
</table></form></center>
<?
dbquit();
?>
</body>
</html>
Reply With Quote
  #2  
Old 05-28-2002, 10:11 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont know the structure of your "shoutboxuser" table however doesnt it have an primary key with autoincrement? It's very likely that userid is such a field and if it is, your query must be:

mysql_query("INSERT INTO shoutboxuser (userid, username, password, email, homepage, yim, aim, icq, msn) VALUES (NULL, '$username', '$password', '$email', '$homepage', '$yim', '$icq', '$msn')");

If it does not work for you, insert:

echo mysql_error();

after this line to debug..
Reply With Quote
  #3  
Old 05-28-2002, 06:42 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
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 12:13 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.03915 seconds
  • Memory Usage 2,195KB
  • Queries Executed 11 (?)
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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete