Jump to content

laffin

Members
  • Posts

    1,200
  • Joined

  • Last visited

Everything posted by laffin

  1. urlencode wnt mess with apache mod rewrite but u shud also be using urldecode urlencode makes GET parameters safe for address url usage.
  2. I was playing with sqlite and did come up with a simple table structure, and a query that appears to work. I built my tables like CREATE TABLE [ticketnumbers] ( [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [tid] INTEGER NOT NULL, [number] TINYINT NOT NULL ); CREATE TABLE [tickets] ( [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, [uid] INTEGER NOT NULL, [purchased] TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL ); CREATE TABLE [users] ( [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, [name] VARCHAR(30) UNIQUE NOT NULL, [password] VARCHAR(16) NOT NULL, [email] VARCHAR(64) UNIQUE NOT NULL, [added] TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, [laston] TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL ); well I got a little out of hand on users table, but just needed some visuals. than I created some test data, 100 users, 200 tickets purchases, and 1600 numbers (this was pure random data, so didnt make every ticket hold 12 numbers) a quick check with SQL, to verify tickets and numbers SELECT * FROM ticketnumbers WHERE number IN(12,31,68) order BY tid but ya see how complex it gets? so I made another query that kinda gave me more useful info SELECT tid,count(number) as matches,group_concat(number) as numbers FROM ticketnumbers WHERE number IN(12,31,68) GROUP BY tid ORDER BY matches DESC Hmmm, not bad the query seemed to work, but this was all done with just the db, random generated test date and a lil searching on the net (I learned that group_concat isnt supported in SQLite until version 3.5.4))
  3. Sounds like a lotto script, with outrageous odd. Thats where I would look for some inspiration. U can store the numbers into mysql, but the table will get out of hand quickly, (because its small amount of info stored in huge amounts). So you may want to clear this table often (Like every new game). so u need user authentication (allow ppl to login), and the user chosen numbers table, and a MySQL that GROUPs the numbers against computer drawn numbers.
  4. I prefrt using the id, since almost all tables have a id INT(11) AUTO_INCREMENT field. But yeah, why make a id/hash system if ya dun use em
  5. learn to use elseif's I see a lot of else statement immediately followed by an if statement, however I dun see the logic behind this and u dun really use $ret, u define it, use it in an expression than redefine it. U have: if ($action == "magic_attack") { $ret=$this->skillup("wisdom"); if ($ret==1){ $_SESSION['disp_msg'][] = $lang_fun["gai_wis"]; } wuts the difference? if ($action == "magic_attack" && (($this->skillup("wisdom")) ==1) { $_SESSION['disp_msg'][] = $lang_fun["gai_wis"]; } two if statements right in succession can be placed into one if statement, with the AND (&&) OR (||) operators. since $ret isnt really used for anything, we can remove the definition, and put it directly into the expression
  6. u dun have a definition for $groupname $group = $a_row['group']; I think ya got yer variable names mixed up
  7. its not safe if u understand how strpos works. Use delimeterd around yer strings instead of {$u}:{$p}* use something like \x01{$u}:{$p}* now \x01 will be treated as a special character, CTRL-A, which u shudn be able to enter by keyboard. or ya can use \n which is a newline, which is how lines end in the text file but that means first line, ya either have a comment, or leave it empty
  8. But the code should work to initially detect the bot.... But I really like Schilly's idea of using a session to keep track of specific bots and ya can add in login time, last access time, as well as page visits for bots to give u a general idea of what they commonly visit and improve a page hit.
  9. I wud check 1 of two things 1) if u have path_info enabled (Apache web server only) or 2) read up on .htaccess and redirect the .html type extension to the php file. this way it bypasses yer modal box wors
  10. A Simple Script usually means a horrible UI so ya need some complexity in order to make it easier for the end user. cookies and sessions arent hard. but if ya looking at a simple script, a member blog area isnt recommended cuz that means user authentication, which means if ya want to know its the same user navigating from page to page u will either use a cookie or a session, or u can have em log in every page they navigate (like i said simple script usually means horrible ui) so either make it into a personal blog, or try yer hand at user authentication.
  11. There are a number of questions, u say u use a form from a third party. Do u also keep track of the users, or is this a non-member site. if its a member site, and the forms data is stored in a db. than its just a matter of checking if a member has filled out a form. if its non-member site, then using sessions will work. But sessions usually have a lifespan/expiry date associated with them.
  12. u mean images or custom fonts? if u use images, u will be using gd2 library to create a canvass and than piece together the individual numbers
  13. Just sez the links are encoded, I believe this is because a lot of ppl use spaces and other characters in their filename. As u may have seen some downloaded documents save on yer pooter with %20, and ya end up renaming them %20 = space and such So Yeah, I wud agree with theonlydrayk, and use urlencode on those files or all files.
  14. I think the reason behind this, is because its not .php if it was .php, u can assum its html/php code in the file so include can process the code in the file fread/echo doesnt process the code. it just spits it out to the browser as is. and if its a php script, and ya name it .txt its a bad idea as than anyone can see the script, and look for ways of breaking the script I think u can replace the fread/echo with readfile instead
  15. Ya know I never thought of using the MYSQL for cache storage, this is an excellant idea. The problem of using files as storage, is the permissions, so ya either have to create an empty file and chmod it 0777 or create an empty folder chmod. Both systems have their pros and cons. But using a db, yer not worried about the permissions, ya can store it into a simple table like: CREATE TABLE cache { id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT, name VARCHAR(30) NOT NULL, cache TEXT } or similar, I really do like this idea rhodesa, cant believe didnt think about doing it before.
  16. Categories are rarely updated. This is wut Ive done. I create a cache file with the array serialized on the category editor, is when I build this cache file. Yeah, it may take 50 secs to generate the list but it shud take under a sec to read a file/unserialized the generated list.
  17. The input names dun really matter much. as they are just remapped as $_POST elements keys. but it is all about how u process the $_POST variables. the form input names are just variable names, nothing more but if yer using just <input type='text'> u may want to use a foreach statement instead. if yer asking how to reduce the number of variables cuz its getting messy. you name the form input like a php array <input type="text" name="book[isbn]"> and so on, so when u process the book information, its all in a premade $_POST array $_POST['book'] But forms have no direct relation to how its put into the db. so this question is kinda confusing.
  18. I think this might be better suited for file/foreach/preg_match code the pattern for preg match should be something like (\d+)\s(\w+)\s(\w+@[\w\.]+),?(\w+@[\w\.]+)? but may require tweaking
  19. I agree with the little guy, have to find wut the vars are a cheap way of debugging is to add html comments but the header function wont work than, u can replace that with the meta tag for redirection.
  20. To me it looks like he is connecting to the server ok, but the user he is logging under doesnt have the credentials to access the specific db. If the server is a shared server, some like to add a prefix to table names. so ya have to watch out for that as well. Check under yer Control panel, MySQL section, u should have a PHPMyAdmin tool or similar, to look at the table/field names u do have access to.
  21. U use the SQL WHERE clause with the isbn of the book and updates. this is basic SQL statement, I wud suggest reading some SQL tutorials.
  22. Yeah, I call em lookup arrays myself. its just an array, with just the info u search primarily on, with same keys <?php $EventsOptionsSignup = Array( Array( 'id' => 29, 'event_option_id' => 14, 'event_signup_id' => 11, 'quantity' => 1, ), Array( 'id' => 30, 'event_option_id' => 15, 'event_signup_id' => 11, 'quantity' => 2, ) ); // Create Lookup arrays foreach($EventsOptionsSignup as $key=>$val) $EventLookup[$key] = $val; ?> so now u can find the Event with in_array
  23. it sounds like a profile information page, if a user logs in and have no profile send them to the profile page. U would need: [*]profile view/edit page [*]processing page [*]Edit to login processing page, for redirect to profile page
  24. I should take a look at sqlite its a subset of SQL, but pretty rich. a subset of SQL - just means that there are some features not implemented. SQLite used a flatfile for a database, so be sure to put these files in a non web accessible folder. About only problem u will encounter, is that php5 does come with 2 different versions SQLite2 - usually built in / as well as PDO interface SQLite3 - using the PDO interface
×
×
  • 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.