Skip to content

Commit

Permalink
where is admin?-function and init product-add
Browse files Browse the repository at this point in the history
  • Loading branch information
Peetra committed Oct 5, 2011
1 parent b1a63e8 commit cb9b2b9
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 46 deletions.
28 changes: 28 additions & 0 deletions adm/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,31 @@ function search_user_form($lang,$searchuser)
</fieldset></div>
<?
}
function item_menu()
{
global $lang;
?>
<div id="sidemenu">
<ul>
<li><a href="./pagesEdit.php"><?= $lang['EDIT_PAGE']?></a></li>
<li><a href="./pagesAdd.php"> <?= $lang['NEW_PAGE']?></a></li>
<li><a href="./pagesDelete.php"><?= $lang['DEL_PAGE']?></a></li>
<li><a href="./groups.php"><?= $lang['MANAGE_GROUPS']?></a></li>
</ul>
</div>
<?php
}

function where_is_adm($file_name, $file_name2)
{
$who_am_i = $_SERVER['PHP_SELF'];
if (basename($who_am_i, ".php") == $file_name)
{
$title = ':)';
$desc = '';
$keywords = '';
include ('./style/header.html');
}
elseif (basename($who_am_i, ".php") == $file_name2)
include ('./style/footer.html');
}
17 changes: 17 additions & 0 deletions adm/groups.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php // adm/groups.php

// $ = (isset($_GET[''])) ? (int) $_GET[''] : 0;

error_reporting(E_ALL);
include ('./index.php');
$title = $lang['MANAGE_GROUPS']; // To be used for headline tags
echo '<div id="acp-top-explanation"><h3>' . $lang['GROUPS_TITLE'] . '</h3>';
echo '<p>' . $lang['GROUPS_EXPLAIN'] . '</p></div>';

item_menu();
where_is_adm('', 'groups')
/*if (basename($who_am_i, ".php") == 'groups') // basename returns the end of a path, here we exclude the fileextension
{
include ('./style/footer.html');
}*/
?>
2 changes: 2 additions & 0 deletions adm/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php // adm/index.php [Administration Control Panel]
error_reporting(E_ALL);
include('../connection.php'); // You see the two dots for going up a directory
/* not needed yet
include('../inc/shopFunctions.php'); */
define('LANG', true); // The user doesn't get anywhere w/o words in the interface. :P
if (!empty($_GET['lang']))
{
Expand Down
2 changes: 1 addition & 1 deletion adm/pagesAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
</table>
</form>
<?php
include ('./style/footer.html');
where_is_adm('', 'pagesAdd');
1 change: 1 addition & 0 deletions adm/pagesDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<?php
// Close db-connection
mysql_close($connection);
where_is_adm('', 'pagesDelete')
?>
3 changes: 1 addition & 2 deletions adm/pagesEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,4 @@
</form> </fieldset>
<?
}
if (basename($who_am_i, ".php") == 'pagesEdit')
include ('./style/footer.html');
where_is_adm('', 'pagesEdit');
13 changes: 2 additions & 11 deletions adm/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
echo '<div id="acp-top-explanation"><h3>' . $lang['ACP_PRODUCTS_TITLE'] . '</h3>';
echo '<p>' . $lang['ACP_PRODUCTS_EXPLAIN'] . '</p></div>';

?>
<menu class="side">
<ul>
<li><a href="./productsEdit.php"><?= $lang['PRODUCTS_EDIT']?></a></li>
<li><a href="./productsAdd.php"> <?= $lang['PRODUCTS_ADD']?></a></li>
<li><a href="./productsDelete.php"><?= $lang['PRODUCTS_DEL']?></a></li>
</ul>
</menu>
<?php
if (basename($who_am_i, ".php") == 'products') // basename returns the end of a path, here we exclude the file extension
include ('./style/footer.html');
item_menu();
where_is_adm('', 'products')
?>
8 changes: 1 addition & 7 deletions adm/productsEdit.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?php



//******* Thought I modify from pagesEdit, but, mm, I'll see **************//



error_reporting(E_ALL);
$who_am_i = $_SERVER['PHP_SELF'];
if (basename($who_am_i, ".php") != 'products')
Expand Down Expand Up @@ -59,5 +54,4 @@
<p><input type="submit" name="send"></p>
</form>
<?
if (basename($who_am_i, ".php") == 'productsEdit')
include ('./style/footer.html');
where_is_adm('', 'productsEdit');
5 changes: 1 addition & 4 deletions adm/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@
</div>
</form>
<?php
if (basename($who_am_i, ".php") == 'settings') // basename returns the end of a path, here we exclude the fileextension
{
include ('./style/footer.html');
}
where_is_adm('', 'groups');
?>
2 changes: 1 addition & 1 deletion adm/style/footer.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

<footer><p>ACP-footer</p><p>ACP-footer</p><p>ACP-footer</p></footer>

</body>
</html>
37 changes: 20 additions & 17 deletions inc/incUsers.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<?php
$uID = (isset($_POST['uID'])) ? (int) $_POST['uID'] : 0;
<?php
if(!defined('LANG'))
exit;
global $lang;
$uID = (isset($_POST['uID'])) ? (int) $_POST['uID'] : 0;

$fname = (isset($_POST['fname']) ? $_POST['fname'] : '');
$fname = mysql_real_escape_string(ucfirst($fname));
$fname = (isset($_POST['fname']) ? $_POST['fname'] : '');
$fname = mysql_real_escape_string(ucfirst($fname));


$lname = (isset($_POST['lname'])? $_POST['lname'] : '');
$lname= mysql_real_escape_string(ucfirst($lname));
$lname = (isset($_POST['lname'])? $_POST['lname'] : '');
$lname= mysql_real_escape_string(ucfirst($lname));

$street = (isset($_POST['street'])? $_POST['street'] : '');
$street = mysql_real_escape_string($street);
$street = (isset($_POST['street'])? $_POST['street'] : '');
$street = mysql_real_escape_string($street);

$zip = (isset($_POST['zip'])) ? (int) $_POST['zip'] : '';
$zip = (isset($_POST['zip'])) ? (int) $_POST['zip'] : '';

$city = (isset($_POST['city'])? $_POST['city'] : '');
$city = mysql_real_escape_string(ucfirst($city));
$city = (isset($_POST['city'])? $_POST['city'] : '');
$city = mysql_real_escape_string(ucfirst($city));

$phone = (isset($_POST['phone'])? $_POST['phone'] : '');
$phone = mysql_real_escape_string($phone);
$phone = (isset($_POST['phone'])? $_POST['phone'] : '');
$phone = mysql_real_escape_string($phone);

$email = (isset($_POST['email'])? $_POST['email'] : '');
$email = mysql_real_escape_string($email);
$email = (isset($_POST['email'])? $_POST['email'] : '');
$email = mysql_real_escape_string($email);

$password = (isset($_POST['password'])? $_POST['password'] : '');
$password = mysql_real_escape_string($password);
$password = (isset($_POST['password'])? $_POST['password'] : '');
$password = mysql_real_escape_string($password);

?>
<h3><?=$lang['REGISTER'];?></h3>
Expand Down
8 changes: 5 additions & 3 deletions lang/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@
'DEL_USER' => 'Delete user',
'DEL_USER_EXPLAIN' => 'Click a user to delete. This can not be undone',
'DEL_USER_REALLY' => 'Are you sure, deleting user',
'' => '',
'' => '',
'' => '',

// Products, productgroups
'GROUPS_TITLE' => 'Product groups',
'GROUPS_EXPLAIN' => 'Here you can manage groups for your shop items',
'MANAGE_GROUPS' => 'Manage groups',
'' => '',
'' => '',
'' => '',
Expand Down

0 comments on commit cb9b2b9

Please sign in to comment.