[PHP] Halp please.

Status
Not open for further replies.

Dzetki

The Prodigal Son Returns
Jul 16, 2010
990
220
I'm trying my best to get a settings page in my blogging software (soon to create a development thread for it), but the password won't update no-matter what i do. this is what happens: And the code's like this:

Halp! ;[
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
PHP:
mysql_connect("This", "code", "is") or die(mysql_error());
mysql_select_db("notgood") or die(mysql_error());

$settings = "UPDATE blog_admin SET password = '" . sha1(md5($_POST['password'])) .  "' WHERE id = '" . $_SESSION['id'] . "'";

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

echo "Success!";

The code makes no sense but it should work with what you have.
 

Dzetki

The Prodigal Son Returns
Jul 16, 2010
990
220
PHP:
mysql_connect("This", "code", "is") or die(mysql_error());
mysql_select_db("notgood") or die(mysql_error());

$settings = "UPDATE blog_admin SET password = '" . sha1(md5($_POST['password'])) .  "' WHERE id = '" . $_SESSION['id'] . "'";

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

echo "Success!";

The code makes no sense but it should work with what you have.
That didn't give me errors, but it didn't update the database table. ;[
 

Dzetki

The Prodigal Son Returns
Jul 16, 2010
990
220
PHP:
<?php
$con = mysql_connect("localhost","root","43kj67");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("blog", $con);
  
$settings="UPDATE blog_admin SET password='" . sha1(md5($_POST['password'])) . "'WHERE id = '" . $_SESSION['id'] . "'

if (!mysql_query($settings,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Post have been submitted. <a href='admin.php'>Return to the previous page</a>.";
?>

Line 12, ;]
 

RastaLulz

fight teh power
Staff member
May 3, 2010
3,926
3,921
Try this:
PHP:
<?php
$con = mysql_connect("localhost","root","43kj67");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("blog", $con);

$settings = "UPDATE blog_admin SET password = '" . sha1(md5($_POST['password'])) . "'";

if (!mysql_query($settings,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Post have been submitted. <a href='admin.php'>Return to the previous page</a>.";
?>
 
Status
Not open for further replies.

Users who are viewing this thread

Top