Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Suggestions and Feature Requests

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2011, 11:37 PM
ToonDartist ToonDartist is offline
Member
 
Join Date: Mar 2011
Posts: 13
Gender: Male
Credits: 1,406
ToonDartist is on a distinguished road
Default Pets as avatars

After being advised, I thought I'd post this here. Instead of being able to register and choose your avatar, I was wondering if it would be possible to register and select a "pet" image that would be larger then the "adoptables". I was kind of hoping for the option of new users can register then select a pet as their avatar. This pet would then raise in level and stats according to the number of adoptables you collect. Rare adoptables would offer new abilities to your pet, and an even cooler feature would be collecting certain adoptables would even alter the image of your pet. It sounds like a lot, i know, but I figured it would be something well worth the effort in the end. It ties in with my sites storyline a lot and I've been doing some research. I got in contact with a php scripter who created her own little script for creating pets and she provided me with her zip containing all the files for this, but as I've stated in my newcomer thread, php might as well be advanced calculus honors. HELP! I have cookies!
Reply With Quote
  #2  
Old 03-23-2011, 05:01 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 332,834
Hall of Famer is on a distinguished road
Default

Umm interesting, you got in contact a coder who helped you with php? Why dont you bring her here then?
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #3  
Old 03-23-2011, 05:26 PM
ToonDartist ToonDartist is offline
Member
 
Join Date: Mar 2011
Posts: 13
Gender: Male
Credits: 1,406
ToonDartist is on a distinguished road
Default

I've tried emailing her but she takes a quite a while to respond, plus her email is wierd, (hotmail) sometimes she can receive mail and sometimes it rejects it. She seems very busy and the script i have is a little old and "buggy". Which is why I was hoping to recruit some assistance. I could post you what I have thou from her. If its possible I could post the pet script here. Let me try and figure this out...
Reply With Quote
  #4  
Old 03-23-2011, 05:29 PM
ToonDartist ToonDartist is offline
Member
 
Join Date: Mar 2011
Posts: 13
Gender: Male
Credits: 1,406
ToonDartist is on a distinguished road
Default

PHP Code:

function printForm() { 

    
//using POST and sending the data to pet_creation.php 
    
print "<form name='createpet' method='POST' action='pet_create.php'>"
    
    
//a field for the name 
    
print "Pet name: <input type='text' maxlength='15' name='formPetname'>"
    
    
//now we will add what is called a select box. This is where users select from a drop down list. We will have two sample species called dragon and cat, but you can add however many you want. 
    
    //a select box works like this: the $_POST variable on the next page will be the name of the select box 
    
print "<br><select name='formSpecies'>"
    
    
//but the value will be assigned to each OPTION 
    
print "<option value='cat'>I Want A Cat</option>"
    print 
"<option value='dragon'>Give Me A Dragon</option>"
    print 
"</select>"
    
    
//we will also put a select box for the gender 
    
print "<br><select name='formGender'>"
    print 
"<option value='female'>Girly Pet</option>"
    print 
"<option value='male'>Boy Pet</option>"
    print 
"</select>"
    
    
//and a box for the colour
    
print "<br><select name='formColour'>"
    print 
"<option value='yellow'>Yellow</option>"
    print 
"<option value='black'>Black</option>"
    print 
"</select>"
    
    
//and a submit button 
    
print "<br><input type='submit' value='Create'>"
    
    
//stop any more code from being executed 
    
myExit(); 

function 
formValidate() { 

    
$uid $_SESSION['uid'];
    
    
//we will check how many pets the user is allowed
    
$sql "SELECT * FROM `USERS` WHERE `id` = '$uid'";
    
$result mysql_query($sql);
    
$petsallowed mysql_result($result,0,"petsallowed");
    
    
//selecting all pets with the "owner" of the user 
    
$query "SELECT * FROM `PETS` WHERE `ownerid` = '$uid'"
    
$result mysql_query($query); 
    
    
//if the results returned are equal to the number of pets the user is allowed, the user can't have another pet. To allow users to have more pets, just change this number. 
    
if (mysql_numrows($result) == $petsallowed) { print "Sorry, you can't have more than one pets."myExit(); } 
    
    
$name $_POST['formPetName'];
    
    
//is the pet name long enough? 
    
if (strlen($name) < 5) { print "Pet name must be at least five characters long.<br>"printForm(); } 
    
    
//is it short enough? 
    
if (strlen($name) > 15) { print "Pet name can't exceed fifteen characters.<br>"printForm(); } 
    
    
$and filter($name);
    if (
$and) { print "Please give an appropriate pet name."myExit(); }
    
    if(
strspn($name"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'") != strlen($name)) { print "Please use alphanumeric characters only in your pet name."myExit(); }
    
    
//is the species a valid species? We will check this simply by checking whether or not the image exists for the species. eg if cat.jpg exists then "cat" is a species and it will be allowed. You need to change this line of code so that the directory for images is correct. You can also change .jpg to .jpeg or .png if that is what you are using. 
    
$tempimage "images/pets/" .$_POST['formSpecies']. "_" .$_POST['formColour']. "_" .$_POST['formGender']. ".jpg"
    if (!
is_file($tempimage)) { print "Please choose a species which exists.<br>"printForm(); } 
    
    
//is the gender a valid gender? 
    
if ($_POST['formGender'] != "female" && $_POST['formGender'] != "male") { print "Please choose a gender which exists.<br>"printForm(); } 
    
    
//is the pet name unique? You can remove this bit of code if you don't want unique pet names. 
    
$petname $_POST['formPetname']; 
    
$query "SELECT * FROM `PETS` WHERE `name` = '$petname'"
    
$result mysql_query($query); 
    
    
//if this returns any results, the pet name is not unique and the user must choose another name 
    
if (mysql_numrows($result) > 0) { print "Sorry, a pet with that name already exists. Please choose again.<br>"printForm(); } 
    

 

formValidate(); 

//if everything is ok, insert the data! 
$gender $_POST['formGender']; 
$species $_POST['formSpecies']; 
$colour $_POST['formColour'];
$petname $_POST['formPetname'];

$birthday gmdate("M d Y"); 

$uid $_SESSION['uid'];
$now gmdate(U);

$query "INSERT INTO `PETS` (`id`, `name`, `ownerid`, `gender`, `species`, `colour`, `fed`, `born`) VALUES ('', '$petname', '$uid', '$gender', '$species', '$colour', '$now', '$birthday');"
mysql_query($query); 


print 
"Pet created successfully."

?> 
Reply With Quote
  #5  
Old 03-23-2011, 05:44 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 332,834
Hall of Famer is on a distinguished road
Default

I see, try your best to contact her and tell her to go to this support forum if you can. I'd like to see what her coding pattern is. Its quite weird that she uses lots of print functions in her script file.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 03-23-2011, 06:54 PM
ToonDartist ToonDartist is offline
Member
 
Join Date: Mar 2011
Posts: 13
Gender: Male
Credits: 1,406
ToonDartist is on a distinguished road
Default

Will do! I'm hating hotmail right now, gmail keeps failing everytime it tries to send it. This code is from about 4 years ago, when there was forum up called the virtual pet project. Not sure if anyone is familiar with that but it was available for download, however the file download times out a lot and when you finally get it, it takes a little work trying to install it. The last comment on the forum was from like 3 years ago I believe...
Reply With Quote
  #7  
Old 03-23-2011, 11:50 PM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 32,832
fadillzzz is an unknown quantity at this point
Default

Agree with you HoF.
The coding style is really weird. That's a lot of 'print' to use, and I don't think that's necessary.
Why not just create a variable that store the HTML and echo it once...?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Avatars in Memberlist Inf3rnal Tutorials and Tips 13 05-01-2012 02:54 PM
Avatars StarGirl Questions and Supports 6 03-31-2012 11:50 AM
User Avatars konzair Suggestions and Feature Requests 4 01-27-2011 04:50 AM
pets dradar Questions and Supports 5 08-06-2010 05:48 PM
I don't see my pets...help sdsmith64 Questions and Supports 8 07-27-2009 06:03 PM


All times are GMT -5. The time now is 01:17 AM.

Currently Active Users: 2420 (0 members and 2420 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636