0

i have a page

edit.php

and i wanted to be like this
edit.php?at=profile
edit.php?at=upgrade
edit.php?at=im
edit.php?at=delete
and if there is no at='something' to include default theme(html)

<?php
include "../app.php";
include $basepath . "inc/PasswordHash.php";
include $basepath . "inc/functions.php";
include $basepath . "inc/adodb5/adodb.inc.php";

// Session Start
$adodbsessionstart = new UADODB;
$adodbsessionstart->adodbSessionStart();

$db = ADONewConnection($dbtype);
$db->debug = true;
$db->Connect($dbhost, $dbuser, $dbpwd, $dbname);

// Session Check
loginCheck();

$username = $_SESSION['sUsername'];
$submit	= (isset($_POST['submit'])) ? true : false;


// THIS IS THE DEFAULT or profile page the form is at theme profile.
if ($submit)
      {
      $t1sql = "SELECT cid, ownerFn, ownerLn, companyPhone, companyAddress, companyEmail, companyName FROM company WHERE username = '".$username."'";
      $t2sql = "SELECT announcement, introduction FROM content WHERE username = '".$username."'";

      $t1execute = $db->Execute($t1sql);
      $t2execute = $db->Execute($t2sql);

      $t1update['OwnerFn'] = $_POST['OwnerFn'];
      $t1update['OwnerLn'] = $_POST['OwnerLn'];
      $t1update['companyName'] = $_POST['companyName'];
      $t1update['companyAddress'] = $_POST['companyAddress'];
      $t1update['companyEmail'] = $_POST['companyEmail'];
      $t1update['companyPhone'] = $_POST['companyPhone'];

      $t2update['introduction'] = $_POST['introduction'];
      $t2update['announcement'] = $_POST['announcement'];

      $t1updateSQL = $db->GetUpdateSQL($t1execute, $t1update);
      $t2updateSQL = $db->GetUpdateSQL($t2execute, $t2update);

      $db->Execute($t1updateSQL);
      $db->Execute($t2updateSQL);

      // REFRESH
      $query = "SELECT company.cid, company.ownerFn, company.ownerLn, company.companyPhone, company.companyAddress, company.companyEmail, company.companyName, content.announcement, content.introduction FROM company, content WHERE company.username = '".$username."'  AND content.username = company.username";
      $row = $db->GetRow($query);
      }
// jika tidak submit
elseif(!$submit)
    {
      $query = "SELECT company.cid, company.ownerFn, company.ownerLn, company.companyPhone, company.companyAddress, company.companyEmail, company.companyName, content.announcement, content.introduction FROM company, content WHERE company.username = '".$username."'  AND content.username = company.username";
      $row = $db->GetRow($query);
    }

// theme control

$at = $_GET['at'];
if ($at = $_GET['example'])
{include $basepath . "member/template/profile/example.php"; }
elseif($at = $_GET["upgrade"])
{}
elseif($at = $_GET["im"])
{}
elseif($at = $_GET["delete"])
{}
elseif($at = $_GET["profile "])
{include $basepath . "member/template/profile/profile.php";}
else {include $basepath . "member/template/profile/profile.php";  }
?>

what do i have to do next ?

Edited by adamramadhan: n/a

1
Contributor
2
Replies
3
Views
7 Years
Discussion Span
Last Post by adamramadhan
0

after i read some docs at php about $get ive made a little change

because i cannot update my thread then ill post here
here's the update

<?php
include "../app.php";
include $basepath . "inc/PasswordHash.php";
include $basepath . "inc/functions.php";
include $basepath . "inc/adodb5/adodb.inc.php";

// Session Start
$adodbsessionstart = new UADODB;
$adodbsessionstart->adodbSessionStart();

$db = ADONewConnection($dbtype);
$db->debug = true;
$db->Connect($dbhost, $dbuser, $dbpwd, $dbname);

// Session Check
loginCheck();

$username = $_SESSION['sUsername'];
$submit	= (isset($_POST['submit'])) ? true : false;


// THIS IS THE DEFAULT or profile page the form is at theme profile.
if ($submit)
      {
      $t1sql = "SELECT cid, ownerFn, ownerLn, companyPhone, companyAddress, companyEmail, companyName FROM company WHERE username = '".$username."'";
      $t2sql = "SELECT announcement, introduction FROM content WHERE username = '".$username."'";

      $t1execute = $db->Execute($t1sql);
      $t2execute = $db->Execute($t2sql);

      $t1update['OwnerFn'] = $_POST['OwnerFn'];
      $t1update['OwnerLn'] = $_POST['OwnerLn'];
      $t1update['companyName'] = $_POST['companyName'];
      $t1update['companyAddress'] = $_POST['companyAddress'];
      $t1update['companyEmail'] = $_POST['companyEmail'];
      $t1update['companyPhone'] = $_POST['companyPhone'];

      $t2update['introduction'] = $_POST['introduction'];
      $t2update['announcement'] = $_POST['announcement'];

      $t1updateSQL = $db->GetUpdateSQL($t1execute, $t1update);
      $t2updateSQL = $db->GetUpdateSQL($t2execute, $t2update);

      $db->Execute($t1updateSQL);
      $db->Execute($t2updateSQL);

      // REFRESH
      $query = "SELECT company.cid, company.ownerFn, company.ownerLn, company.companyPhone, company.companyAddress, company.companyEmail, company.companyName, content.announcement, content.introduction FROM company, content WHERE company.username = '".$username."'  AND content.username = company.username";
      $row = $db->GetRow($query);
      }
// jika tidak submit
elseif(!$submit)
    {
      $query = "SELECT company.cid, company.ownerFn, company.ownerLn, company.companyPhone, company.companyAddress, company.companyEmail, company.companyName, content.announcement, content.introduction FROM company, content WHERE company.username = '".$username."'  AND content.username = company.username";
      $row = $db->GetRow($query);
    }

// theme control

if ($_GET['at']=='')
{include $basepath . "member/template/profile/profile.php"; }
elseif($_GET['at']=='theme')
{}
elseif($_GET['at']=='upgrade')
{}
elseif($_GET['at']=='im')
{}
elseif($_GET['at']=='delete')
{}
?>

but now the eror is "Notice: Undefined index: at"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.