Page: 1, 2  Next

Help Insert the full array into MYSQL
techgearfree
Status: Curious
Joined: 30 Jan 2005
Posts: 6
Reply Quote
First I would like to say your script is excellent. Now, in my code, I do:


//includes the file
include 'browser_detection.php';

//Sets the full array to the php variable $full
$full = browser_detection( 'full');

// Then, I call the variable into my table's column and only recieve:

array.

I was just trying to have all the info in one table.

Any help?

Thanks
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4126
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I'm glad you found the script useful [php browser detection], thanks.

It's hard to say without seeing the code you used to insert this into the table.

However, if you are receiving just 'array' it sounds like you're not properly unpacking the array into the table columns, like this:

:: Code ::
$db_item1 = $full[0];
$db_item2 = $full[1];


and so on.

I'd be interested in seeing your code for this anyway, feel free to post the relevant sections of your db stuff.
Back to top
techgearfree
Status: Curious
Joined: 30 Jan 2005
Posts: 6
Reply Quote
I tried to do serialize to get the array to show correctly

In my register.php file on my site, I did:
:: Code ::

[PHP]
\\this sets the variable in php full to the browser detection function of full, then later, I just call it into the column as $full
$full = serialize(browser_detection( 'full'));

[/PHP]


this gives me : a:10:{i:0;s:2:"ie";i:1;s:3:"6.0";i:2;s:4:"ie5x";i:...

in my column on mysql instead of Array.

When I call it to the webpage, I do:
:: Code ::

[PHP]
$user_browser[0] = unserialize($result3['userinfo']);
//and I insert it normally as:
<TD NOWRAP><CENTER>" . $user_browser[0] . "</CENTER></TD>
[/PHP]



I am unsure as to what you want me to do.

However, my entire code for the register page is:

[PHP]
<?
session_start();

if(isset($HTTP_COOKIE_VARS["users_resolution"]))
$screen_res = $HTTP_COOKIE_VARS["users_resolution"];
else //means cookie is not found set it using Javascript
{
?>
<script language="javascript">
<!--
writeCookie();

function writeCookie()
{
var today = new Date();
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie

}
//-->
</script>
<?
}
?>


<?php

define('IN_RAFS', true);
include "./sessions.php";
include 'includes/header.php';
include 'browser_detection.php';

$page = "Register";
$adsense = "no";
if ( $_SESSION['username'] != NULL ) {
        header("Location: index.php");
}
else {
//        $username = ereg_replace("[^A-Za-z0-9]", "", strtolower(strip_tags($_POST['username'])));
        $full = serialize(browser_detection( 'full'));
      $password = $_POST['password'];
        $cpassword = $_POST['cpassword'];
        $enpassword = $_POST['password'];
        $email = $_POST['email'];
        $cemail = $_POST['cemail'];
        $username = $email;
        $robotkey = $_POST['rokey'];
        $fullname = $_POST['fullname'];
        $street = $_POST['street'];
        $city = $_POST['city'];
        $state = $_POST['state'];
        $zip = $_POST['zip'];
      $cookieip = $_COOKIE['ipcookie'];
        $referral = $_POST['referral'];
        $item = $_POST['item'];
        $ip = $_SERVER['REMOTE_ADDR'];
      $time = time();
        $key = md5($time);
        $date = date("dgdijmzy");
        $sid = session_id();
      $signuptime = date("F j, Y, g:i a");
        if ( $sid != NULL ) {
                $get = "SELECT `key` FROM `robot` WHERE `sid` = '$sid'";
                $rkey =  @mysql_result(mysql_query($get), 0);
        }
        else {
        }
        if (isset($_GET['email'])) {
                                if (isset($_GET['referral'])) {
                                        $referral = $_GET['referral'];
                $referral_email = "SELECT `email` FROM `users` WHERE `id` = '$referral'";
                $referral_email2 =  @mysql_result(mysql_query($referral_email), 0);
                                $referral_text = "<BR>You are being referred by <B>" . $referral_email2 . "</B>";
                                }
                                else {
                                        $referral = 0;
                                }
                $tvars = array(
                        'EMAIL' => $_GET['email'],
                  'ITEM' => $_GET['item'],
                                                'REFERRAL' => $referral,
                                                'REFERRAL_EMAIL' => $referral_text,
                        'SID' => $sid
                        );

                pparse('register_form');
                exit;
        }
      
        if ($username != NULL && $password != NULL && $email != NULL && $robotkey != NULL && $email == $cemail && $password == $cpassword && $fullname != NULL && $street != NULL && $city != NULL && $state != NULL && $zip != NULL) {
                $sqlsid = session_id();
                $exists = mysql_query("SELECT * from users WHERE username='$username' or email='$email'");
                $user_exists = mysql_fetch_array($exists);
                $ipcheck = mysql_query("SELECT * from users WHERE ip='$ip'");
                $ip_exists = mysql_fetch_array($ipcheck);
                echo $_SESSION["autamationcode"];
//                if ( $user_exists == "0" && $ip_exists == "0" && $robotkey == $rkey ) {
                  if ( $user_exists == "0" && $robotkey == $rkey ) {
                        $sql = "INSERT INTO users (id, username, password, email, ip, account, active, name, street, city, state, zip, referral, status, item, resolution, signuptime, cookieip, userinfo)"."VALUES ('NULL', '$username', '$enpassword', '$email', '$ip', '0', '$key', '$fullname', '$street', '$city', '$state', '$zip', '$referral', '1', '$item', '$screen_res', '$signuptime', '$cookieip', '$full')";
                        mysql_query($sql);
                        $clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
                        mysql_query($clearsid);
                        $uid = mysql_query("SELECT id from users WHERE username='$username'");
                        $u = mysql_result($uid, 0);
                        $message = "Thank your for registering! You're just one step away from being registered. Please check the e-mail you provided during registration. You were sent an activation link, just visit it and your account will be active and ready to go!";               
                        $tvars = array(
                                       'message' => $message);
                        pparse('message_body');
                        mail($email, "Welcome to " . $domain, "Thank you for registering at " . $domain . "!\n\nBefore you can get started, you need to activate your account, use the link below to do so\n\nhttp://" . $domain . "/activate.php?id=" . $u . "&k=" . $key . "\n\nOnce activated, you can login to your account with the following details:\n\nUsername: " . $username . "\nPassword: " . $password . "\n\nIf you have any problems please contact us.\n\nThanks,\n" . $domain, "From: " . $domain . " <support@" . $domain . ">");
                }
                elseif ( $robotkey != $rkey ) {
                  $back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
                        $message = "Please make sure you typed the signup key properly.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
                        $clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
                        mysql_query($clearsid);
                        $tvars = array(
                                       'message' => $message);
                        pparse('message_body');
                }
                elseif ( $user_exists != "0" ) {
                  $back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
                        $message = "Sorry but either your username or e-mail are already in use.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
                        $clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
                        mysql_query($clearsid);
                        $tvars = array(
                                       'message' => $message);
                        pparse('message_body');
                }
        }
        elseif ( $_POST == NULL ) {

                        $tvars = array(
                                'email' => $_GET['email'],
                                'cemail' => $_GET['email'],
                        'ITEM' => $_GET['item'],
                                'REFERRAL' => $referral,
                                'REFERRAL_EMAIL' => $referral_text,
                                'SID' => $sid
                                );

                pparse('register_form');
        }
        elseif ( $username != NULL && $password != NULL && $email != NULL && $cpassword != NULL && $cemail != NULL && $password != $cpassword ) {
                $back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
            $message = "Your passwords do not match.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
                $clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
                mysql_query($clearsid);
                $tvars = array(
                               'message' => $message);
                pparse('message_body');
        }
        elseif ( $username != NULL && $password != NULL && $email != NULL && $cpassword != NULL && $cemail != NULL && $email != $cemail ) {
                $back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
            $message = "Your email does not match.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
                $clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
                mysql_query($clearsid);
                $tvars = array(
                               'message' => $message);
                pparse('message_body');
        }
        elseif ( $_POST != NULL && $username == NULL or $password == NULL or $email == NULL or $cpassword == NULL or $cemail == NULL or $fullname == NULL or $street == NULL or $city == NULL or $state == NULL or $zip == NULL ) {
                $back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
            $message = "Please fill in all required fields before submitting.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
                $clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
                mysql_query($clearsid);
                $tvars = array(
                               'message' => $message);
                pparse('message_body');
        }
        //mysql_close($connect);
}
include 'includes/footer.php';
?>
[/PHP]


and again, this gives me: a:10:{i:0;s:2:"ie";i:1;s:3:"6.0";i:2;s:4:"ie5x";i:... in the collumn


Thank you[/code]

< Edited by techgearfree :: Jan 31, 05, 13:24 >

Back to top
techgearfree
Status: Curious
Joined: 30 Jan 2005
Posts: 6
Reply Quote
O, and this is the code when I put it in to the webpage: (and it gives me Array

:: Code ::
<?php
if ($modules) {
$admininfo['Fraud']['info'][] = array(
        'name' => 'Users and IP',
        'link' => $file,
        );
return;
}
include './../includes/adminheader.php';

   $post_userid = $_POST['userid'];

   if ( $_POST && $post_userid != NULL ) {
      // page that confirms that it went thru okay? finished page?

         /********** START DISPLAY INFORMATION *********/
         $query = "SELECT * FROM users WHERE id = '$post_userid'";
         $result = mysql_query($query);
         while($result3 = mysql_fetch_array($result)) {
            $user_id = $result3['id'];
            $user_username = $result3['username'];
            $user_password = $result3['password'];
            $user_ip = $result3['ip'];
            $user_signupcookieip = $result3['cookieip'];
            $user_street = $result3['street'];
            $user_city = $result3['city'];
            $user_state = $result3['state'];
            $user_zip = $result3['zip'];
            $user_referral = $result3['referral'];
               $query_offer = "SELECT * FROM offer_credit WHERE user_id = '$post_userid'";
               $result_offer = mysql_query($query_offer);
               while($result_offer3 = mysql_fetch_array($result_offer)) {
                  $offer_complete = 1;
               }
            if ( $offer_complete == 1 ) {
            $user_completed_offer = "Yes";
            }
            else {
            $user_completed_offer = "No";
            }
            $user_resolution = $result3['resolution'];
            $user_signuptime = $result3['signuptime'];
            $user_browser[0] = unserialize($result3['userinfo']);
            
            $query = "SELECT * FROM logins WHERE username = '$user_username'";
         $result = mysql_query($query);
         while($result3 = mysql_fetch_array($result)) {
            $user_login .= $result3['login'].'<br>';
            $user_loginips .= $result3['loginip'].'<br>';
            $user_logincookieip .= $result3['logincookieip'].'<br>';            
            
            
            $table = "<TR>
                     <TD><CENTER>" . $user_id . "</CENTER></TD>
                     <TD><CENTER>" . $user_username . "</CENTER></TD>
                     <TD><CENTER>" . $user_password . "</CENTER></TD>
                     <TD><CENTER>" . $user_street . "</CENTER></TD>
                     <TD><CENTER>" . $user_city . "</CENTER></TD>
                     <TD><CENTER>" . $user_state . "</CENTER></TD>
                     <TD><CENTER>" . $user_zip . "</CENTER></TD>
                     <TD><CENTER>" . $user_referral . "</CENTER></TD>
                     <TD><CENTER>" . $user_completed_offer . "</CENTER></TD>
                     <TD><CENTER>" . $user_signuptime . "</CENTER></TD>
                     <TD><CENTER>" . $user_ip . "</CENTER></TD>
                     <TD><CENTER>" . $user_signupcookieip . "</CENTER></TD>
                     <TD><CENTER>" . $user_resolution . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_login . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_loginips . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_logincookieip . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_browser[0] . "</CENTER></TD>
                  </TR>";
         }

         $query = "SELECT * FROM users WHERE id != '$post_userid' && ip = '$user_ip'";
         $result = mysql_query($query);
         while($result3 = mysql_fetch_array($result)) {
            $offer_complete = 0;
            $referral_id = $result3['id'];
            $referral_username = $result3['username'];
            $referral_password = $result3['password'];
            $referral_ip = $result3['ip'];
            $referral_street = $result3['street'];
            $referral_city = $result3['city'];
            $referral_state = $result3['state'];
            $referral_zip = $result3['zip'];
            $referral_referral = $result3['referral'];
               $query_offer = "SELECT * FROM offer_credit WHERE user_id = '$referral_id'";
               $result_offer = mysql_query($query_offer);
               while($result_offer3 = mysql_fetch_array($result_offer)) {
                  $offer_complete = 1;
               }
            if ( $offer_complete == 1 ) {
            $referral_completed_offer = "Yes";
            }
            else {
            $referral_completed_offer = "No";
            }
            $referral_resolution = $result3['resolution'];
            $referral_signuptime = $result3['signuptime'];
            $table = $table . "<TR>
                     <TD><CENTER>" . $referral_id . "</CENTER></TD>
                     <TD><CENTER>" . $referral_username . "</CENTER></TD>
                     <TD><CENTER>" . $referral_password . "</CENTER></TD>
                     <TD><CENTER>" . $referral_ip . "</CENTER></TD>
                     <TD><CENTER>" . $referral_street . "</CENTER></TD>
                     <TD><CENTER>" . $referral_city . "</CENTER></TD>
                     <TD><CENTER>" . $referral_state . "</CENTER></TD>
                     <TD><CENTER>" . $referral_zip . "</CENTER></TD>
                     <TD><CENTER>" . $referral_referral . "</CENTER></TD>
                     <TD><CENTER>" . $referral_completed_offer . "</CENTER></TD>
                     <TD><CENTER>" . $referral_resolution . "</CENTER></TD>
                     <TD><CENTER>" . $signuptime . "</CENTER></TD>
                  </TR>";
         }      
         

         $tvars = array(
                         'TABLE' => $table,
                         'USERNAME' => $username,
                         'USER_ID' => $user_id
                         );
                 pparse('admin/users_referrals_list');
         /********** END DISPLAY INFORMATION *********/

   }
}
   elseif ( $_POST ) {
      if ( $post_userid == NULL ) {
         // error empty fields
         echo "Error, empty fields.  Go <a href=\"admin_users_ip.php\">back</a>";
      }
   }

   else {
      // form fields, just 'name', 'desc', 'time', 'pts', 'link', 'img'
              pparse('admin/users_ip');
   }

include './../includes/adminfooter.php';
?>

Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4126
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I think the problem might be with the serialize function.

Take a quick read of the serialize function page on php.net.

:: Quote ::
kjh90 at orgio dot net
20-Mar-2002 01:43
If you want to put serialized data into DB, you have to add slashes.
At this point, there's a problem. If you got data via HTTP POST method, the data has slashes already. I tried to work with "array_walk" or "array_map", but it doesn't work when the data has array.
So make extended stripslashes function.

:: Code ::
<?php
function my_stripslashes($vals) {
   if (is_array($vals)) {
       foreach ($vals as $key=>$val) {
           $vals[$key]=my_stripslashes($val);
       }
   } else {
       $vals = stripslashes($vals);
   }
   return $vals;
}

$data = addslashes(serialize($_POST));
...
$SQL="insert into DB() values($data)";
...
$SQL="select data from DB";
...
$data = my_stripslashes($data);
...
?>



There was also this technique:
:: Code ::
base64_encode (serialize ($this) )
//and
$this = unserialize (base64_decode ($_COOKIE['session']));


Which may or may not take care of your problem. I haven't used serialize before, but it is a very good idea, much more efficient for packing data into a db I'd say.
Back to top
techgearfree
Status: Curious
Joined: 30 Jan 2005
Posts: 6
Reply Quote
I think it might be how I did unserialize into the webpage. because, in teh database, it shows something like: a:10:{i:0;s:2:"ie";i:1;s:3:"6.0";i:2;s:4:"ie5x";i:... I think that the 6.0 is like version, the ie is the browser and stuff. So, it looks like it is doing the stuff correctly, I just need to get it back into the page.

When I do unserialize, it just says Array. I think that might be the problem.

Now, do I have to do serialize? You said you hadn't used it before so it led me to belive I do not even have to serialize it. I just want to store all the information in one collumn, and the code said to make the php variable equal to full, so I did, and it gave me like Array in the database. However, I didn't try to call it into php to see if it gave me the contents of the array. How do you use the 'full' function without serialize?

Thanks!
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4126
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
First of all, I think your idea is a very good one, and it's worth spending the time to find the source of the issue. But reading through the php.net thread, there are issues with using serialize. When you are getting back the value 'array' it means it did not in fact serialize the object, but put in the array itself. From looking at the code sample at php.net, I'd say look into the
:: Code ::
base64_encode (serialize ($this) )
//and
$this = unserialize (base64_decode ($_COOKIE['session']));

functions, those seem to resolve some issues people had.

so:

:: Code ::
base64_encode(serialize($full));
// after you're done with $full, make sure to do this, or unset it, or whatever method you prefer.
$full = ''; // dump the value in case it's held through the page
$full = unserialize(base_64_decode('browser_data'));//which should theoretically give back the array


then use the correct array parameter to extract the data.
:: Code ::
$browser = $full[3];//or whatever it is, can't remember.


In the above script by the way there's a typo,
:: Code ::
$result = mysql_query($query);
         while($result3 = mysql_fetch_array($result)) {


I don't know where the $result3 came from.

It's also possible there is a glitch with serializing a function, why not uncompress your code a bit to make it easier to find the failure point:
:: Code ::

$full = browser_detection('full');
serialize($full);

and so on.

Most complex functions I've come across have some issues, and require a little reading to make work right, and some simply don't work.

If the solution is found, please post it here for other people's benefit, I think using a method like that can really cut down on mysql code bloat, it's actually one reason I never made this run through mysql, but if running this method would certainly make a good add on module to the primary script.

Also, because the variable contains " values, you have to run the $full variable, after serializing, before db insertion, through the magic quotes function:
:: Code ::
<?php
/******************************************************************
   these two functions clean up the data and add quotes for insertion into mysql
   
   strip escape slashes from entry
******************************************************************/
function stripslashes_deep($value)
{
   $value = is_array($value) ?
               array_map('stripslashes_deep', $value) :
               stripslashes($value);
   return $value;
}

/******************************************************************
   Quote a variable to make it safe for insertion
******************************************************************/
function quote_smart($value)
{
   // Stripslashes if we need to
    $value = trim( $value );
   if (get_magic_quotes_gpc()) {
       $value = stripslashes_deep($value);
   }

   // Quote it if it's not an integer
   if (!is_int($value)) {
       $value = "'" . mysql_real_escape_string($value) . "'";
   }
   return $value;
}
?>

Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4126
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Ignore the base_64_decode() and encode idea, I tried that and my server didn't support base_64_decode(), although oddly enough it does support encode. Go figure.

:: Code ::
<?php
   $full = browser_detection('full');
   $full = serialize($full);
   echo $full . '<br>';
   $full = unserialize($full);
   echo $full[0];
?>


This outputs everything as expected, so that's not where the problem lies, my guess is it might be the quotation marks in the serialized variable.
:: Code ::
Output:
a:10:{i:0;s:3:"moz";i:1;s:3:"1.7";i:2;s:0:"";i:3;b:1;i:4;b:1;i:5;s:2:"nt";i:6;d:5;i:7;s:5:"gecko";i:8;s:3:"bro";i:9;s:3:"1.7";}
moz


I tested with no db this method, making one change only to the quotesmart function, removing the "'" . on either end, which is necessary for mysql insertion but not for this example:
:: Code ::
<?php
function stripslashes_deep($value)
{
   $value = is_array($value) ?
               array_map('stripslashes_deep', $value) :
               stripslashes($value);
   return $value;
}

function quote_smart($value)
{
   // Stripslashes if we need to
    $value = trim( $value );
   if (get_magic_quotes_gpc()) {
       $value = stripslashes_deep($value);
   }
   $value = mysql_real_escape_string($value);

    return $value;
}


$full = browser_detection('full');
$full = quote_smart(serialize($full));
echo $full . '<br>';
$full = stripslashes($full);
$full = unserialize($full);
echo $full[0] . '<br>';
print_r($full);

?>


As you can see, the array is successfully serialized, the quotes are escaped for db insertion, and then the escape slashes are stripped out [that's I believe automatic with mysql so you can comment out that step].

then the array is reserialized, and works fine, and print_r shows that it is back as an array.

the only place I can see an error creeping in here is by not escaping the ". Also, I noticed that you put '$full' single quotes around the variables in the sql statement, I'd use the above quote smart function to do that automatically for you.
Back to top
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
You guys are making this too complicated, here's the error I think:

:: Code ::
$user_browser[0] = unserialize($result3['userinfo']);


Of course, fix all those $result3 things.

Notice, $user_browser is using the wrong syntax, this would have been needed to be declared an array before hand, although php is letting you get away with it. Initialize variables in scripts and you'll avoid this type of error.

So you're putting an array into an array, then asking the array to tell you what is in $user_browser[0], which is an array. So it outputs 'array', exactly like it's supposed to.

Change the above line to this:
:: Code ::
$user_browser = unserialize($result3['userinfo']);


Techadmin, usually I like stuff you say, but this one you really missed, although your advice to as a matter of good practice use the quote_smart(serialize($full)); is a good general practice without any doubt, in this case I don't think it was the problem, but that site is going to be easy to hack into if this person doesn't start using some input security methods, this way is easy, so why not do it.
Back to top
techgearfree
Status: Curious
Joined: 30 Jan 2005
Posts: 6
Reply Quote
I changed it to:

:: Code ::
<?php
if ($modules) {
$admininfo['Fraud']['info'][] = array(
        'name' => 'Users and IP',
        'link' => $file,
        );
return;
}
include './../includes/adminheader.php';

   $post_userid = $_POST['userid'];

   if ( $_POST && $post_userid != NULL ) {
      // page that confirms that it went thru okay? finished page?

         /********** START DISPLAY INFORMATION *********/
         $query = "SELECT * FROM users WHERE id = '$post_userid'";
         $result = mysql_query($query);
         while($result3 = mysql_fetch_array($result)) {
            $user_id = $result3['id'];
            $user_username = $result3['username'];
            $user_password = $result3['password'];
            $user_ip = $result3['ip'];
            $user_signupcookieip = $result3['cookieip'];
            $user_street = $result3['street'];
            $user_city = $result3['city'];
            $user_state = $result3['state'];
            $user_zip = $result3['zip'];
            $user_referral = $result3['referral'];
               $query_offer = "SELECT * FROM offer_credit WHERE user_id = '$post_userid'";
               $result_offer = mysql_query($query_offer);
               while($result_offer3 = mysql_fetch_array($result_offer)) {
                  $offer_complete = 1;
               }
            if ( $offer_complete == 1 ) {
            $user_completed_offer = "Yes";
            }
            else {
            $user_completed_offer = "No";
            }
            $user_resolution = $result3['resolution'];
            $user_signuptime = $result3['signuptime'];
            $user_browser = unserialize($result3['userinfo']);
            
            $query = "SELECT * FROM logins WHERE username = '$user_username'";
         $result = mysql_query($query);
         while($result3 = mysql_fetch_array($result)) {
            $user_login .= $result3['login'].'<br>';
            $user_loginips .= $result3['loginip'].'<br>';
            $user_logincookieip .= $result3['logincookieip'].'<br>';            
            
            
            $table = "<TR>
                     <TD><CENTER>" . $user_id . "</CENTER></TD>
                     <TD><CENTER>" . $user_username . "</CENTER></TD>
                     <TD><CENTER>" . $user_password . "</CENTER></TD>
                     <TD><CENTER>" . $user_street . "</CENTER></TD>
                     <TD><CENTER>" . $user_city . "</CENTER></TD>
                     <TD><CENTER>" . $user_state . "</CENTER></TD>
                     <TD><CENTER>" . $user_zip . "</CENTER></TD>
                     <TD><CENTER>" . $user_referral . "</CENTER></TD>
                     <TD><CENTER>" . $user_completed_offer . "</CENTER></TD>
                     <TD><CENTER>" . $user_signuptime . "</CENTER></TD>
                     <TD><CENTER>" . $user_ip . "</CENTER></TD>
                     <TD><CENTER>" . $user_signupcookieip . "</CENTER></TD>
                     <TD><CENTER>" . $user_resolution . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_login . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_loginips . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_logincookieip . "</CENTER></TD>
                     <TD NOWRAP><CENTER>" . $user_browser[0] . "</CENTER></TD>
                  </TR>";
         }

         $query = "SELECT * FROM users WHERE id != '$post_userid' && ip = '$user_ip'";
         $result = mysql_query($query);
         while($result3 = mysql_fetch_array($result)) {
            $offer_complete = 0;
            $referral_id = $result3['id'];
            $referral_username = $result3['username'];
            $referral_password = $result3['password'];
            $referral_ip = $result3['ip'];
            $referral_street = $result3['street'];
            $referral_city = $result3['city'];
            $referral_state = $result3['state'];
            $referral_zip = $result3['zip'];
            $referral_referral = $result3['referral'];
               $query_offer = "SELECT * FROM offer_credit WHERE user_id = '$referral_id'";
               $result_offer = mysql_query($query_offer);
               while($result_offer3 = mysql_fetch_array($result_offer)) {
                  $offer_complete = 1;
               }
            if ( $offer_complete == 1 ) {
            $referral_completed_offer = "Yes";
            }
            else {
            $referral_completed_offer = "No";
            }
            $referral_resolution = $result3['resolution'];
            $referral_signuptime = $result3['signuptime'];
            $table = $table . "<TR>
                     <TD><CENTER>" . $referral_id . "</CENTER></TD>
                     <TD><CENTER>" . $referral_username . "</CENTER></TD>
                     <TD><CENTER>" . $referral_password . "</CENTER></TD>
                     <TD><CENTER>" . $referral_ip . "</CENTER></TD>
                     <TD><CENTER>" . $referral_street . "</CENTER></TD>
                     <TD><CENTER>" . $referral_city . "</CENTER></TD>
                     <TD><CENTER>" . $referral_state . "</CENTER></TD>
                     <TD><CENTER>" . $referral_zip . "</CENTER></TD>
                     <TD><CENTER>" . $referral_referral . "</CENTER></TD>
                     <TD><CENTER>" . $referral_completed_offer . "</CENTER></TD>
                     <TD><CENTER>" . $referral_resolution . "</CENTER></TD>
                     <TD><CENTER>" . $signuptime . "</CENTER></TD>
                  </TR>";
         }      
         

         $tvars = array(
                         'TABLE' => $table,
                         'USERNAME' => $username,
                         'USER_ID' => $user_id
                         );
                 pparse('admin/users_referrals_list');
         /********** END DISPLAY INFORMATION *********/

   }
}
   elseif ( $_POST ) {
      if ( $post_userid == NULL ) {
         // error empty fields
         echo "Error, empty fields.  Go <a href=\"admin_users_ip.php\">back</a>";
      }
   }

   else {
      // form fields, just 'name', 'desc', 'time', 'pts', 'link', 'img'
              pparse('admin/users_ip');
   }

include './../includes/adminfooter.php';
?>


and I get: ie as the only thing. I am just going to make a column for everything, instead of doing an array. Unless, there is something really easy to fix in my code that is causing it to only give ie.


Thanks

ps: result3 thingy is ok
Back to top
Display posts from previous:   
Page: 1, 2  Next
All times are GMT - 8 Hours