Search found 35 matches

by pHp_n0ob
Sat Oct 13, 2012 11:24 pm
Forum: PHP - Code
Topic: Flat File Based Chat Help
Replies: 17
Views: 4006

Re: Flat File Based Chat Help

This script outputs lines of a file in reverse order. <?php header('Content-Type: text/plain'); $output = ''; $handle = fopen('data.txt', 'r'); if (is_resource($handle)) { while ($line = fgets($handle)) { $output = $line.$output; } fclose($handle); } echo $output; Thanks for the help...please expla...
by pHp_n0ob
Sat Oct 13, 2012 1:43 pm
Forum: PHP - Code
Topic: Flat File Based Chat Help
Replies: 17
Views: 4006

Flat File Based Chat Help

Can anyone please write a php code for a chat script as below: For eg. A user "user1" wrote "hi". Another user "user2" wrote "how are you". Another user "user3" wrote "Hi Everybody!". So the messages are being written on file "chat.txt...
by pHp_n0ob
Fri Sep 28, 2012 12:29 pm
Forum: PHP - Code
Topic: File function help needed
Replies: 11
Views: 2995

Re: File function help needed

I am going to try whatever you said..( seperate file for each text ) :D I said one file per chat session. .....please also tell that how can I list those files (with text contents and sort newest at top) The glob() function is an easy way to show files. You may want put information in the file name...
by pHp_n0ob
Thu Sep 27, 2012 10:58 pm
Forum: PHP - Code
Topic: File function help needed
Replies: 11
Views: 2995

Re: File function help needed

.but it looks ugly to use so much files and then deleting them Looks ugly to whom? Lots of small files is what Unix finds beautiful. Each will have timestamps, so you can delete by date. And you can name them so they can be deleted by matching parts of the file names. All these capabilities are inc...
by pHp_n0ob
Thu Sep 27, 2012 1:17 pm
Forum: PHP - Theory and Design
Topic: submit Button coding
Replies: 4
Views: 10419

Re: submit Button coding

What you want, say clearly...according to your question,i think <form method="post" name="data" action="target.php"><input type="text" name="name" value="Name"/><input type="number" name="phone" value="Phone Number&...
by pHp_n0ob
Wed Sep 26, 2012 10:28 pm
Forum: PHP - Code
Topic: File function help needed
Replies: 11
Views: 2995

Re: File function help needed

Celauran wrote:So read each line into an array and then reverse the array.
you mean something like array_reverse


but how to read lines through array reverse
by pHp_n0ob
Wed Sep 26, 2012 9:15 pm
Forum: PHP - Code
Topic: File function help needed
Replies: 11
Views: 2995

Re: File function help needed

This is a fairly poor idea, but if you really want to do it then I would recommend a few things: - Separate reading and writing - For writing, lock the file and append lines to the end of the file. - For reading, pass a URL parameter (or post var) with the last position of the end of the file. Then...
by pHp_n0ob
Wed Sep 26, 2012 1:23 pm
Forum: PHP - Code
Topic: File function help needed
Replies: 11
Views: 2995

Re: File function help needed

You'll want a+ for fopen. Please post your code and explain where you're running into problems. Also, why are you writing this to a file? 1. a+ will put the cursor at end,so its showing newest post at last. 2. the problem is i want to save the whole data in a single flat file...with exception that ...
by pHp_n0ob
Wed Sep 26, 2012 7:09 am
Forum: PHP - Code
Topic: File function help needed
Replies: 11
Views: 2995

File function help needed

I'm allowing my users to write in a .txt file through html forms.....but HOW can i display the .txt file in order to the newest post... For eg. (1). A user "bdplanet" wrote "hi" (2). Another user "soroze" wrote "how r u" (3). Another user "vivek" wro...
by pHp_n0ob
Thu Jul 19, 2012 7:46 am
Forum: Javascript
Topic: Form Validation [*N0T WORKING*]
Replies: 3
Views: 2464

Re: Form Validation [*N0T WORKING*]

Could you perhaps explain how it isn't working :) I made a form...and set validation..example:If a name would contain numbers(0-9),it would show an alert box written Name must contain Alphabets only .....similarlly,every condition has been set using js.....but its n0t workIng at all as I mentioned :(
by pHp_n0ob
Thu Jul 19, 2012 6:32 am
Forum: PHP - Code
Topic: Replacing text with smilies! Getting some error!
Replies: 17
Views: 2414

Re: Replacing text with smilies! Getting some error!

Sorry, I don't use databases (especially not MySQL.) 8) 8O If it's one's own content for one's own site, then any form of separated file storage isn't called for. I do use flat files, but I don't store other people's content or information very often so there is no need for me to use a database nor...
by pHp_n0ob
Thu Jul 19, 2012 6:19 am
Forum: Javascript
Topic: Form Validation [*N0T WORKING*]
Replies: 3
Views: 2464

Form Validation [*N0T WORKING*]

:banghead: My hardwork going into vein :banghead: dont know why its not working <?php include "../templates/header.php";?> <script type='text/javascript'> function formValidator(){// Setting variables var name = document.getElementById('name'); var subject = document.getElementById('subjec...
by pHp_n0ob
Mon Jul 16, 2012 6:36 am
Forum: PHP - Code
Topic: Replacing text with smilies! Getting some error!
Replies: 17
Views: 2414

Re: Replacing text with smilies! Getting some error!

TildeHash wrote:
pHp_n0ob wrote:Oh...thanx :p plz tell smthing ab0ut mysql...i'm gettin error...http://topnet.nstop.in/user_db.php
Sorry, I don't use databases (especially not MySQL.) 8)
8O
then how without databasess??? Do u use flat files instead
by pHp_n0ob
Mon Jul 16, 2012 6:31 am
Forum: PHP - Code
Topic: Replacing text with smilies! Getting some error!
Replies: 17
Views: 2414

Re: Replacing text with smilies! Getting some error!

TildeHash wrote:
pHp_n0ob wrote:Oh...thanx :p plz tell smthing ab0ut mysql...i'm gettin error...http://topnet.nstop.in/user_db.php
Sorry, I don't use databases (especially not MySQL.) 8)
8O
then how without databasess??? Do u use flat files instead :)
by pHp_n0ob
Mon Jul 16, 2012 6:23 am
Forum: PHP - Code
Topic: Replacing text with smilies! Getting some error!
Replies: 17
Views: 2414

Re: Replacing text with smilies! Getting some error!

There were a few problems with it, but it should work as expected now: <form method="GET"> <input type="text" name="name" value="Name" /><br /> <input type="text" name="msz" value="Message" /> <input type="submit" name=...