View previous topic :: View next topic � |
Author |
Message |
Twilkitri Pez-Ruler
Joined: 19 May 2002 Posts: 1481 Location: Australia
|
Posted: Sun Mar 02, 2003 9:46 pm�� �Post subject: beyonder's PHP thread o' FUN |
|
|
We all know he was going to make this eventually, so I've made it for him since he was taking so long.
beyonder, how would I use PHP to let people book through the FE4SRP/ProjectTables page rather than having to email me? _________________ ~Twilkitri~
http://darktwilkitri.thegreatbeyond.net/ (is broken) |
|
Back to top |
|
|
beyonder Webmaster
Joined: 20 May 2002 Posts: 678 Location: my house.
|
Posted: Sun Mar 02, 2003 10:13 pm�� �Post subject: |
|
|
<?php
if (isset($submit)){
//code to do on submit goes here!(nifty, eh?)
}
else{
echo '
<form method="post" action="thisverysamefile.php">
make a form, put it here.....
<input type="submit" name="submit" value="submit"></input>
</form>
';
}
?>
when the user clicks the submit button, the script gets called again, but since $submit is now set, executes the other section....which will be used to store the data they entered. when making the form, remember that the name of each field and it's value will be passed to the script when the person hits the submit button...this means that if you use name="hello" for a field, that will be accessable through use of $name in the script. there would then be two ways to store the data, one being files on the server, the other being the mySQL database on the server(for this method you need to ask me for a db account for your script to use)
http://www.php.net/manual/en/ref.filesystem.php <-- php filesystem functions
http://www.php.net/manual/en/ref.mysql.php <-- php mySQL functions _________________
|
|
Back to top |
|
|
Twilkitri Pez-Ruler
Joined: 19 May 2002 Posts: 1481 Location: Australia
|
Posted: Sat Mar 08, 2003 7:00 am�� �Post subject: |
|
|
OK now, I haven't really looked at that yet, this is a different topic.
You know how old browsers can't handle PNG outside of a page, and send it to MPE or some such program, right? Anyways, I didn't really want to make a tiny page for every PNG sheet that got put up, so I tried making a single dynamic page in php. But it won't work ><
Can you see any errors in this?
Code: | <html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
header("Content-type: image/png");
$string = $_GET['pic'];
$add = "SHEETS/";
$add .= $string;
$im = imagecreatefrompng($add);
imagepng($im);
//imagedestroy($im);
?>
</body>
</html>
|
And here are the errors:
Code: | Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\darktwilkitri\FE4\PNGVIEW.PHP:6) in c:\inetpub\wwwroot\darktwilkitri\FE4\PNGVIEW.PHP on line 7
Fatal error: Call to undefined function: imagecreatefrompng() in c:\inetpub\wwwroot\darktwilkitri\FE4\PNGVIEW.PHP on line 1 |
Goes better on the net than in the cli... it just sits there if I try to run it in the cli... _________________ ~Twilkitri~
http://darktwilkitri.thegreatbeyond.net/ (is broken) |
|
Back to top |
|
|
beyonder Webmaster
Joined: 20 May 2002 Posts: 678 Location: my house.
|
Posted: Sat Mar 08, 2003 3:33 pm�� �Post subject: |
|
|
if this script worked, it wold end up with some weird output.....the code for an image embedded into a html file if i'm thinking right......why can't you just echo an img tag to embed the picture into a very simple page
replace
$im = imagecreatefrompng($add);
imagepng($im);
//imagedestroy($im);
with
echo "<img src=\"" . $add . "\">";
adding attributes to the img tag as you wish.....and take out the header("Content-type: image/png"); line....this function can only be used if it is the absolute first thing in a file....no html before it, and if left in will make the browser think that what it's looking at is supposed to be *entirely* a png and kill itself.
and besides that, the php PNG functions are quite buggy(and for some reason the server seems to think that they don't exist....) _________________
|
|
Back to top |
|
|
Twilkitri Pez-Ruler
Joined: 19 May 2002 Posts: 1481 Location: Australia
|
Posted: Tue Nov 04, 2003 10:24 pm�� �Post subject: |
|
|
It's been too long since beyonder had any FUN in his PHP thread o' it!
Rightio.
http://www.thegreatbeyond.net/DarkTwilkitri/sts2.php
There you can see the brains... er, error which is similar to what I was talking to you about in chat the other day. Although I didn't get those messages because I don't have notices turned on, so it may be a different error just with the same effect.
Any ideas?
I'll just pust the code here too...
Code: | <?php
$count = file_get_contents("STScount.txt");
$count++;
$countfile = fopen("STScount.txt", "wb");
fwrite($countfile, $count);
fclose($countfile);
print "This page has been viewed $count times since November 5, 2003.";
?>
|
_________________ ~Twilkitri~
http://darktwilkitri.thegreatbeyond.net/ (is broken) |
|
Back to top |
|
|
beyonder Webmaster
Joined: 20 May 2002 Posts: 678 Location: my house.
|
Posted: Wed Nov 05, 2003 4:12 am�� �Post subject: |
|
|
Well, since giving the user 'nobody' write access to everything on a server does not make much sense, if you upload a file, the ftp writes the file using the user 'thegreat', now this user can write to the file but 'nobody' cannot. 'nobody' is the user that the Apache process, and therefore the PHP parser runs on. There's really two solutions to this. They both involve chmod 777'ing *something*, in one case it's a directory in another it's a file. You have access to chmod files through the ftp. THe directory method would be to make a directory, chmod it and have the script create the file in it. The file method should be pretty obvious. _________________
|
|
Back to top |
|
|
beyonder Webmaster
Joined: 20 May 2002 Posts: 678 Location: my house.
|
Posted: Wed Nov 05, 2003 4:13 am�� �Post subject: |
|
|
Or, if you're feeling like the spawn of satan, a chmod 666 should also do the trick. ^.~ _________________
|
|
Back to top |
|
|
Twilkitri Pez-Ruler
Joined: 19 May 2002 Posts: 1481 Location: Australia
|
Posted: Thu Nov 06, 2003 12:29 am�� �Post subject: |
|
|
Hooray!
Took me a while to figure out how to get ftp to tell your ftp to chmod, though. What sort of a name for a remote command command is 'quote' ?!? _________________ ~Twilkitri~
http://darktwilkitri.thegreatbeyond.net/ (is broken) |
|
Back to top |
|
|
beyonder Webmaster
Joined: 20 May 2002 Posts: 678 Location: my house.
|
Posted: Thu Nov 06, 2003 1:24 am�� �Post subject: |
|
|
'quote' isn't a remote command. it's a local command. it tells your ftp client to send the command exactly as you type it. _________________
|
|
Back to top |
|
|
Twilkitri Pez-Ruler
Joined: 19 May 2002 Posts: 1481 Location: Australia
|
|
Back to top |
|
|
beyonder Webmaster
Joined: 20 May 2002 Posts: 678 Location: my house.
|
Posted: Sat Nov 08, 2003 12:57 am�� �Post subject: |
|
|
no it's not... _________________
|
|
Back to top |
|
|
Twilkitri Pez-Ruler
Joined: 19 May 2002 Posts: 1481 Location: Australia
|
Posted: Sat Nov 08, 2003 8:20 am�� �Post subject: |
|
|
DarkTwilkitri wrote: | Hooray!
Took me a while to figure out how to get ftp to tell your ftp to chmod, though. What sort of a name for a remote command command is 'quote' ?!? |
Ergo, a command which runs remote commands. _________________ ~Twilkitri~
http://darktwilkitri.thegreatbeyond.net/ (is broken) |
|
Back to top |
|
|
chromus Pez-Ruler
Joined: 13 Aug 2002 Posts: 1703
|
|
Back to top |
|
|
beyonder Webmaster
Joined: 20 May 2002 Posts: 678 Location: my house.
|
Posted: Sun Jan 18, 2004 2:55 pm�� �Post subject: |
|
|
o_o; your special html characters in the source are missing semicolons...so in mozilla they just show up as <, should be < _________________
|
|
Back to top |
|
|
chromus Pez-Ruler
Joined: 13 Aug 2002 Posts: 1703
|
Posted: Sun Jan 18, 2004 7:16 pm�� �Post subject: |
|
|
Whoops. All fixed now, I hope. If anyone finds any more problems, let me know and I'll fix them. |
|
Back to top |
|
|
|