Unstoppable Domains

I need help with this script...

Spaceship Spaceship
Watch

Barrucadu

Established Member
Impact
64
when I load the page nothing happenes, heres the script:

PHP:
<?php

include '../../Includes/DBconnect.php';

session_start();

$sql = 'select * from '.$DBusers.' where uname="'.$_SESSION['usrnm'].'" and pword="'.$_SESSION['pwcd'].'" limit 1';

mysql_connect($DBhostname,$DBusername,$DBpassword);
mysql_select_db($DBname);
$result = mysql_query($sql) or die($sql);
mysql_close();

$num = mysql_num_rows($result);

if($num == 0){
	header("Location: http://www.yarrt.com/badlogin.php
	");
}
if(!$_SESSION['admincode'] == "67896789"){
	header("Location: http://www.yarrt.com/admin/badlogin.php
	");
}

if($_GET['act']=='delusr'){
	$sqlcode = 'DELETE FROM members_1 WHERE uname="'.$_GET['user'].'";';
	$sql2 = 'insert into admin_pending values("'.$sqlcode.'","'.$_SESSION['usrnm'].'")';
}
if($_POST['act']=='changeinfo'){
	$sqlcode = '';
	if(!$_POST['newinfo']=='' && !$_POST['newpassword']==''){
		$sqlcode = 'UPDATE members_1 SET myinfo="'.$_POST['newinfo'].'",pword="'.$_POST['newpassword'].'" WHERE uname="'.$_POST['olduname'].'";';
	}
	if($_POST['newinfo']=='' && !$_POST['newpassword']==''){
		$sqlcode = 'UPDATE members_1 SET pword="'.$_POST['newpassword'].'" WHERE uname="'.$_POST['olduname'].'";';
	}
	if(!$_POST['newinfo']=='' && $_POST['newpassword']==''){
		$sqlcode = 'UPDATE members_1 SET myinfo="'.$_POST['newinfo'].'" WHERE uname="'.$_POST['olduname'].'";';
	}
	$sql2 = 'insert into admin_pending values("'.$sqlcode.'","'.$_SESSION['usrnm'].'")';
}
if($_GET['act']=='delcont'){
	$sqlcode = 'DELETE FROM content_1 WHERE page="'.$_GET['page'].'" and title="'.$_GET['title'].'";';
	$sql2 = 'insert into admin_pending values("'.$sqlcode.'","'.$_SESSION['uname'].'")';
}
if($_GET['act']=='addcont'){
	$sqlcode = 'INSERT INTO content_1 VALUES("thompson","'.$_POST['contt'].'","'.$_POST['contb'].'");';
	$sql2 = 'insert into admin_pending values("'.$sqlcode.'","'.$_SESSION['uname'].'")';
}

mysql_connect($DBhostname,$DBusername,$DBpassword);
mysql_select_db($DBname);
mysql_query($sql2) or die($sql2);
mysql_close();
header("Location: http://yarrt.com/members/admin/index.php");

What its supposed to do is create a sql query and put it in the pending database, for later use.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
replace:

PHP:
mysql_query($sql2) or die($sql2);

With

PHP:
mysql_query($sql2) or die(mysql_error());

See if there is an error, if so, copy and paste the error message.

Cody
 
0
•••
Ive made it echo the error message and the query, the output is:

Code:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'testtesttest",pword="1234" WHERE uname="dphoyes";","Mikor")' at

insert into admin_pending values("UPDATE members_1 SET myinfo="testtesttest",pword="1234" WHERE uname="dphoyes";","Mikor")

the error is because i use " twice but i dont know how to get around this..
 
Last edited:
0
•••
All of your queries are messed up, your going to need to go and fix em.

you have:

Code:
insert into admin_pending values("UPDATE members_1 SET myinfo="testtesttest",pword="1234" WHERE uname="dphoyes";","Mikor")

Thats two types of queries.... :P You insert... plus update... im not even going to try to think what you are trying to do cause you lost me here... and i have seen some confusing codes O.o

insert into admin_pending values("UPDATE members_1 SET myinfo="testtesttest",pword="1234" WHERE uname="dphoyes";","Mikor")
 
0
•••
i'm trying to store a query in a database for later use.
 
0
•••
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back