help convert php code to eruby

  • Thread starter Raymond Scheeren
  • Start date
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">&nbsp;&nbsp;<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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top