News:

Wondering if this will always be free?  See why free is better.

Main Menu

Members Changing Membergroup

Started by forummaker, March 13, 2009, 03:33:52 PM

Previous topic - Next topic

Fustrate

Steven Hoffman
Former Team Member, 2009-2012

Lithriel

Tried the updated one:

"Parse error: syntax error, unexpected T_EXIT in /home/nevrast3/public_html/epicforum/group_change.php on line 21"

Lithriel

Okay, I tried everything over again this morning, and I am getting an "Acess Denied" message now, yay!  Progress!

Only thing is I am actually logged in.  Lol.

I tried logging out and then loggin back in, but when I pull up the page I keep getting the access denied message.

Here's my code:

<?php
include_once('./SSI.php');

if(!
$user_info['is_logged'])
   die(
'Access Denied');

// This is an array of all of the groups they can change between - $id => $name
$groups = array(
   
'8' => "Hero",
   
'9' => "Villain"
);

// And these are your post-based groups. Just the group ID.
$post_groups = array(14,10,11,12,13);

// First check for anything that was submitted...
if(isset($_POST['submit'])){
   
$group = (int) $_POST['new-group'];

   if(!isset(
$groups[$group]))
      die(
'You need to pick a valid group!');

   
$my_groups $user_info['groups'];

   foreach(
$my_groups as $id)
      if(isset(
$groups[$group]) && !in_array($id$post_groups))
         
$new_groups[] = $group;
      else if(!
in_array($id$post_groups))
         
$new_groups[] = $id;

   
$new_groups array_values(array_unique($new_groups));
   
$primary $new_groups[0];
   
$additional array_slice($new_groups1);
   
$additional implode(','$additional);

   
mysql_query("
      UPDATE 
{$db_prefix}members
      SET ID_GROUP = '
{$primary}', additionalGroups = '{$additional}'
      WHERE ID_MEMBER = 
{$context['user']['id']}"__FILE____LINE__);
}
?>


Change between membergroups<br />
<br />
<form action="group_change.php" method="post" name="form">
<?php

foreach($groups as $id => $name)
   echo 
'
   <label><input type="radio" name="new-group" value="'
$id'" /> '$name'</label><br />';

?>

   <input type="submit" name="submit" value="Submit">
</form>

Fustrate

Is there an SSI.php file in the same folder as this?
Steven Hoffman
Former Team Member, 2009-2012

Lithriel

My forum is here: http://nevrast.net/epicforum/index.php

This page is here: http://nevrast.net/epicforum/group_change.php

The SSI.php file is here: http://nevrast.net/epicforum/SSI.php

So the group_change.php file is in the root forum folder, as well as the SSI.php file

Lithriel


Advertisement: