[RESOLVED] Cannot create new users, please help!

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

[RESOLVED] Cannot create new users, please help!

Post by Raven »

Script URL: localhost
Version of script: HESK 2.0
Hosting company: localhost
URL of phpinfo.php: ...
URL of session_test.php: ...
What terms did you try when SEARCHING for a solution: failed login

Write your message below: I have just attempted to add a new user (the 1st non admin user) and no matter what I do it always says, "Please assign user to al least one category!" even though I have one selected (also tried with more than one but still the same...

Here is a screen shot, as you can see i've only changed the CSS and added an image:

Image

If you need me to post the source php code from my manage_users.php just ask - just didn't want to post the entire thing if it might not be needed.
Last edited by Raven on Sat Oct 17, 2009 7:00 pm, edited 1 time in total.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Try upgrading to 2.1 - I know that used to be an issue with some PHP version/browser combination, but can't really remember what it was now.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Hi Klemen, thanks for your quick reply.

In an ideal world an update would be the way to go and although I really want to, I have put so much work in to my site that it would take me weeks to apply all of the changes again... If indeed I could remember all of then lol

I have even tried adding the old manage_users.php from my back up of HESK 2.0 (the un-altered one) in case it was something that I had changed that had caused it but it still didn't work :(

I also attempted to run the 'upgrade' script to HESK v2.1 and this just screwed up the database :shock: - good job I backed everything up before.

If you remember what the problem was could you please let me know?

Thanks for all your support so far, much appreciated 8) :lol:
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Anyone? :(
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Try this: in manage_users.php change

Code: Select all

    if ($myuser['isadmin']==0)
    {
		hesk_input($_POST['categories'],$hesklang['asign_one_cat']);
	    foreach ($_POST['categories'] as $cat)
	    {
	        $myuser['categories'].="$cat,";
	    }

		hesk_input($_POST['features'],$hesklang['asign_one_feat']);
	    foreach ($_POST['features'] as $feat)
	    {
	        $myuser['heskprivileges'].="$feat,";
	    }
	}
to

Code: Select all

    if ($myuser['isadmin']==0)
    {
    	if (empty($_POST['categories']))
        {
			hesk_error($hesklang['asign_one_cat']);
        }

	    foreach ($_POST['categories'] as $cat)
	    {
			if ( !($cat = intval($cat)) )
            {
				continue;
            }

	        $myuser['categories'] .= intval($cat).',';
	    }

    	if (empty($_POST['features']))
        {
			hesk_error($hesklang['asign_one_feat']);
        }

        $possible_features = array(
        			'can_view_tickets','can_reply_tickets',
                    'can_del_tickets','can_edit_tickets',
                    'can_del_notes','can_change_cat',
                    'can_man_kb','can_man_users',
                    'can_man_cat','can_man_canned',
                    'can_man_settings','can_add_archive');

	    foreach ($_POST['features'] as $feat)
	    {
        	if ( !in_array($feat,$possible_features) )
            {
            	continue;
            }
	        $myuser['heskprivileges'] .= hesk_input($feat) .',';
	    }
	}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

:) Fantastic - thats sorted it :)

Is there anyway I can buy you a beer without a paypal account as the help you have given me since I found this script has been top notch and I wanna say thank ;)

**EDIT**
Could you (if you have time) please explain what you did to make it work and maybe offer any words of wisdom as to why it stopped working?

Thanks again :)
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Hmmm, due to the above error I initially posted about I decided to test the rest of my HESK installation and found one more thing - When viewing the main admin page with my list of tickets I cannot 'Mark selected tickets Resolved" or "Delete selected Tickets" as it just says, "No tickets selected, nothing to change".

Might this be a similar/the same issue as my original problem...? Any suggestions would be supurb :)

P.S.
My partner has a PayPal account so I'm in the process of sending you that beer :)
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

The same issue, yes. It's because of some changes in PHP 5.3.0.

You can try changing code in file common.inc.php (inside inc folder) from

Code: Select all

function hesk_input($in,$error=0) {

    $in = trim($in);

    if (strlen($in))
    {
        $in = htmlspecialchars($in);
        $in = preg_replace('/&(\#[0-9]+;)/','&$1',$in);
    }
    elseif ($error)
    {
        hesk_error($error);
    }

    if (!ini_get('magic_quotes_gpc'))
    {
        if (!is_array($in))
            $in = addslashes($in);
        else
            $in = hesk_slashArray($in);
    }

    return $in;

} // END hesk_input()
to

Code: Select all

function hesk_input($in,$error=0) {

	if (is_array($in))
    {
    	$in = array_map('hesk_input',$in);
        return $in;
    }

    $in = trim($in);

    if (strlen($in))
    {
        $in = htmlspecialchars($in);
        $in = preg_replace('/&(\#[0-9]+;)/','&$1',$in);
    }
    elseif ($error)
    {
        hesk_error($error);
    }

    if (HESK_SLASH)
    {
		$in = addslashes($in);
    }

    return $in;

} // END hesk_input()

Note that I cannot list here all the changes that have been made from version 2.0. If you have any further issues please upgrade to version 2.1 first as many things have been fixed/changed. Version 2.0 is out of date now and thus not officially supported anymore.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

I have now upgraded to 2.1 as firstly, I don't think it is fair asking you to support an out dated version of HESK and second, HESK 2.1 has so many cool new features :)

I have about finished re-designing my install of HESK 2.1 to match my old installation. The front end looks exactly the same as it did before and I have just about finished the admin section too -- well, I couldn't skin the front end and ignore the admin side hehe
Post Reply