Jump to content
xisto Community

truefusion

Members
  • Content Count

    3,324
  • Joined

  • Last visited

Everything posted by truefusion

  1. Can anyone verify if the downloading of topics was possible before? I don't recall it being there before. But it's interesting to know that we have the ability to download topics. This is a pretty nice layout, though i wish it had more blue in it. The current color scheme gives an interesting mood to me, which i can't really describe. I like how the posts are displayed like thought bubbles, pointing to the username. I await to see all the other modifications set in place.
  2. "You are no longer my son"—within context, should this be considered a good thing or a bad thing? In a culture that implies that it is family oriented though excluding the son as part of the family after they've obtained "their own," is it good or bad? "How dare you leave this family for your own!" "Wonderful, you've obtaind your own family! I'm proud of you my... Wait, you're no longer my son!" Since it is all a case-by-case thing, it can only be judged by case, on whether it is good or not. Having a bad family, the son says, "Finally, i've obtained my own and am therefore separate!" Any father who is proud of their son isn't going to deny their own flesh and blood. Therefore, if the statement this topic is based on is true, then it is false insofar as it is not something that goes through one's mind when the relative scenarios occur. And if it is generally false, then it is significantly false. If it is significantly false, then it is unnecessary to be mindful of the statement.
  3. Since i didn't really understand the logic of the snippet you have provided, i modified the pattern to be (more) logical. Also, since the snippet you've provided contains variables that are relative to the script that it is part of, i removed those variables, therefore mere copying and pasting the code i provide will only cause problems. However, you can still implement it if you analyze the script you took the snippet from and if you can understand what i provide you. Anywho... <?phpfunction parseUrl($matches){ if (!preg_match("`^https?://|ftps?://`", $matches[0])){ /* assume http:// */ return "<a href=\"http://".$matches[0]."\">» ".$matches[0]." «</a>"; } else { return "<a href=\"".$matches[0]."\">» ".$matches[0]." «</a>"; }}$text = "asdf.com;;$test1 = preg_replace_callback("`(?:https?://|ftps?://)?[\w\.\-_]+/?\S*`i", "parseUrl", $text);$test2 = preg_replace("`(http|ftp)+(s)?:(//)((\w|\.|\-|_)+)(/)?(\S+)?`i", "<a href=\"$1$2:$3$4\" title=\"\">» $1$2:$3$4 «</a>", $text);print $test1."<br/>\n";print $test2."\n";?>
  4. URLs that start with "www" aren't valid absolute links, since they are relative links. If you were to add a ? between (http|ftp)+ and (s), that, if i'm not mistaken, should convert URLs that start with "www" into links; however, the links will be relative. In order to get it to work as expected, you'll have to make your own function that handles the matched results for use with preg_replace_callback() for it to place the protocol (i.e. http://) in the proper place without affecting URLs that already have a protocol prefixed.
  5. Topic is resolved.Please PM any moderator to continue this discussion. Until then, this topic is closed.
  6. If you tell us which forum software you're using, we may be able to point things out specifically rather than in general. What you would look for, however, is if it has its own template system, which it appears to have. If you're new to PHP, you probably won't understand most of the code found in the forum script to be able to pin point where exactly all the files are coming from. I've only examined PHPBB2's source code, and my memory concerning it is a bit faint.
  7. You have the following choices for file managers: Konqueror (KDE 3's is pretty much an all-in-one file manager), Dolphin, Nautilus, Thunar and PCManFM. If you want simplicity, go with Thunar; if you want slightly more than that, go with PCManFM; likewise, Nautilus; likewise, Dolphin; likewise, KDE 3's Konqueror. Puppy Linux. It's basically a lightweight Linux distro (similar to DSL in a sense) that can run on Apple computers. If i'm not mistaken, that is all it was made to do—make Linux available on Apple computers.
  8. The most popular ones are Amarok, Banshee, Kaffiene, Mplayer, etc. The first two only do audio, though, but have good support for media organization. Synaptic package manager should have categories on the side that allow for quick and easy listing of programs (e.g. Multimedia), but it is best to look under the universe repositories.
  9. Those haven't been implemented yet, so for now that kind of support would require modifying the class. But i'm not entirely sure what kind of purpose a button would serve in a form. The only thing i could think of is perhaps to call a JavaScript function, but i can't think of a function that one would normally call in a form other than perhaps submitting the form.
  10. This is a PHP class i put together a long time ago, which others might find useful. The class itself still needs some work to make it (feel) more complete; however, whether or not i apply any modifications here is another story, even though it may be easy to implement these modifications. A Small Description Originally this script was used as a way to write the submitted information to a file but was expanded to do more. It was started to provide an easy way of generating forms without having to constantly write handlers which all pretty much did the same thing. The class allows to specify which elements are to be used for each field (though it currently only supports text input types and textareas) along with attributes with values for each element. The form "template" is merely an array following a certain format. So far the class allows the ability either to write to file or send an e-mail. The e-mail portion of it allows you to specify subject and body of the e-mail; both fields allowing variables from the post data to be inserted. If no custom body message is included, it'll default to something simple. Writing to file, however, isn't yet customizable unless you edit the code. Studying the code will show where things can be improved on. There's a lot of things that could be implemented to allow further customization, but i've only been modifying this script on a per need basis. The script needs more support for other input types. Other things include custom error messages, if these custom error messages should only be for debugging purposes, extra form verifiers (e.g. if a field should be made optional; all fields are currently mandatory), a way to send the user a message, page redirection after a successful form submittion, custom headers and footers (i.e. if there should be some HTML before and after the form), doing away with $this->exclude (if you study the code, you'll know why), etc. But as for now it fulfills pretty basic needs. The Class: $this->verify(); } } function verify(){ foreach ($this as $key => $value){ if (!in_array($key, $this->exclude)){ if ($this->{$key}[1] == "string") { if (empty($_POST[$key])){ $this->errors[] = "<i>".str_replace("_", " ", $key)."</i> is required."; } } else if ($this->{$key}[1] == "integer") { if (!is_numeric($_POST[$key])){ $this->errors[] = "<i>".ucwords(str_replace("_", " ", $key))."</i> needs to be a number."; } } } } if (!is_array($this->errors) && empty($this->errors)){ $this->doSubmit(); } else if (is_array($this->errors) && !empty($this->errors)){ $this->displayErrors(); } } function parse_email_option($field){ preg_match_all("/\\$[a-zA-Z_-]+/", $field, $strs); foreach ($strs[0] as $value){ $field = str_replace($value, $_POST[str_replace("$", "", $value)], $field); } return $field; } function displayErrors(){ foreach ($this->errors as $value){ echo " <div class=\"error\">".$value."</div> "; } } function doSubmit(){ if (is_array($this->email_address)){ # E-mail Subject if (isset($this->email_address[1])){ $subject = $this->parse_email_option($this->email_address[1]); } else { $subject = "Untitled."; } # E-mail Message if (isset($this->email_address[2])){ $message = $this->parse_email_option($this->email_address[2]); } else { $message = ""; unset($_POST['submit']); foreach ($_POST as $key => $value){ $message .= "<b>".ucwords(str_replace("_", " ", $key))."</b> linenums:0'>class form { function form(){ $this->exclude = array("registered", "fwrite", "mail", "filename", "email_address", "errors", "exclude"); $this->fwrite = FALSE; $this->mail = FALSE; } function setFormVars($variables, $filename = NULL, $email_address = NULL){ foreach ($variables as $value){ $this->$value[0] = array($value[1], $value[2]); } $this->filename = $filename; $this->email_address = $email_address; if ($_POST['submit'] == "Submit"){ $this->verify(); } } function verify(){ foreach ($this as $key => $value){ if (!in_array($key, $this->exclude)){ if ($this->{$key}[1] == "string") { if (empty($_POST[$key])){ $this->errors[] = "<i>".str_replace("_", " ", $key)."</i> is required."; } } else if ($this->{$key}[1] == "integer") { if (!is_numeric($_POST[$key])){ $this->errors[] = "<i>".ucwords(str_replace("_", " ", $key))."</i> needs to be a number."; } } } } if (!is_array($this->errors) && empty($this->errors)){ $this->doSubmit(); } else if (is_array($this->errors) && !empty($this->errors)){ $this->displayErrors(); } } function parse_email_option($field){ preg_match_all("/\\$[a-zA-Z_-]+/", $field, $strs); foreach ($strs[0] as $value){ $field = str_replace($value, $_POST[str_replace("$", "", $value)], $field); } return $field; } function displayErrors(){ foreach ($this->errors as $value){ echo " <div class=\"error\">".$value."</div> "; } } function doSubmit(){ if (is_array($this->email_address)){ # E-mail Subject if (isset($this->email_address[1])){ $subject = $this->parse_email_option($this->email_address[1]); } else { $subject = "Untitled."; } # E-mail Message if (isset($this->email_address[2])){ $message = $this->parse_email_option($this->email_address[2]); } else { $message = ""; unset($_POST['submit']); foreach ($_POST as $key => $value){ $message .= "<b>".ucwords(str_replace("_", " ", $key))."</b>: ".$_POST[$key]."<br/><br/>\n"; } } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; if (mail($this->email_address[0], $subject, $message, $headers)){ echo "<h2 style=\"text-align: center;\">Thanks for your time!</h2>"; $this->mail = TRUE; } } if ($this->filename != NULL){ unset($_POST['submit']); $handle = fopen($this->filename, 'a'); $content = ""; $array_keys = array_keys($_POST); foreach ($_POST as $key => $value){ $content .= base64_encode($_POST[$key]); if ($key != $array_keys[count($array_keys)-1]){ $content .= "||"; } } $content .= "\n"; if(fwrite($handle, $content)){ echo "<h2 style=\"text-align: center;\">Thanks for your time!</h2>"; $this->fwrite = TRUE; } fclose($handle); } if ($this->mail || $this->fwrite){ $this->registered = TRUE; } } function doForm() { if (!$this->registered) { echo "\t<form method=\"post\" action=\"\">\n\t<table align=\"center\" border=\"0\" cellspacing=\"10\" cellpadding=\"0\">\n"; foreach ($this as $key => $value) { if (!in_array($key, $this->exclude)) { echo "\t<tr>\n\t<td valign=\"top\">".ucwords(str_replace("_", " ", $key)).":</td>\n"; if ($this->{$key}[0][0] == "text"){ echo "\t<td>\n\t<input type=\"text\" name=\"".str_replace(" ", "_", $key)."\" value=\"".$_POST[$key]."\""; if (is_array($this->{$key}[0][1])) { foreach ($this->{$key}[0][1] as $attr => $value){ if ($attr != "name" && $attr != "value"){ echo " ".$attr."=\"".$this->{$key}[0][1][$attr]."\""; } } } echo "/>\n\t</td>\n"; } else if ($this->{$key}[0][0] == "textarea"){ echo "\t<td>\n\t<textarea name=\"".str_replace(" ", "_", $key)."\""; if (is_array($this->{$key}[0][1])) { foreach ($this->{$key}[0][1] as $attr => $value){ if ($attr != "name" && $attr != "value"){ echo " ".$attr."=\"".$this->{$key}[0][1][$attr]."\""; } } } echo ">".$_POST[$key]."</textarea>\n\t</td>\n"; } echo "\t</tr>\n"; } } echo "\t<tr>\n\t<td colspan=\"2\" align=\"center\">\n\t<input type=\"reset\" value=\"Reset\"/>\n\t<input type=\"submit\" name=\"submit\" value=\"Submit\"/>\n\t</td>\n\t</tr>\n\t</table>\n\t</form>\n"; } }} How to use it in your script: $form = new form();$form->setFormVars( array( // fields array array("first_name", array("text"), "string"), array("last_name", array("text"), "string"), array("age", array("text", array("style" => "width: 70px;")), "integer"), array("body", array("textarea", array("rows" => "15", "cols" => "60")), "string") ), NULL, // (str) path to file, if any; otherwise null array("whatever@wherever.com", 'New e-mail from $first_name $last_name', '<b>$first_name</b> of $age writes: <p>$body</p>') /* array(e-mail, subject, body) for e-mail, if any; otherwise null or leave empty. * Do note the single quotes for the subject and body: important for inserting form post data. */);$form->doForm();The variables within the subject and body of the e-mail, their names must match the field names which you provide in the fields array.
  11. My gallery script has a function that recursively scans a folder and pulls up all the files; i'll pull it up. However, you'll have to work out a way to differentiate between directories and files so you don't get the same message, then you just delete the directories after deleting the files:function deepscan($dir){ if (!preg_match("/\/$/", $dir)){ $dir .= "/"; } $files = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($dir.$file)){ $files[] = $dir.$file; $files = array_merge($files, deepscan($dir.$file)); } else { array_push($files, $dir.$file); } } } closedir($handle); } sort($files); return $files;}
  12. You don't need to set mkdir.php to 0777 for it to create folders. Setting the folder that mkdir.php is in to 0777 should have allowed the script to create the folder in the current working directory. I'm not sure what would be the problem.
  13. Whoa, whoa, whoa—don't send those people over here! Let them continue in their disbelief. (Although, i do have to agree that providing a whois isn't prove within itself.)
  14. Having the PHP file create the folder may be equal to chmodding the folder to 0777—but don't quote me on this. The only way i can think of to keep things as secure as i would assume you would want would be to have a program on the server side that is owned by the same user or group that the folder you are trying to upload to has, which the PHP script(s) communicate(s) with by sending it all the data it needs (e.g. the temporary name of the uploaded file and what mimetype it should be and where to move it to if all is green). This, i would say (or at least in theory), should allow a directory with 0774 permissions to "accept" uploads from users while keeping things satisfyingly secure. However, this may require more access to the server in order to make this executable work the way you want. The only implication i can think of is when it comes time to allow the user to delete what they've uploaded (assuming this is in a multi-user environment), as you wouldn't want users deleting things that aren't theirs. But that shouldn't be (much of) a problem if you have the script check a database of who uploaded the file.
  15. One could probably argue that it was just as evil to even attempt to come up with something that merely looks complex just to try and prove that men are more evil, rather than equally evil, than women and making it public as the final result of the math problem, therefore making women increase in evil appearance, bringing things back to equality.
  16. The only other post i can think of (and i checked, too) where i informed others about version 3 of the Credit System concerning myCENTs and warnings is this one. To my knowledge, both statements still hold true (whether or not they will change in the future i do not know).
  17. Topic is resolved.Please PM any moderator to continue this discussion. Until then, this topic is closed.
  18. Although warnings don't touch the Xisto dollars received from myCents, even during the time that Credit System v2 was up, one warning meant no hosting if you weren't already hosted. Not obeying the rules always meant the possibility of losing your hosting or the possibility of losing the ability to be hosted. There shouldn't be any new exception(s) with the new system, unless perhaps you pay with real cash, but that, i would say, is another story. But to add to this, warnings don't prevent myCents from increasing.
  19. The easiest way i can think of to get the desired result you want is if for the active auction you grab the last three bids before you do anything with the submitted bid. Assuming the result is within an array, you pull out all the usernames from the result, and if the user that is trying to bid again is found three times within the result, deny the bid. This means that you won't need to delete anything and can have a complete bidding history of the active auction while achieving the task you want to accomplish. This also seems like less work for the server.
  20. System builders: Those who put together their computer from buying the parts separately; like me. That means no annoying locking out of your own PC if you change parts. It's only logical for such an edition to be sold on Newegg. However, don't be surprised if there is still a catch.
  21. To be more specific on what i meant, my concept does not require any rows to be created or deleted for the desired result. At most it may require a new column or two to be inserted in the users' table, where you would keep track of how many times the user "sent a result." If there is a need to keep track of what was submitted, then two columns: one an "integer" for the number of times the user submitted something, and one, i suppose, "text" for what was submitted, since i have no idea what can be submitted. Think of it similar to PHP's argv and argc variables.
  22. Though i don't entirely understand what you're trying to do, but if i understand anything, why not just keep track of how many times a user "sent a result", and if it equals 4, disable the user until another user does the same act the previous user committed? This seems simpler than your method of what appears to be the same thing that is being achieved. And this way you don't have to delete anything, and most likely don't even have to create new rows to keep track of results.
  23. If you think about it, what does Microsoft having their own virus scanner imply? Doesn't it mean that they're admitting to the flaws of their own operating system? Doesn't it mean that, because they know their code better than anyone, they are therefore able to tell the public that there is a new deadly virus going around and the only way to protect yourself against it is by using their anti-virus program without anyone knowing the better? That because they now have an anti-virus program they can forget about making patches to their system to do away with viruses? Or is it that because they've made their virus program free that they are now going to start doing away with as many bugs in their operating system as possible? Whatever the case, the way they advertise can either create and secure a monopoly in the anti-virus industry or cause them to lose that chance.
  24. Though i've never used ROR, from what i understand of it, you're supposed to first set up the environment before you can actually start development. You should be able to do so by logging into your account's C-panel and clicking on "Ruby on Rails." This should take you to "Manage Ruby on Rails Applications." If you fill out the form you are presented with and submit it, you should then have a working ROR environment to place your code in, which you can execute in a browser. Do note a ROR environment contains a lot of files, as it attempts to supply users with everything they could ever need for a production environment.
  25. I wonder what will become of Firewire. But am i understanding the image correctly when i say that USB 3.0 will require two USB ports? If so, then that's a bit cheating for performance. And if so, i can only imagine how the USB ports on cases and motherboards that support USB 3.0 will look like.
×
×
  • 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.