Jump to content
  • 0
BerkayAta

Account Freeze

Question

I want to add Account Freeze pages in my homepage. For example : http://kingdommt2.com/index.php?s=dondur Account : Sanane3152 Password : 123456789 This script is : http://pastebin.com/j29ECscP User is login to homepage. If user want to Account Freeze click to Account Freeze page. Select the date. For example : 1 day, 2 day, 3 day, 1 month, 2 month. When the time runs out account is available. How can I do this ? Thanks for everything.

 

 

<!-- center column -->

            <div id="register" class="col-2">
    <div class="content content-last">
        <div class="content-bg">
            <div class="content-bg-bottom">
            <div class="textblock">
        <h2>Hesab&#305; Dondur</h2>
 
  <div class="inner-form-border">
                <div class="inner-form-box">
<?PHP
if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
 
    echo '';
   
     
      if(isset($_POST['banla']) && $_POST['banla']=='Hesabi Dondur') {
       
 
            $sqlCmd = "SELECT * FROM account.account WHERE id='".$getAdmin->id."' LIMIT 1";
            $sqlQry = mysql_query($sqlCmd,$sqlServ);
           
            if(mysql_num_rows($sqlQry)>0)
            {
              $accData = mysql_fetch_object($sqlQry);
                          $DeactiveCmd ="UPDATE account.account SET availDt='".$_POST['date']."' WHERE id='".$getAdmin->id."'  ";
                          if(mysql_query($DeactiveCmd,$sqlServ)) {
                                 
                                 
                                 echo'<div class="formNotification"><div></div>
                  <p>Hesab&#305;n&#305;z Belirledi&#287;iniz S&uuml;re Kadar Kapal&#305; Kalacakt&#305;r. <strong><font color="#00FF00">Deaktive Olmu&#351;tur</font></strong>
<br />
Anasayfaya Y&ouml;nlendiriliyorsunuz.... </p></div>';
                                 echo'<meta http-equiv="refresh" content="1; URL=index.php?s=logout"> ';
                                 
              }  
            }
                }
     
      ?>
 
 
                                <p>A&#351;a&#287;&#305;daki S&uuml;relerden Birini Se&ccedil;erek Dondurunuz <br>
                            <font color="#FF0000">NOT: GER&#304; D&Ouml;N&Uuml;&#350;&Uuml; OLMAZ</font></p>
                                <form name="pwlostForm" id="pwlostForm" method="post" action="index.php?s=dondur">
                                  <div>
                                                <label for="username">
                                                S&uuml;renizi Se&ccedil;iniz: *
                                                <span class="thell">
                                                <select name="date">
                          <?PHP
            foreach($Deactive AS $aKey => $aValue) {
              echo'<option value="'.$aValue.'">'.$aKey.'</option>';
            }
          ?>
                        </select>
                                  </span>                      
                                  </div>                    
                    <input id="submitBtn" type="submit" name="banla" value="Hesabi Dondur" class="btn-big" />
                    <p></p>
                    <script type="text/javascript">
                        $(function() {
                                                });
                    </script>
                                </form>
                                <p id="regLegend">* Zorunludur </p>
 
        <?php
}
else
{
echo "<div class='formNotification2'><div></div>Buraya Giris Yetkiniz Bulunmamaktadir<br>
L&uuml;tfen &Uuml;ye  Girisi Yapiniz!!</p></div><div class='box clearfix'>
 
        <h2><img class='headicon' alt='' src='/img/alpha.gif' />&Ccedil;&#305;k&#305;&#351; yap&#305;l&#305;yor </h2>
    <img class='content-image' src='/img/img-content-01.jpg' />
        <div class='textblock'>
          <p><meta http-equiv='refresh' content='0; URL=index.php'>Ana sayfaya y&ouml;nlendirileceksiniz. L&uuml;tfen bekleyin...</p>
  </div>
    <div class='footer'></div>
</div></div>";
}
?></div></div></div></div></div></div></div>

 

Share this post


Link to post

Recommended Posts

  • 0

If I understand well, you want a custom script coded for your homepage?

Share this post


Link to post
  • 0

looks like he wants temporary bans through an admin panel

Share this post


Link to post
  • 0

If I understand well, you want a custom script coded for your homepage?

 

Yes. I gave the code doesn't work.

Share this post


Link to post
  • 0

Hey!

 

Create database table:

CREATE TABLE `frozenaccounts` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `account_id` int(10) NOT NULL,
  `start_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `end_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; 

Create a dropdown menu, and a button. When he hit the button, read the data from the dropdown menu. 

Put the account id and start, end date to that table.

On the index page of admins, create a code which checks if the end date equals with this date. In this case unblock the account.

Share this post


Link to post
  • 0

Hey!

 

Create database table:

CREATE TABLE `frozenaccounts` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `account_id` int(10) NOT NULL,
  `start_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `end_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; 

Create a dropdown menu, and a button. When he hit the button, read the data from the dropdown menu. 

Put the account id and start, end date to that table.

On the index page of admins, create a code which checks if the end date equals with this date. In this case unblock the account.

 

I don't understand with you. Please give me full codes.

 

Share this post


Link to post
  • 0

This code will block the account.

<?php
if($_POST['submit'])
{
	$delay = $_POST['delay'];
	$account_id = 1234;
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("INSERT INTO account.frozenaccounts (`account_id`, `start_date`, `end_date`) VALUES ($account_id, $start_date, $end_date)");
	$sql02 = mysql_query("UPDATE account.account SET status = 'BLOCK' WHERE id = $account_id");
	if($sql01 && $sql02)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="page1.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

This code will unblock the frozen chars which's delay has expired:

<?php
$now = date("Y-m-d H:i:s");
$query = mysql_query("SELECT * FROM account.frozenaccounts WHERE end_date <= $now");
if(mysql_num_rows($query) > 0)
{
	//there are minimum one account which is frozen, and you have to unfroze it
	while($array = mysql_fetch_array($query))
	{
		$accountid = $array['account_id'];
		$query2 = mysql_query("DELETE FROM account.frozenaccounts WHERE account_id = $accountid");
		$query3 = mysql_query("UPDATE account.account SET status = 'OK' WHERE id = $accountid");
	}
}
?>

If you won't open the page, where the second code is placed, it won't unfreeze the accounts. So you need to open it about once a day. If you open it for example 24 times a day, it will works perfectly, because if i freeze my account today at 8PM, and you will open it tomorrow at 7PM, my account won't unfreeze, so i have to wait to the next day. In my opinion 24 times per day would be ideal for this script.

Share this post


Link to post
  • 0

This code will block the account.

<?php
if($_POST['submit'])
{
	$delay = $_POST['delay'];
	$account_id = 1234;
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("INSERT INTO account.frozenaccounts (`account_id`, `start_date`, `end_date`) VALUES ($account_id, $start_date, $end_date)");
	$sql02 = mysql_query("UPDATE account.account SET status = 'BLOCK' WHERE id = $account_id");
	if($sql01 && $sql02)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="page1.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

This code will unblock the frozen chars which's delay has expired:

<?php
$now = date("Y-m-d H:i:s");
$query = mysql_query("SELECT * FROM account.frozenaccounts WHERE end_date <= $now");
if(mysql_num_rows($query) > 0)
{
	//there are minimum one account which is frozen, and you have to unfroze it
	while($array = mysql_fetch_array($query))
	{
		$accountid = $array['account_id'];
		$query2 = mysql_query("DELETE FROM account.frozenaccounts WHERE account_id = $accountid");
		$query3 = mysql_query("UPDATE account.account SET status = 'OK' WHERE id = $accountid");
	}
}
?>

If you won't open the page, where the second code is placed, it won't unfreeze the accounts. So you need to open it about once a day. If you open it for example 24 times a day, it will works perfectly, because if i freeze my account today at 8PM, and you will open it tomorrow at 7PM, my account won't unfreeze, so i have to wait to the next day. In my opinion 24 times per day would be ideal for this script.

 

I have got a problem. Notice: Undefined index: submit in C:AppServwwwYespagesfreeze.php on line 4

 

Share this post


Link to post
  • 0

That's a Notice it's harmless...

Share this post


Link to post
  • 0

That's a Notice it's harmless...

 

Shogun please give me full codes.

Share this post


Link to post
  • 0

This is not a board for full codes. We want you to learn something while you manage to get i working. Without that helping would be senseless

Share this post


Link to post
  • 0

This is not a board for full codes. We want you to learn something while you manage to get i working. Without that helping would be senseless

 

Why ? This thread is in the Beginner Zone. I don't to this. I need help.

Share this post


Link to post
  • 0

We can help you best by showing you how to do it.

Php error messages have a great documentation so you could use google aswell.

but:

<?php
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = 1234; //Here you have to add a code to get the logged in account_id
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET avialTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

Share this post


Link to post
  • 0

We can help you best by showing you how to do it.

Php error messages have a great documentation so you could use google aswell.

but:

 

<?php
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = 1234; //Here you have to add a code to get the logged in account_id
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET avialTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

 

Thanks for give me codes but it doesn't work

 

Share this post


Link to post
  • 0

You need to add the function to get the account_id at line 5

 

Yes I know. This is : ($_SESSION['user_id']) But If user don't login the site click to freeze.php open the freeze.php

Share this post


Link to post
  • 0
<?php
if(isset($_SESSION['user_id']){
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = $_SESSION['user_id'];
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET avialTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

<?php
} else {
	echo "You dont have permission to go here";
}
?>

Share this post


Link to post
  • 0
<?php
if(isset($_SESSION['user_id']){
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = $_SESSION['user_id'];
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET avialTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

<?php
} else {
	echo "You dont have permission to go here";
}
?>

 

This is an error : Parse error: syntax error, unexpected '{' in C:AppServwwwYespagesfreeze.php on line 2

Share this post


Link to post
  • 0

You don't say... delete line 18

Share this post


Link to post
  • 0

You don't say... delete line 18

 

By then : Parse error: syntax error, unexpected '{' in C:AppServwwwYespagesfreeze.php on line And I delete '{' it. If I login to site I see You dont have permission to go here

Share this post


Link to post
  • 0

No dont delete line 18 o.o

And you have to be logged in to access the site :)

 

€dit: forgot to close one bracket

<?php
if(isset($_SESSION['user_id'])){
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = $_SESSION['user_id'];
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET avialTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

<?php
} else {
	echo "You dont have permission to go here";
}
?>

Share this post


Link to post
  • 0

No dont delete line 18 o.o

And you have to be logged in to access the site :)

 

€dit: forgot to close one bracket

<?php
if(isset($_SESSION['user_id'])){
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = $_SESSION['user_id'];
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET avialTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error";
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

<?php
} else {
	echo "You dont have permission to go here";
}
?>

 

Okey. If user don't login the site says You dont have permission to go here but by then for example I selected 1 day and click to Submit an error. sql error How can I solve it ?

 

Share this post


Link to post
  • 0
<?php
if(isset($_SESSION['user_id'])){
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = $_SESSION['user_id'];
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET availlTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error: ".mysql_error();
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

<?php
} else {
	echo "You dont have permission to go here";
}
?>
Take this script and give me the error message thats showing

Share this post


Link to post
  • 0

<?php
if(isset($_SESSION['user_id'])){
if(isset($_POST['delay']))
{
	$delay = mysql_real_escape_string($_POST['delay']);
	$account_id = $_SESSION['user_id'];
	$start_date = date("Y-m-d H:i:s");
	$end_date = date("Y-m-d H:i:s", strtotime("$delay day"));
	$sql01 = mysql_query("UPDATE account.account SET availlTd = DATE_ADD(NOW,INTERVAL ".$delay." DAY) WHERE id = $account_id");
	if($sql01)
	{
		echo "Your account is blocked for $delay days.<br><br>";
	}
	else
	{
		echo "sql error: ".mysql_error();
	}
}
?>

<form action="freeze.php" method="POST">
	<select name="delay">
		<option value="1">1 day</option>
		<option value="2">2 day</option>
		<option value="3">3 day</option>
		<option value="7">1 week</option>
	</select>
	<input type="submit" name="submit" value="Submit"/>
</form>

<?php
} else {
	echo "You dont have permission to go here";
}
?>
Take this script and give me the error message thats showing

 

 

sql error: Unknown column 'availlTd' in 'field list' :)

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.