Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2003, 04:53 AM
99SIVTEC 99SIVTEC is offline
 
Join Date: Nov 2001
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Auto Insert Username

I'm making a timeslip database for one of my car sites. On the page where a user can submit their own timeslip I would like the "driver" name field to automatically fill in with the persons screen name from the vbulletin forum. Is this possible? Can anyone shed some light on how I would go about this? In the displayed results I would also like to have the username linked to their profile as well if possible.
Reply With Quote
  #2  
Old 09-01-2003, 05:16 AM
EvilLS1's Avatar
EvilLS1 EvilLS1 is offline
 
Join Date: Apr 2002
Location: Georgia, USA
Posts: 987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this file be in your vB directory? If so:

Make sure your php file contains this:
Code:
require('./global.php');
And then use this as the default input value in your form:
Code:
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$userid">$bbuserinfo[username]</a>
Reply With Quote
  #3  
Old 09-01-2003, 04:06 PM
99SIVTEC 99SIVTEC is offline
 
Join Date: Nov 2001
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I added that, but when I display the results it is just showing $bbuserinfo[username]. Now does it matter if i'm using a different database for this hack apart from my vbulletin db? Should I just go ahead and add the contents of this database to my vb? Maybe that is the problem
Reply With Quote
  #4  
Old 09-01-2003, 04:06 PM
99SIVTEC 99SIVTEC is offline
 
Join Date: Nov 2001
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

btw, sorry i'm pretty new to all of this
Reply With Quote
  #5  
Old 09-01-2003, 04:09 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The file has to be in PHP format (.PHP) also, if you arent using HTML in the file, you use

PHP Code:
echo("<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$userid\">$bbuserinfo[username]</a>"); 
If you are using HTML, use

PHP Code:
<?php
     
echo("<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$userid\">$bbuserinfo[username]</a>");
?>
Reply With Quote
  #6  
Old 09-01-2003, 04:52 PM
99SIVTEC 99SIVTEC is offline
 
Join Date: Nov 2001
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

here are the contents of my timeslipadd.php which is the part that actually adds the timeslip info to the database. The part that i'm trying to get to display the username is "DRIVER"

PHP Code:
<?php
require('./global.php');
include (
"mainfile.php"); 
$index 1;
global 
$menu_id,$menu,$Pmenu,$activeusers;
$Pmenu="P_thememenu_homepage";
include(
"header.php");
?>
<body bgcolor="c9cace" text="000000" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF"><center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#333D4D" width="100%">
    <tr>
      <td width="100%">
<div align="center">
  <center>
      </center>
</div>
<div align="center">
  <center>
      </center>
</div>
<div align="center">
  <center>
      </center>
</div>
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4" background="/vbulletin/images/bg.jpg">
    <tr>
      <td width="100%" align="center" bgcolor="ececec">

<?php 

$dbh
=mysql_connect ("localhost""xxxxxxx""xxxxxxx") or die ('I cannot connect to the database.');
mysql_select_db ("xxxxxxx_forums"); 

if(
$submit == "submit")


$sql "INSERT INTO TIMESLIPS (DRIVER,MAKE,MODEL,YEAR,INDUCTION,ET,TRAP,LOCATION) 
VALUES ('
$DRIVER','$MAKE','$MODEL','$YEAR','$INDUCTION','$ET','$TRAP','$LOCATION')";     
$result mysql_query($sql); 
if (!
$sql) { 
echo 
mysql_error(); 
}
echo
"<META HTTP-EQUIV='refresh' content='0;URL=http://www.sportcompactracing.com/vbulletin/TIMESLIP.php'>";

Else 

?> 
<form method=post action='<?php echo $PHP_SELF?>'>
          <p><font color="000000">Driver<br>
            <input name="DRIVER" type="text" value="&lt;a href=&quot;member.php?s=$session[sessionhash]&amp;action=getinfo&amp;userid=$userid&quot;&gt;$bbuserinfo[username]&lt;/a&gt;"member.php?s=$session[sessionhash]&action=getinfo&userid=$userid">
            <br>
            make<br>
            <select name="MAKE" size="1" id="MAKE">
              <option>Acura</option>
              <option>Audi</option>
              <option>BMW</option>
              <option>Chevrolet</option>
              <option>Dodge</option>
              <option>Ford</option>
              <option>Honda</option>
              <option>Lexus</option>
              <option>Mazda</option>
              <option>Mercedes</option>
              <option>MINI</option>
              <option>Mitsubishi</option>
              <option>Nissan</option>
              <option>Porsche</option>
              <option>Saab</option>
              <option>Subaru</option>
              <option>Toyota</option>
              <option>Volkswagen</option>
              <option>Volvo</option>
            </select>
            <br>
            model<br>
            <input type=Text name='MODEL' >
            <br>
            year<br>
            <select name="YEAR" size="1" id="YEAR">
              <option>1980</option>
              <option>1981</option>
              <option>1982</option>
              <option>1983</option>
              <option>1984</option>
              <option>1985</option>
              <option>1986</option>
              <option>1987</option>
              <option>1988</option>
              <option>1989</option>
              <option>1990</option>
              <option>1991</option>
              <option>1992</option>
              <option>1993</option>
              <option>1994</option>
              <option>1995</option>
              <option>1996</option>
              <option>1997</option>
              <option>1998</option>
              <option>1999</option>
              <option>2000</option>
              <option>2001</option>
              <option>2002</option>
              <option>2003</option>
              <option>2004</option>
              <option>2005</option>
              <option>2006</option>
              <option>2007</option>
              <option>2008</option>
              <option>2009</option>
              <option>2010</option>
            </select>
            <br>
            Power Adder<br>
            <select name="INDUCTION" size="1" id="INDUCTION">
              <option>N/A</option>
              <option>Turbocharged</option>
              <option>Supercharged</option>
              <option>Nitrous Oxide</option>
              <option>Other</option>
            </select>
            <br>
            ET<br>
            <select name="ET" size="1" id="ET">
              <option>9.00</option>
              <option>9.10</option>
              <option>9.20</option>
              <option>9.30</option>
              <option>9.40</option>
              <option>9.50</option>
              <option>9.60</option>
              <option>9.70</option>
              <option>9.80</option>
              <option>9.90</option>
              <option>10.00</option>
              <option>10.10</option>
              <option>10.20</option>
              <option>10.30</option>
              <option>10.40</option>
              <option>10.50</option>
              <option>10.60</option>
              <option>10.70</option>
              <option>10.80</option>
              <option>10.90</option>
              <option>11.00</option>
              <option>11.10</option>
              <option>11.20</option>
              <option>11.30</option>
              <option>11.40</option>
              <option>11.50</option>
              <option>11.60</option>
              <option>11.70</option>
              <option>11.80</option>
              <option>11.90</option>
              <option>12.00</option>
              <option>12.10</option>
              <option>12.20</option>
              <option>12.30</option>
              <option>12.40</option>
              <option>12.50</option>
              <option>12.60</option>
              <option>12.70</option>
              <option>12.80</option>
              <option>12.90</option>
              <option>13.00</option>
              <option>13.10</option>
              <option>13.20</option>
              <option>13.30</option>
              <option>13.40</option>
              <option>13.50</option>
              <option>13.60</option>
              <option>13.70</option>
              <option>13.80</option>
              <option>13.90</option>
              <option>14.00</option>
              <option>14.10</option>
              <option>14.20</option>
              <option>14.30</option>
              <option>14.40</option>
              <option>14.50</option>
              <option>14.60</option>
              <option>14.70</option>
              <option>14.80</option>
              <option>14.90</option>
              <option>15.00</option>
              <option>15.10</option>
              <option>15.20</option>
              <option>15.30</option>
              <option>15.40</option>
              <option>15.50</option>
              <option>15.60</option>
              <option>15.70</option>
              <option>15.80</option>
              <option>15.90</option>
              <option>16.00</option>
              <option>16.10</option>
              <option>16.20</option>
              <option>16.30</option>
              <option>16.40</option>
              <option>16.50</option>
              <option>16.60</option>
              <option>16.70</option>
              <option>16.80</option>
              <option>16.90</option>
              <option>17.00</option>
              <option>17.10</option>
              <option>17.20</option>
              <option>17.30</option>
              <option>17.40</option>
              <option>17.50</option>
              <option>17.60</option>
              <option>17.70</option>
              <option>17.80</option>
              <option>17.90</option>
              <option>18.00</option>
            </select>
            <br>
            Trap Speed<br>
            <input type=Text name='TRAP'>
            <br>
            Location<br>
            <input type=Text name='LOCATION'>
            <br>
            </font><br>
            <input type=submit name=submit value=submit>
          </p>
</form>
<? 

?> 
<?php
echo "<br>"
include(
"footer.php");
?>
Reply With Quote
  #7  
Old 09-01-2003, 04:56 PM
99SIVTEC 99SIVTEC is offline
 
Join Date: Nov 2001
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then this is the main file that displays the results (I haven't worked on it too much).

PHP Code:
<?php
require('./global.php');
include (
"mainfile.php"); 
$index 1;
global 
$menu_id,$menu,$Pmenu,$activeusers;
$Pmenu="P_thememenu_homepage";
include(
"header.php");
?>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#333D4D" width="100%">
    <tr>
      <td width="100%" bgcolor="f5f5f5">
<div align="center">
  <center>
      </center>
    </div>
    <div align="center"> 
      <center>
      </center>
    </div>
    <div align="center"> 
      <center>
      </center>
    </div>
    <div align="center"> 
      <p><font size="2" face="Arial, Helvetica, sans-serif"><a href="timeslipadd.php"><font color="123642" class="nf"><b>Add 
        your Timeslip to the Database</b></font></a> </font></p>
    </div> 
<tr> 
  <td width="100%"> <table width="98%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000">
      <tr bgcolor="0072BC"> 
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=DRIVER">Driver</a> 
            </font></div></th>
        <!-- the other six headers omitted... -->
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=MAKE">Make</a> 
            </font></div></th>
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=Model">Model</a> 
            </font></div></th>
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=Year">Year</a> 
            </font></div></th>
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=Induction">Power 
            Adder</a> </font></div></th>
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=ET">1/4 
            Mile ET</a> </font></div></th>
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=Trap">Trap 
            Speed</a> </font></div></th>
        <th> 
          <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><a href="TIMESLIP.php?sortby=LOCATION">Track 
            Name</a> </font></div></th>
      </tr>
      <? 
if(empty($sortby)) $sortby = "ET"; 
$dbh=mysql_connect ("localhost", "xxx_xx", "xxxxxx") or die ('I cannot connect to the database.');  
mysql_select_db ("xxx_forums");   
$result = @mysql_query("SELECT * FROM TIMESLIPS ORDER BY $sortby");    
if (!$result)  
{      
  echo("<p>Error performing query: " . mysql_error() . "</p>");  
  exit();    
}    
while ($row = mysql_fetch_array($result))  
{  
  $driver = $row["DRIVER"]; 
  $make = $row["MAKE"];
  $model = $row["MODEL"];
$year = $row["YEAR"];
$induction = $row["INDUCTION"];
$et = $row["ET"];
$trap = $row["TRAP"];
$trackname = $row["LOCATION"]; 
?>
      <tr bgcolor="f5f5f5"> 
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$driver?>
            </font></div></td>
        <!-- six other columns here...-->
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$make?>
            </font></div></td>
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$model?>
            </font></div></td>
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$year?>
            </font></div></td>
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$induction?>
            </font></div></td>
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$et?>
            </font></div></td>
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$trap?>
            </font></div></td>
        <td> 
          <div align="center"> <font color="000000" size="2" face="Arial, Helvetica, sans-serif"> 
            <?=$trackname?>
            </font></div></td>
      </tr>
      <? 

?>
    </table><font size="2" face="Arial, Helvetica, sans-serif"></body></font> 
<font size="2" face="Arial, Helvetica, sans-serif"> 
<?php
echo "<br>"
include(
"footer.php");
?>
</font>
Reply With Quote
  #8  
Old 09-01-2003, 05:03 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Apologies but I thought you were doing something else, so my code won't work.
Reply With Quote
  #9  
Old 09-01-2003, 05:10 PM
99SIVTEC 99SIVTEC is offline
 
Join Date: Nov 2001
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not a problem. That's why I just went ahead and put the code up so you guys know what i'm trying to do
Reply With Quote
  #10  
Old 09-02-2003, 12:14 AM
99SIVTEC 99SIVTEC is offline
 
Join Date: Nov 2001
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, so when I use

PHP Code:
<?php 
     
echo("<a href=\"member.php?s=$session[sessionhash]&action=getinfo&userid=$userid\">$bbuserinfo[username]</a>"); 
?>
In my form as a test it properly displays my username, but the link to the profile is wrong. It takes me to :

http://www.mywebsite.com/vbulletin/m...etinfo&userid=

it leaves the userid off from what I can tell.

When I use

PHP Code:
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$userid">$bbuserinfo[username]</a
as the default value for my form it kind of works, but the results page doesn't display the username. It only displays:

$bbuserinfo[username]

Which then links to :

http://www.mywebsite.com/vbulletin/member.php?s=$session[sessionhash]&action=getinfo&userid=$userid

which isn't correct.

Any idea's? I'm trying everything I can think of. I plan to just use the echo command to display the username on the timeslipadd page, then a hidden form to actually insert into the database, or can I actually use an insert command to get the username into that field at the same time they submit the rest of teh data via the form?

Thanks for all the help guys. I think we are close
Reply With Quote
Reply

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 01:22 AM.


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.04563 seconds
  • Memory Usage 2,339KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_code
  • (6)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