Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 12-22-2002, 12:29 AM
ciqala ciqala is offline
 
Join Date: Nov 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default add an admin only javascript field in posts

I have a dvd forum and when i create a post about a release i include a cover picture and a link to amazon.com

I now want to use the "buy it from amazon" buttons which creates an amazon style image and when its clicked you can add to your amazon cart instantly and carry on looking at the forum or go to checkout.

the problem is they give you a piece of javascript to insert and I understand putting the ability to post executable javascript in a post is a big big security no no.

the only apparent solution would be to add a new field to the page where you create your post which only appears for admins

you can then post the code into the fiels and have it appear in the top of the postbit or wherever you want.

it would need to be database driven so that it could store the code but my programming knowledge sadly only includes if...endif and include() when it comes to php. plus i'm not sure if it would be better to create a new table to store the info or if you should add it to the end of one of the other tables...

anyways i think this is a hack that would be very useful for a multitude of reasons not limited only to amazon buttons it would allow the admins to use any <script> code they wanted without fear of the users being able to do the same.

here is an example of the code i need to include...
Quote:
<script language="JavaScript">
function popUp(URL,NAME) {
amznwin=window.open(URL,NAME,'location=yes,scrollb ars=yes,status=yes,toolbar=yes,resizable=yes,width =380,height=450,screenX=10,screenY=10,top=10,left= 10');
amznwin.focus();}
document.open();
document.write("<a href=javascriptopUp('http://buybox.amazon.com/exec/obidos/redirect?tag=hiphopdvds-20&link_code=xsc&creative=23424&camp=2025&path=/dt/assoc/tg/aa/xml/assoc/-/B00005JKCH/hiphopdvds-20/ref=ac_bb5_,_amazon')><img src=http://rcm-images.amazon.com/images/G/01/associates/remote-buy-box/buy5.gif border=0 alt='Buy from Amazon.com' ></a>");
document.close();
</script>
<noscript>
<form method="POST" action="http://buybox.amazon.com/o/dt/assoc/handle-buy-box=B00005JKCH">
<input type="hidden" name="asin.B00005JKCH" value="1">
<input type="hidden" name="tag-value" value="hiphopdvds-20">
<input type="hidden" name="tag_value" value="hiphopdvds-20">
<input type="image" name="submit.add-to-cart" value="Buy from Amazon.com" border="0" alt="Buy from Amazon.com" src="http://rcm-images.amazon.com/images/G/01/associates/add-to-cart.gif">
</form>
</noscript>
if someone can do this or provide me with a similiar hack that i could use for guidance it would be very much appreciated.

Cheers

Ciq
Reply With Quote
  #2  
Old 12-22-2002, 12:56 AM
okrogius okrogius is offline
 
Join Date: Dec 2001
Location: USA
Posts: 264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Create a new bb tag code with the parameter being the ASIN, then simply post as normal. No hacking needed.
Reply With Quote
  #3  
Old 12-22-2002, 01:04 AM
ciqala ciqala is offline
 
Join Date: Nov 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After realising that i basically only need html as it uses <script> I tried installing a hack to allow only admins to post html but it doesnt seem to like it still as the code i posted above shows as blank.

The bb code thing sounds interesting but wouldnt that mean that you would still only get a hardcoded link to the product page. my reason for doing this is to utilise a special amazon.com associates feature that creates an image based button which pops up a special amazon window which has built in cart functionality.
Reply With Quote
  #4  
Old 12-22-2002, 03:03 PM
okrogius okrogius is offline
 
Join Date: Dec 2001
Location: USA
Posts: 264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, it woudln't be hardcoded. Read my post.
Reply With Quote
  #5  
Old 12-22-2002, 06:00 PM
ciqala ciqala is offline
 
Join Date: Nov 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

my apologies this head cold is not helping me think straight.

I created this vbcode but its still not working perhaps you can help me out.

vB code tag: amazon
vB code replacement: code as posted above with asin replaced by {option}
vB code example: [amazon=00000000][/amazon]
Use option = Yes

When i save this it messes up the display of the list of custom vBcodes in the adminCP and when i edit it I see that it cuts off the code about midway through. i'm assuming that its because the relevant column in the db has a 255 char limit.

I tried to change it to replace it with a php include that includes a basic php function that echos the text and fills in the asin with the variable i passed. the only problem is that this doesnt get parsed as php code so it just appears in the thread as <?php>include('some_file.php');</?>.

I'm thinking the only way to acheive it using vBcode is to create a .js that holds the code i need and then use a two-line piece of html that sets a variable with the asin and then calls the script whilst passing it the asin at the same time. but i dont know javascript.

am i on the right track?

thanks for your help

Ciqala
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 08:09 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.05910 seconds
  • Memory Usage 2,198KB
  • 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
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete