Jump to content

Logfile Search Php


arnisi

Recommended Posts

Hello to all of you, i m a university student and i decided to ask for your help because from this task it depends if i m going to pass the lesson. so please help me!!!!!!!

 

The part that i have problem is the search part. I work at localhost, xampp and i have made a table named "logfile" in database named "uowm". My table looks like this:

 

5848241992_f4b47fed02.jpg

 

I have two files, the one is search.php and the other one is functions.php .

 

The code of search.php is this one:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title></title>

<link href="index.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="container">

 

<div id="maincontent">

<form method="post" action="search.php" enctype="multipart/form-data">

<p>Category:

<select name="logfile">

<option value="">Please select category</option>

<?php

include_once("functions.php");

db_open();

db_logfile_print_option();

?>

</select></p>

<input type="submit" value="submit" />

<?php

if(!empty($_POST['logfile'])) {

$sql ='SELECT sql_command FROM logfile WHERE log_id="'.$_POST['logfile'];

@ $result = mysql_query($sql);

echo "<center>The result is".$result ;

echo <<<form_rt1

<center>

<table border='5'>

<tr>

<th><b>Log ID</b></th>

<th><b>User ID</b></th>

<th><b>Date</b></th>

<th><b>Sql command</b></th>

</tr>

form_rt1;

include_once("functions.php");

db_open();

$sql ='SELECT * FROM logfile WHERE log_id="'.$_POST['logfile'].'"';

@ $result = mysql_query($sql);

 

while ($row = mysql_fetch_array($result)){

echo "<tr><td>".$row['log_id']."</td>";

echo "<td>".$row['user_id']."</td>";

echo "<td>".$row['date']."</td>";

echo "<td>".$row['sql_command']."</td></tr>";

}

echo <<<form_rt2

</table>

</center>

form_rt2;

}

$sql ='SELECT * FROM logfile WHERE log_id="'.$_POST['logfile'].'"';

@ $result = mysql_query($sql);

 

 

?>

</form>

</div>

</div>

</body>

    </html>

 

Could you please make it work? THANK YOU SO MUCH

 

p.s. i'm uploading the files too, if someone needs them.

The code from functions.php is this one:

 

<?php

function db_open() {

  @ $db = mysql_connect('localhost', 'luser1', '1234') or die('Iβ€IΒµIΒ½ I?I€I?IΒIΒµIΖ’IΒµ IΒ½IΒ± IΒ³I?IΒ½IΒµI? IΖ’IΒIΒ½I/IΒµIΖ’IΒ· I?IΒµ Iβ€IΒ· IΒ²IΒ¬IΖ’IΒ· I/IΒµI/I?I?IΒ­IΒ½I‰IΒ½');

  @ mysql_select_db('uowm') or die('  Iβ€” IΒ²IΒ¬IΖ’IΒ· I/IΒµI/I?I?IΒ­IΒ½I‰IΒ½ I/IΒµIΒ½ IΒ²IΒIΒ­I?IΒ·I?IΒµ.');

 

  mysql_query("SET CHARACTER SET utf8");

mysql_query("SET NAMES utf8");

}

 

function db_close() {

mysql_close();}

 

function db_logfile_print_option()

{

$sql='SELECT * from logfile';

@ $result = mysql_query($sql);

while ($row = mysql_fetch_array($result)){

var_dump ($row);

    echo "<option value=\"$row[log_id]\">

$row[logfile_name]</option>";

}} 

 

function db_query($query, & $result)

{

@ $result = mysql_query($query) or exit('Το αίτημα απέτυχε');

}

 

function db_logfile_print_option()

{

@$sql='SELECT * from logfile' ;

@ $result = mysql_query($sql);

while ($row = mysql_fetch_array($result))

    {

      echo "<option value=\"$row[log_id]\"> $row[logfile_name]</option>";

    }

}

 

function db_logfile_print_checkbox()

{

@$sql='SELECT * from logfile';

@ $result = mysql_query($sql);

while ($row = mysql_fetch_array($result))

    {

    echo "<p><label>$row[sql_command]</label><input type=\"checkbox\" name=\"logfile[]\" value=\”$row[log_id]\” </p>";

    }

}

 

?>

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/239783-logfile-search-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.