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 SelkiesSong » Mon Apr 20, 2009 4:26 pm

Sweet, it worked. Not sure why that one uploader wouldn't take it, since the file was going to the same place anyway... XD

Thanks!

EDIT: Hmm...now the image on the adopt page isn't showing up.. D: No image shows up at all, and when I added the //, it just showed up as a broken image box instead... -goes to read through all the pages again-

EDIT2: Ah ha! I had a space in my key php. XD All better now!

I'm going to experiment with this now to see if I can't answer it myself, but I'm assuming we can do all of our page building html on the same php code, since it's basically the page itself?

Edit 3: N/m, answer's yes. ^_^"
~*~Keep Marching On~*~
Image
Art Tumblr
User avatar
SelkiesSong
 
Posts: 2295
Joined: Mon Sep 29, 2008 2:25 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby qhost » Sat May 23, 2009 6:23 pm

I'm back! :D Yes, that's right, I'm here to annoy everyone again!
Just kidding XD

I've been busy for the last....uh, couple of months and I haven't had time to edit codes and stuff. Today I decided to try it out again and found that old code for putting writing on adopts. I tried putting the codes in simple.php but it didn't work. Surprisingly, it didn't come up with an error, but the image wasn't showing. So I guess it works a bit...

Anyhow, just wondering, do I put the codes in simple.php or adopttools.php? And also what do I put in the image source bit?
This is the code:

Code: Select all
$text='$_REQUEST['ownername']\'s Pet';
$imgname='image';

$im = @imagecreatefrompng($imgname);
$color = imagecolorallocate($im, 0,0,0);
imagestring($im, 10,0,0, $text, $color);
imagesavealpha($im, true);
header("Content-Type: image/png");
imagepng($im);
imagedestroy($im);


It's the $imgname='image'; but where the image source bit needs to go. I tried doing something like $_REQUEST['id'] or $adoptable=find_adoptable($_REQUEST['id']) and that didn't work D:

Yes, I'm very annoying XD This is the last thing I need help with though, unless I ever find/make codes for an account system, which won't be for a few years XD

~Kiara
    Image-----

    she/they | adult | australia | artist | writer
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    My name is Boo & I am perpetually tired.
    Taking a break from CS for a little while!

    Spotted Tribal count: 31
    ♥︎ Click here to see the hoard! ♥︎
    -
User avatar
qhost
 
Posts: 4352
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 @ngel » Thu Jun 04, 2009 7:24 pm

My new site with pets - http://magicrain.clan.su :oops:
Image Image
User avatar
@ngel
 
Posts: 220
Joined: Sat Dec 27, 2008 7:21 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Bolt1784 » Mon Aug 10, 2009 9:11 pm

Thankyou so much Nick, thanks to you, my adoptables website is a success! :)
Image
»
User avatar
Bolt1784
 
Posts: 12877
Joined: Tue Feb 24, 2009 6:16 am
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 Aug 19, 2009 3:30 am

I'm really sorry, after a loooong long time I'm annoying you again ^^°

I'm still trying to make the adoptables grow up after a set number of days instead of a date and I already tried about what feels like 100 different methods but none of them worked... and I kind of don't understand why, because when I tested it in a test.php it did work.

I'm not asking how it works, I have just a very simple question:

Why can't I change these lines in simple.php without making the script corrupt:

Code: Select all
foreach ($variation->age as $age) {

   if (!isset$age['date'] || time() > strtotime($age['date'])) {
      $pickedAge=$age;
   }
}


I saved the adoption date in a database, I selected the date with UNIX_TIMESTAMP and put the id and the date in a row ($row[0] and $row[1]) and wrote if (!isset$age['date'] || time()-$row[1] > $age['date'])
and $age['date'] are the days that need to pass in seconds...

The question is: Is it even possible in that way or do I think in a totally wrong direction?
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 Nick » Wed Aug 19, 2009 3:11 pm

Rolly-chan wrote:I saved the adoption date in a database, I selected the date with UNIX_TIMESTAMP and put the id and the date in a row ($row[0] and $row[1]) and wrote if (!isset$age['date'] || time()-$row[1] > $age['date'])
and $age['date'] are the days that need to pass in seconds...

The question is: Is it even possible in that way or do I think in a totally wrong direction?


You're missing the brackets on the argument to isset(): isset($age['date'])

Otherwise, that sounds correct.
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 Rolly-chan » Thu Aug 20, 2009 5:36 am

thenickdude wrote:
Rolly-chan wrote:I saved the adoption date in a database, I selected the date with UNIX_TIMESTAMP and put the id and the date in a row ($row[0] and $row[1]) and wrote if (!isset$age['date'] || time()-$row[1] > $age['date'])
and $age['date'] are the days that need to pass in seconds...

The question is: Is it even possible in that way or do I think in a totally wrong direction?


You're missing the brackets on the argument to isset(): isset($age['date'])

Otherwise, that sounds correct.


Thanks, I changed it, but sadly it still doesn't work... *sigh* Well, I'll just search everything for errors and if I don't find any, I'll just try something else again.
The adoptables just won't grow up. It's always the baby image that's displayed ^^°
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 Nick » Thu Aug 20, 2009 12:38 pm

What values end up in $row[1] and $age['date'], exactly?

If you're getting an error message, you need to post it. You can see errors generated by the pic generating script by saving the broken picture to your computer, then opening it with a text editor like notepad.
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 Rolly-chan » Fri Aug 21, 2009 12:46 am

thenickdude wrote:What values end up in $row[1] and $age['date'], exactly?


$row[1] is the adoption date, which I selected from the database with UNIX_TIMESTAMP and
$age['date'] are the days, that need to pass before it grows up, in seconds

If you're getting an error message, you need to post it. You can see errors generated by the pic generating script by saving the broken picture to your computer, then opening it with a text editor like notepad.


I don't get any error messages. The image just stays the same, the adoptables don't grow up like they should.
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 Nick » Fri Aug 21, 2009 1:52 am

That's what you expect to be in there. But what actually ends up there? Print it out with echo(), then use the trick of opening the resulting corrupt image in notepad to see the results.

While you're at it, PM me the code you're using.. :).
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

Who is online

Users browsing this forum: Google [Bot] and 2 guests