Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 07-01-2013, 01:55 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: 636,585
Hall of Famer is on a distinguished road
Default

Here is a simple fix, try it if you are interested. Just copy/paste whatever is inside the code block to your donate.php file, make sure to overwrite the old contents:

PHP Code:
<?php

class DonateController extends AppController{

    private 
$view;
    private 
$subController;

    public function 
__construct(){
        
parent::__construct("member");
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$document->setTitle($mysidia->lang->title);
        
        if(
$mysidia->input->post("recipient") and is_numeric($mysidia->input->post("amount"))){
            
$recipient preg_replace("/[^a-zA-Z0-9\\040]/"""$mysidia->input->post("recipient"));
            
$amount preg_replace("/[^0-9]/"""$mysidia->input->post("amount"));
            
$recipient = new Member($recipient);
            
             if(
$amount 0){
                
$document->setTitle($mysidia->lang->fail);
                
$document->addLangvar($mysidia->lang->negative);
            }
            elseif(
$mysidia->user->money $amount){
                
$document->setTitle($mysidia->lang->fail);
                
$document->addLangvar($mysidia->lang->funds);
            }
            elseif(
$recipient->username == $mysidia->user->username){
                
$document->setTitle($mysidia->lang->fail);
                
$document->addLangvar("Cannot donate to yourself!");
           } 
            else{
                
$mysidia->user->donate($recipient$amount);
                
$document->setTitle($mysidia->lang->success);
                
$document->add(new Comment("You've just donated {$amount} of {$mysidia->settings->cost} to <a href='profile/{$recipient->username}'>{$recipient->username}</a>. "));
                
$document->add(new Comment("You'll be redirected back to the donation page within 3 seconds. Click "));
                
$document->add(new Link("donate""here "));
                
$document->add(new Comment("if your browser does not automatically redirect you."));
                
header("Refresh:3; URL='donate'");
            }
            return;
        }

        
$document->add(new Comment("This page will allows you to donate your money to other users. "));
        
$document->add(new Comment("You currently have {$mysidia->user->getcash()} {$mysidia->settings->cost} left."));
        
$document->add(new Paragraph(new Comment("")));

        
$donateForm = new FormBuilder("donateform""donate""post");
        
$donateForm->buildComment("Donate to: "FALSE)
                   ->
buildTextField("recipient")
                   ->
buildComment("Amount to donate: "FALSE)
                   ->
buildTextField("amount")
                   ->
buildButton("Donate""submit""submit");
        
$document->add($donateForm);    
    }
}
?>
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
 

Tags
bug, donate, error


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


All times are GMT -5. The time now is 10:43 AM.

Currently Active Users: 2154 (0 members and 2154 guests)
Threads: 4,081, Posts: 32,032, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636