Jump to content
xisto Community

mobious

Members
  • Content Count

    117
  • Joined

  • Last visited

Everything posted by mobious

  1. you just need to setup a new mysql table. for the template system and the db class, i'll just send mine. for the template, you are the one who will edit it. you will make it so that it will match your site.
  2. i just wanna remind everyone that using this script (which uses a flat file) is not recommended if your site has a high overhead. as it will have undesirable effects. your script may not open a file pointer since it is already opened by another. and will render the script useless. if your site has a high overhead, i suggest to migrate to sql.
  3. you completely posted all your templates you didn't post the actual php script. maybe you should post it you wish so that he may have an idea or learn how you did it.
  4. that was just a simplified way to write an if..then..else.. statement.the last part is an example of a loop to register the whole rowset into a multi-dimensional array. and then use the for loop to process the each row.
  5. yes that's the common problem. but imo, it's his username and password. the warning came from ftp_login() which is after ftp_connect(). so he successfuly connected to his server but cannot login due to wrong username or password. it may be because it is using ftp through proxy authentication. ftp_login() has no support for it but i found a script for it. function ftp_parse_response($response, &$errstr) { if(!is_array($response)) { $errstr = 'Parameter \$response must be an array'; return false; } foreach($response as $r) { $code = substr(trim($r),0,3); if(!is_numeric($code)) { $errstr = "$code is not a valid FTP code",$code); } if($code > 400) { $errstr = $r; return false; } } return true;}$user = "user";$pass = "password";$host = "ftp.example.com";$proxyuser = "proxyuser";$proxypass = "proxypass";$proxyhost = "ftp.proxy.com";$conn_id = ftp_connect($proxyhost);if(!$conn_id) { die("cannot connect to proxy");}$commands = array( "USER ".$user."@".$host." ".$proxyuser, "PASS ".$pass, "PASS ".$proxypass);foreach($commands as $c) { $ret = ftp_raw($conn_id,$c); //you can write your own ftp_parse_response func that //use an array of string as input if(!ftp_parse_response($ret,$errstr)) { ftp_close($conn_id); die("cannot login to $host"); }}echo "ok, now connected";
  6. i'll suggest phpbb. i already have integrated my site's authentication with what phpbb uses. so you really get what you want. when they are logged in your site, they are also logged in phpbb. when they register in your site, they are also registered in phpbb. in general, your site and phpbb will have the same auth system. if just want make the header/menu/footer to be the same. you must edit the overall header and footer templates to your liking. i can integrate phpbb to your site. if you are interested just tell me, i can help.
  7. if installation instructions won't be of any use then they really can't be helped. then just go to pre-compiled distributions. much like of PHPTriad. you can get apache and php in their distribution.
  8. it's just what was displayed. just check your username and password. you should also change how you write your code for logging in. use this: if (!ftp_login($ftpcon1, $username1, $password1)) } print "Could not login to remote host</BODY></HTML>";}
  9. i have s simple script which used mysql instead. this script makes use of a template system. if you know php then feel free to modify this to suit your need. otherwise just tell me and i will modify it for you. if (isset($_GET['submit'])) { $strip_var_list = array("shout_name" => "name", "shout_website" => "website", "shout_msg" => "msg"); while(list($var, $param) = @each($strip_var_list)) { if (!empty($HTTP_POST_VARS[$param])) { $$var = trim(htmlspecialchars($HTTP_POST_VARS[$param])); } } $shout_time = time(); $sql = "INSERT INTO shoutbox (shout_name, shout_website, shout_date, shout_msg) VALUES ('{$shout_name}', '{$shout_website}', {$shout_time}, '{$shout_msg}')"; if(!($result = $db->query($sql))) { die(mysql_error()); } header("Location: shout.php?show");} elseif (isset($_GET['show'])) { $template->set_filenames(array( "body" => "shout-body.html") ); $current_time = time(); $sql = "DELETE FROM shoutbox WHERE shout_date <= " . ($current_time - 172800); if(!($result = $db->query($sql))) { die(mysql_error()); } $sql = "SELECT * FROM shoutbox ORDER BY shout_date DESC"; if(!($result = $db->query($sql))) { die(mysql_error()); } while ($shout[] = $db->fetchrow($result)); if (count($shout) > 1 && ($total_shout = count($shout) - 1)) { for ($x = 0; $x < $total_shout; $x++) { $template->assign_block_vars("shout_row", array( "NAME" => $shout[$x]['shout_name'], "WEBSITE" => $shout[$x]['shout_website'], "DATE" => date("M-d-Y", $shout[$x]['shout_date']), "MESSAGE" => $shout[$x]['shout_msg']) ); } } $template->pparse("body");}
  10. list assigns variables as if they were an array. in the get_microtime() function an array was returned from the function explode(). list() then was used to assign variables for the elements of the array. return() is used to return a certain value from function to a variable. example: function test () { $test = "test"; return($test);}//when the function is referenced by a variable, the value returned will be//the new value of the variable.$string = test();//$string now has a value of "test"
  11. my advice to you si learn how to setup your own webserver. i suggest get the latest apache distribution and install it on your system. then go to http://php.net/ and grab the latest php distribution. then configure it to your apache webserver. after a successful setup you can now grab a copy of the PHP Manual. Then your off to your never-ending quest for mastery!!!!! READ! UNDERSTAND! PRACTICE! EXPERIMENT! and then CREATE! ok?
  12. for an array: $array = array("Key1" => "Value1, "Key2" => "Value2"); there are many types of loops. this is one of them. The for loop. this loops works in a simple way. it sets an initial value for a variable then check it with the condition then if it is true, executes the commands inside the loop and executes a command to change the value of the variable and the loop is ready for another processing. In this example the variable is $x and the condition is $x < 10 and the code we used to change the value of $x is $x++ for ($x = 1; $x < 10; $x++) { print $x;} PHP already has a function for generating a random number. the function is rand(). Here is a simple function to get the current microseconds. this function is also used to time your script's execution time. function get_microtime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); }
  13. well maybe they are really active these days and always looking for defects in the phpbb system and releasing various critical updates. well it seems that the phpbb gourp still has a lot to do in terms of securing it's system. even though it is true...it is still my favorite!
  14. well for all of your web developing needs, i recommend dreamweaver mx 2004. it's file manager is my best buddy. of course the standard syntax highlighting is also updated. it also has tools for managing mysql dbs. and has ftp support.
  15. mobious

    I Need Help...

    you can also make the page redirect to the given url. $page = $_GET['page'];header("Location: $page"); this is much more efficient since you do not have to fill one html file with all the html tags for your pages.
  16. microtime() is a funtion that will return the time in seceonds as well with the microseconds. srand() is a function that seeds a random value generator. if you are confused of what a seed and a number generator is.. then just stick to the rand() function. a float is a data type. it is an integer with a decimal point like 1.5, 0.5 and 0.1. array_rand() is a funtion that picks one or more keys. the value returned will be an array with the keys that were randomly picked. An array in PHP is actually an ordered map. A map is a type that maps values to keys. This type is optimized in several ways, so you can use it as a real array, or a list (vector), hashtable (which is an implementation of a map), dictionary, collection, stack, queue and probably more. it's really hard to explain because there are many types of arrays. foreach loop is used with an array. the arguments are used here as a reference to the keys and the values of the array. the loop start from where the pointer is. so if the pointer is at the end of the array, the loop will not work. you have to reset the array.
  17. well i really started out fairly simple. i got interested on what can PHP do. so i searched the net on how to learn it. after a while i learned to setup my own webserver...then a mysql server and evan my own nameserver! then i went to the site of PHP and grab the PHP Manual. that thing is very simple yet complete! that is a must have for me! then i learned PHP!
  18. remember that your shortcut method will only work if the short_open_tag config is set to true. anyways for the shortcuts that i know... another way of writing this: if ("red" == "red") { print "red";} else { print "not red";} is this way... "red" == "red" ? print "red" : print "not red"; this is the standard format: [condition] ? [codes to bexecuted when true] : [codes to be executed when false] for your mysql question... i have a simple loop for you. it may be simple but the product of your loop will be a multi-dimensional array. don't mind the code ok. it's just an example. $sql = "SELECT * FROM armor WHERE armor_type = '{$type}' AND SUBSTRING(armor_name, 1, 1) LIKE '{$first_letter}' ORDER BY armor_name ASC";if(!($result = mysql_query($sql))) { die(mysql_error());}while ($item[] = mysql_fetch_array($result, MYSQL_ASSOC));//do the processing of data here. i always use a for.. loop.for ($x = $start; $x < $display_item; $x++) { if ($item[$x]['armor_sold'] == "") { $armor_sold = "N/A"; } else { $armor_sold = explode(":", $item[$x]['armor_sold']); $armor_sold = implode(", ", $armor_sold); }}
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.