Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 159
0 Users 5 Guests Online
Forum Index » PHP + MySQL » [help] ?page=gallery_admin=act
Posted on Friday 6th June 2008 at 08:41 PM
Adam981
templates/default/images/noavatar.png's Avatar
Junior Member
What i'm looking to do is take <a href='gallery_admin.php?page=accept&id=$imgs[id]'>Accept</a> and keep it inside my site php nav so it display with the layout..

so im looking for maybe something like this

?page=gallery_admin&action=accept&id=$imgs[id]

i seen this done something like that befor.. can anyone help.?
Posted on Saturday 7th June 2008 at 09:14 AM
ilyas-shezad
templates/default/images/noavatar.png's Avatar
Junior Member
What do you mean by keeping it inside your site php navigation so it displays with your layout?

Is it possible u can provide the code you wish to put this code into?
Posted on Saturday 7th June 2008 at 02:09 PM
Adam981
templates/default/images/noavatar.png's Avatar
Junior Member
Yeah i'm using the PHP Switch Navigation, so each page displays with my layout without having to add the template to each page, but the problem im having is you need to link the pages like ?page= and in gallery_admin.php they have the links set up like

"gallery_admin.php?page=accept&id=$imgs[id]" so if i use to "include gallery_admin.php into the navagation my links would be like

?page=gallery_admin?page=accept&id=$imgs[id]


See my problem?
Posted on Sunday 8th June 2008 at 08:59 AM
ilyas-shezad
templates/default/images/noavatar.png's Avatar
Junior Member
Can I see code for gallery_admin.php?
Posted on Sunday 8th June 2008 at 11:02 AM
Adam981
templates/default/images/noavatar.png's Avatar
Junior Member
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<? //gallery_admin.php 
session_start(); 
// starts session 
include("config.php" ); 
$id = (int) $_GET['id']; //secure the id for SQL Injections 
//includes config 
if($logged['username'] && $logged['userlevel'] == 6){ 
//checks if logged in and admin 
switch($_GET['page']){ 
// allows multiple pages 
default: // main page 
$display mysql_query("SELECT * FROM `image_requests` ORDER BY `id` ASC" ); 
//get requests 
while ($imgs mysql_fetch_array($display)) { 
echo 
"<table width='900'> 
<tr> 
<td width='300'><a href='http://
$imgs[url]' target='_blank'><img src='$imgs[image]' height='250' width='250'> 
<i>Submitted by:</i><a href='members.php?user=
$imgs[username]'>$imgs[username]</a> 
<a href='gallery_admin.php?page=accept&id=
$imgs[id]'> | <a href='gallery_admin.php?page=delete&id=$imgs[id]'></td> 
</tr> 
</table>"

//displays requests 

break; 
//end 
case 'accept'
//accept page 
if($_GET["id"]){ 
//get id from address bar 
$get mysql_query("SELECT * FROM `image_requests` WHERE `id` = '$id' "); 
// get requests 
$imgs mysql_fetch_array($get); 
$accepted mysql_query("INSERT INTO `gallery` ( `username` , `image` , `url` ) VALUES ( '$imgs[username]' , '$imgs[image]' , '$imgs[url]' ) "); 
//accept images 
$delete mysql_query("DELETE FROM `image_requests` WHERE `id` = '$id' "); 
//delete when accepted 
echo "Image accepted"
//accepted 
}else{ 
//or 
echo("Could not get id"); 
// could not find the request 

break; 
//end 
case 'delete'
// delte page 
if ($id) { 
//gets is 
$delete mysql_query("DELETE FROM `image_requests` WHERE `id` = '$id' "); 
//deltes 
echo("Image deleted and not accepted" ); 
// tells u image is deleted 
}else{ 
//or 
echo("Could not get id"); 
//could not find request 

break; 
//end 

//end switch 
}else{ 
//or 
echo("You are not logged in or are not an admin" ); 
//not logged in or not admin 

//end 
?>