Question How to write into the database

Thảo luận trong 'Add-on Quesions' bắt đầu bởi zooky, 21/2/14.

1votes
5/5, 1 vote

  1. zooky

    zooky New Member

    Bài viết:
    2
    Likes :
    0
    1. Create file 1.php
    PHP:
    <?php
    print'<form action="http://site.com/callback.php" method="post">
    <input type="text" name="simple_text"  value="Test text into DB" />
    <input type="submit" value="Submit" accesskey="s" class="button primary" />
    </form>'
    ;
    ?>
    http://site.com/1.php

    2. Need field simple_text write into the database
    Create file callback.php

    http://site.com/callback.php
    PHP:
    <?php

    $parentOfDirOfFile 
    dirname(dirname(__FILE__));
    $scriptFilename = (isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '');
    $pathToCheck '/ControllerPublic/SimpleText.php';
    $fileDir false;
    if (
    file_exists($parentOfDirOfFile $pathToCheck))
    {
        
    $fileDir $parentOfDirOfFile;
    }
    if (
    $fileDir === false AND !empty($scriptFilename))
    {
        
    $parentOfDirOfScriptFilename dirname(dirname($scriptFilename));
        if (
    file_exists($parentOfDirOfScriptFilename $pathToCheck))
        {
            
    $fileDir $parentOfDirOfScriptFilename;
        }
    }
    if (
    $fileDir === false)
    {
        die(
    'XenForo path could not be figured out...');

    chdir($fileDir);

    $simple_text $_REQUEST['simple_text'];

    require (
    $fileDir $pathToCheck);
    and all files http://xenforo.com/community/threads/how-to-read-and-write-into-the-database-with-a-page.23560/

    How to write into the database field name="simple_text" value="Test text into DB"?
     
    Đang tải...
comments powered by Disqus

Chia sẻ trang này

Đang tải...