Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-25-2013, 09:39 AM
Isura Isura is offline
Member
 
Join Date: Jun 2011
Posts: 38
Gender: Female
Credits: 8,133
Isura is on a distinguished road
Default Using checkboxes to select adoptables

Hello,

I'm working on a group function to sort pets in different groups for Ruinily. It works fine so far I only have one small problem:

Current it's only possible to move one creature to one group at once. Since this is unpractical if people have a lot of pets, I want to do the selection over 'checkboxes':

PHP Code:
<form method='post'
...
<
input type='checkbox' name='movecreature[]' value='{$adopt->aid}' />
...
</
form
Unfortunately, the mysidia script doesn't allowe the transmission of arrays over post or get. I think the reason is the secure function in the input class:

PHP Code:
private function secure($data){
if(
is_array($data) and SUBDIR != "AdminCP") die ("Hacking Attempt!");
...

(Or in Mys v.1.3.3:)

PHP Code:
private function secure($data){
if(
is_array($data)) die ("Hacking Attempt!");
...

Is there a way to formulate an exception for a certain post variable? Something like:

PHP Code:
if(is_array($data) and !is_array($_POST("movecreature"))) die ("Hacking Attempt!"); 
I'm really thankful for every idea to solve this problem .
(Sorry for my bad english ^^)
__________________
Reply With Quote
  #2  
Old 08-25-2013, 03:04 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,387
IntoRain is on a distinguished road
Default

I tried it out and "Hacking Attempt!" does appear when I try to use an array to store the values.

If there's no way to prevent it, you can always create a checkbox for each adoptables. Then do a cycle (after submitting) to verify which checkboxes were checked and had PetID values on them then push those values to an array and well, do your group thing.

Like:

PHP Code:
//for each pet, add a checkbox
$checkbox = new CheckBox("name""Postname{$index}"value)
{
$index}++ //doing this, for each pet you'll have Postname1, Postname2, Postname3 etc.. value can be pet ID?

//after submitting/post
for($index 0$index numPets$index++)
{
    if(
$mysidia->input->post("Postname{$index}") != NULL//value not null means ID was stored/checked
{
     
$petID $mysidia->input->post("Postname{$index}");
     
//do whatever
}

__________________


asp.net stole my soul.
Reply With Quote
  #3  
Old 08-26-2013, 04:55 AM
Isura Isura is offline
Member
 
Join Date: Jun 2011
Posts: 38
Gender: Female
Credits: 8,133
Isura is on a distinguished road
Default

Thank you

That really helps me.
__________________
Reply With Quote
  #4  
Old 08-26-2013, 08:40 AM
Ruinily Ruinily is offline
Member
 
Join Date: Mar 2011
Location: England
Posts: 185
Gender: Female
Credits: 22,825
Ruinily is on a distinguished road
Default

I just wanted to say thankyou too! ^_^
__________________

Chocolate butterfly cat pudding. o.o


And since even the programming on this forum doesnt like me anymore heres my sites address. XD
http://felkyocreatures.com/index.php
Reply With Quote
  #5  
Old 08-26-2013, 01:05 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,387
IntoRain is on a distinguished road
Default

Glad to help! ^^
__________________


asp.net stole my soul.
Reply With Quote
  #6  
Old 01-24-2016, 11:07 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,599
FounderSim is on a distinguished road
Default

Here's what I just did getting value of multiple checkboxes
view stuff:
Code:
$cells->add(new CheckBox("", "select[]", "{$id}"));
code
Code:
		$select = $mysidia->input->post("select");
		
		for($i = 0; $i < count($select); $i++)
		{
			//$select[$i]; my selected checkbox
			
		}
__________________
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
Creating a "Faction" for adoptables/owned adoptables Vaporman87 Questions and Supports 1 03-04-2014 03:38 PM
Allow users to select gender? quirkii Questions and Supports 2 07-07-2012 06:27 AM
Choosing Adoptables Type [EASY ADOPTABLES SCRIPT ONLY] Ashje Addons/Mods Graveyard 2 05-24-2009 03:17 AM


All times are GMT -5. The time now is 05:00 PM.

Currently Active Users: 9818 (0 members and 9818 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