thegreatbeyond
Slightly better than a 6-month old PEZ!
 
 FAQ   Search   Memberlist   Usergroups   Register 
 Profile   Log in to check your private messages   Log in 

beyonder's PHP thread o' FUN
Goto page 1, 2  Next
Post new topic���Reply to topic ���thegreatbeyond Forum Index -> Anything.
View previous topic :: View next topic
Author Message
Twilkitri
Pez-Ruler
Pez-Ruler


Joined: 19 May 2002
Posts: 1481
Location: Australia

PostPosted: Sun Mar 02, 2003 9:46 pm� �Post subject: beyonder's PHP thread o' FUN Reply with quote

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
View user's profile Send private message
beyonder
Webmaster
Webmaster


Joined: 20 May 2002
Posts: 678
Location: my house.

PostPosted: Sun Mar 02, 2003 10:13 pm� �Post subject: Reply with quote

<?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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Twilkitri
Pez-Ruler
Pez-Ruler


Joined: 19 May 2002
Posts: 1481
Location: Australia

PostPosted: Sat Mar 08, 2003 7:00 am� �Post subject: Reply with quote

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
View user's profile Send private message
beyonder
Webmaster
Webmaster


Joined: 20 May 2002
Posts: 678
Location: my house.

PostPosted: Sat Mar 08, 2003 3:33 pm� �Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Twilkitri
Pez-Ruler
Pez-Ruler


Joined: 19 May 2002
Posts: 1481
Location: Australia

PostPosted: Tue Nov 04, 2003 10:24 pm� �Post subject: Reply with quote

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
View user's profile Send private message
beyonder
Webmaster
Webmaster


Joined: 20 May 2002
Posts: 678
Location: my house.

PostPosted: Wed Nov 05, 2003 4:12 am� �Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
beyonder
Webmaster
Webmaster


Joined: 20 May 2002
Posts: 678
Location: my house.

PostPosted: Wed Nov 05, 2003 4:13 am� �Post subject: Reply with quote

Or, if you're feeling like the spawn of satan, a chmod 666 should also do the trick. ^.~
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Twilkitri
Pez-Ruler
Pez-Ruler


Joined: 19 May 2002
Posts: 1481
Location: Australia

PostPosted: Thu Nov 06, 2003 12:29 am� �Post subject: Reply with quote

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
View user's profile Send private message
beyonder
Webmaster
Webmaster


Joined: 20 May 2002
Posts: 678
Location: my house.

PostPosted: Thu Nov 06, 2003 1:24 am� �Post subject: Reply with quote

'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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Twilkitri
Pez-Ruler
Pez-Ruler


Joined: 19 May 2002
Posts: 1481
Location: Australia

PostPosted: Thu Nov 06, 2003 7:01 pm� �Post subject: Reply with quote

That's what I said...
_________________
~Twilkitri~
http://darktwilkitri.thegreatbeyond.net/ (is broken)
Back to top
View user's profile Send private message
beyonder
Webmaster
Webmaster


Joined: 20 May 2002
Posts: 678
Location: my house.

PostPosted: Sat Nov 08, 2003 12:57 am� �Post subject: Reply with quote

no it's not...
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Twilkitri
Pez-Ruler
Pez-Ruler


Joined: 19 May 2002
Posts: 1481
Location: Australia

PostPosted: Sat Nov 08, 2003 8:20 am� �Post subject: Reply with quote

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
View user's profile Send private message
chromus
Pez-Ruler
Pez-Ruler


Joined: 13 Aug 2002
Posts: 1703

PostPosted: Sat Jan 17, 2004 9:49 pm� �Post subject: Reply with quote

As opposed to asking for help with PHP, I want to see how people like the PHP version of some of my scripts. Check them out:

http://chromus.thegreatbeyond.net/dungeons_and_dragons_scripts/

I've even included source code!
Back to top
View user's profile Send private message Visit poster's website
beyonder
Webmaster
Webmaster


Joined: 20 May 2002
Posts: 678
Location: my house.

PostPosted: Sun Jan 18, 2004 2:55 pm� �Post subject: Reply with quote

o_o; your special html characters in the source are missing semicolons...so in mozilla they just show up as &lt, should be &lt;
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
chromus
Pez-Ruler
Pez-Ruler


Joined: 13 Aug 2002
Posts: 1703

PostPosted: Sun Jan 18, 2004 7:16 pm� �Post subject: Reply with quote

Whoops. All fixed now, I hope. If anyone finds any more problems, let me know and I'll fix them.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:
Post new topic���Reply to topic ���thegreatbeyond Forum Index -> Anything. All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2


Jump to:  
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
You can attach files in this forum
You can download files in this forum


Fission phpBB Template by SkaidonDesigns
Powered by phpBB � 2001, 2002 phpBB Group