Page 1 of 1

php inside vicidial script

PostPosted: Sat Sep 30, 2017 5:22 pm
by uselessinfoguru
is it possible to get something like this
Code: Select all
$user_group = $_GET ['user_group'];
if ($user_group == "100") {
echo file_get_contents('/srv/www/htdocs/agc/script.php');
}
if ($user_group == "101") {
echo file_get_contents('/srv/www/htdocs/agc/script2.php');
}

to work inside the vicidial script screen?

or is there another way to have a different script pop depending on user group?

Re: php inside vicidial script

PostPosted: Sat Sep 30, 2017 7:04 pm
by mflorell
Just put an IFRAME inside of your script and you can point it to anything you want.

Re: php inside vicidial script

PostPosted: Mon Oct 02, 2017 9:29 am
by uselessinfoguru
this works mostly, right now, tho, i'm trying to get values to populate inside the echo file_get_contents phps... for instance script1 has <?php echo $_GET['agent_name'] ?> but even tho i have $agent_name = $_GET['agent_name']; in a line above the file_get_contents, and i have the custom fields in the iframe url &agent_name=--A--fullname--B-- i can't get the agent name to show up in the script. Is this because I'm using echo file_get_contents? Is it not possible to forward customs values this way?

Re: php inside vicidial script

PostPosted: Mon Oct 02, 2017 9:39 am
by uselessinfoguru
i suppose instead of echoing different php files, i could just put the scripting in the main php file and echo that text if user group matches

Re: php inside vicidial script

PostPosted: Mon Oct 02, 2017 10:31 am
by uselessinfoguru
yes, that's much easier
Code: Select all
<?php
$user_group = $_GET['user_group'];
$agent_name = $_GET['agent_name'];

if ($user_group == "1000") {
echo "<center>Fronter Script</center><br></br>
Hello my name is
$agent_name
thank you for calling in to claim your rewards today, what is your claim number? (verify customers first and last name and collect claim # off of postcard)
<div></div>
One moment while my computer updates you information(pause for a few seconds)
<div></div>";
?>


this works quite well as long as the iframe link has the custom fields in the url
and, of course, you can have multiple scripts based on user group by adding the next line
if ($user_group == 1001) {
echo "All the text in script 2 with proper formatting.";
}

the only thing i thought was odd was the fact that i only needed $agent_name in the script to have it pop the agent name correct. IDK if this is due to the echo command being already inside php programming, or if it has something to do with the <iframe> but while <?php echo $agent_name; ?> and <?php echo $_GET['agent_name'] ?> did not work, simply putting $agent_name did work.
OK, I think I understand now, technically I'm doing echo "$agent_name"; , it's just that's there's text before the $ and between name and the "