Премини към съдържанието
Форумът в приложение

По-лесно сърфиране. Научи повече.

Kaldata.com - Форуми

Приложение на форума на цял екран с push известия, значки и други.

За да инсталирате това приложение на iOS и iPadOS
  1. Докоснете Иконата за споделяне в Safari
  2. Превъртете менюто и докоснете Добавяне към началния екран.
  3. Докоснете Добавяне в горния десен ъгъл.
За да инсталирате това приложение на Android
  1. Докоснете менюто с 3 точки (⋮) в горния десен ъгъл на браузъра.
  2. Докоснете Добавяне към началния екран или Инсталиране на приложение.
  3. Потвърдете, като докоснете Инсталиране.

Добре дошли!

Добре дошли в нашите форуми, пълни с полезна информация. Имате проблем с компютъра или телефона си? Публикувайте нова тема и ще намерите решение на всичките си проблеми. Общувайте свободно и открийте безброй нови приятели.

Моля, регистрирайте се за да публикувате тема и да получите пълен достъп до всички функции.

 

скрипт за активация

Featured Replies

Здравейте,

Ползвам този скрип за регистрация, но няма активация:

<? 

session_start();

?>

<? include('header.php'); ?>




<?


if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"]))

{


?>


<b><a href="#" onClick="window.location.reload()">Reload Page</a></b>


<? include('footer.php'); ?>



<? exit(); } ?>




<?




// incluimos archivos necesarios


require('config.php');

//require('admin/funciones.php');


if (isset($_POST["username"])) {


if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){ 


echo "<br><br>Sorry, security code error... "; 


include('footer.php'); exit();

}



// Declaramos las variables


$username = $_POST["username"];

$password = $_POST["password"];

$cpassword = $_POST["cpassword"];

$email = $_POST["email"];

$cemail = $_POST["cemail"];

$pemail = $_POST["pemail"];

$country = $_POST["country"];



// comprobamos que no haya campos en blanco


if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL|$cemail==NULL|$pemail==NULL|$country==NULL) {

echo "All Fields Required";

}else{



// sanitizamos las variables


$username = uc($username);

$password = uc($password);

$cpassword = uc($cpassword);

$email = limpiar($email);

$cemail = limpiar($cemail);

$pemail = limpiar($pemail);

$country = limpiar($country);



// limitamos el numero de caracteres


$username=limitatexto($username,15);

$password=limitatexto($password,15);

$cpassword=limitatexto($cpassword,15);

$email=limitatexto($email,100);

$cemail=limitatexto($cemail,100);

$pemail=limitatexto($pemail,100);

$country=limitatexto($country,15);



// comprobamos que tengan un minimo de caracteres


minimo($username);

minimopass($password);



// їCoinciden las contraseсas?

if($password!=$cpassword) {

echo "Passwords Do Not Match";

}else{



// їCoinciden los emails?

if($email!=$cemail) {

echo "Emails Do not Match";

}else{



// Comprobamos que sea un email valido

ValidaMail($email);



// Comprobamos que sea un email valido

ValidaMail($pemail);






// Comprobamos que no se haya creado otra cuenta desde la misma ip


$laip = getRealIP();



if($laip!="127.0.0.1")

{


	$checkip = mysql_query("SELECT ip FROM tb_users WHERE ip='$laip'");

	$ip_exist = mysql_num_rows($checkip);


}


if ($ip_exist>0) {

echo "Error: You have created an account.";

}else{



// Comprobamos que el nombre de usuario, email y el email de paypal no existan


$checkuser = mysql_query("SELECT username FROM tb_users WHERE username='$username'");

$username_exist = mysql_num_rows($checkuser);


$checkemail = mysql_query("SELECT email FROM tb_users WHERE email='$email'");

$email_exist = mysql_num_rows($checkemail);


$checkpemail = mysql_query("SELECT pemail FROM tb_users WHERE pemail='$pemail'");

$pemail_exist = mysql_num_rows($checkpemail);


if ($email_exist>0|$username_exist>0) {

echo "Username or Email Already in Use.";

}else{


if ($pemail_exist>0) {

echo "Your Paypal Address It's Already in Use.";

}else{



// Si se ha introducido un referer comprobamos que exista


if ($_POST["referer"] != "") {


// Sanitizamos la variable


$referer = limpiar($_POST["referer"]);

$referer=limitatexto($referer,15);


$checkref = mysql_query("SELECT username FROM tb_users WHERE username='$referer'");

$referer_exist = mysql_num_rows($checkref);


if ($referer_exist<1) {

// En caso de no existir el referer damos un mensaje de error

echo "Error: The referer User Doesn't Exists"; include('footer.php');exit();

}else{

// Si todo parece correcto procedemos con la inserccion

	  $sqlz = "SELECT * FROM tb_users WHERE username='$referer'";

	  $resultz = mysql_query($sqlz);		

	  $myrowz = mysql_fetch_array($resultz);


$numero=$myrowz["referals"];


	  $sqlex = "UPDATE tb_users SET referals='$numero' +1 WHERE username='$referer'";

	  $resultex = mysql_query($sqlex);

}


}



// Si todo parece correcto procedemos con la inserccion


$joindate=time();


$query = "INSERT INTO tb_users (username, password, ip, email, pemail, referer, country, joindate, activationkey) VALUES('$username','$password','$laip','$email','$pemail','$referer','$country','$joindate','$activationkey','verify')";

mysql_query($query) or die(mysql_error());



}

}

}

}

}

}


// En caso de no haber sido enviado los datos mostramos el formulario


}else{


?>

<div align="center"><div id="form">


<form action="verify.php" method="POST" name="register">

<form action="register.php" method="POST">




<table width="400" border="0" align="center">

  <tr>

	<td width="150" align="left"><p><label>Username</label></p></td>

	<td width="250" align="left"><input type='text' size='15' maxlength='25' name='username' autocomplete="off" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Password</label></p></td>

	<td width="250" align="left"><input type="password" size="25" maxlength="15" name="password" autocomplete="off" class="field" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Confirm Pass</label></p></td>

	<td width="250" align="left"><input type="password" size="25" maxlength="15" name="cpassword" autocomplete="off" class="field" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Email Address</label></p></td>

	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="email" autocomplete="off" class="field" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Confirm Email</label></p></td>

	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="cemail" autocomplete="off" class="field" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>PayPal E-mail</label></p></td>

	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="pemail" autocomplete="off" class="field" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Country</label></p></td>

	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="country" autocomplete="off" class="field" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Referrer</label></p></td>

	<td width="250" align="left"><input type="text" size="25" maxlength="15" name="referer" value="<? echo limpiar($_GET["r"]); ?>" autocomplete="off" class="field" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Terms of Service</label></p></td>

	<td width="250" align="left"><textarea rows="7" cols="25" readonly>

Please read the following rules and terms of the <? include('sitename.php'); ?> service very carefully before joining. We've tried to keep them as short and simple as possible so they would be easy to understand and follow.


1)	Sending unsolicited mail to people, asking them to join <? include('sitename.php'); ?> without any prior contact with you is not only against our policy, but it is also illegal. We have ZERO tolerance against spamming and if we receive just ONE SINGLE complaint against you for spamming, we first verify that the spam incident did occur and then we delete all current funds in your account. If you are reported as spamming for a second time, we will verify the second incident and then take the necessary steps for terminating your account.


2)	You may only have one account. Do not attempt to create more than one account or all of your accounts will be terminated. You should never need another account. If you have forgotten your user information all you need to simply do is request for it to be e-mailed to you.


3)	You may refer other people in your household but only ONE member PER computer.


4)	We have the right to suspend or terminate your account at any time, for any reason and without warning or notice. If we decide to give a notice, we will notify you by e-mail. If you are caught cheating in any way, your account will be deleted without notice and your e-mail will be kept to be posted on a future "wall of shame".


5)	All payments are made via PayPal and no other payment method is being used at this time. You must manually request for payment to be processed and it will be issued within 3 business days. You must accumulate at least $10 before payment will be issued. 


6)	You must have a valid e-mail address and valid PayPal address to register with our program. All e-mail addresses are verified and the system will not let you join without validating at least your e-mail address first. A verification e-mail is sent to you upon registration.


7)	Our current pay rate is $0.01 for each website you visit and $0.01 for each website your direct referrals visit.


8)	You can refer an unlimited amount of people to join the program but you will only earn referral income those that you DIRECTLY refer. 


9)	Advertising fees are to be paid via PayPal only. PayPal accepts all major credit cards, bank transfers and PayPal funds.


10)	By joining <? include('sitename.php'); ?>, you agree that you shall be fully responsible for any filing of taxes that is required by your governmental authorities. Because of our worldwide, international status - we will not do this for you.


11)	You are not an employee of <? include('sitename.php'); ?> and you are not an independent contractor for <? include('sitename.php'); ?>. We simply create a middle-man connection from the advertiser to the consumer. You or <? include('sitename.php'); ?> has the right to terminate this relationship at any time.


12)	We have the right to change our terms of service at anytime without prior consent or notice. Latter notices will be posted via the <? include('sitename.php'); ?> stats area or e-mailed to you.


					</textarea></td>

  </tr>

  <tr>

	<td width="150" align="left"><p><label>Security code:</label></p></td>

	<td width="250" align="left"><input type="text" size="5" maxlength="5" name="code" autocomplete="off" class="securitycode" value="" tabindex="1" /></td>

  </tr>

  <tr>

	<td width="150" align="left">&nbsp;</td>

	<td width="250" align="left"><img src="image.php?<?php echo $res; ?>" /></td>

  </tr>

  <tr>

	<td width="150" align="left">&nbsp;</td>

	<td width="250" align="center">

<input type="hidden" name="'form_submitted" value="1"/> 

<input type="submit" value="Register" class="submit" tabindex="4" />

	</td>

  </tr>

</table>

</form>

</fieldset>

</div></div>


<?

}

?>







<? include('footer.php'); ?>
И този за вpъзка с базата данни:
<?php


// Database configuration


$bd_host = "localhost";

$bd_usuario = "име";

$bd_password = "парола";

$bd_base = "база данни";

$url = "урл";

$con = mysql_connect($bd_host, $bd_usuario, $bd_password); mysql_select_db($bd_base, $con);


?>
И намерих този с активация, който искам да вкарам в горния скрип за регистрация:
   

	  <?php


	  if (isset($_POST['submitted'])) {




		  $errors = array();


			  require_once ('mysql_connect.php');



	  if (eregi('^[[:alnum:]\.\'\-]{4,30}$', stripslashes(trim($_POST['username']))) ) {


			  $user = mysql_real_escape_string($_POST['username']);


			  $query = "SELECT username FROM users WHERE username = '$user'";


			  $result = @mysql_query($query);


			  $num = @mysql_num_rows($result);




			  if ($num> 0) {


				  $errors[] = '<font color="red">The username you have chosen has already been taken, please try again.</font>';


			  } else {


				  $username = mysql_real_escape_string($_POST['username']);


			  }


		  } else {


			  $errors[] = '<font color="red">Please provide a valid username between 4 and 30 characters.</font>';


		  }



	  if (!eregi('^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}', stripslashes(trim($_POST['email'])) )) {


			  $errors[] = '<font color="red">Please provide a valid email address.</font>';


		  } else {


			  $email = mysql_real_escape_string($_POST['email']);


		  }



	  if (!empty($_POST['password1'])) {


			  if ($_POST['password1'] != $_POST['password2']) {


				  $errors[] = '<font color="red">The 2 passwords you have entered do not match.</font>';


			  } else {


				  $password = $_POST['password1'];


			  }


		  } else {


			  $errors[] = '<font color="red">Please provide a password.</font>';


		  }



	  if (empty($errors)) {


					  $a = md5(uniqid(rand(), true));


			  $query = "INSERT INTO users (username, email, password, active) VALUES ('$username', '$email', SHA('$password'), '$a')";




			  $result = @mysql_query($query);




			  if (mysql_affected_rows() == 1) {




							  // Send the E-Mail


							  $body = "Thank you for registering at the User Registration site. To activate your account, please click on this link:\n\n";


					  $body .= "http://www.whateveraddressyouwanthere.com/activate.php?x=" . mysql_insert_id() . "&y=$a";


				  mail($_POST['email'], 'Registration Confirmation', $body, 'From: admin@localhost');




							  // Show thank you message


				  echo '<h3>Thank You!</h3>


				  You have been registered, you have been sent an e-mail to the address you specified before. Please check your e-mails to activate your account.';


			  } else {


				  echo '<font color="red">You could not be registered, please contact us about the problem and we will fix it as soon as we can.</font>';


			  }



	  } else {


			  echo '<h3>Error!</h3>


			  The following error(s) occured:<br />';




			  foreach ($errors as $msg) {


				  echo " - <font color=\"red\">$msg</font><br />\n";


			  }


		  }


	  }


	  ?>



	  <h3>Register</h3>


	  <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">


		  <p><input type="text" name="username" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" size="30" maxlength="30" /> <small>Username</small></p>




		  <p><input type="password" name="password1" size="30" maxlength="40" /> <small>Password</small></p>




		  <p><input type="password" name="password2" size="30" maxlength="40" /> <small>Confirm Password</small></p>




		  <p><input type="text" name="email" size="30" maxlength="30" value="<?php if(isset($_POST['email'])) echo $_POST['email']; ?>" /> <small>Email Address</small></p>




		  <p><input type="submit" name="submit" value="Register" /></p>


		  <input type="hidden" name="submitted" value="TRUE" />


	  </form>



	  <?php


	  if (isset($_GET['x'])) {


		  $x = (int) $_GET['x'];


	  } else {


		  $x = 0;


	  }


	  if (isset($_GET['y'])) {


		  $y = $_GET['y'];


	  } else {


		  $y = 0;


	  }




	  if ( ($x> 0) && (strlen($y) == 32)) {




		  require_once ('mysql_connect.php');


		  $query = "UPDATE users SET active=NULL WHERE (user_id=$x AND active='" . $y . "') LIMIT 1";  


		  $result = mysql_query($query);




		  if (mysql_affected_rows() == 1) {


			  echo "<h3>Your account is now active. You may now log in.</h3>";


		  } else {


			  echo '<p><font color="red" size="+1">Your account could not be activated. Please re-check the link or contact the system administrator.</font></p>';


		  }




		  mysql_close();




	  } else {




		  echo '<b>Activation link not valid!</b>';




	  }


	  ?>
И този за връзка с базата данни:
<?php

// CHANGE THESE VALUES

DEFINE ('DB_USER', 'име');

DEFINE ('DB_PASSWORD', 'парола');

DEFINE ('DB_HOST', 'localhost');

DEFINE ('DB_NAME', 'база данни');

$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error());

@mysql_select_db (DB_NAME) OR die('Could not select the database: ' . mysql_error() ); 


?>

Значи въпроса ми е как да направя първия скрипт за регистрация да си остане така, че да изпълнява и изпращане на емайл с линк за активация

и скрипта за връзката с базата данни да е един общ?

Ако някой може да ми свърши работа да го направи и да ми го прати като два файла на ЛС.

$bd_host = "localhost";

$bd_usuario = "име";

$bd_password = "парола";

$bd_base = "база данни";

DEFINE ('DB_USER', $bd_usuario);

DEFINE ('DB_PASSWORD', $bd_password );

DEFINE ('DB_HOST', $bd_host);

DEFINE ('DB_NAME', $bd_base);

и така нататък ...

Мога да ти кажа принципа, на който бях написал нещо подбно на времето, но няма как да ти го напиша... не съм писал php от дооооста време, а и тогава толкова го пишех де ;) (1 седмица) - значи при самата регистрация се генерира код със зададена дължина на символи примерно. Имаш променлива accactivated(примерно) със стойност 0, след това при вход има условие, ако тази стойност е 0 да ти вади формата за попълване на кода за активиране, когато този код се въведе и съвпадне със името и паролата записани в бд променя accactivated на 1 и така вече е активирано acc-то..., ако отворя дебелата книга сигурно до 1 ден мога и да ти го напиша, но незнам дали мога да си го позволя. Успех!

  • Автор
Мога да ти кажа принципа, на който бях написал нещо подбно на времето, но няма как да ти го напиша... не съм писал php от дооооста време, а и тогава толкова го пишех де :yanim: (1 седмица) - значи при самата регистрация се генерира код със зададена дължина на символи примерно. Имаш променлива accactivated(примерно) със стойност 0, след това при вход има условие, ако тази стойност е 0 да ти вади формата за попълване на кода за активиране, когато този код се въведе и съвпадне със името и паролата записани в бд променя accactivated на 1 и така вече е активирано acc-то..., ако отворя дебелата книга сигурно до 1 ден мога и да ти го напиша, но незнам дали мога да си го позволя. Успех!

Защо не можеш да си го позволиш?

Много си зает или .. ?

  • 2 седмици по-късно...

Насоки:

1. Редактирай си базата данни - добави в таблицата с потребителите 2 полета: 1) active, тип enum ('1', '0') със стойност по default 0 и 2) vkey varchar unique.

2. В скриптът ти за регистрация, в моментът, в който се добавя потребителя в базата (след всички проверки) добави да попълва и тези 2 полета, като на vkey използвай md5 хаш (или какъвто искаш друг) на случайно генерирани цифри и букви (готова функция можеш да намериш от тези за password генераторите).

3. Преди да приключи регистрацията, след успешното попълване на записа в базата данни, добави изпращане на мейл към потребителя с текст и линк към активационен скрипт (примерно http://saita.ti/activate.php?string=9e107d...d81d3542a419d6).

4. Създай си активационен скрипт (activate.php от примера в писмото) и в него взимаш съдържанието на $_GET['string'] и правиш едно просто query -

mysql_query("UPDATE `tablica_potrebiteli` SET active = 1 WHERE vkey = '".$_GET['string']."' LIMIT 1")

5. Редактирай си login скрипта, и когато влиза даден потребител добави една WHERE active = 1 клауза.

Това е в общи линии, ако не съм пропуснал нещо разбира се.

Успех.

Регистрирайте се или влезете в профила си за да коментирате

Разглеждащи това в момента 0

  • Няма регистрирани потребители разглеждащи тази страница.

Дарение

  • Подкрепи съществуването на форума - направи дарение
    32%
    Дарени 315 € от нужните 1 000 €

Бюлетин

Получавайте известие, когато има важна промяна или новина свързана с форума.

Профил

Навигация

Търсене

Търсене

Конфигуриране на push известия в браузъра

Chrome (Android)
  1. Докоснете иконата на катинар до адресната лента.
  2. Докоснете Разрешения → Известия.
  3. Променете предпочитанията си.
Chrome (Desktop)
  1. Кликнете върху иконата на катинар в адресната лента.
  2. Изберете Настройки на сайта.
  3. Намерете Известия и коригирайте предпочитанията си.