View Full Version : PHP help
Hayd93
20-10-2007, 03:57 PM
Not for me for a mate right here is what i want to know
how would he code it so on a dj panel once a dj ahs viewed the radio info once it wont let them see it again untill a admin gives them permissions too via the panel
what would the code be for the user and the admin
basicly like what ch have
Edited by Tomm (Forum Moderator): Moved from Website Design and Development, please post in the right forum next time.
DeejayMachoo$
20-10-2007, 04:05 PM
have you even tried to attempt this?
The easyest way would to have a form saying "once i view the details i wont be able to view them again" and when u submit it it changes a coloum in the database to 1 or 0 and make the page check what that is and if its 1 then it doesnt display but if its 0 then it does, i find it hard to explain stuff like this its easyer to just write it
Hayd93
20-10-2007, 04:06 PM
have you even tried to attempt this?
The easyest way would to have a form saying "once i view the details i wont be able to view them again" and when u submit it it changes a coloum in the database to 1 or 0 and make the page check what that is and if its 1 then it doesnt display but if its 0 then it does, i find it hard to explain stuff like this its easyer to just write it
Like i say not me,my mate, he has yes that is y he is now asking for help
and + rep for help
DeejayMachoo$
20-10-2007, 04:11 PM
ok so add a column to the users table called stats with default 0,
Before i can contine helping your friend, could you get the name of the users table and what does he use for the sessioned user eg. $logged[username] or $logged[email] to display the logged in users infomation.
Hayd93
20-10-2007, 04:17 PM
$_SESSION['session_username']
and users table is called staff
donno what that means as i cant do php but taht si what he said
Mr Macro
27-10-2007, 09:27 PM
Make a column in the 'Staff' Column, call it 'Detail'
then make a if like:
<?php
if ($_SESSION['Detail'] != '1' ) {
die('You have already read the Radio Information');
}
?>
lolwut
27-10-2007, 10:05 PM
SQL Query to update your "staff" user table:
ALTER TABLE `staff` ADD `radioinfoviews` VARCHAR( 10 ) NOT NULL DEFAULT '0';
Add to the top of your radio information page:
<?php
mysql_query("UPDATE `staff` SET `radioinfoviews` = '1' WHERE `username` = '$_SESSION['session_username']';");
if($users[radioinfoviews] <= "1"){ // THIS IS THE LINE YOU MIGHT NEED TO EDIT.
echo("Sorry, you have already viewed the radio info, you now need to ask an admin to allow you rights.");
exit;
}
?>
Now add this to your DJ admin page:
<?php
if(!$_POST['this']){
echo("<form method=\"POST\">
Name of user to allow access: <input type=\"text\" name=\"username\">
<br>
<input type=\"submit\" name=\"this\" value=\"Allow Access\">
</form>");
}else{
$username=$_POST['username'];
mysql_query("UPDATE `staff` SET `radioinfoviews` = '0' WHERE `username` = '$username' ;");
echo("The user $username has now been granted access to the radio info page for ONE TIME ONLY.
?>
Would need basic SQL/PHP knowledge to do this. But, if you've already made a DJ panel then I guess you've got that already.
EDIT: If you already know PHP, you might want to check this code, I have a reputation for being somewhat messy.
Kazco
27-10-2007, 10:24 PM
<?php
if(!$_POST['this']){
echo("<form method=\"POST\">
Name of user to allow access: <input type=\"text\" name=\"username\">
<br>
<input type=\"submit\" name=\"this\" value=\"Allow Access\">
</form>");
}else{
$username=$_POST['username'];
mysql_query("UPDATE `staff` SET `radioinfoviews` = '0' WHERE `username` = '$username' ;");
echo("The user $username has now been granted access to the radio info page for ONE TIME ONLY.
?>
Would need basic SQL/PHP knowledge to do this. But, if you've already made a DJ panel then I guess you've got that already.
EDIT: If you already know PHP, you might want to check this code, I have a reputation for being somewhat messy.
Checking the code, I think this may work (I only checked the one shown in the quote..)
Try Imperial's first, then try this:
<?php
if(!$_POST['this']){
echo("<form method=\"POST\">
Name of user to allow access: <input type=\"text\" name=\"username\">
<br>
<input type=\"submit\" name=\"this\" value=\"Allow Access\">
</form>");
}else{
$username=$_POST['username'];
mysql_query("UPDATE `staff` SET `radioinfoviews` = '0' WHERE `username` = '$username' ;");
echo("The user $username has now been granted access to the radio info page for ONE TIME ONLY.");
}
?>
EDIT: Looks the same, but I have changed some thinks, and made it look easier to read.
lolwut
28-10-2007, 11:42 AM
^^ What Kazco said. :rolleyes:
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.