<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Creazione account php]]></title><description><![CDATA[<p dir="auto">Salve ragazzi<br />
Ho uno script php che mi permette di creare account.<br />
Avendo creato una tabella mysql e inserendo mon password ed email mi crea l'account e basta; ora come posso creare il resto?<br />
Cioe'<br />
ho questi file:<br />
<strong>account.php</strong></p>
<pre><code class="language-php"> include_once("functions.inc.php");

if ($_REQUEST["action"] != "signup" &amp;&amp; $_REQUEST["action"] != "confirm") {

 signupForm();

}

if ($_REQUEST["action"] == "signup") {

 $username = $_POST["username"];
 $password = $_POST["password"];
 $email    = $_POST["email"];

 createAccount($username,$password,$email);

}

if ($_REQUEST["action"] == "confirm" &amp;&amp; $_REQUEST["confirm"] != "") {

 confirm($_REQUEST["confirm"]);

}
</code></pre>
<p dir="auto"><strong>config.php</strong></p>
<pre><code class="language-php"># Database name
$db = "xxx";

# Internet address or hostname of database host
$db_host = "localhost";

# Database username
$db_user = "xxx";

# Database password
$db_password = "xxx";
</code></pre>
<p dir="auto"><strong>functions.php</strong></p>
<pre><code class="language-php">include_once("config.inc.php");

function confirm ($random) {

 # Inherit database connection information from variables defined in config.inc.php
 global $db, $db_host, $db_user, $db_password;

 # Connect to the database and report any errors on connect.
 $cid = mysql_connect($db_host,$db_user,$db_password);

 if (!$cid) {

  die("ERROR: " . mysql_error() . "\n");

 }

 # Setup SQL statement, update account to show that user has confirmed.
 $SQL = "UPDATE account SET confirmed = '0' WHERE random = '$confirm'";
 $result = mysql_db_query($db,$SQL,$cid);

 # Check for errors.
 if (!$result) {

  die("ERROR: " . mysql_error() . "\n");

 } else {

  echo "Congratulations, your account has been confirmed successfully. You may now login.";

 }

 mysql_close($cid); 

}

function signupForm () {

 # Nothing more than spitting out HTML for the form
 echo "&lt;form name=\"signup\" method=\"POST\" action=\"?action=signup\"&gt;";
 echo "Username: &lt;input type=\"text\" name=\"username\"&gt;&lt;br&gt;";
 echo "Password: &lt;input type=\"password\" name=\"password\"&gt;&lt;br&gt;";
 echo "E-Mail: &lt;input type=\"text\" name=\"email\"&gt;&lt;br&gt;";
 echo "&lt;input type=\"submit\"&gt;&lt;/form&gt;";

}

function createAccount ($username, $password, $email) {

 if ($username == "" || $password == "" || $email == "") {

  die("ERROR: Please make sure that all entries are valid!");
 
 }

 # Inherit database connection information from variables defined in config.inc.php
 global $db, $db_host, $db_user, $db_password;

 # Connect to the database and report any errors on connect.
 $cid = mysql_connect($db_host,$db_user,$db_password);

 if (!$cid) {

  die("ERROR: " . mysql_error() . "\n");

 } 

 # Create Random number
 $floor = 100000;
 $ceiling = 999999;
 srand((double)microtime()*1000000);
 $random = rand($floor, $ceiling);

 # Message sent in the e-mail to the user that's signing up.
 $message = "You or someone using your email address has requested an account on the system. If you requested the account please click on the confirmation link below. If not, please send a message to email.\n\nhttp://www.miosito/account/account.php?action=confirm&amp;confirm=$random\n\nThanks!";

 # Send the confirmation e-mail to the user.
 mail($email, "Account Confirmation", $message);

 # I usually hash the passwords instead of storing the plaintext password in the database.
 # Just comment the next line out if you'd prefer to store them as plaintext.
 $password = md5($password);

 # Setup SQL statement and add the account into the system.
 $SQL = "INSERT INTO account VALUES ('$username','$password','$email','1','$random')";
 $result = mysql_db_query($db,$SQL,$cid);

 # Check for errors.
 if (!$result) {

  die("ERROR: " . mysql_error() . "\n");

 } else {

  echo "Congratulations, your account has been added into the system. Check your e-mail for the confirmation message";

 }

 mysql_close($cid);

}
</code></pre>
<p dir="auto">cioe' devo creare il login e la pag utente.<br />
Mi aiutate?</p>
]]></description><link>https://dev.connect.gt/topic/48144/creazione-account-php</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 06:09:12 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/48144.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Sep 2007 12:16:02 GMT</pubDate><ttl>60</ttl></channel></rss>