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 » Wed Apr 15, 2009 1:32 am

I do say that they should have a firm grasp of HTML, and have already used the HTML adoptables system, which would include building their own pages and using an FTP system. People are free to ignore me, of course.. :).
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 kleela_ » Fri Apr 17, 2009 12:31 am

Ok...So I can't figure this out... So when I click to adopt a pet, I know it should go to
http://zafarii.netii.net/adopt.php?id=1 But it only goes to
zafarii.netii.net/adopt.php , so the image wont show up. And I cant figure out why.

This is the code from mainpage.php
Code: Select all
<html><head></head> <body><p>Adopt one of my pets!</p><table width="400" border="0" cellspacing="0" cellpadding="4">  <tr>    <td><img src="dogbaby.png"></td>    <td>       <form action='adopt.php' method='post'>           <input type="hidden" name="id" value="1">            Owner's name: <input type="text" name="ownername" value=""><br/>            Pet's name: <input type="text" name="petname" value=""><br/>                        <input type="submit" value="Adopt me!">        </form>    </td>  </tr>  <tr>    <td><img src="ratbaby.png"></td>    <td>       <form action='adopt.php' method='post'>           <input type="hidden" name="id" value="2">            Owner's name: <input type="text" name="ownername" value=""><br/>            Pet's name: <input type="text" name="petname" value=""><br/>                        <input type="submit" value="Adopt me!">        </form>        </td>  </tr></table></body></html>


This is the code from adopt.php
Code: Select all
<html><head></head> <body><?php require("adopttools.php"); $adoptable=find_adoptable($_REQUEST['id']);  $sum=0;foreach ($adoptable->variation as $variation) {   $sum=$sum + $variation['chance'];} $random=lcg_value()*$sum; $sum=0;foreach ($adoptable->variation as $variation) {   $sum = $sum + $variation['chance'];    if ($random <= $sum) {      //Choose this variation      $v_id= encrypt_variation($variation['id']);      break;   }} ?> <p><img src="simple.php?a=<?php echo $_REQUEST['id'];?>&amp;v=<?php echo $v_id;?>"></p> <p>Thanks for adopting this pet! :). Use this code to display your pet on a webpage: (HTML code)</p> <p><textarea cols="60" rows="2"><?php echo "<a href='http://".$_SERVER['SERVER_NAME']."/'><img border='0' src='http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/simple.php?a=".$_REQUEST['id']."&amp;v=$v_id'></a><br>Owner's name: ".$_REQUEST['ownername']."<br>Pet's name: ".$_REQUEST['petname']; ?></textarea></p> <p>Use this code to display your pet on a forum: (BBCode)</p> <p><textarea cols="60" rows="2"><?php echo "[url=http://".$_SERVER['SERVER_NAME']."/][img]http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/simple.php?a=".$_REQUEST['id']."&amp;v=$v_id&amp;.jpg[/img][/url]Owner's name: ".$_REQUEST['ownername']."Pet's name: ".$_REQUEST['petname']; ?></textarea></p> </body></html>


Code from adoptables(xml)
Code: Select all
<adoptables> <adoptable id="1">   <variation id="1" chance="1.0">      <age image="dogbaby.png" />      <age date="2008-11-20" image="dogpuppyrare.png" />         <age date="2008-11-25" image="dogadultrare.png" />   </variation>   <variation id="2" chance="5.0">      <age image="dogbaby.png" />      <age date="2008-11-20" image="dogpuppy.png" />         <age date="2008-11-25" image="dogadult.png" />   </variation></adoptable> <adoptable id="2">   <variation id="1" chance="1.0">      <age image="ratbaby.png" />      <age date="2008-11-23" image="ratadult.png" />   </variation></adoptable> </adoptables>
User avatar
kleela_
 
Posts: 2
Joined: Sun Mar 15, 2009 12:10 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 » Fri Apr 17, 2009 2:09 am

No, it should be going to just adopt.php on its own (the ?id=1 part gets sent to the server too, but it is hidden. You can make it visible by changing method='post' to method='get' in mainpage.php). I'm checking out your site now to see if I can figure out what went wrong.

EDIT: You have a space character before the <?php or after the ?> of simple.php, adopttools.php or key.php which needs to be removed.
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 kleela_ » Sat Apr 18, 2009 1:10 pm

Oh thanks! I guess I had a space after the key page that I didn't spot, and didn't think of checking :) It works now!
User avatar
kleela_
 
Posts: 2
Joined: Sun Mar 15, 2009 12:10 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby SelkiesSong » Sun Apr 19, 2009 4:35 pm

I tried making a site on 000webhost as the tutorial suggested, but it seems they do not allow folks to upload php files. I tried changing everything to .html, and it seemed to be working until I got to part four. ^_^" Can we really not use webhost or am I doing something wrong? (Sorry if this has already been mentioned, I read through the first few pages, but I didn't see anyone mentioning it...)

EDIT: Nevermind! ^_^ Seems phtml works just fine. I'm gonna try that and see if it works.

EDIT2: Urg. webhost doesn't like xml files either. Are there any alternate extensions for those?
~*~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 Nick » Sun Apr 19, 2009 8:17 pm

The tutorial site works just fine at 000webhost, that's where I tested it. What leads you to believe that those file extensions don't work?

You can name the XML file whatever you like, just make sure that you update the file name accordingly in adopttools.php.
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 SelkiesSong » Sun Apr 19, 2009 8:27 pm

thenickdude wrote:The tutorial site works just fine at 000webhost, that's where I tested it. What leads you to believe that those file extensions don't work?

You can name the XML file whatever you like, just make sure that you update the file name accordingly in adopttools.php.


What led me to believe that they didn't work was the fact that when I try to upload anything with .php or .xml as the extension, it doesn't upload and "that file type is not allowed" pops up in red text. I can take a screen shot if that wasn't clear enough?
~*~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 Nick » Mon Apr 20, 2009 3:58 pm

A screen shot would definitely help. Here's a screenshot from a 000webhost account I just signed up for, using the first uploader they offer:

Image

I finished uploading the site using the second uploader:

Image

Both worked just fine, no error messages at all. I uploaded the site again with their Java uploader:

Image

That worked too (and was much faster than the other methods). I uploaded the files again directly using the FTP client WinSCP:

Image

That worked fine, too. Here's the working website:

http://cswebtest.netne.net/mainpage.php
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 SelkiesSong » Mon Apr 20, 2009 4:16 pm

M'kay...I'm guessing the problem is that they have a ton of different upload managers and I'm not using the right one...

Cuz this is what mine looked like:
Image

Where were the ones you were using?
~*~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 Nick » Mon Apr 20, 2009 4:21 pm

The "Files" section of the CPanel. I used the methods FTP, File Manager, and Another File Manager. Dunno where you found yours.
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: No registered users and 3 guests