Jump to content

phorcon3

Members
  • Posts

    177
  • Joined

  • Last visited

    Never

Everything posted by phorcon3

  1. mysql table: id name check reply 1 test1 1 1 2 test2 [/td] [td]1 and now i wanna have a cronjob, and i wanna do the following first of all i have to group reply, meaning they must have the same ID number and then i wanna delete those, but ONLY then when ALL those rows, with the same reply ID number ALSO have a 1 in the check column does that make sense? i tried, the following <?php $a = mysql_query("SELECT `reply` FROM `table` WHERE `check` = '1' GROUP BY `reply`"); while($b = mysql_fetch_assoc($a)) { mysql_query("DELETE FROM `table` WHERE `reply` = '$b[reply]'"); } ?> but it would delete ALL rows with the same reply ID number, even tho i ONLY want to delete them when ALL of them have check = 1, but its ignoring it, and i suppose its because of GROUP BY? i hope this makes sense lol
  2. i just thought there may be other advantages ..performance wise.. but i guess not lol thanks
  3. would templates ...integratin a template engine into ur website enhance ur websites performance?
  4. <?php $query = "UPDATE bil_msg_sent SET active='1', payment='CM' WHERE id='".$id_num."'"; ?>
  5. could someone please tell me the advantage of using a template engine (such as Smarty) versus having all the code + design in just one file?
  6. here's the file that will output the data <?php $a = mysql_query("SELECT `col1`, `col2` FROM `table` WHERE `blah` = 'blah' ORDER BY `blah` DESC"); while($b = mysql_fetch_assoc($a)) { $blah[] = $b; } $smarty->assign('blah', $blah); ?> the template file would be: {section name=i loop=$blah} {$blah[i].col1} / {$blah[i].col2} {/section} and i have a function, which i wanna use for all col2s. i wanna shorten the text for col2, which would look somewhat like this <?php short($b['col2']); ?> but how do you do this with smarty? i mean, this wouldnt work of course {section name=i loop=$blah} {$blah[i].col1} / {short($blah[i].col2)} {/section} does anyone here use smarty and can help me with this? id appreciate it. thanks.
  7. hi, i'd just like to know if that's a really stupid idea what i'm trying to do.. so, ive been tryin to come up with a somewhat decent concept for a multi-language website ...but i still think its crap. i don't wanna do the mysql database thingy ..pullin all the data from my database is sure gonna mess up my servers performance, so i dun really wanna do that. it would only work if i had just a few phrases ..but i have entire sites i need translated ...static text problem is, i dun have templates (is that actually bad? would templates be more efficient? but i dunno how long it would take me to integrate smarty on my website ..for ..300 somewhat files ..probably a year) anyways ..if i had templates ..i could just link to different tpl-folders, such as root/tpl/en/ root/tpl/de/ root/tpl/es/ or whatever.. anyway, that probably woulda been the easiest way to do it.. so, what i might try to do is.. like... i dunno maybe create subdomains? or have just regular urls, such as http://www.domain.com -> english http://www.domain.com/de/index.php -> german instead of the subdomains, which of course would be http://de.domain.com/index.php i dont know how secure subdomains would be. so, anyway, heres my idea, and i gotta know if thats stupid and totally unefficient i copy ALL files, and put them in the root/de/ folder ...and just translate all those files (containing both, code & design) i mean there are 300 files, maybe ..but they only have a total of 2MB anyways.. but id just like to know if copying all of em, and translating em into a different language is just retarded or not. reference: i mean i dont know how youtube is doing it ..but when u link to a different site (ie: espana) ..they have subdomains for it (http://es.youtube.com). and i just wonder - do they use templates? and did they just translate those? - or are they using various text files? - or maybe they are usin database storage? - or did they do the same thing im trying to do. copy all files and translate those and put em in a different folder? i hope this makes sense, and it probably doesnt. i just dun know how to explain it better. lol but i really need this. ive been trying all day to come up with something that would be efficient and not mess up my servers performance. and i think i grew a brain tumor by doing so. and i dont mean to spam. but ive seriously searched the entire forum and havent really found anything. and google. nothing. absolutely nothing. ive found this site http://www.stylusinc.com/website/multilanguage_support.htm ..and is the third method, the same i try to do here? i mean, it says microsoft is usin that method lol. dont know if thats true or not, but if it is, im sure theres a good reason for it why they do it that way. i hope someone reads this lol.
  8. i dont see whats there not to understand. i have a website. and i want people to view it in different languages. and i need to change the text according to the users settings. english/german/spanish ..whatever so i created an external file for ALL the text. any text that appears on the SITE that is NOT in the databank (meaning, all the text that hasnt been inserted by a user -> its text I created, and text that will probably never change.) for example Cancel i have that word in my text file under, ie: languages/en/index.php <?php $l['Cancel'] = 'Cancel'; ?> languages/de/index.php <?php $l['Cancel'] = 'Abbrechen'; ?> and i cannot do that with a mysql database. im sure that will most definitely kill my server. and i think its efficient the way i do. but i just thought, maybe i have to split it up. certain TEXT that appears only on CERTAIN pages, and common words such as 'cancel', 'okay' or whatever, to put all those into the INDEX.php ...and text that is not so common in the PAGENAME1.php, PAGENAME2.php files and then have a page file, like: <?php include 'languages/en/index.php'; include 'languages/en/pagename1.php'; ?> or MAYBE it doesnt even matter, if its a huge file.. i dunno. im just viewin it on my localhost server, but i dun really notice any long page loads. but its only me on that site. so... if there are more users, i dun know what will happen ..i just wanted to know what would be the best way to do it. but obviously, no one has ever worked with diff. language files lol i just thought maybe someone has, and could give me a few hints on how to do it. but thanks anyway, haku;) appreciate ya help.
  9. hi, thanks for gettin back to me i just thought ill use a php file instead /languages/en/index.php for example: <?php $l['text1'] = 'Text 1'; $l['text2'] = 'Text 2'; $l['text3'] = 'Text 3'; ?> i dun wanna use mysql for doing that.. its a good idea tho. but i just thought itd be better to use a php file instead cause of loadin time.. and its text that wont change anyway.. its just information for users but my problem is, which might not even be a problem ..i have this file ..and its huge.. i mean, im not quite done yet, but it might have 200kb ..so it will contain ALL the text i have on my entire website just in this ONE file.. and on every single page i have include 'languages/en/index.php'; for example ..and i just wonder, when a user goes on that page (which may only contain a few words from THAT text file), will it load the entire 200kb just for those few words? cause i could imagine ..if there are more users, and the server always has to reload the 200kb just for the TEXT.. that my cpu could explode, lol or i dunno.. or will it only look for the variables contained in that page anyway? i hope this makes sense lol ..i dunno, i just thought i should ask, before im compeletely done with all the text and then it probably wont work anyway. but thanks for helpin me out here;)
  10. for example, if I had 200 files and I would want em to be displayed in diff languages, would one single file, containing all the text kill my server? Cause I can imagine that this file will be somewhere around 300kb if not more? and if I have an include '/languages/en/index.php'; in every single file, would it always load the 300kb everytime someone goes to that page? I'd just like to know what the best way would be to do this. I just thought I put em all into one file, because text like 'Save', 'Submit' and 'Cancel' will appear more than just once in diff. files. so to have a single file for every site would mean I'd have Cancel 200 times. Anyway, I'd appreciate any comments/thoughts on this. Thanks.
  11. <?php putenv("TZ=America/New_York"); $currentdate = date('n-j-Y'); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); if($currentdate > $date){ echo "if $currentdate and time is > than $date $time"; } elseif($currentdate == $date){ echo "if $currentdate is = to $date"; } else{ echo "defult for if $currentdate hasnt come around yet"; } ?> would that work..?
  12. when people link to http://www.example.com/images/test.png ..and test.png doesn't exist I'd like to redirect em to the page 404.php. does anyone know how to do this? would you have to use a htaccess file?
  13. nah, it's ok ..but thanks anyway. i just changed it to GET instead of POST ...doesnt really make a big difference anyway, i guess. but thanks;)
  14. lol thanks for ya help ..but i didnt forget bout the session_start(); that error is just effed up..
  15. i guess u could also have cronjobs to delete accounts that havent been verified within a month or so...
  16. and its the same in FF ..it definitely has somethin to do with the post command, doesnt matter which browser ur usin.
  17. thanks ..im using IE7 tho.. dun tell me its got the same kinda problem.. it wouldn't surprise me tho.
  18. Who cares if they're fake or not? Have em confirm their email? You should send em an email with an unique confirmation link... or wouldn't that work?
  19. When I have a post command on a certain page, and then just link to a different page after the command has been executed, and then try again to go back to the same page I started from by clicking on the 'back button' in IE, I get the following error: Error Message: Warning: Page Has Expired: The Page You Requested...blah blah and my question is, how do you get rid off of that? I hope this makes sense?! It's a search page, and to get rid off of the error I have to click refresh and then OK to get the same results as from before. I suppose it has something to do with the PHP session ID? I just think it's a pain in the ass lol and I wish it would automatically update the page. Appreciate any help. Thanks.
  20. a) I have a main script linked to pretty much all my sites.. and part of the code is: <?php if(get_magic_quotes_gpc() == '0') { if($_POST) { foreach($_POST as $item => $value) { if(!is_array($value)) { $_POST[$item] = trim(mysql_real_escape_string($_POST[$item])); } } } } ?> or would it have to be.. <?php if(get_magic_quotes_gpc() == '0') { if($_POST) { foreach($_POST as $item => $value) { if(!is_array($value)) { $_POST[$item] = addslashes($_POST[$item]); } } } } ?> or is there any better way to make sure all $_POSTs are somewhat secure before being inserted into the DB? I also have some other code too that strips the data before inserted (allowing some html code).. and what should I do for $_GETs? same as for $_POSTs I assume? b) Is there a huge difference between <?php include_once 'file.php'; ?> and <?php include_once('file.php'); ?> I know, both work the same ...but are there any risks involved? c) Uh, I'm gonna ask this too.. lol what works better.. <?php mysql_query("INSERT INTO `table` (`column`) VALUES ('".$insert."')"); ?> or <?php mysql_query("INSERT INTO `table` (`column`) VALUES ('$insert')"); ?> AND <?php mysql_query("INSERT INTO `table` (`time`) VALUES ('".time()."')"); ?> or <?php $time = time(); mysql_query("INSERT INTO `table` (`time`) VALUES ('$time')"); ?>
×
×
  • 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.