My personal keyword organizer.. My personal keyword organizer..
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

My personal keyword organizer..

Started by InSAnE NiNjA, January 04, 2004, 08:45:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

InSAnE NiNjA

literally this does nothing about hacking into the system.. it just helps me organize my keywords..

currently (as far as i know) "cars" doesnt match "car", this helps that.. as well as help in finding spelling mistakes

i DID program this with capitalization in mind.. it compairs words in lowercase form to be uniform (obsessive compulsive type stuff)

i just thought this might be useful to others as it helped me.. there is NO security on this.. so unless its modified.. its only to be uploaded/used/deleted if you do use it at all

took me 20 mins to make up.. so far, i've only used it once, so i didnt work on improving it, so dont insult the cheap coding.. lol

<?
include_once $_SERVER['DOCUMENT_ROOT'].'/includes/sql.php';


switch($_REQUEST['page']) {

default :
case 'display':

    $query = "
                SELECT `keywords`
                FROM `gallery_pictures`
                WHERE `keywords` LIKE '__%'
                GROUP BY `keywords`
                ";
    $result = mysql_query($query) or die("$query<br />".mysql_error());

    $total_array = array();

    while (list($keywords) = mysql_fetch_row($result)) {
        $array = explode(" ",$keywords);

        foreach($array as $word)
        {
            $word = "<td><input type=\"radio\" name=\"oldword\" value=\"".strtolower($word)."\" onClick=\"document.form.newword.value='$word'\"></td>"
                . "<td><a target=\"_blank\" href=\"thumbnails.php?album=search&search={$word}\">{$word}</a></td>";

            if (!in_array($word,$total_array)) $total_array[] = $word;
        }
    }

    sort($total_array);

    $output = implode("</tr>\n<tr>", $total_array);

    $output = "
<form name=form action=\"?page=changeword\" method=post>
    <table>
<tr>$output</tr>
    </table>
    <input type=text name=newword>
    <input type=submit value=change>
</form>
";

    print "<html><style>a{text-decoration:none;}</style><body><center>$output</center></body></html>";

break;


case 'changeword':

    if ($_REQUEST['oldword'] && $_REQUEST['newword'])
    {
        $oldword = $_REQUEST['oldword'];

        $query = "SELECT `pid`,`keywords` FROM `gallery_pictures` WHERE CONCAT(' ',`keywords`,' ') LIKE '% {$oldword} %'";
        $result = mysql_query($query) or die(mysql_error());

        while (list($id,$keywords) = mysql_fetch_row($result))
        {
            $array_new = array();
            $array_old = explode(" ", trim($keywords));

            foreach($array_old as $word)
            {
                // convert old to new if its the same word
                if (strtolower($word) == $_REQUEST['oldword']) $word = $_REQUEST['newword'];

                // rebuild array to reprocess it
                $array_new[] = $word;
            }

            $keywords = implode(" ", $array_new);
            $newquerys[] = "UPDATE `gallery_pictures` SET `keywords` = '$keywords' WHERE `pid` = '$id'";
        }
    }
    $newquerys[] = "UPDATE `gallery_pictures` SET `keywords` = TRIM(REPLACE(`keywords`,'  ',' '))";

    foreach ($newquerys as $query) { $result = mysql_query($query) or die($query."<br />".mysql_error()); }

    header("Location: ?page=display");

break;

}
?>