Jump to content

brooksh

Members
  • Posts

    139
  • Joined

  • Last visited

Everything posted by brooksh

  1. I want to encrypt the ID number into another number. But then I want to be able to decrypt the encrypted number so that I can see the original number. Any simple ideas would be appreciated. $original_num = "123-45"; $encrypted_num = encrypt($original_num); echo $encrypted_num; //$encrypted_num = somthing like 73632 $decrypted_num = decrypt($encrypted_num); echo $decrypted_num;
  2. I guess by changing from Apache 1.3 to Apache 2.2 it fixed the problem and exec() works now.
  3. Currently I am running PHP 4.4.7. safe_mode is off. It was working and now it isn't. I'm assuming it is a server setting, but I can't seem to find it. exec("/usr/local/bin/php ./create_account.php \"domain=$domain\" &2>1"); or exec("/usr/bin/php /home/public_html/create_account.php \"domain=$domain\" &2>1"); I would appreciate any suggestions.
  4. How can I get a page to run in the background? I have a page that takes about 2 minutes to run and I don't want a user to wait until the script processes. How can this be accomplished?
  5. How would I echo the output?
  6. Can anyone see what is wrong? or why it won't work. exec("/usr/bin/php ./create.php \"domain=domain.com\" \"username=username\" \"password=password\" \"package=basic\" /dev/null 2>&1 &"); I've also tried exec("/usr/bin/php /home/public_html/order/create.php \"domain=domain.com\" \"username=username\" \"password=password\" \"package=basic\" /dev/null 2>&1 &"); if I run it in shell it works just fine. I thought it used to work but it won't anymore. There is nothing wrong with create.php. Any help would be appreciated.
  7. Here is the solved script mysql_connect("localhost", "username1", "password1") or die("Could not connect to the database."); mysql_select_db("database1") or die("Could not connect to database1."); $result1 = mysql_query('SELECT * FROM table1') or exit(mysql_error()); while ($row = mysql_fetch_assoc($result1)) { foreach ($row as $key => $value) { $row[$key] = $key . " = '" . addslashes($value) . "'"; } mysql_connect("localhost", "username2", "password2") or die("Could not connect to the database."); mysql_select_db("database2") or die("Could not connect to database2."); $result2 = mysql_query('INSERT INTO table2 SET ' . implode(',', $row)) or exit(mysql_error()); }
  8. I've searched and cannot find a script that works to transfer from one database to another. This is what I have, but it doesn't work. Can anyone help me? $resource1 = @mysql_connect("localhost", "username", "password") or die("Could not connect to the database."); $db = mysql_select_db("database") or die("Could not connect to database."); $resource2 = @mysql_connect("localhost", "username2", "password2") or die("Could not connect to the database."); $db = mysql_select_db("database2") or die("Could not connect to database2."); $sql = "SELECT * FROM table1"; $query = mysql_query($sql, $resource1); for ($i=0;$i<($result = mysql_fetch_assoc($query));$i++) { mysql_query("INSERT INTO table2 VALUES * ($resource2"); } mysql_close($resource1); mysql_close($resource2);
  9. Of course. Thanks so much. Sometimes I overlook the easiest things.
  10. Can someone tell me why I'm only getting 1 result back? $sql = "SELECT id,mls,imagename FROM images"; $result = mysql_query ($sql); while($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { $id = $row[id]; $mls = $row[mls]; $imagename = $row[imagename]; $sql = "SELECT id FROM residential WHERE mls = '$mls'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==0){ mysql_query("DELETE FROM images WHERE mls = '$mls'"); $path = "/home/endtek/public_html/images/mlsimages/imls/$imagename"; if (file_exists($path)) { unlink($path); } }//end count=0 }//end while
  11. I have my images in one table, then the data in another. I am trying to cross reference the image to see if the data exists, if it doesn't, I want to delete the image in the table, and the image itself. I wrote a script, but for some reason it doesn't seem to be working. Can anyone tell me what I'm doing wrong? $sql = "SELECT id,mls,imagename FROM images"; $result = mysql_query ($sql); while($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { $id = $row[id]; $mls = $row[mls]; $imagename = $row[imagename]; $sql = "SELECT id FROM residential WHERE mls = '$mls'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==0){ mysql_query("DELETE FROM images WHERE mls = '$mls'"); $path = "/home/endtek/public_html/images/mlsimages/imls/$imagename"; if (file_exists($path)) { unlink($path); } }//end count=0 }//end while
  12. I've been searching to figure out how not to have duplicates in a dropdown menu populated from my database. This is what I have, but how do I change it to get rid of duplicates? <?php $result = mysql_query("SELECT City FROM residential order by City"); echo "<select MULTIPLE NAME=\"City_code\">"; while($row = mysql_fetch_array($result)){ echo "<option name=\"City\" value=\"$row[City]\">$row[City]</option>"; } ?> </select>
  13. I am trying to ignore specific files for download. I have this code, but it still downloads the unwanted file. Also how could I do it for more than one file to ignore? if (file_exists($ignore)) { } else { ftp_get($conn_id, $dir" . basename($file), $file, FTP_BINARY); } }
  14. <?php function check_back_link($remote_url, $your_link) { $match_pattern = preg_quote(rtrim($your_link, "/"), "/"); $found = false; if ($handle = @fopen($remote_url, "r")) { while (!feof($handle)) { $part = fread($handle, 1024); if (preg_match("/<a(.*)href=[\"']".$match_pattern. "(\/?)[\"'](.*)>(.*)<\/a>/", $part)) { $found = true; break; } } fclose($handle); } return $found; } // example: //if (check_back_link("http://www.it-guru.co.uk", "http://www.it-guru.co.uk")) echo "link exists"; ?>
  15. How can I verify that my link exists on another site? I want to search the page and for the script to come back and say that it is there or not. $handle = fopen("$url", "rb"); $contents = 'mylink.com'; while (!feof($handle)) { $contents .= fread($handle, 8192); } if($contents!=""){ echo "No"; } else { echo "Yes"; fclose($handle);
  16. I found this, but it doesn't work. Anyone have any ideas? mysql_query("INSERT INTO newnames (id, name) SELECT id, name FROM names");
  17. First of all, I want to know if this script will even work. I only want it inserted if it doesn't already exist. I know that I could do replace, but I think it would use more of the servers resources. This is about 8000 rows from the first table. And if it is possible to make it more efficient. $sql = "select id,name from names"; $result = mysql_query ($sql); while($data = mysql_fetch_array ($result, MYSQL_ASSOC)) { $newid = $data[id]; $newname = $data[name]; mysql_query("INSERT into newnames SET id=$newid, name=$newname WHERE id > $newid"); }
  18. <?php/** * The letter l (lowercase L) and the number 1 * have been removed, as they can be mistaken * for each other. */function createRandomPassword() { $chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 7) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass;}// Usage$password = createRandomPassword();echo "Your random password is: $password";?>
  19. I am trying to write a script that verifies that a domain resolves to my server. It works fine for .com and .net but anything else it doesn't find the name servers. If anyone has any ideas on how to fix it, or if someone knows a better script, please share it with me. Thanks. $homepage = "test.org"; if($homepage != "") { $end2 = substr("$homepage",-2); $end3 = substr("$homepage",-3); $end4 = substr("$homepage",-4); if($end4==info) {$type=info;} if($end3==biz) {$type=biz;} if($end2==us) {$type=us;} if($end2==ws) {$type=ws;} if($end4==name) {$type=name;} if($end3==com) {$type=com; $lookup="whois.crsnic.net";} if($end3==net) {$type=net; $lookup="whois.crsnic.net";} if($end3==org) {$type=org; $lookup="whois.publicinterestregistry.net";} if($end4==info) {$type=info; $lookup="whois.afilias.info";} $fp = fsockopen( "$lookup", 43, &$errno, &$errstr, 10); fputs($fp, "$homepage\r\n"); while(!feof($fp)) { $buf = fgets($fp,128); if (ereg( "Domain servers", $buf)) { {$dns = fgets($fp,128);} {$dns .= fgets($fp,128);} } if (ereg( "Name Server:", $buf)) { {$dns = fgets($fp,128);} {$dns .= fgets($fp,128);} $dns = str_replace( "Name Server:", "", $buf); $dns = str_replace( "Server:", "", $dns); $dns = trim($dns); } } echo "Name Server: $dns"; if ($dns == "NS1.TESTING.COM") { } else { echo "<table width=100%><tr><td><p align=\"left\"><font color=\"#FF0000\"> <font face=\"Arial\" size=\"2\">You must change the name servers to <b>$homepage</b>. <BR>Go to your current registrar </font><font face=\"Arial\" size=\"1\">(register.com, godaddy.com)</font><font face=\"Arial\" size=\"2\"> and change the name servers to ns1.testing.com and ns2.testing.com</font></font><BR><BR></p></td></tr></table>"; } }
  20. Here is what I need. I want to pull 10 ids from the database based on their rank. Then pick a random id out of the 10 ids. Right now it pulls 10 ids, but I want it to just pull 1 that is random.  Here is what I have. [code]$result=mysql_query("SELECT * FROM contacts WHERE callback ='' AND updated ='' AND processing='' AND noanswer='' AND voting='' ORDER BY rank DESC LIMIT 10"); if ($myrow = mysql_fetch_array($result)) { do { ?> <table width=500 align=center><tr><td><? $id = $myrow["id"]; ?> <body onLoad="document.forms[0].submit()">   <form method="post" name="radio_form" action="<?php echo $SCRIPT_NAME; ?>?id=<?php echo $id; ?>&processing=1&post="> <input type="hidden" name="id" value="<?php echo $id; ?>"> <input type="hidden" name="processing" value="1"> </td></tr></table> <?php } while ($myrow = mysql_fetch_array($result)); }[/code]
×
×
  • 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.