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 Nick » Tue Dec 30, 2008 1:06 pm

Lady wrote:I'm having trouble with the files in the zip.

I had problems every time I edited it on my own, so I scraped all of it and started from the zip files to see what I kept messing up on. Unfortunately, the problem keeps coming up anyway.


Do you have somewhere where I can view the system?
User avatar
Nick
Admin
 
Posts: 6338
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 Rolly-chan » Tue Dec 30, 2008 10:27 pm

I just found out that the pictures are not displayed even if I don't put them into another folder.
And I have no clue what's wrong. ?_?

EDIT: It works o_O And I have no idea how I made it work. Scary...
User avatar
Rolly-chan
 
Posts: 2790
Joined: Tue Nov 18, 2008 8:09 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby qhost » Tue Dec 30, 2008 10:40 pm

Rolly-chan wrote:I just found out that the pictures are not displayed even if I don't put them into another folder.
And I have no clue what's wrong. ?_?

EDIT: It works o_O And I have no idea how I made it work. Scary...


That happened to me once. The pictures were working just fine one moment, then the next they weren't. Then suddenly, a while later, the pictures came back again. And I didn't have to edit the codes or anything :?
    -
    she/they | adult | australia | artist | writer
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    My name is Boo & I am perpetually tired.
    I have real bad anxiety so I take a while to respond
    to msgs sometimes, sorry!
    -
User avatar
qhost
 
Posts: 4107
Joined: Wed Oct 01, 2008 6:36 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Rolly-chan » Tue Dec 30, 2008 10:58 pm

Kiara wrote:
Rolly-chan wrote:I just found out that the pictures are not displayed even if I don't put them into another folder.
And I have no clue what's wrong. ?_?

EDIT: It works o_O And I have no idea how I made it work. Scary...


That happened to me once. The pictures were working just fine one moment, then the next they weren't. Then suddenly, a while later, the pictures came back again. And I didn't have to edit the codes or anything :?


Yeah, it's happening again. But this time I know why (at least a little XD)
The script does work without the key.php and without encrypting the variations. But as soon as I change the script to the encrypting-part it doesn't work any more. Why this? ?_?
User avatar
Rolly-chan
 
Posts: 2790
Joined: Tue Nov 18, 2008 8:09 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby qhost » Tue Dec 30, 2008 11:30 pm

Rolly-chan wrote:Yeah, it's happening again. But this time I know why (at least a little XD)
The script does work without the key.php and without encrypting the variations. But as soon as I change the script to the encrypting-part it doesn't work any more. Why this? ?_?


What does your simple.php file look like? That's the reason why mine wasn't working to start off with .
    -
    she/they | adult | australia | artist | writer
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    My name is Boo & I am perpetually tired.
    I have real bad anxiety so I take a while to respond
    to msgs sometimes, sorry!
    -
User avatar
qhost
 
Posts: 4107
Joined: Wed Oct 01, 2008 6:36 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Rolly-chan » Wed Dec 31, 2008 12:31 am

It looks like this

Code: Select all
<?php

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

require("adopttools.php");

//Find the variation with the given adoptable id ('a') and variation id ('v')
$variation=find_variation($_REQUEST['a'], decrypt_variation($_REQUEST['v']));

//Decide which of the ages we want to show for the adoptable
      
$pickedAge=NULL; //We'll store the age we eventually pick into the variable $pickedAge
      
/* Check the ages in order. The age we end up picking will be the last age
 * in the file where the current date is after the 'date' attribute
 */
foreach ($variation->age as $age) {
   if (!isset($age['date']) || time() > strtotime($age['date'])) {
      $pickedAge=$age;
   }
}

//Now that we've picked the age, display the image that that age uses
readfile($pickedAge['image']);   

exit();

?>
User avatar
Rolly-chan
 
Posts: 2790
Joined: Tue Nov 18, 2008 8:09 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby qhost » Wed Dec 31, 2008 12:44 am

Rolly-chan wrote:It looks like this

Code: Select all
<?php

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

require("adopttools.php");

//Find the variation with the given adoptable id ('a') and variation id ('v')
$variation=find_variation($_REQUEST['a'], decrypt_variation($_REQUEST['v']));

//Decide which of the ages we want to show for the adoptable
      
$pickedAge=NULL; //We'll store the age we eventually pick into the variable $pickedAge
      
/* Check the ages in order. The age we end up picking will be the last age
 * in the file where the current date is after the 'date' attribute
 */
foreach ($variation->age as $age) {
   if (!isset($age['date']) || time() > strtotime($age['date'])) {
      $pickedAge=$age;
   }
}

//Now that we've picked the age, display the image that that age uses
readfile($pickedAge['image']);   

exit();

?>


Looks fine to me...what webhost do you use? Have you uploaded the key.php file? Other than that I can't really think of anything...
    -
    she/they | adult | australia | artist | writer
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    My name is Boo & I am perpetually tired.
    I have real bad anxiety so I take a while to respond
    to msgs sometimes, sorry!
    -
User avatar
qhost
 
Posts: 4107
Joined: Wed Oct 01, 2008 6:36 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Wed Dec 31, 2008 1:32 am

Rolly-chan wrote:It looks like this

Code: Select all
//header("Content-Type: image/png");


With this line commented out, you cannot see the image loading (perhaps you knew that and were just using it to test for error messages). When you added the encryption, all the old pet codes stop working. You need to update adopt.php so that it includes the encyption too.
User avatar
Nick
Admin
 
Posts: 6338
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 Rolly-chan » Wed Dec 31, 2008 3:05 am

thenickdude wrote:
Rolly-chan wrote:It looks like this

Code: Select all
//header("Content-Type: image/png");


With this line commented out, you cannot see the image loading (perhaps you knew that and were just using it to test for error messages). When you added the encryption, all the old pet codes stop working. You need to update adopt.php so that it includes the encyption too.


You mean this line?
Code: Select all
$v_id=encrypt_variation($variation['id']);


Because I already included this line in adopt.php
User avatar
Rolly-chan
 
Posts: 2790
Joined: Tue Nov 18, 2008 8:09 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Lady » Fri Jan 02, 2009 3:19 am

Yays, it all works now.

http://partlysunny.info
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

Who is online

Users browsing this forum: No registered users and 2 guests