Sourabh Kumar Sourabh Kumar - 5 months ago 15
PHP Question

How to make a HTML private chatting website?

Starting from beginning, I'm making a private chatting site, which is lightweight, simple with some or no animation. I'm making it for private chats (2 persons only) and I'm not understanding some topics.

Here are my questions:

1: Can we pick some value from existing files? Like character/word from file 'main.txt' on line number 10

2: How can we delete a table from database by SQL commands .. Like clicking a button on HTML form makes delete that table...

3: Displaying contents of 2 or more HTML files in a single index.html file... The

<frameset>
tag isn't working well with me...

Answer
  1. QUESTION

You could use file function which reads entire file into an array
Example:

$filename = 'file.txt';
$data = file($filename);
foreach ($data as $line_num=>$line)
  {
   echo 'Line # <b>'.$line_num.'</b>:'.$line.'<br/>;
  }

http://php.net/manual/en/function.file.php

  1. QUESTION

The SQL DROP TABLE statement is used to remove a table definition and all data, indexes, triggers, constraints, and permission specifications for that table.

NOTE: You have to be careful while using this command because once a table is deleted then all the information available in the table would also be lost forever.
Example:

DROP TABLE table_name;

http://dev.mysql.com/doc/refman/5.7/en/drop-table.html

3 QUESTION
(UPDATE) If I understood correctly I believe you can follow this road for showing access to other links on your main site,using function below

function showHTMLNavigationMenu() {
    $menu = array(
        'index.php' => 'MAIN SITE',
        'site_1.php' => 'Link to site 1',
        'site_2.php' => 'Link to site 2',
        'site_3.php' => 'Link to site 3',
        'site_4.php' => 'Link to site 4'
    );
    $links_arr = array();
    foreach ($menu as $link => $header) {
        $links_arr[] = '<a href="' . $link . '">' . $header . '</a>';
    }

    echo h2('Izbornik');
    echo implode(' <br> ', $links_arr);
    echo '<hr/>';
}

You'll get something like this enter image description here

Hope it helps...