Jump to content

Koobi

Staff Alumni
  • Posts

    419
  • Joined

  • Last visited

    Never

Everything posted by Koobi

  1. sweet :) and thanks for posting the solution here for the others to see. yeah i'm planning to move to another distro soon, either Debian or Gentoo...or both on different PC's glad you sorted it out.
  2. [!--quoteo(post=387953:date=Jun 26 2006, 01:17 PM:name=rashid)--][div class=\'quotetop\']QUOTE(rashid @ Jun 26 2006, 01:17 PM) [snapback]387953[/snapback][/div][div class=\'quotemain\'][!--quotec--] Bane thx for being the only one bothered to reply, appreciate that. i will look into this though Im sure I disabled SELinux at the install stage. I'll check the links you posted, thanks very much dude. [/quote] Not a problem. The only reason I have time to reply here is because the other guys are doing such a great job of replying in other parts of the forum that need attention too :) Hope you sort it out and let me know if need further assitance with this.
  3. did you restart apache after you did? because php.ini is only read in once at startup so you would have to restart apache for it to know that you enabled the mysql extension.
  4. so you are giving me a string whose length you describe in the number of characters it contains and you want me to break it into lines? how many characters exist in a line? i think i might have misunderstood your question. show me an example of the input you would enter and the output you expect. in any case, i believe you would find the functions [a href=\"http://www.php.net/substr\" target=\"_blank\"]substr()[/a] and [a href=\"http://www.php.net/strpos\" target=\"_blank\"]strpos()[/a] useful
  5. if it can be viewed by your browser, there will be 101 ways to view it as the browser sees it. keep in mind that the browser sees no PHP, it only sees the processed PHP (which happens on the hosts server) which is actually HTML. why would you want to hide your Javascript anyway? all it would do is pass a variable to a PHP script on the server, variables that would exist on the page anyway.
  6. i'm moving this from the PHP Help forum because it does not belong there. :Edit: to answer your question, i believe you have to make it a habit to code as often as possible. i didn't touch PHP for about 3-4 months towards the end of last year and i forgot a lot of the function names, syntax's, etc but once i started coding again, it all came back to me. so just try and make coding a habit and start a simple and personal php project on your own. something you would really enjoy coding. that will make you want to learn new things or new ways in which to do the same thing and you might develop little tricks of your own.
  7. you would have to use Javascript because AJAX is actually Javascript (XMLHTTP Request Object). PHP is a server side language so unless you submit your page back to the server, PHP won't even know the page exists. AJAX is Javascript, mainly. which means its client side (on your PC - browser) so the moment it detects you've done something (like clicking on that radio button), the Javascript sends that radio buttons data in the background to your PHP page on the server and retrieves the data it needs frm that (the price of an item in this case) and then dynamically writes that value to a part of the page without refreshing the entire page (because Javascript has the capability to manipulate a part of a page as you may already know) so in short, for the functionality you require, you would have to use a client side language and the best one i can think of is JavaScript at this moment. :edit: if you're looking for an AJAX class, try [a href=\"http://www.xajaxproject.org/\" target=\"_blank\"]Xajax[/a] i'm not particularly a fan of AJAX which makes coding it an effort for me but the Xajax classes make it that much easier.
  8. echo is a language construct, print isn't. echo doesnt return a value while print returns a value actually you can view it all here: [a href=\"http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40\" target=\"_blank\"]What is the difference between echo and print?[/a] if you had looked up echo and print in the manual, you would have come accross that link :)
  9. to add to kenrbnsn's post, you can also do this: [code] <?php if ($foldertype == 'A' || $foldertype == 'B') {    switch ($quantity) {       case '500':       case '1000':       case '2000':       case '5000':           $iprice = $TempAB . $quantity;           break;          default:                  $iprice = 0;                  break; } } ?> [/code] but i've taken the liberty of assuming that the value of $quantity will be a part of $iprice so this is conditional. :edit: i added a 'default' case to be on the safe side. :edit 2: you can also do this if you prefer: [code] <?php $allowed = array('500', '1000', '2000', '5000'); if (($foldertype == 'A' || $foldertype == 'B') && in_array($quantity, $allowed)) {           $iprice = $TempAB . $quantity; } ?> [/code]
  10. that would be because you use double quotes as delimiters (at the beginning and end of the SQL to tell PHP that those are the bounds of the SQL) and you use double quotes within the query as well and PHP gets confused as to which is what since it's only a program that follows coded instructions. you have two options, i prefer the latter: [code] $request = "INSERT INTO buser values(NULL,\"$user\",\"$pass\",\"pass2\",\"email\",\"email2\")"; [/code] [code] $request = "INSERT INTO buser values(NULL,'$user','$pass','pass2','email','email2')"; [/code] why do i prefer the latter? because it's easier to read and is probably fractionally faster than the former. hope that helped :) :edit: also, don't forget the missing brace i mentioned in my previous post :)
  11. [!--quoteo(post=386894:date=Jun 22 2006, 11:13 PM:name=Bane)--][div class=\'quotetop\']QUOTE(Bane @ Jun 22 2006, 11:13 PM) [snapback]386894[/snapback][/div][div class=\'quotemain\'][!--quotec--] what which line is line 20? paste your exact error here and tell us which line is line 20 [/quote] better do that first ^^ or this might turn into a big waste of time :) regarding your language problem, you would, ideally, include the appropriate language file based on the users preferences. this language file would contain a multidimensional array with keys whose values contain the string of text in that language: en_US.php [code] <?php $lang['form']['invalid_entry'] = 'You entered an invalid entry in the form'; $lang['form']['no_empty'] = 'The %s field cannot be empty'; ?> [/code] index.php [code] <?php //assume $_SESSION['language'] will hold the users language preference prefix. // 'en_US' in this example include $_SESSION['language'] . '.php'; if (isset($_POST['stage']) && ('process' == $_POST['stage'])) { process_form(); }else{ print_form($lang); } function print_form() { echo <<<END <form action="{$_SERVER['PHP_SELF']}" method="POST"> What is your name? <input type="text" name="name"> <input type="hidden" name="stage" value="process"> <input type="submit" value="send this on over."> </form> END; } function process_form($myLang) {     if(empty($_POST['name']))     {         echo sprintf($myLang['form']['no_empty'], 'Name');     } } ?> [/code] you would find the function [a href=\"http://www.php.net/sprintf\" target=\"_blank\"]sprintf()[/a] very useful for situations where you have to manage strings in language due to the structural differences accross different languages. personally, i prefer using ini files with [a href=\"http://www.php.net/parse_ini_file\" target=\"_blank\"]parse_ini_file()[/a] there's a simple trick to prevent ini files being viewable via the browser (without any Apache, chmod tricks) so if you do resort to ini files, let me know :)
  12. sounds like an SELinux issue. i can't confidently tell you the solution because i've never tried this but you would probably have to manipulate the .so file using chcon so that you can manipulate the security settings of that particular .so file. It seems as though SELinux is not allowing apache to access it because the system sees it as an unauthorized file. [a href=\"http://en.wikipedia.org/wiki/Security_Enhanced_Linux\" target=\"_blank\"]Security-Enhanced Linux (SELinux)[/a] [a href=\"http://www.nsa.gov/selinux/info/faq.cfm\" target=\"_blank\"]SELinux Frequently Asked Questions (FAQ)[/a]
  13. it's funny..T_VARIABLE is to do with variable names...but to me it seems like you're missing a brace...because your else (before the $pass=md5($pass);) lacks an opening brace but at the end of the PHP you have a closing brace. and it would be best if you told us what line 36 was...especially because i'm not really into the whole counting thing :)
  14. there's not much you have to learn for layout specific graphic tips. first of all, you have to establish a style. depending on what look you like, develop a style and stick to it. don't mix too much into one layout. in general, learn about "colour theory" and know the difference between print and web graphics in terms of resolution (DPI, not screen resolution), colour ranges of monitors (RGB) as opposed to that of printers (CMYK), learn about the different graphic formats for the web (GIF, PNG 8 and PNG 24, JPG) and what browsers support them to what extent (eg: IE6 and lower doesn't support partial transparency for PNG's) and when which format is appropriate. i'm sure you already know about things like "image tiling", etc. you can get all this from google as long as you know what keywords to use. if you have something specific to web design, let me know.
  15. str_replace() accepts arrays in the search and replace parameters: [code] $search = $replace = array(); $connection = mysql_connect($host,$user,$pass) or die ("Unable to connect!"); $sent=$_POST['message']; mysql_select_db($db) or die ("Unable to select database!"); $lang = array(); $query = "SELECT * FROM words"; $result = mysql_query($query); while($row = mysql_fetch_row($result)){ $search[] = $row[1]; $replace[] = $row[2]; } $par = str_replace($search, $replace, $sent); echo "$par<br><br>"; } echo "<form method=POST>Message:<textarea name=message></textarea><br><input type=submit name=submit value=submit></form>"; [/code]
  16. did you try what i suggested? also, i remembered you have to surround your _SERVER vars in curly braces. what which line is line 20? paste your exact error here and tell us which line is line 20 try this: [code] <?php if (isset($_POST['stage']) && ('process' == $_POST['stage'])) { process_form(); }else{ print_form(); } function print_form() { echo <<< END <form action="{$_SERVER['PHP_SELF']}" method="POST"> What is your name? <input type="text" name="name"> <input type="hidden" name="stage" value="process"> <input type="submit" value="send this on over."> </form> END; } function process_form() { echo 'Hello' . $_POST['name'] . '!'; } ?> [/code] and remember, no characters around the [a href=\"http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc\" target=\"_blank\"]heredoc's[/a] delimiters
  17. you're using the heredoc syntax and it requires that no characters exist around their delimiters, even white spaces. so make sure this: [code] echo <<<END [/code] and this: [code] END; [/code] have NOTHING before or after them, not even a space.
  18. maybe this thread will help? [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=58799\" target=\"_blank\"]Good PHP Books, Recommended Books[/a] you could probably find exactly what you want on the web though, if you know what you're looking for :)
  19. Wikipedia's article on [a href=\"http://en.wikipedia.org/wiki/Control_Panel_%28Web_Hosting%29\" target=\"_blank\"]Control panel (Web hosting)[/a] should lead you to many useful things.
  20. I also like the new [a href=\"http://www.phpfreaks.com/forums/index.php?showforum=43\" target=\"_blank\"]Regex within PHP[/a] section. Helps us organize things better :)
  21. that was you at linuxquestions, right? :) (i'm koobi there) this is the only one i know of: [a href=\"http://www.debugconsole.de\" target=\"_blank\"]debugConsole[/a] hope that helped.
  22. [!--quoteo(post=384205:date=Jun 15 2006, 08:54 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 15 2006, 08:54 PM) [snapback]384205[/snapback][/div][div class=\'quotemain\'][!--quotec--] Not necessarily, but most likely. [/quote] as far as i've heard, its the standard editor for any OS qualified to be called a UNIX by the Open Group Base Specifications of IEEE. but i might be mistaken, i only know what i've read :)
  23. hope it goes well. by the way, was the last long list of errors you posted the output of 'make' or 'make test'?
  24. put this file on your host: [code] <?php     phpinfo (INFO_GENERAL); ?> [/code] now view it via http. that should indicate where php.ini is. using ssh, you can edit it. i know vim or vi exists on every *nix machine but vim is weird to use for a first time user. there's also the nano editor but i don't think it comes on every *nix installation. once you make the changes, you have to restart apache for the changes to take place.
×
×
  • 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.