Make your own PHP adoptables system

Need help with the site/forum/pets? Ask questions and get help from other members here.

Re: Make your own PHP adoptables system

Postby Lady » Fri Jan 30, 2009 7:54 pm

I don't know if this has been explained/asked/whatever yet, but if it has please ignore/point me there. :lol:

How do you disable older adopts from being adopted? You can always type in the adoption code in the address bar and find older pets, but I'd like to "close" those old adopts. Is that possible?
ImageImageImageImage
User avatar
Lady
 
Posts: 4424
Joined: Tue Jun 24, 2008 5:44 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Fri Jan 30, 2009 8:33 pm

Hm, that's interesting, Lady! Actually, it doesn't support that right now. Fortunately, adding it is easy. In your XML file where you have something like:

Code: Select all
<adoptable id="1">


Just edit it like:

Code: Select all
<adoptable id="1" closed="1">


Then in adopt.php, after this line:

Code: Select all
$adoptable=find_adoptable($_REQUEST['id']);


You can add:

Code: Select all
if (isset($adoptable['closed'])) exit();


Now if people try to guess the older ID numbers, they just get an empty page and no adoption.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Lady » Sat Jan 31, 2009 12:46 am

thenickdude wrote:Hm, that's interesting, Lady! Actually, it doesn't support that right now. Fortunately, adding it is easy. In your XML file where you have something like:
Code: Select all
<adoptable id="1">

Just edit it like:
Code: Select all
<adoptable id="1" closed="1">

Then in adopt.php, after this line:
Code: Select all
$adoptable=find_adoptable($_REQUEST['id']);

You can add:
Code: Select all
if (isset($adoptable->closed)) exit();

Now if people try to guess the older ID numbers, they just get an empty page and no adoption.

Awesomeness. :D You should probably add another little bit on the coding about that, or just post a link to your post to point it out.
ImageImageImageImage
User avatar
Lady
 
Posts: 4424
Joined: Tue Jun 24, 2008 5:44 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby SilverFlame » Sat Jan 31, 2009 10:15 am

thenickdude wrote:Okay well there aren't any useful files uploaded there. Tell me when you've uploaded the files from the tutorial.

I have "Simple" and "default" uploaded, I'm not going to go any farther than that if they don't even work...
Clicky clicky?
I need profile views to win a contest. The prize is a rare on DragCave.
Thanks to clickers! <3

ImageImageImageImage
User avatar
SilverFlame
 
Posts: 13
Joined: Sun Dec 28, 2008 11:27 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Jan 31, 2009 3:41 pm

Default.php isn't a tutorial file, it's a file that 000webhost uploaded to introduce your site.

Your simple.php seems to be working fine:

http://silverflame.comoj.com/simple.php?id=1

Image

http://silverflame.comoj.com/simple.php?id=2

Image


~Meg~, can you post the URL to your site so I can try to fix that one for you.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby SilverFlame » Sat Jan 31, 2009 4:26 pm

Sorry, must've gotten Default confused with an earlier file I deleted.

Really? All I'm getting is just the website URL. No image, just plain text of the URL.
Clicky clicky?
I need profile views to win a contest. The prize is a rare on DragCave.
Thanks to clickers! <3

ImageImageImageImage
User avatar
SilverFlame
 
Posts: 13
Joined: Sun Dec 28, 2008 11:27 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Jan 31, 2009 4:46 pm

You mean, you don't see those images in my post? Try pressing refresh in your browser.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby SilverFlame » Sat Jan 31, 2009 5:13 pm

No, I see them in the post, just not on my site.
Clicky clicky?
I need profile views to win a contest. The prize is a rare on DragCave.
Thanks to clickers! <3

ImageImageImageImage
User avatar
SilverFlame
 
Posts: 13
Joined: Sun Dec 28, 2008 11:27 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Jan 31, 2009 5:43 pm

What addresses are you trying to go to to view them? The correct addresses to view those pics were in the post I made. As is demonstrated in the tutorial, you need to include the ?id=1 or ?id=2 part to tell simple.php WHICH pet it is supposed to display. If you just go to simple.php on its own, it doesn't know which picture to show so it just shows nothing.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby SilverFlame » Sun Feb 01, 2009 3:56 am

Code: Select all
<?php

//Tell the browser that we are sending it a PNG image to display
header("Content-Type: image/gif");

if ($_REQUEST['id']==1) {
    //Echo the contents of the image file called "dogbaby.png" to send it to the browser
    readfile("1gold.gif");
} else if ($_REQUEST['id']==2) {
    //Echo the contents of the image file called "ratbaby.png" to send it to the browser
    readfile("1silver.gif");
}
exit();
?>


That's the code. It shows both IDs.
Clicky clicky?
I need profile views to win a contest. The prize is a rare on DragCave.
Thanks to clickers! <3

ImageImageImageImage
User avatar
SilverFlame
 
Posts: 13
Joined: Sun Dec 28, 2008 11:27 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Who is online

Users browsing this forum: No registered users and 1 guest