Jump to content

Recommended Posts

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>

 

Link to comment
Share on other sites

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

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.

Why so serious?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Why so serious?

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • Former Staff

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>
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • Former Staff
<?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";
}
?>
Link to comment
Share on other sites

<?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

Link to comment
Share on other sites

  • Former Staff

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";
}
?>
Link to comment
Share on other sites

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 ?

 

Link to comment
Share on other sites

  • Former Staff
<?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
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      Moving server from FreeBSD 11.2 to 13.2 - lib needed

    2. 0

      I just implemented some costumes and they are not visible

    3. 0

      Skill Tree Problem

    4. 97

      Ulthar SF V2 (TMP4 Base)

    5. 5

      Client Crashes through Offline Shop (Ikarus)

    6. 5

      VIVY-WORLD2 - FARM TO THE TOP

    7. 0

      ToolTip Bug?

    8. 0

      Skill tree build erorr

  • Recently Browsing

    • 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.