Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Prev Previous Post   Next Post Next
  #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
 

Thread Tools
Display Modes

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 08:26 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.03657 seconds
  • Memory Usage 2,330KB
  • Queries Executed 12 (?)
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)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)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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