Jump to content

chrishawkins

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chrishawkins's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Updated: Is this what you mean; <form name="form1" method="post" action=""> <label> <input type="submit" name="update" id="update" value="Update Records"> </label> </form> <form name="form2" method="get" action="test.php?show_results=1"> <label> <input type="submit" name="show_results" id="show_results" value="Show Results"> </label> </form> <?php $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); if(isset($_GET['show_results']) && $_GET['show_results'] == 1){ $res = mysql_query("SELECT *, probid_users.name AS name, probid_winners.winner_id AS winnerid FROM probid_winners left join probid_users ON probid_users.user_id = probid_winners.buyer_id WHERE probid_winners.payment_status='confirmed' AND printed='' AND buyer_id BETWEEN 2 AND 1000000000 ORDER BY bid_amount DESC = " . mysql_real_escape_string($_GET['show_results'] or trigger_error (mysql_error()); } echo "<table border='5'> <tr> <th>Name</th> <th>Auction ID</th> <th>Bid Amount</th> <th>Deposit Status</th> </tr>"; while($row = mysql_fetch_array($res)) { echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['auction_id'] . "</td>"; echo "<td>" . $row['bid_amount'] . "</td>"; echo "<td>" . $row['payment_status'] . "</td>"; echo "<td><form1=\"update_row\" method=\"post\" action=\"test.php?id=".$row['winnerid']."\"> <input type=\"hidden\" name=\"updating_row\" value=\"".$row['winnerid']."\" /> <input type=\"submit\" name=\"submit_update\" value=\"Remove\" /> </form>"; echo "</tr>"; if(isset($_POST['updating_row'])){ $res = mysql_query("UPDATE probid_winners SET printed='printed' WHERE probid_winners.winner_id = " . mysql_real_escape_string($_POST['updating_row'] or trigger_error (mysql_error()); } } echo "</table>"; mysql_close($con); ?>
  2. I am getting this error; Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in running this code; <form name="form1" method="post" action=""> <label> <input type="submit" name="update" id="update" value="Update Records"> </label> </form> <form name="form2" method="get" action="test.php?show_record=1"> <label> <input type="submit" name="show_results" id="show_results" value="Show Results"> </label> </form> <?php $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); if(isset($_GET['show_results']) && $_GET['show_results'] == 1){ $res = mysql_query("SELECT *, probid_users.name AS name, probid_winners.winner_id AS winnerid FROM probid_winners left join probid_users ON probid_users.user_id = probid_winners.buyer_id WHERE probid_winners.payment_status='confirmed' AND printed='' AND buyer_id BETWEEN 2 AND 1000000000 ORDER BY bid_amount DESC = " . mysql_real_escape_string($_GET['show_results'])); } echo "<table border='5'> <tr> <th>Name</th> <th>Auction ID</th> <th>Bid Amount</th> <th>Deposit Status</th> </tr>"; while($row = mysql_fetch_array($res)) { echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['auction_id'] . "</td>"; echo "<td>" . $row['bid_amount'] . "</td>"; echo "<td>" . $row['payment_status'] . "</td>"; echo "<td><form1=\"update_row\" method=\"post\" action=\"test.php?id=".$row['winnerid']."\"> <input type=\"hidden\" name=\"updating_row\" value=\"".$row['winnerid']."\" /> <input type=\"submit\" name=\"submit_update\" value=\"Remove\" /> </form>"; echo "</tr>"; if(isset($_POST['updating_row'])){ $res = mysql_query("UPDATE probid_winners SET printed='printed' WHERE probid_winners.winner_id = " . mysql_real_escape_string($_POST['updating_row'])); } } echo "</table>"; mysql_close($con); ?> I was hoping that someone might be able to help me out with this issue.
  3. Hello, I have been able to put together some php code that shows a daily sales report of items that have been sold that day. The code selects from a table in my database, looks for the value under payment_status and when the value is confirmed it echos the results. However, what I need to do now, is when it finds that the payment_status is confirmed and after it has been displayed to me, I need it to update the field named printed in that table to a value I set (i.e. printed). Also, the next time I run the script, I will need for it to do the same thing, only I will need it to now look for the payment_status='confirmed' as well as printed='printed' and only echo the results of payment_status='confirmed' if printed="null". Can someone help me out with this? Here is the code I have thus far; <?php $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM auction_winners WHERE payment_status='confirmed' ORDER BY bid_amount"); echo "<table border='1'> <tr> <th>Auction ID</th> <th>Bid Amount</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['auction_id'] . "</td>"; echo "<td>" . $row['bid_amount'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  4. I have a php file that is dependent on two different javascript file to run and function correctly. I've noticed that one of the files seems to hold all of the style attributes for the layout of the php file. Is there any program out there that will let me edit the style in a GUI like kind of like frontpage would? I am having a hard time editing the layout because I am not familiar with javascript styling. Please let me know
  5. Do you think you might be willing to explain to a noob how this might be possible? This is the script I am currently using to scrap the data... <? $url = 'http://anydomain.com/'; $ch = curl_init($url); //curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $curl_scraped_page = curl_exec($ch); curl_close($ch); echo $curl_scraped_page; ?> Wouldn't I need to be able to store the session variables somehow? If so, how would I do this without actually browsing to the site manually? ANy help will do...
  6. Hey Huggie, I am a noob here as well as to the world of PHP and CURL, however, I was wondering if you would be willing to lend me some of your expertise with a project that I am working on. It is somewhat similar to the topics posted in this thread. Let me know if you would be willing to help out. Like I said, I am new here, so I am still unable to post prvt messages. So, if your interested, I guess you can either post back here, or send me a prvt message with some contact info. Cheers Chris
  7. Have you had any luck finding out what you needed to make this script work? I so, let me know, I am trying to accomplish the same.
  8. Not really, the site I am looking to iframe actually has functionality to it, and would need to be able to be refreshed to show new content. The reason that do not want to members to be able to manipulate the site within the iframe is because it has my info on it, and I wouldn't want them coming in and randomly deleting, and or changing thing within the iframed site.
  9. What I am looking to do is use php to embed an iframe of an external site in my webpage. The reason I am looking to use php to do this is because I was informed that I would need the functionality of php to be able to implement what I would like for the iframe to do. Ok, so, getting down to it... What I am looking for is an iframe that I would be able to embed in my page, but one that will NOT show the header and/or possibly the footer of the site I am embedding. With this said, I would also like to see if it would be possible to have it auto login to the site before the page fully loads. And last, but not least, I would like to see if it would be possible to take away all interaction with the site by my users. I would not like for the users of my site to be able to manipulate the embedded site of use it's features in any way... I am only showing them for educational purposes. Is any or all of this possible? Please let me know if you can help... Thanks in advance Chris
  10. Hello there, Thanks for the reply, I would absolutely appreciate some assistance, thats if your still up for it... Please, let me know if you might still be willing to assist me and I can forward you a copy of the script. Thanks in advance Chris P.S. I have since then changed the directory in which the stats package is in... You can now refer here: http://imaqeshaq.com/myspace/ The layout I would prefer to use is still here: http://imaqeshaq.com/statslayout/ Thanks again
  11. I was wondering if someone would be up to lending me a hand on the .CSS for an old (pretty unconventional ) stats script I have... I am trying to get the stats package at this URL http://imaqeshaq.com/stats/?view=day look like the layout I laid out at this URL http://imaqeshaq.com/statslayout/ Would this be too too difficult, and would there be anyone out there willing to help me out?
  12. I am using a stats script on my server to capture info about my site viewers, but where I would like to grab the referred url, it is only capturing the url of the page currently being viewed, and it's not even doing that all that well, because when it displays the url being viewed, it only displays a portion of it. The link below is the site I have the stats script installed on. If you click one of the url's under the agent column, it will navigate you to the url where the code snippet is. If you then come back to the stats site and refresh the page, you will see that you have been tracked and that only the url that where you were when tracked was returned, and not the referring url. (i.e. the stats site's url) I would like to also grab the referring url. http://imaqeshaq.com/stats/ Here is the script I am using... <?php // ------------------------------------------------------------------------ // configuration file // ------------------------------------------------------------------------ // **************************************************************** // // ATTENTION // // **************************************************************** // // $lvc_include_dir must be set in the file with 'new-visitor' call // // **************************************************************** // $ignore_messages = true; $lvc_config_file = 'config.inc.php3'; include($lvc_include_dir.$lvc_config_file); // ------------------------------------------------------------------------ // extract agent from $HTTP_USER_AGENT ($agt) // ------------------------------------------------------------------------ function extract_agent($agt) { global $lvc_agent_max_length; global $lvc_agent_versions; global $lvc_agent_os; global $lvc_other_agt; if (ereg('MSIE', $agt) && !ereg('Opera', $agt)) // Internet Explorer { $new_agt = 'IE'; $agt = strtr($agt, '_', ' '); for ($cnt = 0, $ok = false; $cnt < sizeof($lvc_agent_versions['IE']) && !$ok; $cnt++) { if ($ok = ereg($lvc_agent_versions['IE'][$cnt], $agt)) { $new_agt .= ';'.$lvc_agent_versions['IE'][$cnt]; for (@reset($lvc_agent_os['IE']), $ok = false; (list($key, $value) = @each($lvc_agent_os['IE'])) && !$ok;) { if ($ok = ereg($key, $agt)) $new_agt .= ';'.$value; } } } if (!$ok) $new_agt = $agt; } elseif (ereg('Opera', $agt)) // Opera { $new_agt = 'OP'; for ($cnt = 0, $ok = false; $cnt < sizeof($lvc_agent_versions['OP']) && !$ok; $cnt++) { if ($ok = ereg($lvc_agent_versions['OP'][$cnt], $agt)) { $new_agt .= ';'.$lvc_agent_versions['OP'][$cnt]; for (@reset($lvc_agent_os['OP']), $ok = false; (list($key, $value) = @each($lvc_agent_os['OP'])) && !$ok;) { if ($ok = ereg($key, $agt)) $new_agt .= ';'.$value; } } } if (!$ok) $new_agt = $agt; } elseif (ereg('Mozilla/4.', $agt)) // Netscape 4.x { $new_agt = 'NS'; for ($cnt = 0, $ok = false; $cnt < sizeof($lvc_agent_versions['NS']) && !$ok; $cnt++) { if ($ok = ereg($lvc_agent_versions['NS'][$cnt], $agt)) { $new_agt .= ';'.$lvc_agent_versions['NS'][$cnt]; for (@reset($lvc_agent_os['NS']), $ok = false; (list($key, $value) = @each($lvc_agent_os['NS'])) && !$ok;) { if ($ok = ereg($key, $agt)) $new_agt .= ';'.$value; } } } if (!$ok) $new_agt = $agt; } elseif (ereg('Mozilla/5.0', $agt) && !ereg('Konqueror', $agt)) // NS 6 { $new_agt = 'NS'; for ($cnt = 0, $ok = false; $cnt < sizeof($lvc_agent_versions['NS6']) && !$ok; $cnt++) { if ($ok = ereg($lvc_agent_versions['NS6'][$cnt], $agt)) { $new_agt .= ';'.$lvc_agent_versions_2['NS6'][$cnt]; for (@reset($lvc_agent_os['NS']), $ok = false; (list($key, $value) = @each($lvc_agent_os['NS'])) && !$ok;) { if ($ok = ereg($key, $agt)) $new_agt .= ';'.$value; } } } if (!$ok) $new_agt = $agt; } else // others { $new_agt = $agt; for (@reset($lvc_other_agt), $ok = false; (list($key, $value) = @each($lvc_other_agt)) && !$ok;) { if ($ok = ereg($key, $agt)) $new_agt = $value; } } $new_agt = strip_tags($new_agt); if (strlen($new_agt) > $lvc_agent_max_length) $new_agt = substr($new_agt, 0, $lvc_agent_max_length-4).' ...'; return($new_agt); } // ------------------------------------------------------------------------ // looking for the cookie if ($$lvc_cookie_name == '1') { // this cookie is only on my machines $insert = false; setcookie($lvc_cookie_name, '1', time() + (3600*100000)); } else { $insert = true; // no insertion if referer comes from the site itself if (isset($HTTP_REFERER)) { for ($cnt = 0; $cnt < sizeof($lvc_ignore_referers) && $insert; $cnt++) { $insert = $insert && (strtolower(substr($HTTP_REFERER, 0, strlen($lvc_ignore_referers[$cnt]))) != $lvc_ignore_referers[$cnt]); } } // no insertion for my own machines for ($cnt = 0; $cnt < sizeof($lvc_ignore_machines) && $insert; $cnt++) { $insert = $insert && ($REMOTE_ADDR != $lvc_ignore_machines[$cnt]); } // no insertion if not the good server (test servers for example) for ($cnt = 0; $cnt < sizeof($lvc_ignore_servers) && $insert; $cnt++) { $insert = $insert && ($SERVER_NAME != $lvc_ignore_servers[$cnt]); } } if ($insert) { $found = false; $gDb = new Db; if ($connected = $gDb->DbConnect($lvc_db_host, $lvc_db_user, $lvc_db_password, $lvc_db_database)) { // does this visitor is in [$lvc_between_2_visits] last visitors ? $query = 'SELECT MAX(CODE) FROM '.$lvc_table_visitors; if ($gDb->DbQuery($query) && $gDb->DbNumRows() != 0) { if ($gDb->DbNextRow()) { $record = $gDb->Row; $max_code = $record[0]; $query = 'SELECT COUNT(CODE) '; $query .= 'FROM '.$lvc_table_visitors.' '; $query .= "WHERE ADDR='".$REMOTE_ADDR."' "; $query .= 'AND CODE BETWEEN '.max(0, $max_code - $lvc_between_2_visits + 1).' AND '.$max_code; if ($gDb->DbQuery($query) && $gDb->DbNumRows() != 0) { if ($gDb->DbNextRow()) { $record = $gDb->Row; $found = ($record[0] > 0); } } } } } if (!$found) { $referer = $HTTP_REFERER; $url = parse_url( $referer ); $ref_host = $url['scheme'].'://'.$url['host'].'/'; if ($ref_host == ':///') $ref_host = ''; elseif ($ref_host == 'news:///' || $ref_host == 'news://news/') $ref_host = 'news:'; $rows_list = 'DATE, ADDR, HOST, AGENT, REFERER, REF_HOST'; $agent = extract_agent($HTTP_USER_AGENT); $values_list = "'" . date('Y/m/d H:i') . "',"; // DATE $values_list .= "'" . $REMOTE_ADDR . "',"; // ADDR $values_list .= "'" . gethostbyaddr( $REMOTE_ADDR ) . "',"; // HOST $values_list .= "'" . $agent . "',"; // AGENT $values_list .= "'" . AddSlashes(strip_tags($referer)) . "',"; // REFERER $values_list .= "'" . AddSlashes(strip_tags($ref_host)) . "'"; // REF_HOST $query = 'INSERT INTO '.$lvc_table_visitors.' ('.$rows_list.') VALUES ('.$values_list.')'; if ($connected) { $gDb->DbQuery($query); } else { $log_file = @fopen($lvc_log_file, 'a'); if ($log_file) { fputs($log_file, $query . ";\n"); fclose($log_file); } } } } ?> Can anyone help me?
  13. Ok, I guess that what I am really trying to get at here is this... I bought a domain several months back for the sole purpose of housing a statistics script, that does exactly that; it sends back information about the viewers of my various sites. This script itself is rather unconventional, as I have recently found other scripts that show much more information, such as phpMyVisites and Trace Watch, two wonderful open source stats scripts that I would suggest to anyone. However, I continue to use the original script that I had found, but only to capture the viewers IP address, which neither phpMyVisites nor Trace Watch do. So, moving along... The reason I have come to post this today is this; I have recently found that this php stats script that I have (the unconventional one) has proven to be pretty good for tracking the IP's, the ISP's, and the browsers of the people who view my myspace page... Yes yes I know, myspace!! What a joke, but I do have one. What I am trying to accomplish here is to be able to also return the viewers primary myspace photo, a URL to the viewers profile page, or maybe just the users myspace ID and I will handle the rest. But, at this point I would just like to be able to better know who each person is, rather than just having their IP address... I though that this might be done by retrieving the cookies that mayspace generates. Would you happen to have a better suggestion for me? ~Chris
  14. Is it possible to pull the cookies of a viewers browser when you are using a php script to track them on your site and return the info to a stats page, just as it would be done using javascript? If it sounds like I don't know what I am talking about, it's because I don't. I am a novice at best. I am running a stats script on my server and using it to track the stats of individuals that view my site page that I have the code snippet on that returns the info back to my stats page. I have done this my embedding the url to the .swf file that pulls that stats in my sites page. Well, it's not an actual .swf file. I have the .htaccess file set like this RewriteEngine on RewriteRule image.swf image.php and inside the image.php file is this <?PHP $lvc_include_dir = 'include/'; include($lvc_include_dir.'new-visitor.inc.php3'); ?> I am wondering if it is possible to retrieve the cookies as well using php scripting... Either the cookies of my site or of another site that are saved to the viewers computer... Please let me know if this is at all possible.. ~Chris
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.