Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: My personal keyword organizer..  (Read 3329 times)

0 Members and 1 Guest are viewing this topic.

InSAnE NiNjA

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • http://insaneninja.livejournal.com/
My personal keyword organizer..
« on: January 04, 2004, 08:45:06 am »

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

Code: [Select]
<?
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;

}
?>
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 18 queries.