Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. yes... it would work that way... :-) strpos() is faster... just if you go that way, just strtolower() the $_POST'd email first...
  2. $pass=md5($_POST[password]); easy enough to keep it from being seen properly... but completly hackable...
  3. with that script, it saves all your user info into the $_SESSION[user]... so if you want their name somewhere on the page... just echo $_SESSION[user][fullname]; or the likes...
  4. sorry... not really sure what you mean by that... this should work as is... but it really depends on how your script works... function validEmail($address){ if(eregi("^[a-z0-9]([\._\-]?[a-z0-9])*@[a-z0-9]([\.\-]?[a-z0-9])*\.[a-z]{2,}$", $address)) return true; else return false; } if(validEmail($_POST[email])){ if(strpos($_POST[email],'bad@email.host')!==false){ die('I dont like that user... go away!'); }else{ #continue your script } }
  5. a) this is a help forum... we help you, with your programs... we dont build em for you... b) its a competition! if i did the work, and built your functions... i'd expect the prize... not tryin to bash you atall... just dont expect us to build your pages... were here to help you... not to do for you...
  6. you can set sessions to last far longer then 20 min... i've left mine for days, and returned and it was still active... sessions are great, because your storing it on the server... and is near unhackable(if done right)...
  7. too complicated... <?php $host="localhost"; // Host name $username="myusername"; // Mysql username $password="mypassword"; // Mysql password $db_name="raphkat.co.uk_cart"; // Database name mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $username=addslashes(strip_tags($_POST['username'])); $password=md5($_POST['password']); $result=mysql_query("SELECT * FROM `users` WHERE `username`='$username' and `password`='$password' LIMIT 1"); $row=mysql_fetch_array($result); if(!empty($row)){ $_SESSION[user]=$row; header("location:index.php"); }else{ echo "You have entered an incorrect username... Please try again"; } ?>
  8. if(validEmail($_POST[email])){ if(strpos($_POST[email],'bad@email.host')!==false){ FLEEFROMMYWRATH($baduser); }else{ } }
  9. thing about using $_REQUEST... is that it contains both $_POST and $_GET... now... as that seems a good thing... its not always is... a) it can be a huge security hole, if the variables are not properly verified and/or cleaned up... b) if something comes in by the same name through $_POST and $_GET, making $_REQUEST[$name]=array('name1','name2'); which could cause some serious errors... so... $_REQUEST may be helpful, i'd just be really careful with how and where you use em... definatly not for logins
  10. sessions and cookies are very similar... cookies store on the computer, sessions store on the server that much said... cookies cannot contain arrays so easily... sessions can... when you do the login, just store their data into $_SESSION ($_SESSION[user]=$row) then anywhere on the page, you can use any of that information via $_SESSION[user][fullname]... for example :-)
  11. if you get a premade one, you have to stick with their setup... their functions and the likes... if you want anything special... thats... too bad... if you make one, you get full control of what you want it to do, but a) you have to debug yourself, and b) it'd take more time to set up fully that much said... both routes do work, and both do have (dis)advanatages of their own... if you have more time, i suggest you make it, if you need it up and running ASAP, get a premade one...
  12. well... all the product information comes from the database... and honestly... i REALLY wouldnt want to clean up a database after everybody for those of you out there who look at a page, add stuff to your cart, then close the window(you know who you are)... but i keep all the non static stuff active in the $_SESSION[cart], so you know exactly what their getting... product id -> so you know what they are getting... can access that product, so you have all the static stuff(price, weight, amount in stock, etc...) quantity -> so you know how many their getting(if set to 0, removes from cart) colours -> so you know what colour they want(depending on availability) specials -> if they want any thing special done with the order therefore... the only thing thats in there besides customary stuff... is `id`... which again, allows you to access the product, then apply their custom stuff :-)
  13. $_SESSION the way i set mine up... was like this... $_SESSION[cart][]=array(id=>'product id#',quanity=>'#',colours=>'red|white(for example)',special=>'text'); but thats just me... then i have my functions to get all my other importants... weight, # in stock,etc...
  14. personally... i think we should abolish that function... so much of the internet is java/ajax enhanced... just those hackers out there who give everybody a bad name
  15. echo '<td width="150" height="120" align="center" valign="middle" bgcolor="#781616"><img src="'.$fullimage[$xx].'" width='".$width[$xx].'" height="'.$height[$xx].'" border="1" onclick="MM_openBrWindow(\'preview.php?pic='.$fullimage[xx];.'\',\'MyPreview\',\'width=500\',\'height=500\')"/></td>'; should work... :-D
  16. ohya... also with... if($any_variable == '0'){$any_variable = "No";} if($any_variable == '1'){$any_variable = "Yes";} you prolly want to code it this way... its alot faster ;-)... switch($any_variable){ case "0": $any_variable="No"; break; case "1": $any_variable="Yes"; break; }
  17. if you have them with specific $var names... no theres prolly not a better way of getting at them $var names... if you want to destroy $vars... unset($var1,$var2);
  18. well... thats pretty easy... top of your pages, put this... <noscript>WHAT DO YOU THINK YOUR DOING!?!? TURN JAVASCRIPT BACK ON!!!</noscript> or something to that affect... LOL
  19. personally... i dont believe in standards... its the people that work outside the box that get anywhere in the programming world... personally... i as a rule, use a simple javascript function for my forms... like so... <s cript> function formsubmit(webpage){ document.form.action=webpage; document.form.submit(); } </s cript> <form name=form method=post> <input type=text name=test> </form> <a href="javascript:formsubmit('whereiwannago.php');">text</a> using the standard methods... forms can only go to one location... using this... you can send the same form information to any webpages you want... which does work... but this is SOOOO helpful!
  20. in your login... mysql_query("UPDATE `user` SET online='1' WHERE id='$id' LIMIT 1"); in your logout... mysql_query("UPDATE `user` SET online='0' WHERE id='$id' LIMIT 1"); then on every page... $time=time(); $timeout=time()+(60*60); #now+1hour mysql_query("UPDATE `user` SET timestamp='$time' WHERE id='$id' LIMIT 1"); $query=mysql_query("SELECT * FROM `user` WHERE `online`='1' AND `timestamp`>='$timeout'"); while($row=mysql_fetch_array($query)){ mysql_query("UPDATE `user` SET online='0' WHERE id='$row[id]' LIMIT 1"); } code not tested... but it should work
  21. in your database, make a column for online=0/1... when they login, it switches to 1, when they logout, it switches to 0. then you just... mysql_query("SELECT * FROM `users` WHERE `online`='1'"); . . . you'd want to set a timer... just in case they close the browser, without loging out...
  22. ohya... switch() is going to be faster then your if()elsif()'s... might wanna switch to that :-)
  23. basically... you got 2 options... 1) send out one email with many To:'s... makes some email servers mad... 2) send out many emails with 1 To:'s... works a little slower on the user's end... <?php $to[]='customer1@yahoo.com'; $to[]='customer2@gmail.com'; $reply="noreply@companyname.com"; $from="Company Name Here"; $subject="Newsletter"; $message="<!--html content here-->"; $to=implode(",",$to); mail($to, $subject, $message, $headers); ?> or foreach($to as $t){ mail($t, $subject, $message, $headers); } both of which should work... considering your headers are set properly... you might also wanna check with your host, see if theres a limit on how many people you can send an email to at once... if its too low... choose option 2
×
×
  • 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.