Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2000
Posts: 129
Member
Member
Offline
Joined: Sep 2000
Posts: 129
Anyone can develop hack for the main page which displays something like:
"Welcome to our newest member: username."
"Total post:###"

Any helps will be appreciate it.

-santanablank-


...... x ......
Using UBBt 6.4.2 + Digg Ajax Mod, Trust Ajax Mod, Captcha Regristation & Login mod, Checkusername Ajax mode.
Sponsored Links
Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
Cute idea. I think you'd want to add something like this:


// show last username
if ($config['showreg']) {
$sth = $dbh->do_query("select U_Username from w3t_Users order by U_Number DESC limit 1");
$lastUser = $dbh -> fetch_array($sth);
$lastUserText = "Welcome to our newest member: $lastUser<BR>";
$dbh -> finish_sth($sth);
}


Then right above where he prints $showreg you add $lastUserText.

Let me know if it works, maybe I'll use it on my site. []/w3timages/icons/wink.gif[/]

-F



Joined: Sep 2000
Posts: 129
Member
Member
Offline
Joined: Sep 2000
Posts: 129
fmann, thanks, but it doesn't work.
It says: Welcome to our newest member: array

Any idea why?

-santanablank-


...... x ......
Using UBBt 6.4.2 + Digg Ajax Mod, Trust Ajax Mod, Captcha Regristation & Login mod, Checkusername Ajax mode.
Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
Probably beause the code has a bug in it.

// show last username
if ($config['showreg']) {
$sth = $dbh->do_query("select U_Username from w3t_Users order by U_Number DESC limit 1");
list($lastUser) = $dbh -> fetch_array($sth);
$lastUserText = "Welcome to our newest member: $lastUser<BR>";
$dbh -> finish_sth($sth);
}


Should do the trick... But I didn't test it out. That's cause fetch_array() returns an array. And when you try to print out an array and not a member in the array PHP is smart and prints "array" to help you debug..

If that code up there doesn't work then this should.

// show last username
if ($config['showreg']) {
$sth = $dbh->do_query("select U_Username from w3t_Users order by U_Number DESC limit 1");
$lastUser = $dbh -> fetch_array($sth);
$lastUserText = "Welcome to our newest member: $lastUser[0]<BR>";
$dbh -> finish_sth($sth);
}


If not then I use the excuse that I didn't really take a close look at it and I'm sleep deprived. And that I'm assuming that fetch_array() returns an array based on the fact that it printed the word "array".

Doug
http://www.netherworldrpg.net

Joined: Sep 2000
Posts: 129
Member
Member
Offline
Joined: Sep 2000
Posts: 129
Doug, that should do the trick!
Well done! It works just fine. []/w3timages/icons/smile.gif[/]

thanks

-santanablank-


...... x ......
Using UBBt 6.4.2 + Digg Ajax Mod, Trust Ajax Mod, Captcha Regristation & Login mod, Checkusername Ajax mode.
Sponsored Links
Joined: Jan 2001
Posts: 97
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 97
Woukd this work for the Perl version too ya think?

Brew
CustomShowCars.com
OldHouseForums.net
PoliticalForums.net



Brew
CustomShowCars.com
OldHouseForums.com
PoliticalForums.net
pcgnetworks.com
ut2003news.com
rtcwnews.com
bf1942news.com
nolf2news.com
Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
I installed it into wwwthreads.php and categories.php



I got this variant of your code working best:

// HACK: show last username
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT U_Username FROM w3t_Users ORDER BY U_Number DESC LIMIT 1");
$lastUser = $dbh -> fetch_array($sth);
$showreg = "$showreg
Welcome to our newest member: $lastUser[0]";
$dbh -> finish_sth($sth);
}
//end hack


My version should be put in right after that chunk of code:

// --------------------------------------------------------------------------
// Let's see how many total registered users there are but only if we want to
// display this information
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT COUNT(*) FROM w3t_Users");
$registered = $dbh -> fetch_array($sth);
$showreg = "$registered[0] $lang[REGED_USERS]";
$dbh -> finish_sth($sth);
}


It can be fine tuned by replacing the text strings with variables from the language file...

Carl

----------
http://www.colour-ize.de/forum (test entry: user: 'test' pw: 'test')

Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
That's not the proper way to concatenate strings in PHP... while that works because of the structure of the langauge... if you run Zend Optimizer that's bad syntax because that code can't be optimized. Proper concatenation is $showreg = $showreg . "Text here";



Doug
http://www.netherworldrpg.net

Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
I haven't run the Perl version of W3T for a long time... but I'll download the Perl version tonight and I'll look at it and try and come up with the code for the Perl version.


Doug
http://www.netherworldrpg.net

Joined: Jan 2001
Posts: 97
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 97
In reply to:

I haven't run the Perl version of W3T for a long time... but I'll download the Perl version tonight and I'll look at it and try and come up with the code for the Perl version.



That would be great Doug!

Thanx!

Brew
CustomShowCars.com
OldHouseForums.net
PoliticalForums.net



Brew
CustomShowCars.com
OldHouseForums.com
PoliticalForums.net
pcgnetworks.com
ut2003news.com
rtcwnews.com
bf1942news.com
nolf2news.com
Sponsored Links
Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
Cool. Good to know. I put that in right away in my code. Thanks... Looks like we are finally getting there :)

Carl

----------
http://www.colour-ize.de/forum (test entry: user: 'test' pw: 'test')

Joined: Aug 2000
Posts: 2
Newbie
Newbie
Offline
Joined: Aug 2000
Posts: 2
// HACK: show last username
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT U_Username FROM w3t_Users ORDER BY U_Number DESC LIMIT 1");
$lastUser = $dbh -> fetch_array($sth);
$showreg = $showreg . "Welcome to our newest mama:$lastUser[0]";
$dbh -> finish_sth($sth);
}
//end hack


look into your categories.php and your wwwthreads.php files- you will find this code:

// --------------------------------------------------------------------------
// Let's see how many total registered users there are but only if we want to
// display this information
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT COUNT(*) FROM w3t_Users");
$registered = $dbh -> fetch_array($sth);
$showreg = "$registered[0] $lang[REGED_USERS]";
$dbh -> finish_sth($sth);
}

add the hack right beneath this code (a space in between is ok!)

i know how hard it is to get the feel for hacks and such- like the idea but scared to mess up your script! . smile hope this helps someone!

just seeing if this works...

[]/testimages/icons/wink.gif[/]

Joined: Oct 2000
Posts: 12
User
User
Offline
Joined: Oct 2000
Posts: 12
Ok This is a cool idea and works great (when you type the codeing in correctly).

Thanks!

Edited by MrFrog on 07/21/01 11:55 AM.


Joined: Aug 2000
Posts: 2
Newbie
Newbie
Offline
Joined: Aug 2000
Posts: 2
um. of course, you would want to substitute the word 'user' in your code for 'mama' in mine. []/testimages/icons/smile.gif[/]

amity

just seeing if this works...

[]/testimages/icons/wink.gif[/]

Joined: Oct 2000
Posts: 12
User
User
Offline
Joined: Oct 2000
Posts: 12
LOL yes I did notice that the fist time it poped up and went back and changed it.



Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)