View Single Post
  #20  
Old 08-01-2007, 04:34 AM
Dkozikowski's Avatar
Dkozikowski+ Offline
Team Pixelpost
 
Join Date: Oct 2005
Posts: 1,855
Send a message via AIM to Dkozikowski
Yup, basically. So you don't have to do the work I took the time to change all the necessary values.

PHP Code:
<?php 
/*

Pixelpost 1.6 FINAL
Written by: Dwilkinsjr
Written for: Pixelpost www: http://www.pixelpost.org/

    <!--
    
          __         _ ____   _              _
     ____/ /      __(_) / /__(_)___  _____  (_)____
    / __  / | /| / / / / //_/ / __ \/ ___/ / / ___/    LINK LIST ADDON v0.1
   / /_/ /| |/ |/ / / / ,< / / / / (__  ) / / /
   \__,_/ |__/|__/_/_/_/|_/_/_/ /_/____/_/ /_/
                 http://dwilkinsjr.com/___/
                                      
                                      
    -->

Contact: dwilkinsjr@dwilkinsjr.com
Copyright (c) 2007 <http://wwww.dwilkinsjr.com>

License: http://www.gnu.org/copyleft/gpl.html

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

*/


$addon_name "<a name=\"LLA\"></a>Link List Editor";
$addon_version "0.1";
$addon_description "Type the text to be displayed with the <code>&lt;LINK_LIST&gt;</code> tag.<br /><br />\n";

### create the about text table to store the about text information
@mysql_query("CREATE TABLE IF NOT EXISTS `".$pixelpost_db_prefix."linklist` (`id` INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(id),`link_list` TEXT NOT NULL)");


if(
$_POST['action'] == "update_linklist") {

    
### query the about text database and pullout all the rows
    
$cquery   = @mysql_query("SELECT * FROM `".$pixelpost_db_prefix."linklist`");
    
$linklist = @mysql_fetch_array($cquery);
    
    
### add slashes to special chars like ' and "
    
$link_list addslashes($_POST['link_list']);
    
    
### if there is no id present in the database, we need to use the insert statement
    
if($linklist['id'] == '') {
     
        @
mysql_query("INSERT INTO `".$pixelpost_db_prefix."linklist` (`link_list`) VALUES('".$link_list."')");
    } else { 
### if we made it down here, we have an id and we can simply update the current row

        
@mysql_query("UPDATE `".$pixelpost_db_prefix."linklist` SET `link_list` = '".$link_list."'");
    }
}

### query the about text database again and pullout all the rows
$query    = @mysql_query("SELECT * FROM `".$pixelpost_db_prefix."linklist`");
$linklist = @mysql_fetch_array($query);

### remove those slashes we previously added for viewing
$links $linklist['link_list'];
$links stripslashes($links);


### lets output our form
$addon_description .= "\n<form name=\"linklistaddon\" id=\"formLLA\" method=\"post\" action=\"#LLA\">\n";
$addon_description .= "<input name=\"action\" type=\"hidden\" value=\"update_linklist\" />\n\n";
$addon_description .= "Links:<br />\n";
$addon_description .= "<textarea name=\"link_list\" id=\"link_list\" rows=\"10\" cols=\"90\">".$links."</textarea><br /><br />\n";
$addon_description .= "<input type=\"submit\" name=\"Submit\" value=\"Submit\" />\n";
$addon_description .= "</form>\n\n";
$addon_descripton  .= "<br /><br />ADDON Author: Dwilkinsjr (<a href='http://www.dwilkinsjr.com/myaddons' target='_blank'>dwilkinsjr.com</a>)";


### finally, our template tags
$tpl str_replace("<LINK_LIST>",$links,$tpl);
?>
Reply With Quote