[Addon] Tags [RevCMS]

Spartak

Member
Sep 24, 2011
225
33
Hey,​
Here's my Tag's script, i only give my own code, so you will need to edit HTML part if needed.​

PHP:
[PHP]
$my_id = $_SESSION['user']['id'];
$fetch_tags = mysql_query("SELECT tag,id FROM user_tags WHERE user_id = '".$my_id."' LIMIT 20") or die(mysql_error());
$tags_num = mysql_num_rows($fetch_tags);
 
    $randomq[] = "What is your favourite food?";
    $randomq[] = "Who is your favourite actor?";
    $randomq[] = "What kind of music do you like?";
    $randomq[] = "What is your favourite sport?";
    $randomq[] = "Who is your favourite actress?";
    $randomq[] = "What is your favourite colour?";
    $randomq[] = "What is your favourite band?";
    $randomq[] = "What is your favourite TV show?";
    $randomq[] = "Which football team do you support?";
    $randomq[] = "What is your favourite football team?";
    $randomq[] = "Your favourite cartoon?";
    $randomq[] = "What is your favourite video game?";
    $randomq[] = "What's your favourite pastime?";
    $randomq[] = "What kind of mood are you in right now?";
    $randomq[] = "What is your favourite movie?";
    $randomq[] = "What is your favourite time of year?";
 
srand ((double) microtime() * 1000000);
$chosen = rand(0,count($randomq)-1);
 
$tag_question = $randomq[$chosen];
 
    $do = $_GET['do'];
    if($do != "") {
    mysql_query("DELETE FROM user_tags WHERE id = '".$do."'");
    Redirect("me");
    }
   
    if (isset($_POST['newtag']))
    {
    $user_id = $_SESSION['user']['id'];
    $tag = htmlspecialchars(addslashes($_POST[newtag]));
   
    if (strlen($user_id) < 1 || strlen($tag) < 1)
    {
    Redirect("me");
    }
    else
    {
        mysql_query("INSERT INTO user_tags (user_id    ,tag) VALUES ('" . $user_id    . "','" . $tag . "')");
    Redirect("me");
    }
    }
[/PHP]
------------------------------------------------- HTML PART -----------------------------------------------------------​
PHP:
<div class="content-box-radio">
<div class="habblet-container ">
    <ul class="box-tabs">
        <li id="tab-3-2" class="selected"><a href="#">My Tags</a><span class="tab-spacer"></span></li>
    </ul>
  <br />
            <a href="me" class="tab-ajax"></a>
    </div>
    <div id="tab-3-2-content" >
    <div id="my-tag-info" class="habblet-content-info">
        <?php if($tags_num > 19){ echo "Max limit tag.delete one of your tag and then add."; } elseif($tags_num == 0){ echo "You dont have tag. Answere the question or make ur own."; } elseif($tags_num < 20){ echo "u dident use all of ur tags. Add more!"; } ?>
    </div>
<div class="box-content">
    <div class="habblet" id="my-tags-list">
 
<?php if($tags_num > 0){
            echo "<ul class=\"tag-list make-clickable\"> ";
    while($row = mysql_fetch_assoc($fetch_tags)){
    echo " <li><a href=\"tags?tag=".strtolower($row['tag'])."\" class=\"tag\" style=\"font-size:10px\">".strtolower($row['tag'])."</a>
                        <a href='?do=".$row['id']."' title=\"delete tag\"><img src='app/tpl/skins/Mango/images/tags.gif' /></a></li>";
    }
            echo "</ul>";
} ?>
 
<?php if($tags_num < 20){ ?>
    <form method="post">
    <div class="add-tag-form clearfix">
        <input type="image" class="tagme" src="YOURTAGIMG to validate">
        <input type="text" name="newtag" id="add-tag-input" maxlength="20" style="float: left"/>
        <em class="tag-question"><?php echo $tag_question; ?></em>
    </div>
    <div style="clear: both"></div>
    </form>
<?php } ?>
    </div>
</div>
 
<script type="text/javascript">
document.observe("dom:loaded", function() {
    TagHelper.setTexts({
        tagLimitText: "you have reached your tag limit - delete 1 if you want to add new one.",
        invalidTagText: "Invalid tag",
        buttonText: "OK"
    });
        TagHelper.init('21063711');
});
</script>
</div>

-------------------------------------- SCREENSHOT ------------------------------------------​
nQD5H.png
--------------------------------------- C R E D I T S --------------------------------------------​
Extreme (me)​
 

Mitchul

Sledmoresux
Feb 18, 2012
371
46
Translated:


HTML:
<div class="content-box-radio">
<div class="habblet-container ">
    <ul class="box-tabs">
        <li id="tab-3-2" class="selected"> href My Tags </ a> <span class="tab-spacer"> </ span> </ li>
    </ ul>
  <br />
            <a href="me" class="tab-ajax"> </ a>
    </ div>
    <div id="tab-3-2-content">
    <div id="my-tag-info" class="habblet-content-info">
        <? php if ($ tags_num> 19) {echo "Max limit tag.delete one of your tags and then add.";} elseif ($ tags_num == 0) {echo "You dont have tags. answere the question or make ur own. ";} elseif ($ tags_num <20) {echo" u dident use all of ur tags. Add more! ";}?>
    </ div>
<div class="box-content">
    <div class="habblet" id="my-tags-list">
 
<? php if ($ tags_num> 0) {
            echo "<ul class=\"tag-list make-clickable\">";
    while ($ row = mysql_fetch_assoc ($ fetch_tags)) {
    echo "<li> <a href=\"tags?tag=".strtolower($row['tag'])."\" class=\"tag\" style=\"font-size:10px\"> ". strtolower ($ row ['tag'])." </ a>
                        <a href='?do=".$row['id']."' title=\"delete tag\"> <img src='app/tpl/skins/Mango/images/tags.gif' /> </ a> </ li> ";
    }
            echo "</ ul>";
}?>
 
<? php if ($ tags_num <20) {?>
    <form method="post">
    <div class="add-tag-form clearfix">
        <input type="image" class="tagme" src="YOURTAGIMG to validate">
        <input type="text" name="newtag" id="add-tag-input" maxlength="20" style="float: left"/>
        <em class="tag-question"> <? php echo $ tag_question;?> </ em>
    </ div>
    <div style="clear: both"> </ div>
    </ form>
<? php}?>
    </ div>
</ div>
 
<script type="text/javascript">
document.observe ("dom: loaded", function () {
    TagHelper.setTexts ({
        tagLimitText: "Reached you have your tag limit - delete 1 if you want to add new one."
        invalidTagText: "Invalid tag"
        ButtonText: "OK"
    });
        TagHelper.init ('21063711 ');
});
</ script>
</ div>

PHP:
<?PHP
$my_id = $_SESSION['user']['id'];
$fetch_tags = mysql_query("SELECT tag,id FROM user_tags WHERE user_id = '".$my_id."' LIMIT 20") or die(mysql_error());
$tags_num = mysql_num_rows($fetch_tags);
 
    $randomq[] = "What is your favourite food?";
    $randomq[] = "Who is your favourite actor?";
    $randomq[] = "What kind of music do you like?";
    $randomq[] = "What is your favourite sport?";
    $randomq[] = "Who is your favourite actress?";
    $randomq[] = "What is your favourite colour?";
    $randomq[] = "What is your favourite band?";
    $randomq[] = "What is your favourite TV show?";
    $randomq[] = "Which football team do you support?";
    $randomq[] = "What is your favourite football team?";
    $randomq[] = "Your favourite cartoon?";
    $randomq[] = "What is your favourite video game?";
    $randomq[] = "What's your favourite pastime?";
    $randomq[] = "What kind of mood are you in right now?";
    $randomq[] = "What is your favourite movie?";
    $randomq[] = "What is your favourite time of year?";
 
srand ((double) microtime() * 1000000);
$chosen = rand(0,count($randomq)-1);
 
$tag_question = $randomq[$chosen];
 
    $do = $_GET['do'];
    if($do != "") {
    mysql_query("DELETE FROM user_tags WHERE id = '".$do."'");
    Redirect("me");
    }
 
    if (isset($_POST['newtag']))
    {
    $user_id = $_SESSION['user']['id'];
    $tag = htmlspecialchars(addslashes($_POST[newtag]));
 
    if (strlen($user_id) < 1 || strlen($tag) < 1)
    {
    Redirect("me");
    }
    else
    {
        mysql_query("INSERT INTO user_tags (user_id    ,tag) VALUES ('" . $user_id    . "','" . $tag . "')");
    Redirect("me");
    }
    }
?>

^PHP Translation.

NOTE: You may have to fix some english errors in the HTML Part.
 

Deion

Posting Freak
Jul 3, 2010
1,273
300
Translated:


HTML:
<div class="content-box-radio">
<div class="habblet-container ">
    <ul class="box-tabs">
        <li id="tab-3-2" class="selected"> href My Tags </ a> <span class="tab-spacer"> </ span> </ li>
    </ ul>
  <br />
            <a href="me" class="tab-ajax"> </ a>
    </ div>
    <div id="tab-3-2-content">
    <div id="my-tag-info" class="habblet-content-info">
        <? php if ($ tags_num> 19) {echo "Max limit tag.delete one of your tags and then add.";} elseif ($ tags_num == 0) {echo "You dont have tags. answere the question or make ur own. ";} elseif ($ tags_num <20) {echo" u dident use all of ur tags. Add more! ";}?>
    </ div>
<div class="box-content">
    <div class="habblet" id="my-tags-list">
 
<? php if ($ tags_num> 0) {
            echo "<ul class=\"tag-list make-clickable\">";
    while ($ row = mysql_fetch_assoc ($ fetch_tags)) {
    echo "<li> <a href=\"tags?tag=".strtolower($row['tag'])."\" class=\"tag\" style=\"font-size:10px\"> ". strtolower ($ row ['tag'])." </ a>
                        <a href='?do=".$row['id']."' title=\"delete tag\"> <img src='app/tpl/skins/Mango/images/tags.gif' /> </ a> </ li> ";
    }
            echo "</ ul>";
}?>
 
<? php if ($ tags_num <20) {?>
    <form method="post">
    <div class="add-tag-form clearfix">
        <input type="image" class="tagme" src="YOURTAGIMG to validate">
        <input type="text" name="newtag" id="add-tag-input" maxlength="20" style="float: left"/>
        <em class="tag-question"> <? php echo $ tag_question;?> </ em>
    </ div>
    <div style="clear: both"> </ div>
    </ form>
<? php}?>
    </ div>
</ div>
 
<script type="text/javascript">
document.observe ("dom: loaded", function () {
    TagHelper.setTexts ({
        tagLimitText: "Reached you have your tag limit - delete 1 if you want to add new one."
        invalidTagText: "Invalid tag"
        ButtonText: "OK"
    });
        TagHelper.init ('21063711 ');
});
</ script>
</ div>

PHP:
<?PHP
$my_id = $_SESSION['user']['id'];
$fetch_tags = mysql_query("SELECT tag,id FROM user_tags WHERE user_id = '".$my_id."' LIMIT 20") or die(mysql_error());
$tags_num = mysql_num_rows($fetch_tags);
 
    $randomq[] = "What is your favourite food?";
    $randomq[] = "Who is your favourite actor?";
    $randomq[] = "What kind of music do you like?";
    $randomq[] = "What is your favourite sport?";
    $randomq[] = "Who is your favourite actress?";
    $randomq[] = "What is your favourite colour?";
    $randomq[] = "What is your favourite band?";
    $randomq[] = "What is your favourite TV show?";
    $randomq[] = "Which football team do you support?";
    $randomq[] = "What is your favourite football team?";
    $randomq[] = "Your favourite cartoon?";
    $randomq[] = "What is your favourite video game?";
    $randomq[] = "What's your favourite pastime?";
    $randomq[] = "What kind of mood are you in right now?";
    $randomq[] = "What is your favourite movie?";
    $randomq[] = "What is your favourite time of year?";
 
srand ((double) microtime() * 1000000);
$chosen = rand(0,count($randomq)-1);
 
$tag_question = $randomq[$chosen];
 
    $do = $_GET['do'];
    if($do != "") {
    mysql_query("DELETE FROM user_tags WHERE id = '".$do."'");
    Redirect("me");
    }
 
    if (isset($_POST['newtag']))
    {
    $user_id = $_SESSION['user']['id'];
    $tag = htmlspecialchars(addslashes($_POST[newtag]));
 
    if (strlen($user_id) < 1 || strlen($tag) < 1)
    {
    Redirect("me");
    }
    else
    {
        mysql_query("INSERT INTO user_tags (user_id    ,tag) VALUES ('" . $user_id    . "','" . $tag . "')");
    Redirect("me");
    }
    }
?>

^PHP Translation.

NOTE: You may have to fix some english errors in the HTML Part.
Ty MitchBitch, that's why I luvv you.
 

brsy

nah mang
May 12, 2011
1,530
272
I found a quick error just by glancing at the code. For one, if you want to redirect a user to a specific page, it's
PHP:
header("Location: me");
// the following is not valid PHP to the extent of my knowledge:
Redirect("me");

Please wait about 5 minutes while I fix everything within the code, and make it more efficient. Do not use the code in the first post, as it will throw errors like a mofo.

----------EDIT----------
Here is the corrected code, something might be wrong, as I deleted loads of shit that I thought were useless. I am also watching a basketball game, so that increases the chances of this being fucked up. If there is an error, just let me know the error and I'll correct it. Like my post if I helped :)
PHP:
<?php
$fetch_tags = mysql_query("SELECT tag,id FROM user_tags WHERE user_id = '".$_SESSION['user']['id']."' ORDER BY DESC LIMIT 20") or die(mysql_error());
$tags_num = mysql_num_rows($fetch_tags);
 
    $randomq[] = "What is your favourite food?";
    $randomq[] = "Who is your favourite actor?";
    $randomq[] = "What kind of music do you like?";
    $randomq[] = "What is your favourite sport?";
    $randomq[] = "Who is your favourite actress?";
    $randomq[] = "What is your favourite colour?";
    $randomq[] = "What is your favourite band?";
    $randomq[] = "What is your favourite TV show?";
    $randomq[] = "Which football team do you support?";
    $randomq[] = "What is your favourite football team?";
    $randomq[] = "Your favourite cartoon?";
    $randomq[] = "What is your favourite video game?";
    $randomq[] = "What's your favourite pastime?";
    $randomq[] = "What kind of mood are you in right now?";
    $randomq[] = "What is your favourite movie?";
    $randomq[] = "What is your favourite time of year?";
 
$chosen = rand(0,count($randomq)-1);
 
    $do = $_GET['do'];
    if($do != "") {
    mysql_query("DELETE FROM user_tags WHERE id = '".$do."'");
    header("Location: me");
    }
 
    if(isset($_POST['newtag'])) {
        $tag = mysql_real_escape_strings(htmlspecialchars($_POST[newtag]));
    }
 
    if(strlen($_SESSION['user']['id']) < 1 || strlen($tag) < 1) {
        header("Location: me");
    }
    else {
        mysql_query("INSERT INTO user_tags (user_id, tag) VALUES ('" . $_SESSION['user']['id'] . "', '" . $tag . "')");
        header("Location: me");
    }
    ?>
 

Spartak

Member
Sep 24, 2011
225
33
I found a quick error just by glancing at the code. For one, if you want to redirect a user to a specific page, it's
PHP:
header("Location: me");
// the following is not valid PHP to the extent of my knowledge:
Redirect("me");

Please wait about 5 minutes while I fix everything within the code, and make it more efficient. Do not use the code in the first post, as it will throw errors like a mofo.

----------EDIT----------
Here is the corrected code, something might be wrong, as I deleted loads of shit that I thought were useless. I am also watching a basketball game, so that increases the chances of this being fucked up. If there is an error, just let me know the error and I'll correct it. Like my post if I helped :)
PHP:
<?php
$fetch_tags = mysql_query("SELECT tag,id FROM user_tags WHERE user_id = '".$_SESSION['user']['id']."' ORDER BY DESC LIMIT 20") or die(mysql_error());
$tags_num = mysql_num_rows($fetch_tags);
 
    $randomq[] = "What is your favourite food?";
    $randomq[] = "Who is your favourite actor?";
    $randomq[] = "What kind of music do you like?";
    $randomq[] = "What is your favourite sport?";
    $randomq[] = "Who is your favourite actress?";
    $randomq[] = "What is your favourite colour?";
    $randomq[] = "What is your favourite band?";
    $randomq[] = "What is your favourite TV show?";
    $randomq[] = "Which football team do you support?";
    $randomq[] = "What is your favourite football team?";
    $randomq[] = "Your favourite cartoon?";
    $randomq[] = "What is your favourite video game?";
    $randomq[] = "What's your favourite pastime?";
    $randomq[] = "What kind of mood are you in right now?";
    $randomq[] = "What is your favourite movie?";
    $randomq[] = "What is your favourite time of year?";
 
$chosen = rand(0,count($randomq)-1);
 
    $do = $_GET['do'];
    if($do != "") {
    mysql_query("DELETE FROM user_tags WHERE id = '".$do."'");
    header("Location: me");
    }
 
    if(isset($_POST['newtag'])) {
        $tag = mysql_real_escape_strings(htmlspecialchars($_POST[newtag]));
    }
 
    if(strlen($_SESSION['user']['id']) < 1 || strlen($tag) < 1) {
        header("Location: me");
    }
    else {
        mysql_query("INSERT INTO user_tags (user_id, tag) VALUES ('" . $_SESSION['user']['id'] . "', '" . $tag . "')");
        header("Location: me");
    }
    ?>
can u tel me the ERRORS? i dont aprov ur Post. IDK about if securise, and wheres ERROR? if its work fine for me? and test on 3 hotels.
 

brsy

nah mang
May 12, 2011
1,530
272
can u tel me the ERRORS? i dont aprov ur Post. IDK about if securise, and wheres ERROR? if its work fine for me? and test on 3 hotels.
1.) When redirecting a user, use header("Location: ");

2.) Don't define variables that aren't used, or that maybe be used, but are unnecessary.

3.) Keep your code nice and neat. By the way, I didn't test the code, so I didn't see any errors for myself. Someone on the thread said there were errors, so I took it upon myself to clean up the code.
 

Spartak

Member
Sep 24, 2011
225
33
1.) When redirecting a user, use header("Location: ");

2.) Don't define variables that aren't used, or that maybe be used, but are unnecessary.

3.) Keep your code nice and neat. By the way, I didn't test the code, so I didn't see any errors for myself. Someone on the thread said there were errors, so I took it upon myself to clean up the code.

All i want, is u tel me where are the errors.

and i only use Header

What did i used? :confused:

Edit: ah ur talking about redirect? its work too u should relook ur PHP TUTO?
and this script i made it a long time ago when i was learning x]
 

Gajeel

Well-Known Member
Oct 4, 2011
2,411
413
Is this applicable for Mango Theme as the screenshot displays it for Habbo theme, or if ever it is easy to port it out to Mango?
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Is this applicable for Mango Theme as the screenshot displays it for Habbo theme, or if ever it is easy to port it out to Mango?

It would be easy to move this over, just change the HTML part.

-
Also this does work, just change abit of code around, I got it working fab.

 

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
It looks alright, but from the image, it looks like a blatent rip from phpretro and made to work with rev
 

jares

New Member
Apr 12, 2012
6
0
Adding tags work, deleting does not.

Clicking the minus does /me?do=X (x being the variable), which just redirects back to me but the tag is still not deleted.
Also doing /me?poopfacemcfart=X does the exact same thing.

Either this system is missing code, or I need to recode it.
 

Users who are viewing this thread

Top