Jump to content

laffin

Members
  • Posts

    1,200
  • Joined

  • Last visited

Everything posted by laffin

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <? include("../Login/session.php"); ?> <? if($session->logged_in){ ?> <form method="post" action="insert.php"> <p>First Name <input type="text" name="first" size="20"> Last <input type="text" name="last" size="20"></p> <p>Address <input type="text" name="address" size="20"> City<input type="text" name="city" size="20"> State <input type="text" name="state" size="20"> Zipcode <input type="text" name="zipcode" size="20"></p> <p>Phone ex.(555) 555-5555 <input type="text" name="phone" size="20"> Cell Phone <input type="text" name="cell" size="20"> </p> <p>Email <input type="text" name="email" size="20"> </p> <p>Age<input type="text" name="age" size="20"> Weight <input type="text" name="weight1" size="20"> Height <input type="text" name="height1" size="20"> Grade Sept. '08 <input type="text" name="grade" size="20"></p> <p>Position: <input type="text" name="position"></p> <p>School <input type="text" name="school" size="20"> Level of Play in '07 <input type="text" name="level" size="20"> Coach's Name <input type="text" name="coach" size="20"></p> <p><input type="submit" value="Send"></p> </form> <? } else echo { ?><H2>Must be logged in</h2> <? } ?> </body> </html>
  2. [/sql]SELECT SUM(price) as total FROM table WHERE user_id=1[/sql] I Wud think that wud work
  3. okay other problems . ? are special characters in patterns. in order to match these as literal (exact) ya need to escape them preg_match_all('@href="/online/frame\.htm\?si=(.*?)&v=1"@', $html, $match);
  4. that's cuz ya using the delimeters within the patters / # set start/end delimeter href="/online/frame.htm?si=(.*?)&v=1" # our search pattern / # end delimeter so it will just look for href=" and think everything beyond that is a optional preg parameter (not a pattern) easiest way change the delimeter @href="/online/frame.htm?si=(.*?)&v=1"@
  5. Just use a session_destroy in yer php code, when yer done with it. at the start of code, maybe ya can use a cookie, to dictate if there is an active session, if(isset($_COOKIE['us']) && !empty($_COOKIE['us'])) { $use_sessions=true; start_sessions(); } this will give ya use of the sessions, if that cookie is set when ya done with the session support setcookie('us',''); destroy_session(); now ya just need a place of when the cookie is set
  6. session_destroy()
  7. LOL Very nice sasa I keep forgetting all the nice functions php provides Coming from a C world.
  8. laffin

    Tokens

    U have to think about that. How does yer script handle tokens/credits (if any)? 1) Dun have it - Ya will have to edit the script to support a credits system. (Hard) 2) It Has it - Ya will have to look how credits are added/subtracted from the users account. (Easy)
  9. U already are doing that $descriprion is returned if the checkbox is checked. if checkbox is left unchecked, nothing is returned checkboxes, only return values when they are checked. so if u have 150 checkboxes, and 2 get checked $_POST['checkbox'] wud return an array of 2 items (not 150) with the $description of those 2 checked as a value
  10. Okay, than definely try using temp files function docode($code) { file_put_contents($tfn="tmp/". time() . ".tmp",$code) ob_start(); include($tfn); $contents=ob_get_contents(); ob_end_clean(); unlink($tfn); return($contents); } should do the trick
  11. gmdate("Y-m-d h:i:s",strtotime("+30 Minutes",strtotime($date))) or gmdate("Y-m-d h:i:s",strtotime($date)+(30*60)) the 1st is easier to understand the 2nd is faster
  12. laffin

    Tokens

    Use the IPN system from paypal. It sends a Payment notification to a script on yer site once a payment is sent to your account. Just depends how ya is using the credit/token system. most ppl use a stored credit system, where their accout can be increased with credits once payment is recieved. and credits are deducted when used on the site.
  13. ya can take lots of different ways. $td = array( array('%','&'), array('<','>'), array(5,6) ); the simplest is using foreach 2 levels foreach($td as $key => $sd) { foreach($sd as $key => $item) { $sd[$key]=htmlentities($item); } }
  14. than consider something where the code is stored in the db. create a random filename store the content into the temp file start ob_start buffering include the file grab the contents stop buffering delete the temp file now ya have the output contents in a string, which ya can do whatever ya want to prevent the user created routine from doing things inadvertently to global vars ya may want to save/restore the global vars and put the above into a function.
  15. ya know, never thougt about tring to use a session with an array usually i thought of sessions like cookies... but they are handled differently, so it may work. but wudn hurt to test it out.....
  16. Not only that, but when u do a massive project. and still in the beginning learning process, you will most likely find a new way of doing something. then inevitably, ya start changing other routines as well. until it becomes a monstrosity of different methods. yep, look, examine and try is best on small projects
  17. Why wud u need the full power of php? Just a question, as i did write a limited gd language for users to be able to generate their own dynamic image signatures. So ya may want to think of going the same way. trying to limit a powerful language, may be more cumbersome than thought initially. when developing a limiting language may be simpler
  18. keep the xml format for use by yer flash proggie construct a php/mysql system, which can autoupdate the db the creation of xml files is not hard to do for php. this can be done dynamicly (reading from the db) or a more fluid way, when u make updates (say on an upload form) which updates the db and the xml file it's not hard at all
  19. Than ya want to keep the existing XML files. How do u update the xml files? is this manual or do u have a system that keeps them updated. if it's xml based, i take it theres more info than just the filename. how are users authenticated, do u have a db? or is it a generic password for all members in a group? u will have to consider, the current methods of the system. and how much ya willing to bend from those methods.
  20. well he has the structures already in an xml content, so it can be done with just php alone, with extensions to read/parse the xml files. a lot more work. Easier as cooldude states, using MySQL to control the directory structure, with a flag which can be used, what's the lowest class that can access the node, or which class this node belongs to.
  21. Yep, or wander around the forums here, and see if you can come up with some answers for some of the questions. These are small, and fast to create, if u have a good grounding in the basics of programming. dun worry if yer answer is different than others, seen some where there are 10 different answers. but if the solution works
  22. Never used a tutorial, but persistant in coming up with solutions. coding is experimentation. Tutorials show ya one way of doing somethings. but ya should always have the basics down, so ya can experiment.
  23. if ya dun have any nesting than preg_match prolly the easiest way to go, if ya got some nesting going on, than ya will have to build a tokenizer/parser to go balance out the begin delimeter and the ending delimeter.
  24. either method, you have to consider the data. and codes ya have to avoid, and how to overcome them. data - shudn contain url/html code serialize/unserialize - works great with arrays, but will more than likely have undesirable characters. so u combine either method with urlencode and urldecode, if yer array contains " & + ? ya may need to add another layer, using htmlentities so on the form ya shud use: <input type=hidden name=comparr value=" . urlencode(htmlentities(serialize($newarray))) . "> to extract the info go in reverse if(isset($_POST['comprarr'])) $arr = unserialize(html_entity_decode(urldecode($_POST['comparr']))); yer processing form shud validate and sanitize any input from the user. otherwise ya will end up with errors
  25. check boxes only return info if it's checked otherwise ya dun get anything from the checkbox below is a sample script to show you what i mean. <?php if($_SERVER['REQUEST_METHOD']=='POST') { if(isset($_POST['cb'])) { $cbv=$_POST['cb']; echo " Checkboxes checked =" . implode(',',$cbv) . ""; } } ?> <html> <body> <form method="POST"> <INPUT TYPE='checkbox' name='cb[]' value='0'> <INPUT TYPE='checkbox' name='cb[]' value='1'> <INPUT TYPE='checkbox' name='cb[]' value='2'> <INPUT TYPE='checkbox' name='cb[]' value='3'> <INPUT TYPE='checkbox' name='cb[]' value='4'> <INPUT type="submit"> </FORM> </body> </html> but since u need all the values that checkboxes contain. your best bet is add a hidden field with the list <INPUT TYPE='hidden' NAME='valid' VALUE='<?=implode('|',$myarrayofvalidids)?>'> than explode and compare it against te values returned by the checkboxes
×
×
  • 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.