Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. MD5 is secure but due to raindow tables its better to user MD5 with salt ie $pass = "hello"; $salt = "blarblar"; MD5(MD5($pass).$salt); now the salt can be stored with the password (extra field needed) or you can have a static site salt code (one that every user will use) personally i generate a random 8 char code for each user and store that in the database you could use sha1 instead it is a little more secure
  2. thanks:) i forgot to say change $newArray[] = $V; to $newArray[$K] = $V; if you wish to keep the arraykeys
  3. in which case that if statment won't be called as its 1 not 2
  4. maybe the reading the error would help.. or atleast let us know what the error is.. either that or i could guess out of memory or a timeout..
  5. before the if($vendLevel == "2") add var_dump($vendLevel); die; what is returned
  6. try this $uSql = "SELECT * FROM jos_findit, jos_findit2"; $uResult = mysql_query($uSql, $connection)or die(mysql_error()); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)){
  7. what are you trying to do, exactly? in anycase heres a basic example <?php $theArray = array(0,1,2,3,4,5,6,7,8,9); echo "<pre>"; print_r($theArray); $theArray = RemoveFromArray($theArray, 4); print_r($theArray); function RemoveFromArray($theArray, $item) { if( !is_array($theArray) ) return false; $newArray = array(); foreach($theArray as $K => $V) { if($K != $item) { $newArray[] = $V; } } return $newArray; } ?> returns
  8. somthing like this $uSql = "SELECT * FROM table1, table2 where table1.ID = 10";
  9. what type of excel files are you using? i know thats a very open question what i mean is, are they very complex (lots of calculation, charts etc) or kinda simple (just X worksheet with rows of data)
  10. ok in regex you can use parenthes to capture a part of the string but sometime you want to group a few letters but are not going to use them so to speed things up you use (?:blar) instead of (blar).. ie $theData = "hello world"; preg_match_all('/(hello)(world)/si', $theData, $result, PREG_PATTERN_ORDER); $result = $result[0]; print_r($result); returns an array [0] = hello [1] = world $theData = "hello world"; preg_match_all('/(?:hello)(world)/si', $theData, $result, PREG_PATTERN_ORDER); $result = $result[0]; print_r($result); returns an array [0] = world
  11. can you post the sting you start with the string you wish to have after filtering it.. because i don't know what you mean by
  12. seams to work here ie <a class=subclass href="www.ask.com">click</a> returns as for <form action="new.asp" method="post"> preg_match_all('/<form(?:.*)(?:action=)(?:"|\')([^"\']*)/si', $subject, $result, PREG_SET_ORDER); will find the value of action or preg_match_all('/(??:href\s?=\s?|action\s?=\s?)(?:"|\\'))(.*?)(?:"|\\')/si', $subject, $result, PREG_SET_ORDER); to extend the one above
  13. try google ajax "drop down" forms php link
  14. try this <?php $conn=@mysql_connect("localhost", "$dbuser","$dbpass") or die("Could not connect". mysql_error()); $rs = @mysql_select_db($db, $conn) or die("Could not select database". mysql_error()); $sql="SELECT * FROM reminders WHERE dom='$today' AND timehour='$thishour' AND timeminute='$thisminute' AND active='yes'"; $rs1=mysql_query($sql,$conn) or die("Could not execute query". mysql_error()); while($row= mysql_fetch_array($rs1) ) { $callname = $row['name']; $callid = $row['callid']; $timehour = $row['timehour']; $timeminute = $row['timeminute']; $meridian = $row['meridian']; $callinno = $row['callinno']; $passcode = $row['passcode']; $locationname = $row['locationname']; $locationaddress = $row['locationaddress']; $locationcity = $row['locationcity']; $locationstate = $row['locationstate']; $locationcountry = $row['locationcountry']; $sql2="SELECT * FROM xocai WHERE active='yes' AND call1='$callid' OR call2='$callid' OR call3='$callid' OR call4='$callid' OR call5='$callid' OR call6='$callid' OR call7='$callid' OR call8='$callid' OR call9='$callid' OR call10='$callid'"; $rs2=mysql_query($sql2,$conn) or die("Could not execute query". mysql_error()); while($row= mysql_fetch_array($rs2) ) { $list .="$firstname = ".$row2["firstname"]." $address = ".$row["areacode"]."".$row["prefix"]."".$row["suffix"]."".$row["carrier"].""; echo ($list); if (!$list ) echo("busted"); } } ?> added $rs1 $rs2
  15. bypassed ? you could also setup .htaccess file I stop any access to the directory appart from the ip address of the company providing the service. then have a php script read from that path or have the files stored outside of the public_html folder and use php to read from their..
  16. It is possible i am using it on Windows, Mac & UNIX, the only problem i have had is with the calculation fields but i think i fixed that awhile ago.. will need to check the code COMs were not used, but i used it with version 97 to 2000 (maybe 2002) need to check
  17. Yes is possible, i know this because i have it running on one of my WebApps, infact i am going to be working on it again to make some improvement, the code is quite old now an their are a few bugs.. $30,000 is OTT, as the webapp itself isn't sold even near that and its pure php, lol (either that or i need a better sales guy)
  18. maybe you should post the whole file, half the info doesn't help as much as all of it
  19. i don't understand what you mean
  20. Great and its my home time.. oh remember to click solved (bottom left)
  21. update if( $uHP == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } to if( $uHP == 0) { echo $enemy->display_name." Wins"; }elseif( $eHP == 0){ echo $enemy->display_name." Wins"; }else{ //neither did any damage (stops inf. loop) echo "Attack was unsuccesful"; } Also PLEASE don't bump your post unless an hour has passed..
  22. aahhhh ahah <?php include('inc/header.php'); $eID = $enemy->ID; $uID = (int)$_GET['ID']; if ($uID > 0) { #if called from header! $enemysql = @mysql_query("SELECT * FROM users WHERE ID = '$eID'"); $enemy = @mysql_fetch_object($enemysql); $usersql = @mysql_query("SELECT * FROM users WHERE ID = '$uID'"); $user = @mysql_fetch_object($usersql); echo "$user->display_name"; echo ' VS. ';echo "$enemy->display_name<br>"; }else{ die("error"); } if ($enemy->ID == $user->ID) { echo' You cant attack yourself!'; } elseif ($user->hp <= 0) { echo ' You are in NO condition to do battle'; } elseif ($enemy->hp == 0) { echo ' Your Enemy Is Already Dead!'; } elseif ($user->energy <= 4) { echo ' Not enough energy!'; } elseif ($user->attack < $enemy->defense) { echo ' You look at your opponent, and wet your pants at his/her strength. You lose the battle.<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$user->ID'"); } elseif ($user->defense > $enemy->attack) { echo' Your opponent takes one look at you, and dies in fear<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$enemy->ID'"); } else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); $uHP = $user->hp; $eHP = $enemy->hp; //temp values $edmg = 1; $udmg = 1; while ( $uHP > 0 && $eHP > 0 && ($edmg > 0 || $udmg > 0) ) { echo "User HP:".$uHP; echo "<br>Enemy HP:".$eHP; $edmg = 0; $udmg = 0; if($attacker) { $edmg = (int)($user->attack - $enemy->defense); $eHP = (int)($eHP - $edmg); echo $user->display_name." has done $edmg damage against ".$enemy->display_name."<br>"; }else{ $udmg = (int)($enemy->attack - $user->defense); $uHP = (int)($uHP - $udmg); echo $enemy->display_name." has done $udmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; flush(); //add } if( $uHP == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =($eHP) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =($uHP) WHERE ID = $user->ID"); } include('inc/footer.php'); ?>
  23. ok lets see if its just taking too long will only loop 10 times (test) <?php include('inc/header.php'); $eID = $enemy->ID; $uID = (int)$_GET['ID']; if ($uID > 0) { #if called from header! $enemysql = @mysql_query("SELECT * FROM users WHERE ID = '$eID'"); $enemy = @mysql_fetch_object($enemysql); $usersql = @mysql_query("SELECT * FROM users WHERE ID = '$uID'"); $user = @mysql_fetch_object($usersql); echo "$user->display_name"; echo ' VS. ';echo "$enemy->display_name<br>"; }else{ die("error"); } if ($enemy->ID == $user->ID) { echo' You cant attack yourself!'; } elseif ($user->hp <= 0) { echo ' You are in NO condition to do battle'; } elseif ($enemy->hp == 0) { echo ' Your Enemy Is Already Dead!'; } elseif ($user->energy <= 4) { echo ' Not enough energy!'; } elseif ($user->attack < $enemy->defense) { echo ' You look at your opponent, and wet your pants at his/her strength. You lose the battle.<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$user->ID'"); } elseif ($user->defense > $enemy->attack) { echo' Your opponent takes one look at you, and dies in fear<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$enemy->ID'"); } else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); $uHP = $user->hp; $eHP = $enemy->hp; //temp values $edmg = 1; $udmg = 1; $count = 10; while ( $uHP > 0 && $eHP > 0 && ($edmg > 0 || $udmg > 0) && $count>0 ) { $count = $count - 1; echo "User HP:".$uHP; echo "<br>Enemy HP:".$eHP; $edmg = 0; $udmg = 0; if($attacker) { $edmg = (int)($user->attack - $enemy->defense); $eHP = (int)($eHP - edmg); echo $user->display_name." has done $edmg damage against ".$enemy->display_name."<br>"; }else{ $udmg = (int)($enemy->attack - $user->defense); $uHP = (int)($uHP - udmg); echo $enemy->display_name." has done $udmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; flush(); //add } if( $uHP == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =($eHP) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =($uHP) WHERE ID = $user->ID"); } include('inc/footer.php'); ?>
  24. OK well we know its the while... ok i am running out of idea.. edited for null damage <?php include('inc/header.php'); $eID = $enemy->ID; $uID = (int)$_GET['ID']; if ($uID > 0) { #if called from header! $enemysql = @mysql_query("SELECT * FROM users WHERE ID = '$eID'"); $enemy = @mysql_fetch_object($enemysql); $usersql = @mysql_query("SELECT * FROM users WHERE ID = '$uID'"); $user = @mysql_fetch_object($usersql); echo "$user->display_name"; echo ' VS. ';echo "$enemy->display_name<br>"; }else{ die("error"); } if ($enemy->ID == $user->ID) { echo' You cant attack yourself!'; } elseif ($user->hp <= 0) { echo ' You are in NO condition to do battle'; } elseif ($enemy->hp == 0) { echo ' Your Enemy Is Already Dead!'; } elseif ($user->energy <= 4) { echo ' Not enough energy!'; } elseif ($user->attack < $enemy->defense) { echo ' You look at your opponent, and wet your pants at his/her strength. You lose the battle.<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$user->ID'"); } elseif ($user->defense > $enemy->attack) { echo' Your opponent takes one look at you, and dies in fear<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$enemy->ID'"); } else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); $uHP = $user->hp; $eHP = $enemy->hp; //temp values $edmg = 1; $udmg = 1; while ( $uHP > 0 && $eHP > 0 && ($edmg > 0 || $udmg > 0) ) { echo "User HP:".$uHP; echo "<br>Enemy HP:".$eHP; $edmg = 0; $udmg = 0; if($attacker) { $edmg = (int)($user->attack - $enemy->defense); $eHP = (int)($eHP - edmg); echo $user->display_name." has done $edmg damage against ".$enemy->display_name."<br>"; }else{ $udmg = (int)($enemy->attack - $user->defense); $uHP = (int)($uHP - udmg); echo $enemy->display_name." has done $udmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; flush(); //add } if( $uHP == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =($eHP) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =($uHP) WHERE ID = $user->ID"); } include('inc/footer.php'); ?>
×
×
  • 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.