Jump to content

PHP Message Posting

- - - - -

  • Please log in to reply
3 replies to this topic

#1
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Hello all,

I've been developing a basic chat system for my website, all it does is log the message and then display it using AJAX from the log file (I wanted to make a call to the database but there is MySQL errors).

I am confused, as I haven't found the problem yet (after two days of deskchecking and such).

Here is the current code:
<!07:37:01PM, 15/04/11 AEST-->

<?php

//Message Data:

$title = $_POST["title"];

$msg = $_POST["inputBox"];

$timestamp = time();

$ip=$_SERVER['REMOTE_ADDR'];

$feedback = $_POST["feedback"];

//Logging Data:

$logString = "[".$timestamp."] ".$title."-".$msg;

$logFile = fopen("util/secureLog.txt","a+");


function logData ($timestamp, $title, $msg, $feedback,$ip,$logString)

{

file_put_contents($logFile,$logString,"FILE_APPEND");

fclose($logFile);

}

?>

I've removed the failed MySQL code (all 24 lines of it).

Thank you for any help...
Jack
Creator, Owner, Webmaster
Brezerd.net

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Do you have a specific question? I am unclear of what I am looking at, in regards to you stating that it throws errors in MySQL.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Sorry, I suppose it was 'sloppy' writing.

I want to know why it fails to write to the file. It is meant to but doesn't. It's probably something simple I've missed as I've been working on it for roughly two days straight.

Basically, it isn't working and I need some help.

It is meant to:
  • Take the inputs from the from to the msgProcess.php file (the code of which is there).
  • Write these values (Timestamp, IP, Title, Message, Feedback) to the logfile.

Those are only for this file however.

Does that clarify things?
Jack
Creator, Owner, Webmaster
Brezerd.net

#4
Rangasaurus

Rangasaurus

    Newbie

  • Members
  • Pip
  • 1 posts
I would recommend using MySQL or at least XML.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users