Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. the \n only adds a new line into the source code... you would want to use the <br> tag instead
  2. no... not efficiently... and theres no time like now to start ;-) it makes page dynamics SOOO much easier and faster...
  3. problem... you have two else statements... [code] if(( $st_id !=null ) and ($mo_id !=null)){ if($pos === false){   setcookie("st_id",$st_id);   setcookie("mo_id", $mo_id);   header("Location:pages/personal_details.php"); }else{ #this should be an elseif()   header("Location:staff/satff_login.php"); }else{ #this is the second   header("Location:http://resource/view.php?inpopup=true&id=2916");   exit(); } }# you also forgot this... [/code]
  4. heres the easiest way of setting a link to the same page, with putting any/if $_GET[] vars [code] <a href="?op=test1"><img src=""></a> [/code] that'll link you to the same page, but have the ?op active... much easier and faster then making it a form.
  5. no... the session id is quite static... shouldnt change anything... besides... why would you need/want to form a sessid? its much easier to call it directly...
  6. just  as a subnote... this is about 2-3x faster Edited: [code] $password = bin2hex(md5($_POST['password'])); [/code] basically the md5 encription "scrambles" the string, so you'd also need to md5() the passwords in the database... other then that... i'd need a little more code to see why your getting white page...
  7. [code]$password = md5($_POST['password']);[/code]
  8. the switch function is ALOT faster as it only makes one choice, instead of asking for every option... your code made 11 choices, switch would make 1
  9. why put the {} around the vars? completly unneccessary... [code]'{$password'}', [/code] and that has an extra '
  10. ya... you forgot the " at the very end... [code] $insert = mysql_query("INSERT INTO `users` (`username`, `password`, `points`, `ip`, `email`, `name`, `gender`, `age`, `location`, `registered`, `last_login`, `admin`, `character`) VALUES ('{$username}', '{$password'}', '5000', '{$REMOTE_ADDR}', '{$email}', '{$name}', '{$gender}', '{$age}', '{$location}', '{$day}', '$timestamp', '0', 'Nerd'")"); [/code]
  11. $_POST is a read only variable... the only way you can write in them, is through a submited form. you'd need to use [code]$textbox=$_POST['textbox'];[/code]
  12. that'll tell you how many fields you have in your array :-) [code] echo count($array); [/code]
  13. wheres your headers? you need them to send most emails almost anywhere... fyi:</br> is completly unneccessary
  14. what i prefer to do... is have this [code] #security --> 1.1.1.1.1 or 0.0.1.0.1 or the likes $result=mysql_query("SELECT * FROM users WHERE `login`='$id' LIMIT 1"); $row=mysql_fetch_array($result); $security=explode(".",$row[security]); [/code] now you can literally turn any feature on/off for some people, and on for others [code] if($security[9]==1) echo 'admin'; #etc [/code]
  15. [code]<? $rs=mysql_query("SELECT * FROM Products ORDER BY ProductID"); while($row=mysql_fetch_array($rs)){ } ?>[/code]
  16. try print_r(row1/row) just to make sure your actually getting the information...
  17. if you have your autoincrement in the id column, this prolly the easiest and fastest... [code] $result=mysql_query("SELECT MAX(id) FROM users"); $row=mysql_fetch_array($result); echo $row['MAX(id)']; [/code]
  18. you forgot a } at the end :-) [code] <? $result = mysql_query("SELECT customer_id FROM $table WHERE $column LIKE '%$searchterm%'") or die ("Unable to execute search.".mysql_error()); while($row = mysql_fetch_array($result)){ $customerid = $row['customer_id']; $result = mysql_query("SELECT * FROM customers, cards, digiboxes WHERE customers.customer_id = cards.customer_id AND customers.customer_id = cards.customer_id AND customers.customer_id = $customerid") or die ("Unable to execute search.".mysql_error()); while($row1 = mysql_fetch_array($result)){   echo $row1['customer_id'];   echo "<br>";   echo $row1['surname'];   echo "<br>";   echo $row1['cardnumber'];   echo "<br>";   echo $row1['serialnumber'];   echo "<br>";   echo "<br>";   echo "<br>"; } } ?> [/code] ... and you probably have error reporting turned off :-)
  19. if theres always 2 commas... then this would skip the first... [code] $pos=strpos($line,","); $pos=strpos($line,",",$pos+1); [/code] that'll tell you exactly where the 2nd comma is.
  20. with that code... you cant resort it down again... just put a limiter on how many it shows... [code]<? if($dir = @opendir("news/")){ $i=0; while(($file = readdir($dir)) !== false){   if($file != ".." && $file != "."){   $i++;   $k=str_pad($i,7, "0",STR_PAD_LEFT);   $date=date("YmHis", filemtime($file)).$k;   $filelist[$date] = $file;   } } closedir($dir); } krsort($filelist); while(list($key, $val) = each($filelist)){ if(!isset($p)){   $p=x;   echo $val; } } ?> [/code]
  21. no... on that webpage, its sorting by reverse key... xtx-->ztx-->xt that should be right... no? if its backwords... change krsort to ksort...
  22. [code]<? if($dir = @opendir("news/")){ $i=0; while(($file = readdir($dir)) !== false){   if($file != ".." && $file != "."){   $i++;   $k=str_pad($i,7, "0",STR_PAD_LEFT);   $date=date("YmHis", filemtime($file)).$k;   $filelist[$date] = $file;   } } closedir($dir); } ?> <form> <select name="selected_dir" > <? krsort($filelist); while(list($key, $val) = each($filelist)){ echo "<option>$val</option>"; } ?> </select> </form>[/code]
  23. this should fix that problem :-) [code] <? function get_ip(){ if(!$ip=@$REMOTE_ADDR) $ip=$_SERVER['REMOTE_ADDR']; return $ip; } echo get_ip(); ?> [/code]
  24. you cant... you'd have to switch them to php ora another language... as html is "static"...
  25. i did say there may need a different sort(asort,ksort...) to further it along... [code]<? if($dir = @opendir("news/")){ while(($file = readdir($dir)) !== false){   if($file != ".." && $file != "."){   $i++;   $k=str_pad($i,7, "0",STR_PAD_LEFT);   $date=date ("YmHis.", filemtime($filename));   $filelist['$date'] = $file;   } } closedir($dir); } ?> <form> <select name="selected_dir" > <?php ksort($filelist); while(list ($key, $val) = each ($filelist)){ echo "<option>$val</option>"; } ?> </select> </form>[/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.