Jump to content

samshel

Members
  • Posts

    837
  • Joined

  • Last visited

Everything posted by samshel

  1. <?php $arrRecords = file("/filepath/filename.dat"); $intCount = count($arrRecords); $arrReferences = array(); $arrReferenceRecords = array(); for($i=0;$i<$intCount;$i++) { $arrColumns = explode("|", $arrRecords[$i]); if(isset($arrReferences[$arrColumns[3]])) $arrReferences[$arrColumns[3]] = $arrReferences[$arrColumns[3]] + 1; else $arrReferences[$arrColumns[3]] = 1; $arrReferenceRecords[$arrColumns[3]] = $arrRecords[$i]; } echo "Duplicate Rows...</br>"; foreach($arrReferences as $key=>$value){ if($value > 1) { echo $arrReferenceRecords[$key]."</br>"; } } ?> PS: Code is not tested...
  2. $dtDate1 = "2005-09-13"; $dtDate2 = "2006-09-13"; $dtDate3 = "2007-09-13"; $dtDate4 = "2008-09-13"; $arrDates = array(strtotime($dtDate1), strtotime($dtDate2), strtotime($dtDate3),strtotime($dtDate4)); sort($arrDates); echo $arrDates[3]; // will display latest date "2008-09-13" echo $arrDates[0]; // will display oldest date "2005-09-13" PS: code not tested.
  3. sorry i am slightly confused.. the code for showing error is on "loginform.php", you are redirecting to "login.php" and you are expecting to see the error there? Sorry if i got it terribly wrong.
  4. <?=$_SERVER['REMOTE_ADDR'];?> gives the IP used by APACHE, if you use localhost as the domainname, it will return 127.0.0.1. Try adding a virtual host and assing the IP of the machine to that.
  5. on failure you are redirecting to login.php, where as index.php is one level up..you sure about the login.php path? try giving full URL, just to debug thats not causing the problem.
  6. samshel

    tabs

    some code will help.
  7. It is inserting '0x0' between each character for the encrypted password.. example: if encrypted password : Xakf12dszO $intTotal = X0x0a0x0k0x0f0x010x020x0d0x0s0x0z0x0O dont understand why it is done so though..may be a checksum or something like that not sure.
  8. Try this line: added ")" at the end of condition if(!in_array($colname, $arrExclude)) { sorry the code was not tested properly.
  9. <?php include ('mysqlconnnection.php'); //include connection $arrExclude = array('col1', 'col2'); $result = mysql_query("SHOW COLUMNS FROM $table") or die("mysql error"); $numColumns = mysql_num_rows($result); $x = 0; while ($x < $numColumns) { $colname = mysql_fetch_row($result); if(!in_array($colname, $arrExclude) { $col[$colname[0]] = $colname[0]; } $x++; } $querycx = 'UPDATE '.$table.' SET '. implode( '=\'\', ', $col ) .'=\'\' WHERE `userName` = \''. $user2 .'\''; echo $querycx; ?> $arrExclude can contain all columns that need not be updated.
  10. what is endless pagination?
  11. can you post some more code?
  12. did you check http://in2.php.net/manual/en/function.preg-replace-callback.php OR you can use preg_match first, here you get an array of matches which also contains your match for "()", that you can later use to replace. hth
  13. do you plan to have differente pages for different clients?? so if you have 100 users you will have 100 pages? or am i getting this terribly wrong.. i think you should have only one page and put the logic to display something or not in the if or switch conditions. PS: OR having different pages depending on type of users ( like admin, user etc) makes more sense to me.
  14. <input type="text" name="username" maxlength="30" size="25" value="<? echo $input->setValue('username').' : '.$input->setError('username'); ?>"> perhaps something like this...?
  15. Check this out.. http://in2.php.net/manual/en/function.imagecopy.php
  16. this will give small case, upper case letters and numbers only <?php if (!preg_match('/^[a-zA-Z0-9]+$/',$data) { echo "FAIL - invalid username"; } ?> PS: added a + at the end to allow more than one charachters. i think you need that ?
  17. please provide table structures if possible,
  18. First tip, always include strings used as array keys in double quotes <?php $result2 = mysql_query("SELECT DISTINCT `Current Residence` FROM `members` ORDER BY `Current Residence`"); echo "<select name='Current Residence'>"; while($nt=mysql_fetch_array($result2)){ echo "<option value='$nt[\"Current Residence\"]'>$nt[\"Current Residence\"]</option>"; } echo str_replace('"', '"', trim($row["Current Residence"])); echo "</select>"; ?>
  19. You can go for a combined primary key of auto id and teacher_id, strings should be avoided in primary keys..
  20. anyways regex would be safe and fast...
  21. what is the problem you are worried about in existing structure ? running out of integers?
×
×
  • 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.