コード例 #1
0
function people()
{
    $members = getmembers(14);
    $count = 0;
    while ($count < count($members)) {
        $currentvalue = getdbmember($members[$count]);
        echo "<a class = \"lightbg\" href = \"http://www.turkiball.com/feed/people/index.php?name=" . $currentvalue['memberName'] . "\">" . $currentvalue['memberName'] . "</a><br><br>\n";
        $count++;
    }
}
コード例 #2
0
function update($stage, $what)
{
    // Select the profile to edit
    if ($stage == 1) {
        if ($what == 1) {
            echo "<p>Which page do you want to edit?</p><br><br>\n";
            echo "<form method = \"post\" action = \"index.php?num=2\">\n";
            echo "<table cellspacing=\"1\" cellpadding=\"2\" width=\"604\" border=\"1\">\n";
            $rows = getrowsturk('Content');
            $count = 0;
            while ($count < $rows) {
                $DATA = getdbturk($count, 'Content');
                // Skips over the profile pages
                if (!strpos($DATA['Address'], 'people/index.php?')) {
                    echo "<tr>\n";
                    echo "<td>" . $DATA['Address'] . "</td>\n";
                    echo "<td><input type = \"radio\" value = \"" . $DATA['Address'] . "\" name = \"id\"></td>\n";
                    echo "</tr>\n";
                }
                $count++;
            }
        } else {
            echo "<p>Which member's profile do you want to edit?</p><br><br>\n";
            echo "<form method = \"post\" action = \"index.php?num=2\">\n";
            echo "<table cellspacing=\"1\" cellpadding=\"2\" width=\"504\" border=\"1\">\n";
            $members = getmembers(14);
            $count = 0;
            while ($count < count($members)) {
                $currentvalue = getdbmember($members[$count]);
                echo "<tr>\n";
                echo "<td>" . $currentvalue['memberName'] . "</td>\n";
                echo "<td><input type = \"radio\" value = \"" . $currentvalue['memberName'] . "\" name = \"id\"></td>\n";
                echo "</tr>\n";
                $count++;
            }
        }
        echo "</tbody>\n";
        echo "</table>\n";
        echo "<br><br><br>\n";
        echo "<input type = \"submit\" value = \"Edit\">\n";
        echo "</form>\n";
        echo "<br><br><br><br><br>\n";
    } elseif ($stage == 2) {
        $filename = $_REQUEST["id"];
        if ($what == 2) {
            $filename = "http://www.turkiball.com/feed/people/index.php?name=" . $filename;
        }
        echo "<p>\n";
        if ($what == 1) {
            echo "Edit the web page here:<br>\n";
        } else {
            echo "Edit the profile here:<br>\n";
        }
        echo "</p>\n";
        echo "<br><br>\n";
        echo "<form method = \"post\" action = \"index.php?num=3\">\n";
        echo "<textarea id=\"editor1\" name=\"editor1\" rows=\"10\" cols=\"80\">";
        echoContent($filename);
        echo "</textarea>\n";
        // Replace that textarea with CKEditor
        echo "<script type=\"text/javascript\">\n";
        echo "var editor = CKEDITOR.replace( 'editor1' );\n";
        echo "CKFinder.SetupCKEditor( editor, '/ckfinder/' ) ;\n";
        //   echo "CKEDITOR.replace( 'editor1' );\n";
        //   echo "CKFinder.SetupCKEditor( editor, '../../ckfinder/' ) ;\n";
        echo "</script>";
        echo "<input type = \"hidden\" name = \"Address\" value = \"" . $filename . "\" />\n";
        echo "<br><br><br>\n";
        echo "<input type = \"submit\" value = \"Submit\">\n";
        echo "</form>\n";
        echo "<br><br><br><br><br>\n";
    } elseif ($stage == 3) {
        $html = $_POST["editor1"];
        //      $apost = "'";
        //      $apostcom = "\\'";
        //      $html = str_replace($apost,$apostcom,$html);																				// Fixes the murderous apostrophe error by escaping apostrophes
        $Address = $_POST["Address"];
        $index = getrowsturk('Content');
        $new = doesItExist('Content', 'Address', $Address);
        $con = mysql_connect("mysql2561int.domain.com", "u1064984_turki", "ldbdin473:klaonm");
        if (!$con) {
            die('Could not connect: ' . mysql_error());
        }
        mysql_select_db("db1064984_turkiball");
        // If true, we're updating a profile
        if ($new) {
            mysql_query("UPDATE `Content` SET Content = '{$html}' WHERE Address = '{$Address}'");
        } else {
            mysql_query("INSERT INTO `Content` (`Index`, `Address`, `Content`) VALUES ('{$index}', '{$Address}', '{$html}');");
        }
        mysql_close($con);
        if ($what == 1) {
            echo "<h3> You're web page update was received. </h3><br><br><br><br>";
        } else {
            echo "<h3> You're profile update was received. </h3><br><br><br><br>";
        }
    }
}