vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Connecting to mysql when you click (https://vborg.vbsupport.ru/showthread.php?t=287542)

cagatayh 09-06-2012 06:43 PM

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>


kh99 09-06-2012 07:46 PM

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.

cagatayh 09-06-2012 08:19 PM

Quote:

Originally Posted by kh99 (Post 2363200)
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..

cagatayh 09-09-2012 07:26 PM

Any help ?

kh99 09-10-2012 12:48 AM

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).

cagatayh 09-10-2012 01:56 PM

Quote:

Originally Posted by kh99 (Post 2364143)
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 :)


All times are GMT. The time now is 06:25 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.01770 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete