Jump to content

soma56

Members
  • Posts

    185
  • Joined

  • Last visited

    Never

Everything posted by soma56

  1. Nice. This forum rocks and you guys are great.
  2. Is it possible to unset a submit button? <?PHP if(isset($_POST['Submit'])) { $date = $_POST['date']; if ($date = '1966-10-03'){ //Do Something } else { //Possible to unset? unset($date); unset($_POST['Submit']); } } else { ?> <form action="" method="post"> <input type="text" name="date" /> <input type="Submit" name="Submit" value="Submit" /> </form> <?PHP } ?> What I'm wondering is if it's possible to unset after submitting in the event of condition x. Should this not in turn echo out the form as it has been unset?
  3. Thanks. I don't want to get a list of pets that were adopted. What I want to do is this: Let's say I have a table that contains only adopted pets. My list contains adopted and unadpoted pets. I wish to add the unadpoted pets only to the list.
  4. I'm racking my brain trying to figure out the most effective way (any way) to insert some information into a table if it hasn't been previously inserted. Here's a simplified sample that I'm working with: -- Column 1 Column 2 Coloumn3 Sue Cat Adopted Jack Dog Adopted Cujo Dog Not Adopted -- The column I'm trying to scrub my loop against is column 3. Here's what I have so far... <?PHP $question = "ADOPTED"; $res = mysql_query("SELECT file FROM temp_data"); while($rw = mysql_fetch_array($res)){ $arr[] = $rw['file']; if (in_array($question, $arr)){ echo "ADOPTED"; //Leave it alone... } else { echo "NOT ADOPTED<br />"; //Insert My New Data } ?> I think I'm on the right path by using the 'in_array' function to check if '$question' variable is within the the '$arr' array, however, logically (to me) it makes sense but it is not working. Suggestions? I should also mention that I'm not receiving any error messages but rather, a completely inaccurate result instead.
  5. Let's see.... You add values to variables but you can declare them before assigning a value... Loops are great - they do things until a specific criteria is met....then I exit or break out of them. Functions are code that do specific tasks (or series of tasks) & can be called upon at any given time during a script. An array is like a....hotel with many different rooms - each room being a different value. I get GET and POST...and know how to use them between pages. Sessions can be used to pass data between pages - they help to keep track of things.... Cookies are like little signatures from your script that you can give to a users browser for any number of reasons. I guess you could say I'm starting to get it. It's only been 4 months. That being said can someone give me a brief and yet simple summary of what a PHP Class is...
  6. I was wondering if there was a way or if it's even possible to determine the type of a proxy using php. When I say type I mean http, socks4 or socks5. Using cURL I think it's safe to assume that if a proxy returns a code of 200 then that proxy is good and http, correct? However, how would I go about determining the type of proxies I have in a list, assuming they are good and socks4 and/or socks5?
  7. Thanks Tibor. I managed to do it with the following: mysql_query("UPDATE players SET test='$myvar' WHERE player_name='$splitname'"); It only took an hour
  8. I'm still in diapers when it comes to MySQL so here goes nothing.... The logic is simple compare tbl1 value 1 with tbl2 value 1 and if there is a match then drop tbl1 value 2 into tble2 value 2 But before that the names between tbl1 value 1 and tbl2 value 1 are backwards (last name first) so I've reversed them in the first table. I've got to the point where I can actually insert into the database but instead of placing the new data where I need it (right beside where the comparison was made) I get a bunch of new rows. <?PHP include "dbconnect.php"; $result = mysql_query("SELECT * FROM players"); while($row = mysql_fetch_array($result)){ if(empty($row['player_position'])){ $fullname = $row['player_name']; $pieces = explode(" ", $fullname); $splitname = $pieces[1]. " " .$pieces[0]; $key = addslashes($splitname); $query2 = "SELECT * FROM players_scrape WHERE player_name LIKE '%$key%'"; $result2 = mysql_query($query2) or die(mysql_error()); while($row = mysql_fetch_array($result2)){ $playerposition = $row['player_position']; mysql_query("INSERT INTO players (test) VALUES ('$playerposition') "); } } } ?> I really hope someone can help me with this.
  9. I hope I'm on the right track. I'm new to MySQL and I'm trying to compare specific rows within two different tables. Basically, what I'm trying to accomplish can be summed up like this: If row1 in table1 contains something like row1 in table2 then return it. This is what I have so far: $query = "SELECT players_scrape.player_name, players.player_name "."FROM players_scrape, players "."where players_scrape.player_name LIKE '%players_scrape.player_name%' = players.player_name"; $result = mysql_query($query) or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ echo $row['player_name']. " - ". $row['player_name']; echo "<br />"; } From what I understand the "LIKE" function returns a row that is similar (not necessarily exact - http://www.webmasterworld.com/forum88/5627.htm). This if what I'm going for. I think I understand how to compare rows from different tables effectively (http://www.tizag.com/mysqlTutorial/mysqljoins.php). What I'm having an issue with is comparing a little more loosely. For example: row1 table1 smith, john row1 table2 JOHN SMITH ...so that MySQL would return results like these.
  10. I found another way...
  11. I'm familiar with 'trim' and even tried the following: $datanew = str_replace(array("\n", "\r", "\t", " ", "\o", "\xOB"), '', $data); but for the life of me I can't remove any white space within the source code which is messing everything else up. This is what I need: What people see.... word1 word2 word3 The source... word1 word2 word3 This is the current situation What people see... word1 word2 word3 The source... word1 word2 word3 For whatever reason, if I can strip the whitespace from the source code then I can use the content accordingly. How would do you strip the white space? Does this even make sense?
  12. thanks, the page doesn't contain any angle brackets. The script isn't removing the content and I'm receiving no error messages. The source code and page still reflects the content that I'm trying to replace. This is what I have tried: echo preg_replace('#(<td class="results" style="border-width: 0px 0px 1px;">)/<.+>(.+)<\/.+>/(</td>)#', 'test', $raw_data); echo preg_replace('!(<td class="results" style="border-width: 0px 0px 1px;">)/<.+>(.+)<\/.+>/(</td>)!', 'test', $raw_data); echo preg_replace("#(<td class=\"results\" style=\"border-width: 0px 0px 1px;\">)/<.+>(.+)<\/.+>/(</td>)#", 'test', $raw_data); I'm not very good at preg_match and I know this issue has something to do with the code between the specific tags I'd like to remove.
  13. What am I doing wrong? <?PHP echo preg_replace('#(<td class="results" style="border-width: 0px 0px 1px;">).*?(</td>)#', 'test', $raw_data); ?> If the contents of $raw_data has: <td class="results" style="border-width: 0px 0px 1px;">THERE IS SOME CONTENT HERE</td> should it not be replaced as so? : <td class="results" style="border-width: 0px 0px 1px;">test</td>
  14. I'm going to write a script that determines if a proxy is good or not through cURL and I would like to know if anyone knows what qualifies a proxy as being good. Let's assume I need to do some surfing through a proxy - that's it. Is there a way in PHP to determine the 'type' of proxy? For example (elite, codeen, etc.) If the proxy page exists is that all I need to run cURL through it or otherwise consider it as being good? Or should I focus my attention towards simply going through the whole process of getting a 'dummy' page using cURL through the proxy and, should it succeed, it will be considered good. I suppose if I can avoid the latter then the script would be more efficient. Advice and suggestions are always greatly appreciated here.
  15. Yes, that would seem to be the obvious thing to miss and initially I hoped for that. This is a real puzzle. The script is quite long and complex. I'll see if I can create a revised version for here. In a nutshell: PHP is performing functions As the status changes I use php to amend a specific file with content for the user I then use Ajax to grab the contents of that page and display it to the user This all happens in a loop very quickly - over and over again. It has successfully stopped some times. While other times I'll start a new session only to find a contamination between the old one and new one. Again, deleting ALL the files on the server did not solve the issue.
  16. Tried that and that's what's mind-boggling. It's PHP loop using ajax. I've deleted the files from the server, cleared my cookies, cache, disconnected the internet, tuned off the computer - and 20 minutes later when I turn everything back on and upload the files it's still running in the loop.
  17. I have a script that is mostly written in PHP with a little JS Ajax for updating. It won't stop. There are some cookies and a couple of simple sessions. I've created a 'destroy' page which destroys the session and deletes the cookies but the program still won't stop. I've deleted the files from the server - the script doesn't exist - and yet if I upload the script after several minutes it updates where it left off. I simply can't figure out how to stop of otherwise 'destroy' this script. What I've tried: A redirect page that includes the following: unset($_SESSION['FOR-EACH-SESSION']); setcookie("FOR-EACH-COOKIE", "", time() - 42000); session_unset(); session_destroy(); die; exit; Deleting the script from the server does not stop the script. Yes, if I go to the script after the files have been deleted I receive a 404 error naturally. Yet, when I upload the files again the script still starts off where it left off, it has sessions from the server that still exist. I don't get. Is there anything else I can do?
  18. MadTechie - you're the man - that' s what I needed to know. Thankyou.
  19. thank you for the response. That's exactly what i'm going to do. I'm trying to convert all the values within the array to lowercase first before using 'array_unique'.
  20. I've figured out how to change all of an arrays keys to lowercase: $lower_case_array = array_change_key_case($mixed_array, CASE_LOWER); But I can't seem to find a way to change the values of an array to lower case. Is there a simple way to do this?
  21. I've created a script to remove duplicate emails and it works perfectly up to about 20k. After that it just stops with no error code. I'm baffled. I've increased the max_execution_time to 2 hours even though this script just takes a few minutes. <?PHP function validElement($element) { return strlen($element) > 1; } function in_iarray($str, $a){ foreach($a as $v){ if(strcasecmp($str, $v)==0){return true;} } return false; } remove_duplicates(); } //Remove more duplicates from list function array_iunique($a){ $n = array(); foreach($a as $k=>$v){ if(!in_iarray($v, $n)){ echo $v; $n[$k]=$v;} } return $n; } //Remove duplicates from list function remove_duplicates() { $p = 0; while ($p != 1) { $rawemaillist = array_values(array_filter($rawemaillist, "validElement")); $p = 1; } $initial = count($rawemaillist); $k = 0; while ($k != 1) { $rawemaillist = array_iunique($rawemaillist); $k = 1; } ?> The script works fine - but only up to around 20 k - which leads me to believe its a server setting issue. Is there something in the php.ini file I should or otherwise a setting that I should be looking at to change???
  22. Looks like I'm getting closer. With some quick testing discovered the following: This worked: $proxypage = file('http://domain.com/proxypage.php'); This didn't work: $proxypage = file('http://subdomain.domain.com/proxypage.php');
  23. I have a script that I've given the user some additional options to either get a random proxy from a URL or list that they have supplied. While getting from the URL is no problem. I banging my head against the wall trying to figure out why the program won't get a random proxy from the list. After submitting their query their proxy list gets written to a temporary file. Everything writes fine and the URL where they are written is the exact format that I need. This works: //Where the user submits a URL <?PHP $proxypage = file('theirproxyurl.php'); ?> Although the page exists in the exact same format as the above link when I write their proxies to a file within the server - it does not work. For example: //Where the user submits a list of proxies - they get written to a file <?PHP $proxypage = file('proxieswrittentofile.php'); ?> Even if I paste the LINK (Note: the page exists with the exact same format) directly in the program where the users proxies were written to it still doesn't work. <?PHP //This doesn't work: $proxypage = file('pasted-working-link-in-exact-same-format.php'); ?> <?PHP //I tried the full URL - it doesn't work either $proxypage = file('http://SUBDOMAIN.fullURLtowrittenproxypage.php'); ?> The only thing that's different is that the file where the proxies are being written is on a sub-domains. Aside from that the pages are absolutely identical down to the <br /> tags. Would sub-domains be an issue for the file function?
×
×
  • 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.