Jump to content

Search the Community

Showing results for tags 'adoption'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Okay so I am still a baby at PHP, I got the PHP 5 book for dummies but I haven't finished it all yet. Maybe I messed up something in mysql database or maybe it is just the php but the short story is this is my first time running a website. Anyways here is the script: <?php include("functions/functions.php"); include("functions/functions_users.php"); include("functions/functions_adopts.php"); include("inc/lang.php"); //***************// // START SCRIPT // //***************// $id = $_GET["id"]; $promocode = $_GET["promocode"]; $name = $_GET["name"]; if($isloggedin == "yes"){ $stmt = $adopts->query ($query = "SELECT * FROM {$prefix}adoptables, {$prefix}"."owned_adoptables WHERE owner='".$loggedinname."' AND currentlevel<'6' AND isfrozen='no'"); $data = $stmt->fetchAll(); $num = count($data); if($num >= 7){ $canadopt = "no"; $article_title = "Too many eggs!"; $article_content = "You already have too many eggs to take care of! Come back once you have hatched an egg!"; } else if($_SESSION["allow"] != 1){ $article_title = $err_idnoexist; $article_content = $err_idnoexist_text; // The adoptable ID appears to be valid, so we need to double check that it is valid by pulling up the adoptable in the DB $query = "SELECT * FROM {$prefix}adoptables, {$prefix}adoptables_conditions WHERE {$prefix}adoptables.id='{$id}' AND {$prefix}adoptables_conditions.id = {$prefix}adoptables.id"; $stmt = $adopts->query($query); $row = $stmt->fetchObject(); if($id == $row->id){ // The ID submitted matches an existing adoptable type $canadopt = canadopt($row->id, "adopting", $promocode, $row); // If we can adopt this creature, do the adoption if($canadopt == "yes") { if (changecash(-$row->cost, $GLOBALS['loggedinname'], $GLOBALS['money'])==true) { // BEGIN the actual adoption process // First we see if we have a custom name; if not, we use the default name if($name == "") $name = $row->type; // Now we determine if we are using alternate images or not $alts = getaltstatus($id, 0, 0); // We need a unique code for the adoptable so we can show it to the user when we're done here... $code = codegen(10, 0); $genders = array('f', 'm'); $rand = rand(0,1); $query = "INSERT INTO {$prefix}owned_adoptables (aid, type, name, owner, currentlevel, totalclicks, code, imageurl, usealternates, tradestatus, isfrozen, gender, lastbred) VALUES ('', '{$row->type}', '{$name}','{$loggedinname}','0','0', '{$code}', '','{$alts}','fortrade','no', '{$genders[$rand]}','0')"; $adopts->query($query); if(!empty($promocode)){ // The promo code has been used, needs to update it before information is leaked out! $newpromocode = codegen(15,0); $query = "UPDATE {$prefix}adoptables_conditions SET promocode='{$newpromocode}' WHERE type='{$row->type}'"; $adopts->query($query); } // Adoption complete, show the user a confirmation screen... $stmt = $adopts->query("SELECT * FROM {$prefix}owned_adoptables WHERE code='{$code}' and owner='{$loggedinname}'"); $owned_adoptable = $stmt->fetchObject(); $id = $owned_adoptable->aid; $article_title = $name." adopted successfully"; $article_content = "<img src='{$row->eggimage}'><br>{$congrats1} {$name}. You can now manage {$name} on the <a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id={$id}'>Click Here to Manage {$name}</a><br> <a href='myadopts.php?act=bbcode&id={$id}'>Click Here to get BBCodes / HTML Codes for {$name}</a></b><br><br> Be sure and <a href='levelup.php?id={$id}'>feed</a> {$name} with clicks so that they grow!"; unset($_SESSION["allow"]); // END the actual adoption process } else { $article_title = "Not enough money."; $article_content = "You don't have enough {$GLOBALS['settings']['cost']} to buy this adoptable. Earn some money and then try again."; } } else { $article_title = $accden; $article_content = $adoptnoper; } } // End the if for if $id == $aid else { // Adoptable does not exist, show an error. $article_title = $err_idnoexist; $article_content = $err_idnoexist_text; } // End the else for if $id == $aid } // End the valid ID input else test statement (bulk of code goes above here) } } // End the log in check IF else { // Guests cannot adopt pets, so why bother... $article_title = $guesttitleerror; $article_content = $guesterror; } // End the log in check ELSE //***************// // OUTPUT PAGE // //***************// echo showpage($article_title, $article_content, $date); ?> Ive tried everything from staring at it to poking it around but it doesn't change anything. I want to make it so people can pick out up to 7 eggs before they have to wait for them to reach a certain level and then they can pick up more eggs. I thought changing if($num >= 7) To 7 would work, but it still limits them to only 2 eggs. I really don't know what else to do.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.