oni-kun
Members-
Posts
1,984 -
Joined
-
Last visited
-
Days Won
1
Everything posted by oni-kun
-
Are you sure HTTP_HOST is new_site.net.au on your web host?
-
Mac is weird! Well, Try if ($_SERVER['HTTP_HOST'] != 'yoursite.com') { add /sitename }
-
echo $_SERVER['HTTP_HOST']; <-- Run that. It should say "localhost" so you can put that in place of 127.0.0.1. I've never worked with a mac network before..
-
Just remember backing up of a whole SQL database may hang your site, depending on the amount of records and the internet throughput/IO bandwidth.
-
You don't have your favicon listed in a meta tag on that page. But Firefox should correct it anyway as I see it: Just place the meta tag in each page and it should be fine for IE. <link href="http://www.yorkbaptist.org.uk/favicon.ico" rel="icon" type="image/x-icon" /> Or wherever favicon you're using is.
-
"/Applications/MAMP/htdocs/includes/magicquotes.inc.php" Then that doesn't exist. What are you running that on? Does your MAMP server have it running on localhost (127.0.0.1)? If it isn't, then it won't work. Change 127.0.0.1 to whatever your MAMP server is set up to run on.
-
Heard of BrowserShots? (Automated browser screenshots) Hehe!
oni-kun posted a topic in Miscellaneous
http://browsershots.org/http://www.crashie.com/ Look at that, I did not even need to use 'hax0rL337' skills to crash a client IE browser. -
Do not use $_REQUEST, replace it with $_POST as you won't know the origin. <form id="form1" name="form1" method="post" action=""> You have no action set, how do you expect it to send the POST data? Change it to: <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> If it's on the same page as your processing data.
-
You're not making much sense here. Permissions are set by the owner, you can't chmod some other machine's folders without you having owner access. chmod 000 file.db
-
Sorry. Change the beginning to this: if ($_SERVER['HTTP_HOST'] == "127.0.0.1") { define ('__ROOT__', $_SERVER['DOCUMENT_ROOT'] . '/new_site'); } else { define ('__ROOT__', $_SERVER['DOCUMENT_ROOT']); } I forgot, definitions cannot appear inside quotes, Try this: include_once(__ROOT__ . "/includes/magicquotes.inc.php"); Sorry again, I'm tired. This should work, I tested an example on my machine.
-
PHP Code / Script To check weather the given email exists in a domain
oni-kun replied to GIrish BM's topic in PHP Coding Help
There isn't a method of really doing this. Gmail uses MX records in a way that makes it impossible to view if the client e-mail exists or not. Only [email protected] will normally work. There's no reliable way to check if the e-mail exists, That is why confirmation e-mails are sent by almost every software that exists. -
Mail form doesn't send Russian/Cyrillic characters correctly?
oni-kun replied to highwaykind's topic in PHP Coding Help
Took a bit of coding/beautifying.. But try this with any language text: I ran it through a formatter, so I'm not sure if it'll run (it cleaned the lines up a bit) But I applied the header and utf8_encodings for you: <?php $your_email_address = "[email protected]"; if (empty($_GET) && empty($_POST)) { die('Ongeldige actie'); } // Emular register_globals on if (!ini_get('register_globals')) { $superglobales = array( $_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET ); if (isset($_SESSION)) { array_unshift($superglobales, $_SESSION); } foreach($superglobales as $superglobal) { extract($superglobal, EXTR_SKIP); } } // to prevent header injection if (eregi("\r", $_POST['your_email_address']) || eregi("\n", $_POST['your_email_address'])) { exit; } // kick anyone whoever tried to inject a header in the form foreach($_POST as $value) { if (strpos($value, 'Content-Type:') !== false) { exit; } } $fields = array_keys($_POST); function headfunction($url) { header("Location: $url"); } // protect the variable $reserved_vars if (isset($reserved_vars)) { unset($reserved_vars); } $reserved_vars = array( "css_file", "background_color", "background_image", "text_color", "link_color", "visited_link_color", "active_link_color", "font_name", "font_size", "highlight_color", "required_fields", "after_url", "check_email_address", "subject", "your_email_address", "env_report", "owner_name", "autoresponse", "response_subject", "response_mail", "dodosmail_header_file", "dodosmail_footer_file" ); function include_dodosmail_header($dodosmail_header_file) { global $reserved_vars; foreach($reserved_vars as $reserved_var) { global $$reserved_var; } if (is_file($dodosmail_header_file)) { include_once ($dodosmail_header_file); return; } else { echo "<html>\n"; echo "<head>\n"; echo "<title>\n"; echo "DodosMail\n"; echo "</title>\n"; if ($css_file != "") echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$css_file\">\n"; echo "</head>\n"; echo "<body bgcolor=\"$background_color\" background=\"$background_image\" text=\"$text_color\" link=\"$link_color\" vlink=\"$visited_link_color\" alink=\"$active_link_color\">\n"; echo "<font face=\"$font_name\" size=\"$font_size\">\n"; } } function include_dodosmail_footer($dodosmail_footer_file) { global $reserved_vars; foreach($reserved_vars as $reserved_var) { global $$reserved_var; } if (is_file($dodosmail_footer_file)) { include_once ($dodosmail_footer_file); return; } else { echo "</font>\n</body>\n</html>"; } } function dodosmail_error_handle($msg) { global $highlight_color; if (isset($highlight_color)) { $extra_begin = "<font color=\"" . $highlight_color . "\">"; $extra_end = "</font>"; } else { $extra_begin = "<span class=\"DodosMailErrorHighLight\">"; $extra_end = "</span>"; } return $extra_begin . $msg . $extra_end; } // checking required fields // in case they used comma and space, replace if (strstr($required_fields, ", ")) { $required_fields = str_replace(", ", ",", $required_fields); } else { $required_fields = $required_fields; } $required_fields = explode(",", $required_fields); for ($i = 0; $i < count($required_fields); $i++) { $required_var_name = $required_fields[$i]; if (empty($$required_var_name)) { include_dodosmail_header($dodosmail_header_file); echo "<p class=\"DodosMailError\">Fout! - het verplichte veld " . dodosmail_error_handle($required_var_name) . " is niet ingevuld.\n"; echo "<br /><br /><a href=\"javascript:history.back(1)\">Terug</a>\n"; echo "</p>\n"; include_dodosmail_footer($dodosmail_footer_file); exit; } } if ($check_email_address == "yes" && !empty($email)) { if (!check_email($email)) { include_dodosmail_header($dodosmail_header_file); echo "<p class=\"DodosMailError\">Fout - het adres " . dodosmail_error_handle($email) . " is niet geldig.\n"; echo "<br /><br /><a href=\"javascript:history.back(1)\">Terug</a>\n"; echo "</p>\n"; include_dodosmail_footer($dodosmail_footer_file); exit; } } for ($i = 0; $i < count($fields); $i++) { $actual_var = $fields[$i]; if (in_array($actual_var, $reserved_vars)) { $inside_mail = $inside_mail; } else { if (is_array($$actual_var)) { $inside_mail.= "$actual_var: "; foreach($$actual_var as $actual_val) { $inside_mail.= "$actual_val "; } $inside_mail.= "\n"; } else { $actual_val = stripslashes($$actual_var); $inside_mail.= "$actual_var: $actual_val\n"; } } } // getting other information from the form $cname = gethostbyaddr($_SERVER[REMOTE_ADDR]); $inside_mail.= " ----------------------------------------------------------------------- SENDER INFO: IP: $_SERVER[REMOTE_ADDR] Computer Name: $cname Browser Type: $_SERVER[HTTP_USER_AGENT] Page Referer: $_SERVER[HTTP_REFERER] ----------------------------------------------------------------------- "; $headers.= "MIME-Version: 1.0\r\n"; $headers.= "X-Priority: 3\r\n"; $headers.= "X-MSMail-Priority: Normal\r\n"; $headers.= "X-Mailer: DodosMail 2.0 http://regretless.com/scripts/\r\n"; $headers.= 'Content-type: text/html; charset=UTF-8' . "\r\n"; // $headers .= "Date: ".date("R")."\r\n"; $headers.= "From: $name <$email>\r\n"; $success = mail($your_email_address, utf8_encode($subject), utf8_encode($inside_mail), $headers); if ($success) { if ($autoresponse == "yes") { $response_subject = utf8_encode(stripslashes($response_subject)); $response_mail = utf8_encode(stripslashes($response_mail)); mail($email, $response_subject, $response_mail, "From: $owner_name <$your_email_address>"); } if ($after_url == "") { // out put send info include_dodosmail_header($dodosmail_header_file); echo "<p>\n"; echo "Het formulier is verzonden!</p><ul>"; for ($i = 0; $i < count($fields); $i++) { $actual_var = $fields[$i]; if (in_array($actual_var, $reserved_vars)) echo ""; else { if (is_array($$actual_var)) { echo "<li>$actual_var: "; foreach($$actual_var as $actual_val) { echo "$actual_val "; } echo "</li>\n"; } else { $actual_val = stripslashes($$actual_var); echo "<li>$actual_var: $actual_val</li>\n"; } } } echo "</ul>\n<p></p>"; include_dodosmail_footer($dodosmail_footer_file); exit; } else { headfunction($after_url); } } else { include_dodosmail_header($dodosmail_header_file); echo "<p class=\"DodosMailError\">Fout - Het formulier is tijdelijk niet bruikbaar, gebruik " . dodosmail_error_handle($your_email_address) . " om contact op te nemen.\n"; echo "<br /><br /><a href=\"javascript:history.back(1)\">Terug</a>\n"; echo "</p>\n"; include_dodosmail_footer($dodosmail_footer_file); exit; } function check_email($email) { if ((preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) || (preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/', $email))) { return true; } return false; } ?> EDIT: Added more encodes. -
Mail form doesn't send Russian/Cyrillic characters correctly?
oni-kun replied to highwaykind's topic in PHP Coding Help
Change charset to UTF-8. And use the following method: $message = utf8_encode('Pусскиа 俛俜保俞俟俠信俢俣俥俦 etc.'); Encoding it in UTF will ensure it is not read as ISO on client. Make sure the charset is UTF-8 as well. This will encode every language in a universal format. Mimetype has to be set as 1.0, and the header set to HTML. -
Putting double spaces instead of single spaces
oni-kun replied to mikebyrne's topic in PHP Coding Help
In reverse order. $field=str_replace(' ',' ',$field); Read the documentation. And \r is a linefeed for macs. Windows uses \r\n. I'd recommend only using this when dealing with newlines: implode("\n",$fields) -
Putting double spaces instead of single spaces
oni-kun replied to mikebyrne's topic in PHP Coding Help
Why are you replacing single/double spaces with commas then? Are you on a mac? else \r will not work. -
__ROOT__ is $_SERVER['DOCUMENT_ROOT']. $_SERVER['DOCUMENT_ROOT'] . "__ROOT__/includes/magicquotes.inc.php"; You're including document root twice. __ROOT__ is supposed to handle the document root for you.
-
If you're using a template-like engine you can simply define language parameters. __NAV_BAR__ / __ABOUT_TEXT__ etc. Define them up top based on what language is set, and set them as the localized text.
-
No problem. It's just maybe best to look up tutorials for RHC5 installs on that. It's hard to give instructions when the environment is alien.
-
This brings me back to some C# code I required for a small project. This pattern is especially useful for handling STDIN/IO observing and status updates for the observing class.
-
Nginx (Engine-X) is what Google uses! Anyway, It's a specific alternative for customization. Another suggestion is Lighttpd, It used to be fairly common and a competitor with Apache, includes FastCGI, Asynchronous IO etc.. But if you're not really experienced with those things, Apache is the best method to go. If you need to do URL rewriting etc. You don't need to install plugins and such, and there is much much more documentation available.
-
Ugh. Don't know what's wrong with your setup. http://dag.wieers.com/rpm/packages/php-pecl-memcache/php-pecl-memcache-2.1.2-1.el5.rf.i386.rpm rpm -ivh php-pecl-memcache-2.1.2-1.el5.rf.i386.rpm And here's a rough guide on getting memcached setup: http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environment
-
You're adding __ROOT__ into single quotes. You must contain them in double quotes.
-
Interesting choice.. Don't know why it should cost like so though. VIM + PHP syntax hilighting ftw.
-
dreamweaver malfunctioning
oni-kun replied to moreshion's topic in Editor Help (PhpStorm, VS Code, etc)
Try reinstalling it and making sure it is the official registered version. What OS are you using? It could be an incompatability. -
The symbol has a globe and an 'a', so I'd assume something to do with a hyperlink. It may default for js as well.