Welcome Guest, Not a member yet? Register   Sign In
If else in Ajax
#1

[eluser]EimA[/eluser]
Hi,

Please help me with this coding. I'm still new with java and ajax.

I want the page to came out if the user have both account. If either one it's work.


if (eregi("iium_staff",$grp[0])) {
$grppriv = 1;
} elseif (eregi("iium_stadd",$grp[0])) {
$grppriv = 2;
} elseif (eregi("iium_stadd",$grp[0])) and (eregi("iium_staff",$grp[0])) {
$grppriv = 1;
$grppriv = 2;
}

Is the coding is correct.
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter community!

This should achieve exactly the same result:
Code:
if (eregi("iium_staff",$grp[0])) {
    $grppriv = 1;
}
if (eregi("iium_stadd",$grp[0])) {
    $grppriv = 2;
}

If that's not what you're after, please try to be a bit more specific.
#3

[eluser]EimA[/eluser]
Thank you .

I need to make user who have both account(iium_staff and iium_stadd) can view both file(notification.php refref to $grppriv = 1 and student_notification.php refer to $grppriv = 2.

How can user with 2 account can have this 2 file?

Please help me.

Actually the entire coding is like this

<?php
//ini_set("display_errors","1");

function checkMyPortalAccount($person) {
$ds=ldap_connect("iiu.edu.my",???); // assuming the LDAP server is on this host
$rldap=ldap_bind($ds,"cn=o???", "????");
$grppriv = 0;
//$person=$_GET['id'];

$dn = "cn=portal.070326.174828.069396000,cn=Groups,dc=iiu,dc=edu,dc=my";
$filter="(uniquemember=cn=$person*)";

$sr=ldap_search($ds, $dn, $filter);

$info = ldap_get_entries($ds, $sr);
for ($i=0; $i<$info["count"]; $i++) {
$grp = explode(",",$info[$i][dn]);
if (eregi("iium_staff",$grp[0])) {
$grppriv = 1;

} if (eregi("iium_stadd",$grp[0])) {
$grppriv = 2;

} elseif (eregi("iium_stadd",$grp[0])) and (eregi("iium_staff",$grp[0])) {
$grppriv = 1;
$grppriv = 2;
}
}

return $grppriv;
}
?&gt;
#4

[eluser]EimA[/eluser]
Sorry forgot to mention, I've try your coding before and still come out one file. Tq. Please help me. i've try 2 days. still could not resolve the problem.
#5

[eluser]TheFuzzy0ne[/eluser]
Sorry, I don't understand what your code does, or what you're trying to do. As your question is not related directly to CodeIgniter, I'd recommend that you try a forum where you're native language is supported. You will find people can understand you better, and you may get a better answer.
#6

[eluser]Phil Sturgeon[/eluser]
EimA I think you are being confused slightly by the change TheFuzzyOne made to your if statement. His change WILL allow "user who have both account(iium_staff and iium_stadd) can view both file(notification.php refref to $grppriv = 1 and student_notification.php refer to $grppriv = 2.".

"User with 2 account can have this 2 file?"
#7

[eluser]EimA[/eluser]
ooo thank you. I understand now. Thank you to both of you.




Theme © iAndrew 2016 - Forum software by © MyBB