Page 1 of 1

WHY WONT THIS CODE WORK

Posted: Wed Oct 07, 2009 9:41 pm
by robertbarzyk
everything works flawless, no errors and it redirects to the page specified
but it doesnt update the feilds in the database... why ?

Code: Select all

<center>
<?php
$name1 = $_GET['friendid'];
$a=$_POST["a"]; // Form posted value
$ch = curl_init() or die(curl_error());
$params="a=$a";
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,"http://www.myspace.com/$name1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data1=curl_exec($ch) or die(curl_error());
echo curl_error($ch);
 
preg_match("/<span class=\"nametext\">(.*)<br \/>/",$data1,$match);
$ishh = $match[1];
 
mysql_connect("localhost", "unrealar_me", "xxxxxx") or die(mysql_error());
mysql_select_db("unrealar_adder") or die(mysql_error());
 
mysql_query("UPDATE riders SET name='tom' WHERE friendid='$name'") 
or die(mysql_error());   
 
?>
<?php
 
preg_match("/<a id=\"ctl00_cpMain_ctl01_UserBasicInformation1_hlDefaultImage\" rel=\"myspace:photo\" href=\"http:\/\/viewmorepics.myspace.com\/index\.cfm\?fuseaction=user\..*?friendID=$name1\">.*?<\s*img [^\>]*src=\"([^\">]+)/is",$data1,$match);
$pic_url = $match[1];
 
mysql_connect("localhost", "unrealar_me", "xxxxxx") or die(mysql_error());
mysql_select_db("unrealar_adder") or die(mysql_error());
 
mysql_query("UPDATE riders SET pic='$pic_url' WHERE friendid='$name'") 
or die(mysql_error());   
 
 $_SESSION['username'] = "$username"; 
 $_SESSION['ip'] = $_SERVER['REMOTE_ADDR']; 
 $_SESSION['basic_is_logged_in'] = true;
 $_SESSION['friendid'] = $_GET['friendid'];
 
include ("index.php");
 
?>

Re: WHY WONT THIS CODE WORK

Posted: Wed Oct 07, 2009 9:59 pm
by requinix
So... where you do define $name?

Re: WHY WONT THIS CODE WORK

Posted: Wed Oct 07, 2009 11:55 pm
by Mirge
tasairis wrote:So... where you do define $name?
Yeah, those errors are quite irritating :) Unless the OP is using register_globals... then he should slap himself.