Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 09-25-2001, 08:10 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, here it is.
This might not be the best way to do this, but well, it's something.

I'm just packed with jobs lately, just can't do them all.
And since I do have some previous commitments (yes, even earlier than this one), I must complete them first.
Veyr sorry, Ruth.

1. Run this query:
Code:
CREATE TABLE tip (
  tipid SMALLINT(5) not null AUTO_INCREMENT,
  title VARCHAR(100) not null,
  tiptext MEDIUMTEXT not null,
  PRIMARY KEY (tipid)
)
2. Save this as tip.php, and upload to your main folder:
PHP Code:
<?php

error_reporting
(7);

require(
"./global.php");

$action trim($action);
if (!isset(
$action)==0) {
  
$action "showtip";
}

// ################################ start quick rate ###############################
if ($action=="showtip") {
  
$tip=$DB_site->query_first("SELECT * FROM tip ORDER BY rand()");
  echo(
"$tip[tipid]");
  eval(
"\$showtip = \"".gettemplate("tip_showtip")."\";");
}

eval(
"dooutput(\"".gettemplate("tip_main")."\");");

?>
3. Save this as tip.php and upload to your admin folder:
PHP Code:
<?php
error_reporting
(7);

require(
"./global.php");

cpheader();

if (isset(
$action)==0) {
  
$action="edit";
}

// ########################### Start Doadd ##########################
if ($action=="doadd") {

  for (
$i=1$i<=$numtips$i++) {
    if (
$tiptext[$i]!="" and $title[$i]!="") {
      
$DB_site->query("INSERT INTO tip (tipid,title,tiptext) VALUES (NULL,'".addslashes($title[$i])."','".addslashes($tiptext[$i])."')");
    }
  }
  
$action="modify";

  echo 
"<p>Record added</p>";

}

// ############################ Start Add ###########################
if ($action=="add") {

  
doformheader("tip","doadd");
  for (
$i=1$i<=$numtips$i++) {
    
maketableheader("Tip #$i");
    
makeinputcode("Title","title[$i]");
    
maketextareacode("Tip Text<br>(You may use HTML)","tiptext[$i]","","10");
  }
  
makehiddencode("numtips","$numtips");
  
doformfooter("Add");

}

// ########################## Start Preadd ##########################
if ($action=="preadd") {

  
doformheader("tip","add");
  
maketableheader("Add new tips");
  
makeinputcode("Number of tips to add","numtips","1");
  
doformfooter("Start");

}

// ########################## Start Modify ##########################
if ($action=="edit") {

  
$tips=$DB_site->query("SELECT * FROM tip");
  
$i=1;
  while (
$curtip=$DB_site->fetch_array($tips)) {
    if (
$title[$curtip[tipid]]=="" or $tiptext[$curtip[tipid]]=="") {
      
$DB_site->query("DELETE FROM tip WHERE tipid='$curtip[tipid]'");
      echo 
"Deleting tip #$i ...<br>";
    } else {
      
$DB_site->query("UPDATE tip SET title='".addslashes($title[$curtip[tipid]])."',tiptext='".addslashes($tiptext[$curtip[tipid]])."' WHERE tipid='$curtip[tipid]'");
      echo 
"Saving tip #$i ...<br>";
    }
    
$i++;
  }
  
$action="modify";

  echo 
"<p>Done</p>";

}

cpfooter();
?>
4. Save this as tip_main template:
Code:
{htmldoctype}
<html>
<head><title>Tip of the moment!</title>
$headinclude
</head>
<body>

$showtip

</body>
</html>
5. Save this as tip_showtip template:
Code:
<normalfont><b>$tip[title]:</b><br><br>

$tip[tiptext]</normalfont>
6. In index.php of the admin folder add this:
PHP Code:
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("Tips"); ?>
</table>
<a href="tip.php?s=<?php echo $session[sessionhash]; ?>&action=preadd"> Add </a> |
<a href="tip.php?s=<?php echo $session[sessionhash]; ?>&action=modify"> Modify </a>
</td></tr>
right BEFORE this:
PHP Code:
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" id="navtable">
<?php maketableheader("Avatars"); ?>
</table>
<a href="avatar.php?s=<?php echo $session[sessionhash]; ?>&action=upload"> Upload </a> |
<a href="avatar.php?s=<?php echo $session[sessionhash]; ?>&action=add"> Add </a> |
<a href="avatar.php?s=<?php echo $session[sessionhash]; ?>&action=modify"> Modify </a>
</td></tr>
That's it.
This will display a random tip on every page load.

I understand if you don't want to use this, it's far from perfect.

Sorry again.
Reply With Quote
  #22  
Old 09-25-2001, 08:19 PM
Ruth Ruth is offline
 
Join Date: Oct 2001
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much FireFly

it is better than nothing, i'll try it soon...

thanks again for your time...you are great
Reply With Quote
  #23  
Old 09-26-2001, 12:10 PM
inetd inetd is offline
 
Join Date: Nov 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you have demo or screenshot's?
Reply With Quote
  #24  
Old 09-26-2001, 06:13 PM
sysmom sysmom is offline
 
Join Date: Oct 2001
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Although there's no vB admin interface to it, last week I quickly wrote up a bare bones little "verse of the day" script that works with a client's vbPortal.

It reads from a two field flat file and spits out a new one every day.

If this little scrap of code would be helpful to anyone, please let me know.

It could be used for quotes, tips, well, you know...

deb
Reply With Quote
  #25  
Old 09-27-2001, 07:03 PM
Ruth Ruth is offline
 
Join Date: Oct 2001
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FireFly, i think the modify link in the CP is not working, besides what is the command to show tips in the pages?
Reply With Quote
  #26  
Old 09-28-2001, 12:47 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use this code in the pages:
PHP Code:
  $tip=$DB_site->query_first("SELECT * FROM tip ORDER BY rand()");
  echo(
"$tip[tipid]");
  eval(
"\$showtip = \"".gettemplate("tip_showtip")."\";"); 
and just add $showtip wherever you want it.

Looks like I forgot a big part from the tip.php file, I'll find it in a min.
Reply With Quote
  #27  
Old 09-28-2001, 11:24 PM
shadowbreed shadowbreed is offline
 
Join Date: Oct 2001
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any idea why the modify option won't work?
Reply With Quote
  #28  
Old 09-29-2001, 07:01 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I forgot that whole part from my file, and now it's not in my file anymore!
I guess I'll have to re-write it.
Arrgh...
Reply With Quote
  #29  
Old 10-10-2001, 01:03 AM
Ruth Ruth is offline
 
Join Date: Oct 2001
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by FireFly
Yeah, I forgot that whole part from my file, and now it's not in my file anymore!
I guess I'll have to re-write it.
Arrgh...
any updates?

thanks
Reply With Quote
  #30  
Old 11-04-2001, 07:20 PM
Ruth Ruth is offline
 
Join Date: Oct 2001
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can anyone finish this hack?

and the ability maybe to make usergroups defined.

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 05:32 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.04410 seconds
  • Memory Usage 2,313KB
  • 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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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_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