R
Raymond Scheeren
Hi,
I want to convert my site from php to eruby(no rails). I'm really new to
ruby and need some help.
The most trival php code i use in my web-page is to use php for password
protect my pages.
Can someone help me to convert this php code to use eruby -> rhtml?
I use the following php code to password protect my pages (with php
session var):
config.php
----------
<?php
//---------------------------------------
// CONFIG
//---------------------------------------
$password = "geheim123"; //set password
?>
common.php
----------
<?php
$password = "";
if (file_exists("config.php")) include "config.php";
$showLogin = false;
if( !isset( $_SESSION ) ) { session_start(); } // starting session
if (isset($_GET['action']) && $_GET['action']=="LOGOUT")
{
session_unset();
$showLogin = true;
}
else
if ($password!="" && !isset($cron_update) && !isset($cron_ping) )
{
if (isset($_POST["form_password"]))
{//vin din login
$pass = $_POST['form_password'];
if ($pass == $password)
$_SESSION["password"] = $password;
else
{
$showLogin = true;
}
}
else
if ($_SESSION["password"] != $password)
$showLogin = true;
}
if ($showLogin == true)
{
include "login.php";
exit;
}
?>
login.php
---------
<HTML><HEAD><LINK HREF="cccam.css" REL="Stylesheet"
TYPE="text/css"></HEAD><BODY>
<center>
<BR><BR><BR>
<BR><BR><BR>
<table border="0" cellspacing="0" cellpadding="0" width="350"
CLASS="tabel_LOGIN">
<tr>
<td align="center"><BR><BR><font face='Arial' size=6
color=white>CCcamInfoPHP</font</td>
</tr>
<tr>
<td>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post"
name="frmLogin">
<table border="0" width="350">
<tr>
<BR><BR>
<td align="center"><input type="password"
name="form_password"> <input type="submit" value=" Login
"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</BODY>
index.php
---------
<?php include "common.php"?>
<html><body><h1>It works!</h1></body></html>
testpage.php
I want to convert my site from php to eruby(no rails). I'm really new to
ruby and need some help.
The most trival php code i use in my web-page is to use php for password
protect my pages.
Can someone help me to convert this php code to use eruby -> rhtml?
I use the following php code to password protect my pages (with php
session var):
config.php
----------
<?php
//---------------------------------------
// CONFIG
//---------------------------------------
$password = "geheim123"; //set password
?>
common.php
----------
<?php
$password = "";
if (file_exists("config.php")) include "config.php";
$showLogin = false;
if( !isset( $_SESSION ) ) { session_start(); } // starting session
if (isset($_GET['action']) && $_GET['action']=="LOGOUT")
{
session_unset();
$showLogin = true;
}
else
if ($password!="" && !isset($cron_update) && !isset($cron_ping) )
{
if (isset($_POST["form_password"]))
{//vin din login
$pass = $_POST['form_password'];
if ($pass == $password)
$_SESSION["password"] = $password;
else
{
$showLogin = true;
}
}
else
if ($_SESSION["password"] != $password)
$showLogin = true;
}
if ($showLogin == true)
{
include "login.php";
exit;
}
?>
login.php
---------
<HTML><HEAD><LINK HREF="cccam.css" REL="Stylesheet"
TYPE="text/css"></HEAD><BODY>
<center>
<BR><BR><BR>
<BR><BR><BR>
<table border="0" cellspacing="0" cellpadding="0" width="350"
CLASS="tabel_LOGIN">
<tr>
<td align="center"><BR><BR><font face='Arial' size=6
color=white>CCcamInfoPHP</font</td>
</tr>
<tr>
<td>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post"
name="frmLogin">
<table border="0" width="350">
<tr>
<BR><BR>
<td align="center"><input type="password"
name="form_password"> <input type="submit" value=" Login
"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</BODY>
index.php
---------
<?php include "common.php"?>
<html><body><h1>It works!</h1></body></html>
testpage.php