php inside vicidial script

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

php inside vicidial script

Postby uselessinfoguru » Sat Sep 30, 2017 5:22 pm

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?
VERSION: 2.14-736a | BUILD: 200204-2336| Cluster Setup
uselessinfoguru
 
Posts: 74
Joined: Tue Jul 25, 2017 10:27 pm

Re: php inside vicidial script

Postby mflorell » Sat Sep 30, 2017 7:04 pm

Just put an IFRAME inside of your script and you can point it to anything you want.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: php inside vicidial script

Postby uselessinfoguru » Mon Oct 02, 2017 9:29 am

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?
VERSION: 2.14-736a | BUILD: 200204-2336| Cluster Setup
uselessinfoguru
 
Posts: 74
Joined: Tue Jul 25, 2017 10:27 pm

Re: php inside vicidial script

Postby uselessinfoguru » Mon Oct 02, 2017 9:39 am

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
VERSION: 2.14-736a | BUILD: 200204-2336| Cluster Setup
uselessinfoguru
 
Posts: 74
Joined: Tue Jul 25, 2017 10:27 pm

Re: php inside vicidial script

Postby uselessinfoguru » Mon Oct 02, 2017 10:31 am

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 "
VERSION: 2.14-736a | BUILD: 200204-2336| Cluster Setup
uselessinfoguru
 
Posts: 74
Joined: Tue Jul 25, 2017 10:27 pm


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 52 guests