LITTLEBLACKDOG.COM Forum Index LITTLEBLACKDOG.COM

 
LWD LWD   FAQ FAQ   Memberlist Memberlist   Usergroups Usergroups   Active Topics Active Topics   Register Register  
  Profile Profile   Log in to check your private messages Log in to check your private messages   Log in Log in  
  Who is Online Who is Online   Image Gallery Image Gallery   Chat Chat   Search Search  
  LWDGear       LBDGear  

View next topic
View previous topic
Post new topic     Reply to topic   LITTLEBLACKDOG.COM Forum Index » Code Warriors
Author Message
West
Butt Sniffer
Butt Sniffer


Joined: 27 Mar 2003
Posts: 1821
Location: Stealthed

Post Posted: Mon Aug 04, 2003 10:20 am   Post subject: A few questions about PHP Reply with quote Back to top  

How can I store a variable from an HTML from into a text document and how can i read the variable back into php from the text document?

Is there any structure to the variables? Do I have to declare them?

Can I alter the variables from one type to the other? (ie is there something like text1.text:=IntToStr(Number1*Number2); )

My host doesn't support MySQL and I was going to write a php shout box (I think I should be able to do that). I have a feeling that you could post PHP into the shoutbox so that it stores the php in the text document. When it comes to retrieve the text and the php it would parse it as part of my site? For example could someone post an infinate while loop and hang the browser? Could that happen and could I stop it?

Any books you would recommend also?

I set up an Apache server just so I could practise PHP and I love it Smile

_________________
View user's profile Send private message Send e-mail
Lycander
Lead Dog
Lead Dog


Joined: 24 May 2002
Age: 25
Posts: 12198
Location: The Constitution State

Post Posted: Mon Aug 04, 2003 10:38 am   Post subject: Reply with quote Back to top  

If you have MS Access, I think PHP can read/write to an MDB file which will make it easier on you. You have to consider the worst case scenario which is 2 people trying to post at the same time and you get a file I/O collision.

I believe to get variables from a POST form, you access the variable's data via:

$_POST['name']

where name is the name of the HTML form object like a text box.

Go to www.php.net and find your way to the documentation download section. You can download the PHP docs in many formats (PDF, HTML tarball, CHM) and look up the routines you want to use. Like if you need to convert a binary number into its string representation there's a rountine for that.

And if someone wants to get cleaver and put PHP code in their post, you could do some validation on the post to make sure they're posting just text and not PHP or Javascript. As far as PHP code goes, I don't think you'll have to worry because it'll just output it as text to the user and they'll see the code in their web browser, but the PHP parser on the server side just prints out the text and moves on with execution in this particular script. The only way to throw it off track from execution in the current script is either by #include directives or calling an external routine (also included via #include).
View user's profile Send private message
West
Butt Sniffer
Butt Sniffer


Joined: 27 Mar 2003
Posts: 1821
Location: Stealthed

Post Posted: Mon Aug 04, 2003 11:04 am   Post subject: Reply with quote Back to top  

Thanks Ly.

_________________
View user's profile Send private message Send e-mail
Lycander
Lead Dog
Lead Dog


Joined: 24 May 2002
Age: 25
Posts: 12198
Location: The Constitution State

Post Posted: Mon Aug 04, 2003 11:36 am   Post subject: Reply with quote Back to top  

You're welcome.

Nice panties.
View user's profile Send private message
BamZipPow
Alpha Dog
Alpha Dog


Joined: 02 Aug 2001
Posts: 18022
Location: Driving EEp all over the place...

Post Posted: Mon Aug 04, 2003 12:03 pm   Post subject: Reply with quote Back to top  

Lycander wrote:
Nice panties.


Shocking Smile

_________________
BamZipPow
...all yer EEps belong to Bam!

View user's profile Send private message Send e-mail AIM Address ICQ Number
West
Butt Sniffer
Butt Sniffer


Joined: 27 Mar 2003
Posts: 1821
Location: Stealthed

Post Posted: Mon Aug 04, 2003 12:17 pm   Post subject: Reply with quote Back to top  

Haha got it sorted Very Happy

http://tinyurl.com/izhp to take my test. (Please dont be offended, its just a joke. Its safe btw)

I'll post my code in a minute if anyone is interested.

_________________


Last edited by West on Mon Aug 04, 2003 12:24 pm; edited 2 times in total
View user's profile Send private message Send e-mail
Lycander
Lead Dog
Lead Dog


Joined: 24 May 2002
Age: 25
Posts: 12198
Location: The Constitution State

Post Posted: Mon Aug 04, 2003 12:18 pm   Post subject: Reply with quote Back to top  

BamZipPow wrote:
Lycander wrote:
Nice panties.


Shocking Smile

Look at the girl in the white skirt dancing in his sig.
View user's profile Send private message
seca111
Leg Humper
Leg Humper


Joined: 12 May 2003
Posts: 4778
Location: Franktown, Colorado

Post Posted: Mon Aug 04, 2003 12:43 pm   Post subject: Reply with quote Back to top  

CONGRATULATIONS, YOU'RE MEDIOCRE! Sad

Only mediocre.... I thought I was at least above average with my responses. Mad
View user's profile Send private message Visit poster's website AIM Address
Lycander
Lead Dog
Lead Dog


Joined: 24 May 2002
Age: 25
Posts: 12198
Location: The Constitution State

Post Posted: Mon Aug 04, 2003 12:46 pm   Post subject: Reply with quote Back to top  

For a minute there I thought I was the only one on the list of wankers. Whew.
View user's profile Send private message
West
Butt Sniffer
Butt Sniffer


Joined: 27 Mar 2003
Posts: 1821
Location: Stealthed

Post Posted: Mon Aug 04, 2003 12:53 pm   Post subject: Reply with quote Back to top  

There was about 70 on it, but I kept deleting it. I removed the Proceed button but it must have still been stored on peoples comps so I was still getting them :S

_________________
View user's profile Send private message Send e-mail
West
Butt Sniffer
Butt Sniffer


Joined: 27 Mar 2003
Posts: 1821
Location: Stealthed

Post Posted: Mon Aug 04, 2003 1:01 pm   Post subject: Reply with quote Back to top  

This is how I wrote and read from a text file if anyone is interested.

To read
Code: Select all

$filename = "file.txt";

$list = file_get_contents($filename);


To write
Code: Select all

$two = $_POST['sname'];
$one = $_POST['wank'];
$space = " wanks for ";
$after = " per week, ";
$combined = "";
$combined .= $two;
$combined .= $space;
$combined .= $one;
$combined .= $after;
$combined .= $list;

$fp = fopen("wank.txt", "w");

fputs ($fp, $combined);

fclose($fp);

_________________
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic     Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours

Help us keep advertisements off this site. Donate today!