Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/scrape/Wlogin.php
<?php

if(!isset($msg)){

if (isset($_POST['savewloginconfigfile']) ){
		
		
  
  $myFile = "/tmp/wlogin.conf";
  $fh = fopen($myFile, 'w');
  
		fwrite($fh, "define(\"HOTSPOT_NAME\",\"$hname\");\n");
		if ($_POST['uam_ip']!='') fwrite($fh, "define(\"UAMIP\",\"".$_POST['uam_ip']."\");\n");
		if ($_POST['uam_port']!='') fwrite($fh,"define(\"UAMPORT\",\"".$_POST['uam_port']."\");\n");
		fwrite($fh, "define(\"UAM_URL\",\"http://".$_POST['uam_ip'].":".$_POST['uam_port']."\");\n");
		if ($_POST['uam_secret']!='')  fwrite($fh,"define(\"UAMSECRET\",\"".$_POST['uam_secret']."\");\n");

		if ($_POST['base_url']!='') fwrite($fh, "define(\"BASE_URL\",\"".$_POST['base_url']."\");\n");
		if ($_POST['base_url']!='') fwrite($fh, "define(\"LOGINPATH\",BASE_URL);\n");
		
		if ($_POST['cookies']!='') fwrite($fh, "define(\"ENABLE_LOGIN_COOKIE\",True);\n");
		else
			fwrite($fh, "define(\"ENABLE_LOGIN_COOKIE\",False);\n");
		
		if ($_POST['debug']!='') fwrite($fh, "define(\"DEBUG_MODE\",True);\n");
		else
			fwrite($fh, "define(\"DEBUG_MODE\",True);\n");
		
		if ($_POST['debug']!='') fwrite($fh, "define(\"LOGOUT_POPUP\",True);\n");
		else
			fwrite($fh, "define(\"LOGOUT_POPUP\",False);\n");
		
		if ($_POST['popup_time']!='') fwrite($fh, "define(\"POPUPTIME\",\"".$_POST['uam_ip']."\");\n");
		
		if ($_POST['other_account']!='') fwrite($fh, "define(\"OTHER_ACCOUNT\",True);\n");
		else
			fwrite($fh, "define(\"OTHER_ACCOUNT\",false);\n");

		if ($_POST['default_language']!='') fwrite($fh, "define(\"DEFAULT_LANGUAGE\",\"".$_POST['language']."\");\n");
		fwrite($fh, "define(\"USERPASSWORD\",true);\n");
		
		$query="SELECT * FROM wlogin_freeurl WHERE location_id='$locID')";
		$result = $_SESSION["oreon"]->database->database->query($query);
		$data="\"";
		while ($row = mysql_fetch_object($result)) {
			$tmp=$row->name.",".$row->url;

			$data=$tmp.";".$data;
		}
		fwrite($fh, $data."\";\n\n");
		
		$query="SELECT * FROM wlogin_popup_list location_id='$locID')";
		$result = $_SESSION["oreon"]->database->database->query($query);
		$data="\"";
		while ($row = mysql_fetch_object($result)) {
			
		fwrite($fh,"\$url_tab[$i][\"name\"]=\"".$row->name."\";\n");
		fwrite($fh,"\$url_tab[$i][\"url\"]=\"".$row->value."\";\n");
		fwrite($fh,"\$url_tab[$i][\"image\"]=\"".$row->logo."\";\n");

		}	
		
		$opt=$oreon->database->getwloginconfiguration($_SESSION['locID']);
		fclose($fh);
		unset($_POST['savewloginconfigfile']);
	}
	else if (isset($_POST['savewloginconfig']) ){
		
		//GENERAL
		
		$opt->uam_ip=$_POST['uam_ip'];
		$opt->config_file=$_POST['config_file'];
		$opt->uam_port=$_POST['uam_port'];
		$opt->base_url=$_POST['base_url'];
		$opt->cookies=$_POST['cookies'];
		$opt->debug=$_POST['debug'];
		$opt->popup_time=$_POST['popup_time'];
		$opt->logout_popup=$_POST['logout_popup'];
		$opt->uam_secret=$_POST['uam_secret'];
		$opt->other_account=$_POST['other_account'];
		$opt->language=$_POST['language'];
		$opt->location_id=$_SESSION['locID'];
		
		$oreon->database->savewloginconfiguration($opt);
		$opt=$oreon->database->getwloginconfiguration($_SESSION['locID']);
		if(isset($_POST['ta_list_name']) && !empty($_POST['ta_list_name']))
			savewloginfreeurl($_POST['ta_list_name'],$_POST['ta_list_url'],$_SESSION['locID']);
		
		if(isset($_POST['popup_name_list']) && !empty($_POST['popup_name_list']))
			savewpopupurl($_POST['popup_name_list'],$_POST['popup_value_list'],$_POST['popup_logo_list'] ,$_SESSION['locID']);
		
		echo "Configuration have been saved";
		
		unset($_POST['savewloginconfig']);
	}

if (isset($_POST['load_default']))
{
	        $lid=-1;
		unset($_POST['load_default']);
}
else
	        $lid=$_SESSION['locID'];
$opt=$oreon->database->getwloginconfiguration($lid);

echo "
<form action=\"phpmyprepaid.php\" method=\"post\" onSubmit=\"selectall()\">
<br>
<big><big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Wlogin configuration</span></b></big></big><br>
<hr>
<table>	
<br>
<td>Configuration File : </td>
<td><input name=\"config_file\" value=\"".$opt['config_file']."\"></td><td>
<input name=\"savewloginconfigfile\" type=\"submit\" value=\"Save config file\" >
</td></tr><tr>
<td>Uam ip : </td>
<td><input name=\"uam_ip\" value=\"".$opt['uam_ip']."\"></td>
</tr><tr>
<td>Uam port : </td>
<td><input name=\"uam_port\" value=\"".$opt['uam_port']."\"></td>
</tr><tr>
<td>Uam secret : </td>
<td><input name=\"uam_secret\" value=\"".$opt['uam_secret']."\"></td>
</tr><tr>
<td>Base url : </td>
<td><input name=\"base_url\" value=\"".$opt['base_url']."\"></td>
</tr><tr>
<td>Popup information display time : </td>
<td><input name=\"popup_time\" value=\"".$opt['popup_time']."\"></td>
</tr><tr>
<td>Cookies : </td>";

if ($opt['cookies'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"cookies\"  value=\"1\" alt=\"Cookies\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"cookies\"   value=\"1\" alt=\"Cookies\"></td>";
echo "</tr><tr>";
echo "<td>Debug : </td>";

if ($opt['debug'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"debug\"  value=\"1\" alt=\"Debug\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"debug\"   value=\"1\" alt=\"Debug\"></td>";
echo "</tr><tr>";
echo "<td>Logout popup : </td>";

if ($opt['logout_popup'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"logout_popup\"  value=\"1\" alt=\"Logout popup\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"logout_popup\"   value=\"1\" alt=\"Logout popup\"></td>";

echo "</tr><tr>";
echo "<td>Other account : </td>";

if ($opt['other_account'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"other_account\"  value=\"1\" alt=\"Other account\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"other_account\"   value=\"1\" alt=\"Other account\"></td>";


echo "</tr><tr>
<td>Default language : </td>
<td><input name=\"language\" value=\"".$opt['language']."\"></td>
</tr><tr>

</tr>
</table>
";
echo "<hr>";
echo "<big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Free url list</span></b></big><br>";

echo '<tbody>
	<table style="width: 100%;" border="0" cellpadding="2"
	cellspacing="2">
	<tbody>
	<tr align="left">
	<td>Name :</td>
	<td>Url :</td>
	</tr><tr align="center">
	<td style="text-align: left; width: 299px;">
	<select size="5" style="width: 299px" multiple id="ta_list_name" name="ta_list_name[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT name FROM wlogin_freeurl WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
 echo ("<option  value=\"".$row->name."\">".$row->name."</option>");

 }
echo'	</select></td>';

	echo '<td style="text-align: left; width: 299px;">
	<select size="5" style="width: 299px" disabled multiple id="ta_list_url" name="ta_list_url[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT url FROM wlogin_freeurl WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
 echo ("<option  value=\"".$row->url."\">".$row->url."</option>");

 }
	echo '<td style="vertical-align: middle; width: 262px; text-align: left;">';
	
echo "<script type='text/javascript'>

function selectall()
{
select = document.getElementById('ta_list_url');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
}

select = document.getElementById('ta_list_name');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
}

select = document.getElementById('popup_name_list');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
 }
select = document.getElementById('popup_value_list');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
 }
select = document.getElementById('popup_logo_list');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
 }
}

function deleteFromList()
{
  fromList =  document.getElementById('ta_list_name');	
  fromList2 =  document.getElementById('ta_list_url');	
    
  var sel = false;
  for (i=0;i<fromList.options.length;i++)
    {
     var current = fromList.options[i];
     if (current.selected)
        {
          sel = true;
          fromList.remove(i);
          fromList2.remove(i);
       }
    }
 if (!sel) alert ('You haven\'t selected any options!');
}		

function copyToListField()
{
  fromList =  document.getElementById('urln');	
  toList =  document.getElementById('ta_list_name');	
  fromList2 =  document.getElementById('urlf');	
  toList2 =  document.getElementById('ta_list_url');	

     var current = fromList.value;
     var current2 = fromList2.value;
     if (current!='' and current2!='')
     {
          toList.options[toList.length] = new Option(current,current); 
          toList2.options[toList2.length] = new Option(current2,current2); 
      fromList.value='';
      fromList2.value='';
    }
}
	
</script>";

print "<a href=\"JavaScript:deleteFromList()\"><img  src=\"images/delete.png\" title=\"Del free url\"></a>";

echo '</td>
	</tr>
	<tr align="center">';


echo '<td style="text-align: left; width: 299px;">
	<input style="width: 299px;" id="urln" name="urln" value=""></td>';
echo '<td style="text-align: left; width: 299px;">
	<input style="width: 299px;" id="urlf" name="urlf" value=""></td><td style="text-align: left;">';

print "<a href=\"JavaScript:copyToListField()\"><img  src=\"images/insert.png\" title=\"Add free url\"></a>";

echo "</td>";

echo "</tr>
	</tbody>
	</table>";

echo "<script type='text/javascript'>

function deleteFromList3()
{
  url_name =  document.getElementById('popup_name_list');	
  url_value =  document.getElementById('popup_value_list');	
  url_logo =  document.getElementById('popup_logo_list');	

 fromList=url_name ; 
  var sel = false;
  for (i=0;i<fromList.options.length;i++)
    {
     var current = fromList.options[i];
     if (current.selected)
        {
          sel = true;
          url_name.remove(i);
          url_value.remove(i);
          url_logo.remove(i);
       }
    }
 if (!sel) alert ('You haven\'t selected any options!');
}		

function select_all(select) {
	url_name =  document.getElementById('popup_name_list');       
	url_value =  document.getElementById('popup_value_list');     
	url_logo =  document.getElementById('popup_logo_list');  

	for (m = 0; m < select.options.length; m++){
		if (select.options[m].selected) {
			url_name.options[m].selected='true';
			url_value.options[m].selected='true';
			url_logo.options[m].selected='true';
		}
}
}

function copyToListField3()
{
    url_namej =  document.getElementById('url_name');        
    url_valuej =  document.getElementById('url_value');      
    url_logoj =  document.getElementById('url_logo'); 

     if (url_namej.value!='' &&  url_valuej.value !='' && url_logoj.value!='')
     {
          popup_name_list.options[popup_name_list.length] = new Option(url_namej.value,url_namej.value); 
          url_namej.value='';
          popup_value_list.options[popup_value_list.length] = new Option(url_valuej.value,url_valuej.value); 
          url_valuej.value='';
          popup_logo_list.options[popup_logo_list.length] = new Option(url_logoj.value,url_logoj.value); 
          url_logoj.value='';
      }

}
</script>";

echo "<hr>";
echo "<big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Url in the popup </span></b></big><br>";
	echo '<tbody>
	<table style="width: 100%;" border="0" cellpadding="2"
	<tbody>
	<tr>
	<td>
	Name :
	</td>
	<td>
	Url :
	</td>
	<td>
	Logo :
	</td></tr>
	<tr align="center">
	<td>
	<select size="5" style="width: 199px" multiple id="popup_name_list" name="popup_name_list[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT name FROM wlogin_popup_list WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
	echo ("<option  value=\"".$row->name."\">".$row->name."</option>");
}
echo '	</select></td>
	</td>
	<td style="text-align: left; width: 299px;">
	<select size="5" style="width: 259px" multiple disabled id="popup_value_list" name="popup_value_list[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT value FROM wlogin_popup_list WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
	echo ("<option  value=\"".$row->value."\">".$row->value."</option>");
}

	echo '</select></td>
		<td style="vertical-align: middle; width: 262px; text-align: left;">
		<select size="5" style="width: 199px" multiple disabled id="popup_logo_list" name="popup_logo_list[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT logo FROM wlogin_popup_list WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
	echo ("<option  value=\"".$row->logo."\">".$row->logo."</option>");
	}

	echo '</select></td>
	<td style="vertical-align: middle; width: 262px; text-align: left;">';
	
	print "<a href=\"JavaScript:deleteFromList3()\"><img  src=\"images/delete.png\" title=\"Del free url\"></a>";
	
	echo '</td></tr><tr>';
	
	echo '<td style="text-align: left; width: 299px;">
	<input style="width: 100%;" id="url_name" name="url_name" value=""></td>';
	echo '<td style="text-align: left; width: 299px;">
	<input style="width: 100%;" id="url_value" name="url_value" value=""></td>
	<td style="height: 22px; text-align: left;">
	<input style="width: 100%;" id="url_logo" name="url_logo" value=""></td><td>';
	print "<a href=\"JavaScript:copyToListField3()\"><img  src=\"images/insert.png\" title=\"Add free url\"></a>";

echo "</td>";

	echo '</table>';


echo "<hr><table>
	<tr>
<td>
<input name=\"savewloginconfig\" type=\"submit\" value=\"Save Configuration\" >
</form>
</td><td>
<form action=\"phpmyprepaid.php\" method=\"post\">
<input type=\"hidden\" name=\"buttonID\" value=\"wlogin_config\">
<input type=\"hidden\" name=\"load_default\" value=\"wlogin_config\">
<input name=\"submit\" type=\"submit\" value=\"Get default configuration\" >
</form>
</td></tr>
</table>

";
}
else echo $msg;
			
		
$opt=$oreon->database->getwloginconfiguration($_SESSION['locID']);

fclose($fh);
unset($_POST['savewloginconfigfile']);
	}
	else if (isset($_POST['savewloginconfig']) ){
		
		//GENERAL
		
		$opt->uam_ip=$_POST['uam_ip'];
		$opt->config_file=$_POST['config_file'];
		$opt->uam_port=$_POST['uam_port'];
		$opt->base_url=$_POST['base_url'];
		$opt->cookies=$_POST['cookies'];
		$opt->debug=$_POST['debug'];
		$opt->popup_time=$_POST['popup_time'];
		$opt->logout_popup=$_POST['logout_popup'];
		$opt->uam_secret=$_POST['uam_secret'];
		$opt->other_account=$_POST['other_account'];
		$opt->language=$_POST['language'];
		$opt->location_id=$_SESSION['locID'];
		
		$oreon->database->savewloginconfiguration($opt);
		$opt=$oreon->database->getwloginconfiguration($_SESSION['locID']);
		if(isset($_POST['ta_list_name']) && !empty($_POST['ta_list_name']))
			savewloginfreeurl($_POST['ta_list_name'],$_POST['ta_list_url'],$_SESSION['locID']);
		
		if(isset($_POST['popup_name_list']) && !empty($_POST['popup_name_list']))
			savewpopupurl($_POST['popup_name_list'],$_POST['popup_value_list'],$_POST['popup_logo_list'] ,$_SESSION['locID']);
		
	       	echo "Configuration have been saved";

unset($_POST['savewloginconfig']);
}
if (isset($_POST['load_default']))
{
	        $lid=-1;
		        unset($_POST['load_default']);
}

else
	        $lid=$_SESSION['locID'];
$opt=$oreon->database->getwloginconfiguration($lid);

echo "
<form action=\"phpmyprepaid.php\" method=\"post\" onSubmit=\"selectall()\">
<br>
<big><big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Wlogin configuration</span></b></big></big><br>
<hr>
<table>	
<br>
<td>Configuration File : </td>
<td><input name=\"config_file\" value=\"".$opt['config_file']."\"></td><td>
<input name=\"savewloginconfigfile\" type=\"submit\" value=\"Save config file\" >
</td></tr><tr>
<td>Uam ip : </td>
<td><input name=\"uam_ip\" value=\"".$opt['uam_ip']."\"></td>
</tr><tr>
<td>Uam port : </td>
<td><input name=\"uam_port\" value=\"".$opt['uam_port']."\"></td>
</tr><tr>
<td>Uam secret : </td>
<td><input name=\"uam_secret\" value=\"".$opt['uam_secret']."\"></td>
</tr><tr>
<td>Base url : </td>
<td><input name=\"base_url\" value=\"".$opt['base_url']."\"></td>
</tr><tr>
<td>Popup information display time : </td>
<td><input name=\"popup_time\" value=\"".$opt['popup_time']."\"></td>
</tr><tr>
<td>Cookies : </td>";

if ($opt['cookies'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"cookies\"  value=\"1\" alt=\"Cookies\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"cookies\"   value=\"1\" alt=\"Cookies\"></td>";
echo "</tr><tr>";
echo "<td>Debug : </td>";

if ($opt['debug'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"debug\"  value=\"1\" alt=\"Debug\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"debug\"   value=\"1\" alt=\"Debug\"></td>";
echo "</tr><tr>";
echo "<td>Logout popup : </td>";

if ($opt['logout_popup'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"logout_popup\"  value=\"1\" alt=\"Logout popup\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"logout_popup\"   value=\"1\" alt=\"Logout popup\"></td>";

echo "</tr><tr>";
echo "<td>Other account : </td>";

if ($opt['other_account'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"other_account\"  value=\"1\" alt=\"Other account\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"other_account\"   value=\"1\" alt=\"Other account\"></td>";


echo "</tr><tr>
<td>Default language : </td>
<td><input name=\"language\" value=\"".$opt['language']."\"></td>
</tr><tr>

</tr>
</table>
";
echo "<hr>";
echo "<big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Free url list</span></b></big><br>";

echo '<tbody>
	<table style="width: 100%;" border="0" cellpadding="2"
	cellspacing="2">
	<tbody>
	<tr align="left">
	<td>Name :</td>
	<td>Url :</td>
	</tr><tr align="center">
	<td style="text-align: left; width: 299px;">
	<select size="5" style="width: 299px" multiple id="ta_list_name" name="ta_list_name[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT name FROM wlogin_freeurl WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
 echo ("<option  value=\"".$row->name."\">".$row->name."</option>");

 }
echo'	</select></td>';

	echo '<td style="text-align: left; width: 299px;">
	<select size="5" style="width: 299px" disabled multiple id="ta_list_url" name="ta_list_url[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT url FROM wlogin_freeurl WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
 echo ("<option  value=\"".$row->url."\">".$row->url."</option>");

 }
	echo '<td style="vertical-align: middle; width: 262px; text-align: left;">';
	
echo "<script type='text/javascript'>

function selectall()
{
select = document.getElementById('ta_list_url');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
}

select = document.getElementById('ta_list_name');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
}

select = document.getElementById('popup_name_list');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
 }
select = document.getElementById('popup_value_list');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
 }
select = document.getElementById('popup_logo_list');
for (i = 0; i < select.length; i++) {
		select.options[i].selected = true
 }
}

function deleteFromList()
{
  fromList =  document.getElementById('ta_list_name');	
  fromList2 =  document.getElementById('ta_list_url');	
    
  var sel = false;
  for (i=0;i<fromList.options.length;i++)
    {
     var current = fromList.options[i];
     if (current.selected)
        {
          sel = true;
          fromList.remove(i);
          fromList2.remove(i);
       }
    }
 if (!sel) alert ('You haven\'t selected any options!');
}		

function copyToListField()
{
  fromList =  document.getElementById('urln');	
  toList =  document.getElementById('ta_list_name');	
  fromList2 =  document.getElementById('urlf');	
  toList2 =  document.getElementById('ta_list_url');	

     var current = fromList.value;
     var current2 = fromList2.value;
     if (current!='' and current2!='')
     {
          toList.options[toList.length] = new Option(current,current); 
          toList2.options[toList2.length] = new Option(current2,current2); 
      fromList.value='';
      fromList2.value='';
    }
}
	
</script>";

print "<a href=\"JavaScript:deleteFromList()\"><img  src=\"images/delete.png\" title=\"Del free url\"></a>";

echo '</td>
	</tr>
	<tr align="center">';


echo '<td style="text-align: left; width: 299px;">
	<input style="width: 299px;" id="urln" name="urln" value=""></td>';
echo '<td style="text-align: left; width: 299px;">
	<input style="width: 299px;" id="urlf" name="urlf" value=""></td><td style="text-align: left;">';

print "<a href=\"JavaScript:copyToListField()\"><img  src=\"images/insert.png\" title=\"Add free url\"></a>";

echo "</td>";

echo "</tr>
	</tbody>
	</table>";

echo "<script type='text/javascript'>

function deleteFromList3()
{
  url_name =  document.getElementById('popup_name_list');	
  url_value =  document.getElementById('popup_value_list');	
  url_logo =  document.getElementById('popup_logo_list');	

 fromList=url_name ; 
  var sel = false;
  for (i=0;i<fromList.options.length;i++)
    {
     var current = fromList.options[i];
     if (current.selected)
        {
          sel = true;
          url_name.remove(i);
          url_value.remove(i);
          url_logo.remove(i);
       }
    }
 if (!sel) alert ('You haven\'t selected any options!');
}		

function select_all(select) {
	url_name =  document.getElementById('popup_name_list');       
	url_value =  document.getElementById('popup_value_list');     
	url_logo =  document.getElementById('popup_logo_list');  

	for (m = 0; m < select.options.length; m++){
		if (select.options[m].selected) {
			url_name.options[m].selected='true';
			url_value.options[m].selected='true';
			url_logo.options[m].selected='true';
		}
}
}

function copyToListField3()
{
    url_namej =  document.getElementById('url_name');        
    url_valuej =  document.getElementById('url_value');      
    url_logoj =  document.getElementById('url_logo'); 

     if (url_namej.value!='' &&  url_valuej.value !='' && url_logoj.value!='')
     {
          popup_name_list.options[popup_name_list.length] = new Option(url_namej.value,url_namej.value); 
          url_namej.value='';
          popup_value_list.options[popup_value_list.length] = new Option(url_valuej.value,url_valuej.value); 
          url_valuej.value='';
          popup_logo_list.options[popup_logo_list.length] = new Option(url_logoj.value,url_logoj.value); 
          url_logoj.value='';
      }

}
</script>";

echo "<hr>";
echo "<big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Url in the popup </span></b></big><br>";
	echo '<tbody>
	<table style="width: 100%;" border="0" cellpadding="2"
	<tbody>
	<tr>
	<td>
	Name :
	</td>
	<td>
	Url :
	</td>
	<td>
	Logo :
	</td></tr>
	<tr align="center">
	<td>
	<select size="5" style="width: 199px" multiple id="popup_name_list" name="popup_name_list[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT name FROM wlogin_popup_list WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
	echo ("<option  value=\"".$row->name."\">".$row->name."</option>");
}
echo '	</select></td>
	</td>
	<td style="text-align: left; width: 299px;">
	<select size="5" style="width: 259px" multiple disabled id="popup_value_list" name="popup_value_list[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT value FROM wlogin_popup_list WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
	echo ("<option  value=\"".$row->value."\">".$row->value."</option>");
}

	echo '</select></td>
		<td style="vertical-align: middle; width: 262px; text-align: left;">
		<select size="5" style="width: 199px" multiple disabled id="popup_logo_list" name="popup_logo_list[]">';

$result=$_SESSION["oreon"]->database->database->query("SELECT logo FROM wlogin_popup_list WHERE location_id='$lid'");
while ($row = mysql_fetch_object($result)) {
	echo ("<option  value=\"".$row->logo."\">".$row->logo."</option>");
	}

	echo '</select></td>
	<td style="vertical-align: middle; width: 262px; text-align: left;">';
	
	print "<a href=\"JavaScript:deleteFromList3()\"><img  src=\"images/delete.png\" title=\"Del free url\"></a>";
	
	echo '</td></tr><tr>';
	
	echo '<td style="text-align: left; width: 299px;">
	<input style="width: 100%;" id="url_name" name="url_name" value=""></td>';
	echo '<td style="text-align: left; width: 299px;">
	<input style="width: 100%;" id="url_value" name="url_value" value=""></td>
	<td style="height: 22px; text-align: left;">
	<input style="width: 100%;" id="url_logo" name="url_logo" value=""></td><td>';
	print "<a href=\"JavaScript:copyToListField3()\"><img  src=\"images/insert.png\" title=\"Add free url\"></a>";

echo "</td>";

	echo '</table>';


echo "<hr><table>
	<tr>
<td>
<input name=\"savewloginconfig\" type=\"submit\" value=\"Save Configuration\" >
</form>
</td><td>
<form action=\"phpmyprepaid.php\" method=\"post\">
<input type=\"hidden\" name=\"buttonID\" value=\"wlogin_config\">
<input type=\"hidden\" name=\"load_default\" value=\"wlogin_config\">
<input name=\"submit\" type=\"submit\" value=\"Get default configuration\" >
</form>
</td></tr>
</table>

";
}
else echo $msg;
Return current item: phpMyPrepaid