xyn Posted July 30, 2006 Share Posted July 30, 2006 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 SQLis 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 scriptfor my members area?Thanks!- Ash Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/ Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 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 thisexample only.The link[code]<?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>[/code]user_band.php[code]<?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");} } }?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65907 Share on other sites More sharing options...
xyn Posted July 30, 2006 Author Share Posted July 30, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65910 Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 afther all that burning my fingers offdo you know how to use session or got sessions inplemented Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65914 Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65916 Share on other sites More sharing options...
xyn Posted July 30, 2006 Author Share Posted July 30, 2006 Yeah I know it uses $_GET function, I wanted to be able to set a time, ie X hours, days, Months.X - my number :/ Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65920 Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65923 Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 your have to look up strtotime();floor();date();time();ok sorry. Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65925 Share on other sites More sharing options...
xyn Posted July 30, 2006 Author Share Posted July 30, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16027-short-problem/#findComment-65926 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.