I have 2 scripts, the second script is linked to the first one, so please take a look at both. My first script: theme.php
<?php
function ceklogin(){
session_start();
if ($_SESSION['loggedin'] != 1) {
header("Location: login.php");
exit;
}}
function bgchange(){
$bg = array('images/angel-beats-bg1.jpg', 'images/angel-beats-bg2.jpg', 'images/angel-beats-bg3.jpg'); // array of filenames
$i = rand(0, count($bg)-1); // generate random number size of the array
$selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen
return $selectedBg;
}
$bgUrl = bgchange();
function css(){
echo '
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/png" href="favicon.png">
<title>OpenWrt Angel Beats! Edition</title>
<style type="text/css">
body {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-image: url('.$bgUrl.');
background-repeat: no-repeat;
margin: auto;
width: auto;
height: auto;
display: table;
text-align:center;
}
.TextBox {
-moz-border-radius:30px;
-webkit-border-radius:30px;
border-radius:30px;
border: #solid 10px #000;
background-color: rgba(255,255,255,0.5);
width:auto;
height:auto;
margin-left: auto ;
margin-right: auto ;
display: inline-block
}
.TextBox:after {
content:"\a \00a0 ";
}
.TextBox:before {
content:"\a \00a0 ";
}
</style>
<body>
<img src="images/header.png" alt="OpenWrt Gratisan"><br>
<strong>
<p>
<a href="status.php" title=""><font color="red">Status</font></a> |
<a href="wget.php" title=""><font color="red">Wget WebUI</font></a> |
<a href="terminal.php" title=""><font color="red">Terminal</font></a> |
<a href="wifi.php" title=""><font color="red">WIFI</font></a> |
<a href="ch_pass.php" title=""><font color="red">Password</font></a> |
<a href="profile.php" title=""><font color="red">Profile</font></a> |
<a href="vpn.php" title=""><font color="red">Accounts</font></a> |
<a href="ussd.php" title=""><font color="red">USSD</font></a> |
<a href="sms_in.php" title=""><font color="red">Inbox SMS</font></a> |
<a href="sms_send.php" title=""><font color="red">Send SMS</font></a> |
</p>
<p>
<a href="vpn_log.php" title=""><font color="red">VPN log</font></a> |
<a href="restart_log.php" title=""><font color="red">Restart Log</font></a> |
<a href="wget_log.php" title=""><font color="red">Wget Log</font></a> |
<a href="dial_log.php" title=""><font color="red">Dial Log</font></a> |
<a href="about.php" title=""><font color="red">About</font></a>
</p>
</font></strong>
<br><br><br>
<div class="TextBox">';
}
function foot() {
echo '<br><br><br><strong>Copyright</strong>';
}
?>
This theme.php
is just like the css for other pages, this is the real webpage:
status.php
<?php
include 'theme.php';
ceklogin();
$event=0;
$st=0;
if($_POST['start']){
$pf=$_POST['profile'];
exec('profile start '.$pf.' > /dev/null 2>&1 &');
$list="Profile Started .. OK";
$event=1;
$st=2;
header( "refresh:1;url=status.php" );
}
if($_POST['stop']){
exec('killall restart-internet.sh');
exec('profile stop');
$list="Profile Stoped .. OK";
$event=1;
$st=2;
header( "refresh:1;url=status.php" );
}
if($_POST['restart']){
exec('profile start > /dev/null 2>&1 &');
$event=1;
$st=2;
$list="Profile restarted .. OK";
header( "refresh:1;url=status.php" );
}
if($_POST['info']){
$pf=$_POST['profile'];
$st=3;
}
if($_POST['reg']){
$param=$_POST['network'];
exec('gsm set network '.$param);
sleep(3);
$st=1;
}
css();
if ( $event == 1 )
{
echo $list;
echo '
<br>
Harap Menunggu....
<br>
</div>';
foot();
echo '
</div>
</body>
</html>';
exit;
}
if ( $event == 0 )
{
exec('cat /tmp/prf',$o);
if ( $o[0] == 'started' ) {
echo "<form action=\"".$PHP_SELF."\" method=\"post\">";
echo '
<input type="submit" name="refresh" value="Refresh Status" />
<input type="submit" name="restart" value="Restart Profile" />
<input type="submit" name="stop" value="Stop Profile" />
</form>';
}
else
{
exec('ls /root/profiles',$list);
echo "<form action=\"".$PHP_SELF."\" method=\"post\">";
echo '
profile :
<select name="profile">';
$x=0;
while($x<count($list))
{
echo "
<option value=\"$list[$x]\">$list[$x]</option>";
$x++;
}
echo '
</select>
<input type="submit" name="start" value="Start Profile" />
<input type="submit" name="info" value="Info Profile" />
</form>';
}
echo "<br>";
if($_POST['all-status']){
$st=1;
}
if($_POST['edge-only']){
$st=1;
exec('gsm jump edge',$ot);
exec('uci set network.3g.service=gprs_only',$ot);
sleep(10);
}
if($_POST['tigag-only']){
$st=1;
exec('gsm jump 3g',$ot);
exec('uci set network.3g.service=umts_only',$ot);
sleep(10);
}
if ( $st == 3 ){
exec('profile info '.$pf,$out);
$st=0;
}else{
if ( $st == 1){
exec('gsm status',$out);
}else{
$st=0;
exec('profile status-koneksi',$out);
}}
if ($st <> 2){
echo '
<div align="center" >
<div style="left:10px;width:380px;height:212px;border:1px solid #000;text-align:center;">';
}
$arrlength=count($out);
for($x=0;$x<$arrlength;$x++)
{
echo $out[$x]. "<br>";
}
}
if ($st <> 2){
echo '</div></div>';
}
if ($st == 0){
echo "<br><form action=\"".$PHP_SELF."\" method=\"post\">";
echo '
<input type="submit" name="all-status" value="Status Modem" />
</form>';
}else{
if ($st == 1){
echo "<br><form action=\"".$PHP_SELF."\" method=\"post\">";
echo '
<input type="submit" name="edge-only" value="Edge Only" />
<input type="submit" name="tigag-only" value="3G Only" />
Network:
<select name="network">
<option value=\"auto\">Auto</option>\"
<option value=\"51001\">Indosat</option>\"
<option value=\"51011\">XL</option>\"
<option value=\"51089\">3</option>\"
<option value=\"51010\">Telkomsel</option>\"
</select>
<input type="submit" name="reg" value="Register" />
</form>';
}}
echo '
</div>';
foot();
echo '
</body>
</html>';
?>
When I run the status.php
everything looks good but the only problem is that the background isn't showing, it only shows a white page and the contents itself. The background is supposed to be from angel beats pictures (random bg every refresh). My guess is that I did a mistake in this part:
body {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-image: url('.$bgUrl.');
background-repeat: no-repeat;
margin: auto;
width: auto;
height: auto;
display: table;
text-align:center;
}
But I just can't figure out my mistake. How do I show a background in status.php
? I'm really sorry for the long scripts, I'm really at my limit right now.
UPDATE
As some people suggested, I took a look at the source code of status.php
in my browser and I got this:
body {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-image: url();
background-repeat: no-repeat;
margin: auto;
width: auto;
height: auto;
display: table;
text-align:center;
}
background-image: url();
isn't showing anything, help!