Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 09-06-2012, 06:43 PM
cagatayh cagatayh is offline
 
Join Date: Aug 2006
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Connecting to mysql when you click

Hi,

I try to add "broken link" function into one of plugins. In postbit plugin when you click the text, it add your ip and titleid into mysql.

But i don't know what should i write for a href.


In the thread if i click the link, it doesnt work but writing the link to the ​web browser address bar and clicking ENTER. It Works...

like this:

https://vborg.vbsupport.ru/showthrea...=67731?do=link


Code:
<plugin active="1" executionorder="5">
					<title>Broken Link</title>
					<hookname>postbit_display_start</hookname>
			<phpcode><![CDATA[
			$linkler = $this->registry->db->query_read("SELECT * FROM broken_link where url LIKE '$post[threadid]'");
			$sonuc=mysql_num_rows($linkler);
			
			
			
			
			if ($_REQUEST['do'] == 'link' && $sonuc < 1)
			{
			
					$broken_gonder = $this->registry->db->query_read("INSERT INTO broken_link (ip, url) VALUES ('".$_SERVER["REMOTE_ADDR"]."', '".$post[threadid]."')");
}

		]]></phpcode>
		</plugin>

Code:
<template name="showthread_extra_fields" templatetype="template" date="1140414721" username="uname" version="1"><![CDATA[]

<if condition="$sonuc == 0">

<a href="/showthread.php?t=$post[threadid]?do=link" onClick="alert('It's OK')">Report Broken Link</a>
</if>

]></template>
Reply With Quote
  #2  
Old 09-06-2012, 07:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When you say it doesn't work, what do you mean? Does anything happen at all when you click it?

Edit: also, your "It's OK" message contains a single quote (apostrophe), so that makes the quotes mismatched.
Reply With Quote
  #3  
Old 09-06-2012, 08:19 PM
cagatayh cagatayh is offline
 
Join Date: Aug 2006
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
When you say it doesn't work, what do you mean? Does anything happen at all when you click it?

Edit: also, your "It's OK" message contains a single quote (apostrophe), so that makes the quotes mismatched.
Yep I write it in english. Original text is ok

When i click, only alert message comes.. Nothing adds into database..
Reply With Quote
  #4  
Old 09-09-2012, 07:26 PM
cagatayh cagatayh is offline
 
Join Date: Aug 2006
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any help ?
Reply With Quote
  #5  
Old 09-10-2012, 12:48 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know why it wouldn't work if the url is correct. Have you ever used the Firebug addon for FireFox? It might let you see if a call is being made, or if there are any javascript errors occuring. Have you tried it without any onClick? (Probably you added that later as a test).

Also, the url you have above has two '?' in it, I think what you want is:
Code:
href="/showthread.php?t=$post[threadid]&amp;do=link"

but I don't think that would keep it from working at all (it should still at least reload the page, I think).
Reply With Quote
Благодарность от:
cagatayh
  #6  
Old 09-10-2012, 01:56 PM
cagatayh cagatayh is offline
 
Join Date: Aug 2006
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
I don't know why it wouldn't work if the url is correct. Have you ever used the Firebug addon for FireFox? It might let you see if a call is being made, or if there are any javascript errors occuring. Have you tried it without any onClick? (Probably you added that later as a test).

Also, the url you have above has two '?' in it, I think what you want is:
Code:
href="/showthread.php?t=$post[threadid]&amp;do=link"

but I don't think that would keep it from working at all (it should still at least reload the page, I think).
Code:
href="/showthread.php?t=$post[threadid]&amp;do=link"
It works.

Thanks a lot
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 04:30 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.06900 seconds
  • Memory Usage 2,214KB
  • 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
  • (5)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (1)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete