예제 #1
0
function add_custom_text($title, $html)
{
    $permalink = create_permalink($title);
    $insert = "INSERT INTO custom_texts VALUES (id, '" . $title . "', '" . $permalink . "', '" . $html . "', 'active')";
    $result = mysql_query($insert);
    if (!$result) {
        echo $insert . "<br>";
        die('Error Inserting into Database.');
    }
    echo "<div class=\"center\"><h1>Success!</h1>" . "<h3>New Custom Text has been saved</h3>" . "<hr width=75%>";
    display_custom_text(get_custom_text(mysql_insert_id()));
    echo "</div>";
}
예제 #2
0
        echo '<div class="top-spacer_20 center error">Error - missing ID value</div>';
    } elseif ($action == "update") {
        $custom_text = get_custom_text($id);
        echo "<form action=\"custom_text_update.php?id=" . $id . "\" method=\"post\" class=\"form-internal inline input-seperation\" id=\"admin\">";
        require "partials/_custom_text_form.php";
        echo "</form>";
    } else {
        $title = $_POST['title'];
        $html = $_POST['html'];
        if (!$title || !$html) {
            echo '<div class="top-spacer_20 center error">Error - missing required value(s)</div>';
        } else {
            $result = update_custom_text($id, $title, $html);
            if ($result) {
                echo '<div class="top-spacer_20"><h1 class="center">Update was successful!</h1>';
                display_custom_text(get_custom_text($id));
                echo "</div>";
            }
        }
    }
    ?>
    <div class="top-spacer_20">
      <a href="custom_text_view_all.php">View all Custom Texts</a>
      <p>
      <a href="cp.php">Control Panel</a>
    </div>
  </div>
</div> <!-- end of row div -->
<?php 
}
require "partials/_footer.php";