| Server IP : 192.169.170.185 / Your IP : 216.73.216.97 Web Server : Apache System : Linux p3plmcpnl495852.prod.phx3.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64 User : akhilnew ( 1712764) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/akhilnew/public_html/admin/ |
Upload File : |
<?php
if($opt1 && ($opt1 === 'add' || $opt1 === 'edit')):
if($opt1 === 'edit' && $opt2):
$stmt = $mysqli->prepare("SELECT subject, journal, journalemail, fromname, fromemail, replyname, replyemail, frequency, copies, price, domain, coverpage, issn, doi, status FROM $table WHERE $firstcol = ? LIMIT 1") or die($mysqli->error);
$stmt->bind_param('i', $opt2);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->bind_result($subject, $journal, $journalemail, $fromname, $fromemail, $replyname, $replyemail, $frequency, $copies, $price, $domain, $coverpage, $issn, $doi, $status);
$stmt->fetch();
$stmt->close();
if($count_rows !== 1):
die('Invalid data selection.');
endif;
else:
$subject = '';$journal = '';$journalemail = '';$fromname = '';$fromemail = '';$replyname = '';$replyemail = '';$frequency = '';$copies = '';$price = '';$domain = '';$issn = '';$doi = '';$status = 'enabled';
endif;
if($opt1 === 'add' || $opt1 === 'edit'):
function subjects($subject){
global $mysqli, $table;$html = '';
$stmt = $mysqli->prepare("SELECT TRIM(subject) FROM $table GROUP BY TRIM(subject) ORDER BY TRIM(subject) ASC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($subject);
while($stmt->fetch()):
$html .= ($subject) ? '<option value="'.trim($subject).'">'.trim($subject).'</option>' : '';
endwhile;
$stmt->close();
return $html;
}
$subjects = subjects($subject);
function frequencies($frequency){
$html = '';
$frequencies = array('Monthly', 'Bimonthly', 'Quarterly', 'Triannual', 'Biannual', 'Yearly', 'Irregular', 'Half Yearly', 'Semi Yearly');
sort($frequencies);
foreach($frequencies as $freq):
$selected = ($frequency === $freq) ? 'selected' : '';
$html .= '<option value="'.$freq.'" '.$selected.'>'.$freq.'</option>';
endforeach;
return $html;
}
$frequencies = frequencies($frequency);
$status = ($status == 'enabled') ? 'checked' : '';
echo <<<EOJ
<input type="hidden" name="dataid" value="{$opt2}" readonly />
<div class="head">
{$back}
<button type="submit" class="waves-effect btn-flat blue accent-3">submit</button>
</div>
<div class="body">
<div class="row">
<div class="col s12 m6 l6">
<label for="subject">subject</label>
<input type="text" name="subject" value="{$subject}" id="subject" />
</div>
<div class="col s12 m6 l6">
<label for="subjectlist">subject list</label>
<select name="subjectlist" id="subjectlist" class="browser-default" onchange="this.form.subject.value = this.value;this.form.subject.focus();">
<option value="" selected>Select Subject</option>
{$subjects}
</select>
</div>
</div>
<div class="row">
<div class="col s12 m6 l6">
<label for="journal">journal name<b class="red-text right">*</b></label>
<input type="text" name="journal" value="{$journal}" id="journal" />
</div>
<div class="col s12 m6 l6">
<label for="journalemail">journal email<b class="red-text right">*</b></label>
<input type="text" name="journalemail" value="{$journalemail}" id="journalemail" />
</div>
</div>
<div class="row">
<div class="col s12 m6 l6">
<label for="fromname">from name<b class="red-text right">*</b></label>
<input type="text" name="fromname" value="{$fromname}" id="fromname" />
</div>
<div class="col s12 m6 l6">
<label for="fromemail">from email<b class="red-text right">*</b></label>
<input type="text" name="fromemail" value="{$fromemail}" id="fromemail" />
</div>
</div>
<div class="row">
<div class="col s12 m6 l6">
<label for="replyname">reply name<b class="red-text right">*</b></label>
<input type="text" name="replyname" value="{$replyname}" id="replyname" />
</div>
<div class="col s12 m6 l6">
<label for="replyemail">reply email<b class="red-text right">*</b></label>
<input type="text" name="replyemail" value="{$replyemail}" id="replyemail" />
</div>
</div>
<div class="row">
<div class="col s12 m6 l3">
<label for="frequency">frequency</label>
<select name="frequency" id="frequency" class="browser-default">
<option value="" selected="selected">Select Frequency</option>
{$frequencies}
</select>
</div>
<div class="col s12 m6 l3">
<label for="copies">copies/year</label>
<input type="text" name="copies" value="{$copies}" id="copies" class="int" />
</div>
<div class="col s12 m6 l3">
<label for="price">price (₹)</label>
<input type="text" name="price" value="{$price}" id="price" class="int" />
</div>
<div class="col s12 m6 l3">
<label for="domain">domain <span class="grey-text">(http:// or https://)</span><b class="red-text right">*</b></label>
<input type="text" name="domain" value="{$domain}" id="domain" />
</div>
</div>
<div class="row">
<div class="col s12 m6 l4">
<label for="coverpage">cover page</label>
<div class="file-field">
<div class="btn btn-flat grey lighten-1">
<span>cover page</span>
<input type="file" name="coverpage" />
</div>
<div class="file-path-wrapper">
<input type="text" placeholder="Only JPG and JPEG file allowed" class="file-path" />
</div>
</div>
</div>
<div class="col s12 m6 l3">
<label for="issn">issn</label>
<input type="text" name="issn" value="{$issn}" id="issn" />
</div>
<div class="col s12 m6 l3">
<label for="doi">doi</label>
<input type="text" name="doi" value="{$doi}" id="doi" />
</div>
<div class="col s12 m6 l2">
<label class="chklab" style="margin-top:16px;"><input type="checkbox" name="status" value="enabled" {$status} />status</label>
</div>
</div>
</div>
EOJ;
else:
echo 'Invalid option selection.';
endif;
else:
$stmt = $mysqli->prepare("SELECT * FROM $table") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$total_rows = $stmt->num_rows();
$stmt->close();
echo <<<EOJ
<div class="head">
<button type="button" class="waves-effect btn-flat green" onclick="cURL('add')">add new</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('enabled', '')">enable</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('disabled', '')">disable</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('delete', 'Do you really want to delete?')"><i class="material-icons">delete</i></button>
<div class="pagination right"><b class="left">Total Rows : {$total_rows}</b></div>
</div>
<table class="table">
<thead>
<tr>
<th class="xs center-align"><input type="checkbox" name="checkall" id="checkall" value="" /></th>
<th class="xs center-align">s. no.</th>
<th class="sm center-align">image</th>
<th>subject</th>
<th>journal</th>
<th class="md">frequency</th>
<th class="xs center-align">copies</th>
<th class="sm right-align">price</th>
<th class="sm center-align">status</th>
<th class="lg right-align">creation</th>
<th class="sm center-align">action</th>
</tr>
</thead>
<tbody>
EOJ;
$stmt = $mysqli->prepare("SELECT $firstcol, subject, journal, frequency, copies, price, coverpage, status, creation FROM $table ORDER BY journal ASC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($id, $subject, $journal, $frequency, $copies, $price, $coverpage, $status, $creation);
while($stmt->fetch()):
$snum = $snum + 1;
$coverpage = ($coverpage && file_exists($uploadpath.'journals/'.$coverpage)) ? $imageurl.'journals/'.$coverpage : $imageurl.'product-ico.png';
$statuscolor = ($status == 'enabled') ? 'green-text' : 'red-text';
$option = ($status == 'enabled') ? 'disabled' : 'enabled';
echo <<<EOJ
<tr>
<td class="center-align"><input type="checkbox" name="dataid[]" value="{$id}" class="checkbox" /></td>
<td class="center-align">{$snum}</td>
<td class="center-align"><img src="{$coverpage}" alt="{$journal}" width="50px" style="float:none" /></td>
<td>{$subject}</td>
<td>{$journal}</td>
<td>{$frequency}</td>
<td class="center-align">{$copies}</td>
<td class="right-align">{$fn->amount('₹', $price)}</td>
<td class="center-align"><button type="submit" class="link {$statuscolor}" onclick="sOPT('{$option}', '', this)">{$status}</button></td>
<td class="right-align">{$fn->dateformat($creation)}</td>
<td class="center-align"><button type="button" class="link blue-text text-accent-3" onclick="cURL('edit/{$id}')">edit</button></td>
</tr>
EOJ;
endwhile;
else:
echo '<tr><td colspan="11" class="center-align">'.$emptyrows.'</td></tr>';
endif;
$stmt->close();
echo '</tbody>';
echo '</table>';
endif;
?>