Currently I have an overview of domains. I logged in with an account that has the contact ID of 197246. but it shows all of them. Here I want to filter my overview that the user which is logged in, sees his own domains.
So when ID 197246 logs in, show the domains that have contact id 197246. When ID 307890 logs in, show those domains.
This is my code so far. I guess here needs to be a filter.
<?php
unset($command);
$command = array(
"command" => "DomainsListActive"
);
$api = new Versio_api();
$versio = $api->api_send($command);
if($versio['success']==0) {
echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
}
else {
if($versio['total_count']>0)
{
require_once("includes/submenu.php");
?>
<div class="col-sm-9 col-md-9" style="width:80%;">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Klantenpaneel</h3>
</div>
<div class="panel-body">
<form method="post" action="">
<table class="table table-striped">
<thead>
<tr>
<th>Domein</th>
<th>TLD</th>
<th>Verloop datum</th>
<th>Automatisch verlengen</th>
<th>contact ID</th>
</tr>
</thead>
<table class="table table-striped table-bordered">
<tbody>
<?php
$teller = 1;
while($versio['total_count']>=$teller) {
?>
<tr>
<td><a href="records.php?domain=<?php echo $versio['domain_'.$teller]; ?>&tld=<?php echo $versio['tld_'.$teller]; ?>">
<?php echo $versio['domain_'.$teller]; ?></a></td>
<td>.<?php echo $versio['tld_'.$teller]; ?></td>
<td><?php echo $versio['expiration_date_'.$teller]; ?></td>
<td><?php echo $versio['auto_renew_'.$teller]; ?></td>
<td><?php echo $versio['contactid_'.$teller]; ?></td>
</tr>
<?php $teller++;
}
?>
</tbody>
</table>
</form>
</div>
</div>
<?php
} else {
echo("Er zijn geen DNS records gevonden voor dit domein.");
}
}
?>
The documentation from Versio gives you an entire list of options in the call. One option you could do is check if the 'contactid_x' equals to the logged in user.
more information on their wiki right here
As an example, this would do the trick:
unset($command);
$command = array(
"command" => "DomainsListActive"
);
$api = new Versio_api();
$versio = $api->api_send($command);
if($versio['success']==0) {
echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
}
else {
if($versio['total_count']>0)
{
require_once("includes/submenu.php");
?>
<div class="col-sm-9 col-md-9" style="width:80%;">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Klantenpaneel</h3>
</div>
<div class="panel-body">
<form method="post" action="">
<table class="table table-striped">
<thead>
<tr>
<th>Domein</th>
<th>TLD</th>
<th>Verloop datum</th>
<th>Automatisch verlengen</th>
<th>contact ID</th>
</tr>
</thead>
<table class="table table-striped table-bordered">
<tbody>
<?php
$teller = 1;
while($versio['total_count']>=$teller) {
if ($versio['contactid_'. $teller] != 197246 ) continue;
?>
<tr>
<td><a href="records.php?domain=<?php echo $versio['domain_'.$teller]; ?>&tld=<?php echo $versio['tld_'.$teller]; ?>">
<?php echo $versio['domain_'.$teller]; ?></a></td>
<td>.<?php echo $versio['tld_'.$teller]; ?></td>
<td><?php echo $versio['expiration_date_'.$teller]; ?></td>
<td><?php echo $versio['auto_renew_'.$teller]; ?></td>
<td><?php echo $versio['contactid_'.$teller]; ?></td>
</tr>
<?php $teller++;
}
?>
</tbody>
</table>
</form>
</div>
</div>
<?php
} else {
echo("Er zijn geen DNS records gevonden voor dit domein.");
}
}
?>
make sure to replace the ID with the ID from the user on line 41
Related
image link
Good day everyone i would like to ask if there is someone had a idea on how to make that specific column a link so that the user can download that pdf file.
This my Datatable
<table id="example" class="table table-striped table-bordered table-hover" style="width:100%">
<thead>
<tr>
<th class="text-center align-middle">Control Number</th>
<th class="text-center align-middle">Attached Form</th>
<th class="text-center align-middle">P.R. Date.</th>
<th class="text-center align-middle">ABC/PR Amount.</th>
<th class="text-center align-middle">File</th>
</tr>
</thead>
<tbody>
<?php
if($logs){
foreach ($logs as $log){
?>
<tr>
<td class="<?php
if (empty($log->control_number)) {
echo "noactioncell";
}
else
{
echo "donecell";
}
?> text-center align-middle" >
<?php
if (!empty($log->control_number)) {
echo $log->control_number;
}
?>
</td>
<td class="<?php
if (empty($log->category)) {
echo "noactioncell";
}
else
{
echo "donecell";
}
?> text-center align-middle" >
<?php
if (!empty($log->category)) {
echo $log->category;
}
?>
</td>
<td class="<?php
if (empty($log->pr_date)) {
echo "noactioncell";
}
else
{
echo "donecell";
}
?> text-center align-middle" >
<?php
if (!empty($log->pr_date)) {
echo date("m/d/Y", strtotime($log->pr_date));
}
?>
</td>
<td class="<?php
if (empty($log->approve_budget )) {
echo "noactioncell";
}
else
{
echo "donecell";
}
?> text-center align-middle" >
<?php
if (!empty($log->approve_budget )) {
echo $log->approve_budget ;
}
?>
</td>
//Here is the column that i want to be a link to be downloaded
<td class="<?php
if (empty($log->file)) {
echo "noactioncell";
}
else
{
echo "donecell";
}
?> text-center align-middle" >
<?php
if (!empty($log->file )) {
echo $log->file ;
}
?>
</td>
////////////////////////////////////////////////////////////////////////
</tr>
<?php
}
}
?>
</tbody>
</table>
just create an anchor link
<?php
if (!empty($log->file )) {
echo '<a href="'.$log->file.'" target="_blank" >'.$log->file.'</a>';
}
i'm trying to build a website where users can find location of my company, but i need to hide the information at the first time and only show the location that users needed.
Here's my code:
<?php
$condition = '';
if(isset($_REQUEST['Kota']) and $_REQUEST['Kota']!=""){
$condition .= ' AND Kota LIKE "%'.$_REQUEST['Kota'].'%" ';
}
if(isset($_REQUEST['Outlet']) and $_REQUEST['Outlet']!=""){
$condition .= ' AND Outlet LIKE "%'.$_REQUEST['Outlet'].'%" ';
}
if(isset($_REQUEST['Alamat']) and $_REQUEST['Alamat']!=""){
$condition .= ' AND Alamat LIKE "%'.$_REQUEST['Alamat'].'%" ';
}
$userData = $db->getAllRecords('lokasi','*',$condition,'ORDER BY id DESC');
?>
<div>
<table class="table table-striped table-bordered">
<thead>
<tr class="bg-primary text-white">
<th>No</th>
<th>Cabang GO</th>
<th>Nama Kota</th>
<th>Alamat Outlet</th>
<th>No Telepon</th>
</tr>
</thead>
<tbody>
<?php
$s = '';
foreach($userData as $val){
$s++;
?>
<tr>
<td><?php echo $s;?></td>
<td><?php echo $val['Kota'];?></td>
<td><?php echo $val['Outlet'];?></td>
<td><?php echo $val['Alamat'];?></td>
<td><?php echo $val['Nomor'];?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
Start out with <div style=visibility:hidden>. Later change it to 'visible' using JavaScript code.
All the Code you have added is fine, you need few more things to add and it will be all working.
Add HTML Form with an input field for entering searching location and a submit button.
<form action="" method="post">
Search Location: <input type="text" name="location"> <input type="submit" name="submit">`enter code here`
</form>
Add "if" Condition to check the user submitted the form and the result from the db is not empty before the table, where you are displaying all the locations.
<?php if(isset($_POST['submit']) && count($userData) > 0){ ?>
<table class="table table-striped table-bordered">
<thead>
<tr class="bg-primary text-white">
<th>No</th>
<th>Cabang GO</th>
<th>Nama Kota</th>
<th>Alamat Outlet</th>
<th>No Telepon</th>
</tr>
</thead>
<tbody>
<?php
$s = '';
foreach($userData as $val){
$s++;
?>
<tr>
<td><?php echo $s;?></td>
<td><?php echo $val['Kota'];?></td>
<td><?php echo $val['Outlet'];?></td>
<td><?php echo $val['Alamat'];?></td>
<td><?php echo $val['Nomor'];?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
I would like to ask on how to make my table to appear as following:
But I only manage to get my table to appear like this:
As you can see, the table is separated according to the different year or semester of when they stored their stuff. It is basically a history storage of that particular person. Unfortunately, I don't know how to make the generated table to attach together for the one with same year and semester instead of separating it. Even the numbering is affected. Below is the code that I have so far:
<?php
include("connect.php");
include("header.php");
if(isset($_GET['invstuview_bag'], $_GET['invstuview_name']))
{
$get_id = $_GET['invstuview_bag'];
$get_name = $_GET['invstuview_name'];
?>
<br/>
<ul class="breadcrumb">
<li class="breadcrumb-item">View History</li>
<li class="breadcrumb-item-active">Baggage Detail History</a></li>
</ul>
<div id="cssword">Baggage Detail History For <?php echo $get_name; ?>(<?php echo $get_id; ?>)</div>
<div class="container" style="width:70%;">
<div class="table-responsive">
<?php
$sql_join = "SELECT student.*,location.*, inventory.*, baggage.*
FROM
student,location, inventory, baggage
WHERE
student.student_id = inventory.invstu_id AND
baggage.baggage_id = inventory.invbag_id AND
location.location_id = inventory.invloc_id AND
invstu_id = '$get_id'
ORDER BY inventory_id";
$result_join= mysqli_query($connect,$sql_join);
$prev_year = "";
$prev_sem = 0;
$get_year = "";
$get_sem = 0;
while($row_join=mysqli_fetch_assoc($result_join))
{
$counter = 1;
$prev_year = $row_join["invstu_year"];
$prev_sem = $row_join["invstu_sem"];
//if the data is of same year and semester
if(($prev_year!="") && ($prev_sem!=0) && ($prev_year == $get_year) && ($prev_sem == $get_sem))
{
$get_year = $row_join["invstu_year"];
$get_sem = $row_join["invstu_sem"];
?>
<table class="table table-bordered">
<tr>
<th>No.</th>
<th>Baggage Types</th>
<th>Quantity</th>
<th>Location</th>
</tr>
<tr>
<td><?php echo $counter; ?></td>
<td><?php echo $row_join["baggage_type"]; ?></td>
<td><?php echo $row_join["invbag_quantity"]; ?></td>
<td><?php echo $row_join["location_house"]; ?></td>
</tr>
<?php
$counter++;
echo'</table>';
}
//if data is not of same year or semester
else
{
$get_year = $row_join["invstu_year"];
$get_sem = $row_join["invstu_sem"];
?>
</br></br>
Room: <?php echo $row_join["invstu_room"]; ?><br/>
Year: <?php echo $row_join["invstu_year"]; ?><br/>
Semester: <?php echo $row_join["invstu_sem"]; ?><br/>
<table class="table table-bordered">
<tr>
<th>No.</th>
<th>Baggage Types</th>
<th>Quantity</th>
<th>Location</th>
</tr>
<tr>
<td><?php echo $counter; ?></td>
<td><?php echo $row_join["baggage_type"]; ?></td>
<td><?php echo $row_join["invbag_quantity"]; ?></td>
<td><?php echo $row_join["location_house"]; ?></td>
</tr>
<?php
$counter++;
echo'</table>';
}
}
?>
</div>
<div align="right">
<button type="button" name="back" class="btn btn-success" id="back" style="width:200px; display:inline-block; margin-top:2%; margin-bottom:1%; background-color: #4CAF50" onclick="window.location.href='view.php'">Back</button>
</div>
</div>
<?php
}
?>
Any ideas is highly appreciated.
Move these out of the while loop:
<table class="table table-bordered">
<tr>
<th>No.</th>
<th>Baggage Types</th>
<th>Quantity</th>
<th>Location</th>
</tr>
echo'</table>';
I have a function manage_child which it is in a datatables that show all children details. My problem is I want to view only one child details at another pages. I have tried to implement this example of code in my function but it didnt work since I call it like this:
`<td><a href="?pages=child_view"</a><?php_e($child_id); ?></td>`
I have link the page where the details should go but it didn't work. I am still in my basic using php and I use mysqli for the database.
This is the example that I tried to implement in my code but still doesn't work.
echo "<td>".$row[id]."</td>";
echo "<td>".$row[l_name]."</td>";
echo "<td>".$row[f_name]."</td>";
echo "<td>".$row[ssn]."</td>";
this is my code
function manage_child(){
$query = query("SELECT * FROM register_child");
confirm($query);
?>
<div class='container-fluid'>
<div class='row'>
<h1 class="page-header">Children
<small>Information</small>
</h1>
<div class="panel-body">
<div class="dataTable_wrapper">
<table width="50%" class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>No</th>
<th>CHild ID</th>
<th>Child IC</th>
<th>Name</th>
<th>Address</th>
<th>Mother name</th>
</tr>
</thead>
<tbody>
<?php
$bil = 0;
while($row = fetch_array($query)) {
$password = $row['ic_no'];
$child_id = $row['child_id'];
$child_name = $row['child_name'];
$address = $row['address'];
$mother_name = $row['mother_name'];
$bil++;
?>
<tr class="odd gradeX">
<td><?php echo $bil; ?></td>
<td><?php _e($password);?></td>
<td><a href="?pages=child_view"</a><?php _e($child_id); ?></td>
<td><?php _e($child_name); ?></td>
<td><?php _e($address); ?></td>
<td><?php _e($mother_name); ?></td>
<?php
}// End of while
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
}
Currently I am stuck. I have to get an overview of domains. These have to link to an record page. The problem is, I don't know how. I have tried to set an $_SESSION, but then it picks the first variable of my array. At the moment things are hardcoded with 1 example.
<?php
unset($command);
$command = array(
"command" => "DomainsListActive"
);
$api = new Versio_api();
$versio = $api->api_send($command);
if($versio['success']==0) {
echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
}
else {
if($versio['total_count']>0)
{
require_once("includes/submenu.php");
?>
<div class="col-sm-9 col-md-9" style="width:80%;">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Klantenpaneel</h3>
</div>
<div class="panel-body">
<form method="post" action="">
<table class="table table-striped">
<thead>
<tr>
<th>Domein</th>
<th>TLD</th>
<th>Verloop datum</th>
<th>Automatisch verlengen</th>
</tr>
</thead>
<table class="table table-striped table-bordered">
<tbody>
<?php
$teller = 1;
while($versio['total_count']>=$teller) {
?>
<tr>
<td><?php echo $versio['id_'.$teller]; ?></td>
<td><?php echo $versio['domain_'.$teller]; ?> </td>
<td><?php echo $versio['tld_'.$teller]; ?></td>
<td><?php echo $versio['expiration_date_'.$teller]; ?></td>
<td><?php echo $versio['auto_renew_'.$teller]; ?></td>
</tr>
<?php $teller++; } ?>
</tbody>
</table>
</form>
</div>
</div>
<?php
} else {
echo("Er zijn geen DNS records gevonden voor dit domein.");
}
}
?>
I have to get for example, the third variable of $versio['domain_'.$teller] to put in my array in antoher document, record.php. If there is somebody who could help me that would be awesome!
If I understand you correctly, could you pass the variables in a query string?
eg:
<a href="records.php?domain=<?php echo $versio['domain_'.$teller]; ?>&tld=<?php echo $versio['tld_'.$teller]; ?>">
<?php echo $versio['domain_'.$teller]; ?>
</a>
Then in records.php you could get those values with:
<?php
$domain = $_GET['domain'];
$tld = $_GET['tld'];