CoovaChilli redirect to a new page on successfull login, to display user account balance

928 Views Asked by At

I'm working on a CoovaChilli project at work. I have experience with PHP but I'm very new to shell scripting. Though I Googled and read Coova support blogs they don't seem to give directions for very beginners.

What I'm trying to do is on a successful login, redirect the user to a new page. Sadly I have no idea what I'm doing, but what I did was I tried to follow exactly the same path they used, to direct user to signup page on button click...

They had 2 main different files extensions linked for signup process

newuser.chi

newuser.chi.save

newuser_form.tmpl

signup.chi

so i created the same file extentions for my new file

intermediate.tmpl(in which I think I have to display the user's balance)

intermediate.chi

In login page for submit button i added my new file...

<!--
  --  The login form
-->

<div id="login-form">
<table>
<tr>
  <td>Username</td>
  <td><INPUT NAME="username" VALUE="$FORM_username"></td>
</tr>
<tr>
  <td>Password</td>
  <td><INPUT NAME="password" VALUE="$FORM_password" TYPE="password"></td>
</tr>
<tr>
  <td colspan="2" nowrap align="center">
    <input type="button" name="signup" value="Sign Up" onClick="window.location='/www/newuser.chi'">
    <input type="submit" name="button" value="Login" onClick="window.location='/www/intermediate.chi'">
  </td>
</tr>
</table>
</div>

intermediate.tmpl:

<div id="intermediate-form">
        <table>
            <tr>
                <td>Reload</td>
                <td><input type="button" name="reload" value="Reload" onClick="window.location='/www/recharge.chi'"></td>
            </tr>
            <tr>
                <td>Balance</td>
                <td>**---I Need To Display Customer's Balance Here---**</td>
            </tr>
            <tr>
                <td colspan="2" nowrap align="center">
                    <input type="button" name="continue" value="Continue" onClick="window.location='http://www.earlierSuccessfullPage.com'">
                </td>
            </tr>
         </table>
    </div>

intermediate.chi:

<? # -*- mode: shell-script -*-
# Copyright (C) 2009-2011 Coova Technologies, LLC. <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

. ./config.sh
http_header
header "<meta></meta>"
uamfile "login 1"
intermediate    /* <= I followed what they did in signup */
footer
?>

in config-local.sh i added this new function...

intermediate(){
    form "intermediate.chi" "$(uamfile intermediate 1)"
}

I cant get it to redirect successfully to an empty page on button click let alone display user's balance on it.

0

There are 0 best solutions below