I think I am one of the best PHP programers here - ... and that's why I will help you

Pages: 1, 2, 3, 4
free web hosting

Read Latest Entries..: (Post #33) by redsky on Aug 15 2004, 05:49 AM. (Line Breaks Removed)
well, then what to we do ?
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

I think I am one of the best PHP programers here - ... and that's why I will help you

Roly
Just post your PHP problem here and I will try to help you. Having trouble writing a script? I am here come to me here. And no offense but I think I know more PHP than the admin.

BTW, I don't want you to think of me as a person who gloats about himself a lot because I don't. I'm just saying this because it's been proved and I'm sure there are other great PHP programers here and I ask them to come here and help asnwer your questions.

Reply

groentjuh
biggrin.gif no help needed here tongue.gif my brother is php-programmer too.

Reply

jailbox
So, im making a chatroom in wml/php with no database. I have most of it covered but I have a few problems. When a user enters the chat he/she has to enter the nickname. After the user has entered one message the chatroom "forgets" the nickname so if he/she enters another message, the name wont be displayed.
I tried using sessions and cookies and such but I cant get em to work.

Reply

icleric
Ahem , am asking for the best News system u can offer me biggrin.gif
appreciate if it is easy to setup , and can manage templates and things like that ,

thnx smile.gif

Reply

Spectre
Mind showing us some of your stuff, Roley? Do you have a portfolio of anything you've done?

Reply

chinfo
And please change the topic title, some people are bound to get offended by that and take it against you. Something like "PHP Help Center" will be sufficient.

Reply

Roly
QUOTE(jailbox @ Aug 1 2004, 10:21 AM)
So, im making a chatroom in wml/php with no database. I have most of it covered but I have a few problems. When a user enters the chat he/she has to enter the nickname. After the user has entered one message the chatroom "forgets" the nickname so if he/she enters another message, the name wont be displayed.
I tried using sessions and cookies and such but I cant get em to work.

Mind showing me your source? And yes cookies is the best way. Your source should look something like this:

CODE
<?php
if(isset($_POST['nickname'])
 setcookie('nickname', htmlentities($_POST['nickname']), 999999);
?>

<form>
<input name=nickname value="<?= isset($_COOKIE['nickname']) ? isset($_COOKIE['nickname']) : NULL; ?>"
<input name=message><input type=submit value="Say It"></form>

And remember you need to set the cookie before you write anything to the page. That means before the <html> tag happy.gif

 

 

 


Reply

Roly
QUOTE(icleric @ Aug 1 2004, 03:03 PM)
Ahem , am asking for the best News system u can offer me  biggrin.gif
appreciate if it is easy to setup , and can manage templates and things like that ,

thnx  smile.gif

You should go to http://php.resourceindex.com and search for one. Before I knew PHP I went to that site to get my scripts and I slowly learned from them. I still go sometimes just to look for some examples.

Reply

Spectre
No, cookies are not the best way to go. Sessions are most definately better than cookies, assuming nothing needs to be 'remembered' outside of the current session.

Some browsers don't allow cookies, and some people turn them off (due to security threats etc), so if your site uses cookies, not all users will be able to view it - or some may even choose to leave based on this reason alone.

On the other hand, sessions always work. And the user can't disable sessions (unless they close their browser window).

And as for your code:
CODE
<?php
if(isset($_POST['nickname'])
setcookie('nickname', htmlentities($_POST['nickname']), 999999);
?>


Shouldn't it be:
CODE
<?php
if(isset($_POST['nickname']) {
      setcookie('nickname', htmlentities($_POST['nickname']), 999999);
}
// edit: IF statements need to be enclosed in { }.

?>


(edit: I read it wrong the first time)

Reply

jailbox
QUOTE(Roly @ Aug 2 2004, 05:53 AM)
QUOTE(jailbox @ Aug 1 2004, 10:21 AM)
So, im making a chatroom in wml/php with no database. I have most of it covered but I have a few problems. When a user enters the chat he/she has to enter the nickname. After the user has entered one message the chatroom "forgets" the nickname so if he/she enters another message, the name wont be displayed.
I tried using sessions and cookies and such but I cant get em to work.

Mind showing me your source? And yes cookies is the best way. Your source should look something like this:

CODE
<?php
if(isset($_POST['nickname'])
 setcookie('nickname', htmlentities($_POST['nickname']), 999999);
?>

<form>
<input name=nickname value="<?= isset($_COOKIE['nickname']) ? isset($_COOKIE['nickname']) : NULL; ?>"
<input name=message><input type=submit value="Say It"></form>

And remember you need to set the cookie before you write anything to the page. That means before the <html> tag happy.gif

Actualy the source for the page where user inputs his/her name is

CODE
<?php
session_start( ); session_register("nick");
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<card id="en" title="Enter nickname">
<p>
<?php $session=session_id(); ?>
</p>
<p>
 
           <do type="accept">    
           <go href="viewroom.php?nick=<?echo $session?>" method="post">
           <postfield name="nick" value="$nick"/>  
           </go>
       </do>
       Enter nickname:
       <input title="nick" name="nick" type="text" /> <br/>  
             
</p>
</card>
</wml>

I dont think thats correct though.

I dont know if its neede but heres also the code for the page that writes the data into the file
CODE
<?php
session_start();
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<card id="msgadd" title="message added">
<p align="center">
<br/>Your message has been added
</p>
<p><?php $session=session_id();  ?></p>
<p><a href="viewroom.php?nick=<?echo $session?>">Chat</a></p>

<p>
<?php

//use the fopen() function
$fp=fopen("msgs.txt",  "r");  
$data = fread( $fp, filesize( "msgs.txt" ));
fclose( $fp );

$fp2 = fopen( "msgs.txt", "w" );

//using the fputs() function
fputs($fp2, "
<p>
//I was just testing so dont even notice the session varaible below
$session: $msg <br/>
</p>
". $data );
 
fclose($fp2);  

?>

</p>
</card>
</wml>

Reply

Latest Entries

redsky
well, then what to we do ?

Reply

ivepanda
haha~~~~~

really??

maybe i will need your help later~~~

....but my english is not good
plx try your best to understand me~~ biggrin.gif

Reply

Roly
Umm, you're supposed to do that yourself because it's gonna be the way you would want it. Here, use the colors table near the middle to help you, it helps me,

http://www.w3schools.com/css/css_colors.asp

Reply

CodeName_88
Roly, I want to set up my site to use php-nuke, but I want to change its template. So if I provide you with the CSS, could you change it for me?

Reply

LuciferStar
cookies are stored in client machine
sessions are stored in sever machine

sessions are safer than cookies.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2, 3, 4

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for php, programers

*MORE FROM TRAP17.COM*
advertisement



I think I am one of the best PHP programers here - ... and that's why I will help you



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE