Jump to content


Photo

Short problem


  • Please log in to reply
8 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 30 July 2006 - 02:29 PM

Hi guys.
I have got a small problem, I want to make a "Time Block" for my user management,
Where Moderators / Admins can Block(ban) a member for a certain time.
How ever I thought using Cookies would fail easily.
Using MYSQL i don't have a clue. The only way i can do with SQL
is a date(); although if the date & time was changed it would unban them...

Basically does anyone have any ideas how I can make a time Ban script
for my members area?

Thanks!
- Ash

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 03:03 PM

This is only a quick example but your get the drift good luck.

ban a user via there id.

add a date field and name field user_id field.

add a link to the admin page like this

example only.

The link

<?php  session_start();

$date=date("d-m-y");
$user_id=$_SESSION['user_id']=$row['user_id'];
$members_name=$_SESSION['member_name']=$row['member_name'];
$user_ban="yes";

<a href="user_band.php?user_id=$user_id&date_band=$date&members_name=$members_name&user_ban='yes'&band_user=user_band">Baned this user</a>


user_band.php
<?php session_start();

$date=($_POST['date']);
$user_id($_POST['user_id']);
$members_name=($_POST['members_name']);
$user_ban=($_POST['user_ban']);

$date=stripslashes($date);
$user_id=stripslasses($user_id);
$members_name=stripslashes($members_name);
$user_ban=stripslashes($user_ban);

if($_GET['band_user']==user_band){

$insert_query="INSERT INTO band_user(user_id,date,members_name,user_ban)VALUES('$user_id','$date','$members_name','user_ban')";
$insert_result=mysql_query($insert_query);

$select_user="SELECT * form user_ban where user_id='$user_id";
$select_user=mysql_query($select_user);

while($record=mysql_fetch_assoc($select_user)) {

elseif($record['user_id']==1) {

$query="UPDATE band_user set user_id='$user_id' AND date='$date' AND members_name='$members_name' AND user_ban='$user_ban' WHERE user_id=$user_id";

$result=mysql_query($result);

header("location:admin.php");
}
 }
  }
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 30 July 2006 - 03:11 PM

That's pretty confusing Lol. I've not come accross some of that before :/.
I'll see what I can do with it but I don't really understand it.

I don't see how that would ban someone for "2 hours, 24 hours, 1 month etc."
And Is there something that can be placed in a form.

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 03:26 PM

afther all that burning my fingers off

do you know how to use session or got sessions inplemented
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 03:32 PM

The above code was using a link so you dont need to use a form.

In the admin page you should of had a page with all the users accounts and had links to delete the user ect ect ect

that where my code comes in.

The first thing was to get all the information to ban a user then insert the users deatails then if that user exists update the user_ban tables that the only way i know sorry.

afther you get all the correct information then we do the date syntex ok.

we would of selected the database and tables then see if the user date was today if so ban them but if they come tommorw let them do whatever.

but it tales a lot of coding sorry.



Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 30 July 2006 - 03:35 PM

Yeah I know it uses $_GET function, I wanted to be able to set a time, ie X hours, days, Months.
X - my number :/

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 03:38 PM

how can we do that with a form method when you need a link on the admin pannel.

or your have millins of forms for every member to ban that silly.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 03:40 PM

your have to look up

strtotime();

floor();

date();

time();

ok sorry.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 30 July 2006 - 03:43 PM

Nope. Using your kind of way or we could use a drop-down.
then use $_POST and submit it that way.

Banning by User ID through Hidden Fields.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users