-
Posts
1,285 -
Joined
-
Last visited
Never
Everything posted by ohdang888
-
nvm i solved it myself. it was a misspelling inlcude was suposed to be include i'm an idiot.lol.
-
this code is on my index.php of the root directory <?php include("inlcude/topmenu.php")?> and the path to the file is mysite/include/topmenu.php what am i doing wrong?
-
hey. how do you make rounded corners for a DIV? nothing i am findin on google is productive
-
when you search for a file to open in notepad, it looks for .txt files... how can i have it automatically show me .php files????????, rather then having to click "all files" everytime.
-
this is my form. its for people to send me suggestions about my ads... iwhile testing it, its creating the file and writing: ,Rate-Useful:,rate-position:,suggestions:../suggestions.txt...... but its not writing the information down... its a pretty simple code too, thats why its maing me mad. heres the code ... <form method="post" > E-Mail:<input type="text" size="15" maxlength="30" name="e_mail"/> <br/> Rate how useful our ads were! <br> <font size=2> 1= Terrible, 5=Great <br> <font size=3> <select name="rate_useful"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <br> Rate the location of our ads on the webpage were! <br> <font size=2> 1= Terrible, 5=Great<br> <font size=3> <select name="position"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <br> Got Any Suggestions? <br> <textarea rows="2" cols="20" name="suggestions"/> <input type="submit" name="click" value="click"/> </form> <?php $email = $_POST["e_mail"]; $use = $_POST["rate_useful"]; $position = $_POST["position"]; $comments = $_POST["suggestions"]; $suggestions = "../suggestions.txt"; $FH = fopen($suggestions, 'a+') or die("can't open file"); fwrite($FH,$email . ',Rate-Useful:' . $use . ',rate-position:' . $position . ',suggestions:' . $suggestions . '......'); fclose($FH); ?>
-
i new to php i use <?php include("../include/file.php")?> but i can;t figure out the path if i am in in the root directory.... i use... <?php include("/include/file.php")?> but it won't work.... (the folder "include "is located in the same folder as this page.)
-
i didn;t write this comment code myself ( i know, i know, i'm a noob) and i can't find the submit button in the code of the comment
-
sorry, the error is that the submit button of the comments is acting as the submit button of the e-mail list. but NOT vice-versa.... the e-mail code comes becomes the comment code in the page. <? /* Scriptsmill comments script v1.03 Copyright (C) 2005-2006 ScriptsMill E-Mail: [email protected] URL: http://www.scriptsmill.com Author: Stanislav Perederiy This file is part of ScriptsMill Comments. ScriptsMill Comments is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. ScriptsMill Comments is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ScriptsMill Comments; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ $COM_CONF['full_path'] = dirname(__FILE__); include("{$COM_CONF['full_path']}/config.php"); if (! $COM_CONF['dbhost']) { echo 'It seems that comments script is not properly installed. See readme.txt for more info.'; } require("{$COM_CONF['full_path']}/lang/lang_{$COM_CONF['lang']}.php"); require("{$COM_CONF['full_path']}/akismet-class.php"); $comments_db_link = mysql_connect($COM_CONF['dbhost'],$COM_CONF['dbuser'],$COM_CONF['dbpassword']); mysql_select_db($COM_CONF['dbname'], $comments_db_link); main(); function main() { if ($_REQUEST['action'] == 'add'){ add(); } elseif ($_REQUEST['action'] == 'unsub'){ unsub(); } elseif (1) { view(); } } function check_for_errors() { global $comments_db_link, $COM_CONF, $COM_LANG; $ip = mysql_escape_string($_SERVER['REMOTE_ADDR']); $result = mysql_query("SELECT ip FROM {$COM_CONF['dbbannedipstable']} WHERE ip='$ip'", $comments_db_link); if (mysql_num_rows($result)>0) { $error_message.=$COM_LANG['not_allowed'] . " "; } if ($_REQUEST['disc_name'] == '') { $error_message.=$_REQUEST['r_disc_name'] . " "; } if ($_REQUEST['disc_body'] == '') { $error_message.=$_REQUEST['r_disc_body'] . " "; } if ($_REQUEST['disc_email'] != '') { if (!is_email($_REQUEST['disc_email'])) { $error_message.="Invalid email address" . " "; } } return $error_message; } function flood_protection($INPUT) { global $comments_db_link, $COM_CONF, $COM_LANG; $result = mysql_query("select time from {$COM_CONF['dbmaintable']} where ip='{$_SERVER['REMOTE_ADDR']}' AND (UNIX_TIMESTAMP( NOW( ) ) - UNIX_TIMESTAMP( time )) < {$COM_CONF['anti_flood_pause']}", $comments_db_link); if (mysql_num_rows($result)>0) { $error_message="Flood detected"; return $error_message; } $result = mysql_query("select ID from {$COM_CONF['dbmaintable']} where text='{$INPUT['disc_body']}' AND author='{$INPUT['disc_name']}' AND href='{$INPUT['href']}'", $comments_db_link); if (mysql_num_rows($result)>0) { $error_message="Flood detected"; return $error_message; } return ""; } function spam_check($email, $name, $url, $text, $path_to_page, $ip) { global $COM_CONF, $comments_db_link; $try = 0; while (!$valid && $try <= 3) { // Initialize and verify API key $akismet = new Akismet($COM_CONF['site_url'], $COM_CONF['akismet_apikey']); $result = $akismet->isKeyValid(); // Possible values: 'valid', 'invalid', 'no connect' if ($result != 'valid') { if (($result == 'invalid')) { // Invalid key return 2; } else { // Could not connect to the Akismet server $try++; } } else { $valid = 1; } } if (!$valid) { return 3; // Could not connect to the Akismet server } // Pass comment info to the class $akismet->setCommentAuthorEmail($email); $akismet->setCommentAuthor($name); $akismet->setCommentAuthorURL($url); $akismet->setCommentContent($text); $akismet->setUserIP($ip); $akismet->setPermalink($COM_CONF['site_url'] . $path_to_page); $akismet->setCommentType('Comment'); $try = 0; while ($try <= 3) { // Check the comment for spam $result = $akismet->isCommentSpam(); // Possible values: 'false' (not spam), 'true' (spam), 'no connect' if ($result != 'false') { if ($result == 'true') { // The comment is spam return 1; } else { // Could not connect to the Akismet server $try++; } } else { return 0; } } return 3; // Could not connect to the Akismet server } function add() { global $comments_db_link, $COM_CONF, $COM_LANG; foreach ($_REQUEST as $key => $value) { if ($key == 'disc_body') { $comment_text=stripslashes($value); } $_REQUEST[$key] = str_replace('<', '<', $_REQUEST[$key]); $_REQUEST[$key] = str_replace('>', '>', $_REQUEST[$key]); if (get_magic_quotes_gpc()) { $_REQUEST[$key] = stripslashes($_REQUEST[$key]); } $_REQUEST[$key] = mysql_escape_string($_REQUEST[$key]); } $_REQUEST['href'] = str_replace('%2F', '/', $_REQUEST['href']); $_REQUEST['href'] = str_replace('%3F', '?', $_REQUEST['href']); $_REQUEST['href'] = str_replace('%26', '&', $_REQUEST['href']); $_REQUEST['href'] = str_replace('%3D', '=', $_REQUEST['href']); if ($_REQUEST['dont_show_email'] != '') { $dont_show="1"; } else { $dont_show="0"; } $error_message = check_for_errors(); $error_message .= flood_protection($_REQUEST); if ($COM_CONF['ckeck_for_spam']) { if (!$error_message) { $spam_check_result = spam_check($_REQUEST['disc_email'], $_REQUEST['disc_name'], "", $comment_text, $_REQUEST['href'], ""); if ($spam_check_result == 1) { $error_message .= " Your comment suspected as spam."; mysql_query("INSERT INTO {$COM_CONF['dbjunktable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link); } if ($spam_check_result == 2) { $error_message .= " Invalid WordPress API key"; } if ($spam_check_result == 3) { $error_message .= " Could not connect to the Akismet server"; } } } if ($error_message) { print "The following errors occured: $error_message Please <a href=\"javascript:history.go(-1)\">get back[/url] and try again."; return 0; } mysql_query("INSERT INTO {$COM_CONF['dbmaintable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link); if ($_REQUEST['email_me'] != '' && $_REQUEST['disc_email'] != '') { $result = mysql_query("select COUNT(*) from {$COM_CONF['dbemailstable']} where href='{$_REQUEST['href']}' AND email='{$_REQUEST['disc_email']}'", $comments_db_link); list ($count) = mysql_fetch_row($result); if ($count == 0) { $hash=md5($email . $COM_CONF['copy_random_seed']); mysql_query("INSERT INTO {$COM_CONF['dbemailstable']} VALUES (NULL, '{$_REQUEST['disc_email']}', '{$_REQUEST['href']}', '$hash')", $comments_db_link); } } if ($COM_CONF['email_admin']) { notify_admin($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email'], $comment_text, "{$_SERVER['REMOTE_ADDR']}, {$_SERVER['HTTP_USER_AGENT']}"); } notify_users($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email']); header("HTTP/1.1 302"); header("Location: {$COM_CONF['site_url']}{$_REQUEST['href']}"); print "<a href=\"{$COM_CONF['site_url']}{$_REQUEST['href']}\">Click here to get back.[/url]"; } function notify_admin($href, $name, $email, $text, $ip) { global $comments_db_link, $COM_CONF, $COM_LANG; $headers = "From: Comments <{$COM_CONF['email_from']}>\r\n"; $text_of_message=" {$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href {$COM_LANG['email_from']}: $name <$email> $text $ip "; mail($COM_CONF['email_admin'], "{$COM_LANG['email_new_comment']} $href", $text_of_message, $headers); } function notify_users($href, $name, $email_from) { global $comments_db_link, $COM_CONF, $COM_LANG; $headers = "From: Comments <{$COM_CONF['email_from']}>\n"; $result=mysql_query("select email, hash from {$COM_CONF['dbemailstable']} where href='$href'", $comments_db_link); while (list($email, $hash) = mysql_fetch_row($result)) { if ($email != $email_from) { $text_of_message=" {$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href {$COM_LANG['email_from']}: $name {$COM_LANG['email_to_unsubscribe']} {$COM_CONF['site_url']}{$COM_CONF['script_url']}?action=unsub&page=$href&id=$hash "; mail($email, "{$COM_LANG['email_new_comment']} $href",$text_of_message, $headers); } } } function unsub() { global $comments_db_link, $COM_CONF, $COM_LANG; $id=mysql_escape_string($_REQUEST['id']); $href=mysql_escape_string($_REQUEST['page']); mysql_query("delete from {$COM_CONF['dbemailstable']} where href='$href' AND hash='$id'", $comments_db_link); if (mysql_affected_rows() > 0) { print "{$COM_LANG['unsubscribed']}"; } else { print "{$COM_LANG['not_unsubscribed']}"; } } function view() { global $comments_db_link, $COM_CONF, $COM_LANG; $request_uri = mysql_escape_string($_SERVER['REQUEST_URI']); $result = mysql_query("select time, text, author, email, dont_show_email from {$COM_CONF['dbmaintable']} where href='$request_uri' order by time {$COM_CONF['sort_order']} LIMIT 10", $comments_db_link); $comments_count=0; $time=$text=$author=$email=$dont_show_email=array(); while (list($time[$comments_count], $text[$comments_count], $author[$comments_count], $email[$comments_count], $dont_show_email[$comments_count])=mysql_fetch_array($result)) { $text[$comments_count] = wordwrap($text[$comments_count], 75, "\n", 1); $time[$comments_count] = format_date($time[$comments_count]); $comments_count++; } require("{$COM_CONF['full_path']}/templates/{$COM_CONF['template']}.php"); } function format_date ($date) { global $COM_LANG; $year = substr($date, 0, 4); $month = intval(substr($date, 5, 2)) - 1; $day = substr($date, 8, 2); $hour = substr($date, 11, 2); $min = substr($date, 14, 2); return "$day {$COM_LANG['months'][$month]} $year, $hour:$min"; } function is_email($Addr) { $p = '/^[a-z0-9!#$%&*+-=?^_`{|}~]+(\.[a-z0-9!#$%&*+-=?^_`{|}~]+)*'; $p.= '@([-a-z0-9]+\.)+([a-z]{2,3}'; $p.= '|info|arpa|aero|coop|name|museum)$/ix'; return preg_match($p, $Addr); } ?>
-
hey. i use scpritmills comments. i created my own e-mail list code, users enter their e-mail and are added to e-mailing list. However, their submit buttons are interferring with each other, sending the people who made comments to "emailadded.php" what do i need to change to get this right? <?php if (!isset($_POST['submit'])) {?> <form method="post" action="../emailadded.php"> E-Mail:<input type="text" size="15" maxlength="30" name="e_mail"/> <br/> <input type="submit" name="submit" value="Submit"/> <form> <?php } else { $email = $_POST["e_mail"]; $emailfile = "../emaillist.txt"; $FH = fopen($emailfile, 'a') or die("can't open file"); fwrite($FH,$email . ','); fclose($FH); } ?> heres the code to the comments.php i;m not sure which part you need, so i posted all of it. <? /* Scriptsmill comments script v1.03 Copyright © 2005-2006 ScriptsMill E-Mail: [email protected] URL: http://www.scriptsmill.com Author: Stanislav Perederiy This file is part of ScriptsMill Comments. ScriptsMill Comments is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. ScriptsMill Comments is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ScriptsMill Comments; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ $COM_CONF['full_path'] = dirname(__FILE__); include("{$COM_CONF['full_path']}/config.php"); if (! $COM_CONF['dbhost']) { echo 'It seems that comments script is not properly installed. See readme.txt for more info.'; } require("{$COM_CONF['full_path']}/lang/lang_{$COM_CONF['lang']}.php"); require("{$COM_CONF['full_path']}/akismet-class.php"); $comments_db_link = mysql_connect($COM_CONF['dbhost'],$COM_CONF['dbuser'],$COM_CONF['dbpassword']); mysql_select_db($COM_CONF['dbname'], $comments_db_link); main(); function main() { if ($_REQUEST['action'] == 'add'){ add(); } elseif ($_REQUEST['action'] == 'unsub'){ unsub(); } elseif (1) { view(); } } function check_for_errors() { global $comments_db_link, $COM_CONF, $COM_LANG; $ip = mysql_escape_string($_SERVER['REMOTE_ADDR']); $result = mysql_query("SELECT ip FROM {$COM_CONF['dbbannedipstable']} WHERE ip='$ip'", $comments_db_link); if (mysql_num_rows($result)>0) { $error_message.=$COM_LANG['not_allowed'] . "<br />"; } if ($_REQUEST['disc_name'] == '') { $error_message.=$_REQUEST['r_disc_name'] . "<br />"; } if ($_REQUEST['disc_body'] == '') { $error_message.=$_REQUEST['r_disc_body'] . "<br />"; } if ($_REQUEST['disc_email'] != '') { if (!is_email($_REQUEST['disc_email'])) { $error_message.="Invalid email address" . "<br />"; } } return $error_message; } function flood_protection($INPUT) { global $comments_db_link, $COM_CONF, $COM_LANG; $result = mysql_query("select time from {$COM_CONF['dbmaintable']} where ip='{$_SERVER['REMOTE_ADDR']}' AND (UNIX_TIMESTAMP( NOW( ) ) - UNIX_TIMESTAMP( time )) < {$COM_CONF['anti_flood_pause']}", $comments_db_link); if (mysql_num_rows($result)>0) { $error_message="Flood detected"; return $error_message; } $result = mysql_query("select ID from {$COM_CONF['dbmaintable']} where text='{$INPUT['disc_body']}' AND author='{$INPUT['disc_name']}' AND href='{$INPUT['href']}'", $comments_db_link); if (mysql_num_rows($result)>0) { $error_message="Flood detected"; return $error_message; } return ""; } function spam_check($email, $name, $url, $text, $path_to_page, $ip) { global $COM_CONF, $comments_db_link; $try = 0; while (!$valid && $try <= 3) { // Initialize and verify API key $akismet = new Akismet($COM_CONF['site_url'], $COM_CONF['akismet_apikey']); $result = $akismet->isKeyValid(); // Possible values: 'valid', 'invalid', 'no connect' if ($result != 'valid') { if (($result == 'invalid')) { // Invalid key return 2; } else { // Could not connect to the Akismet server $try++; } } else { $valid = 1; } } if (!$valid) { return 3; // Could not connect to the Akismet server } // Pass comment info to the class $akismet->setCommentAuthorEmail($email); $akismet->setCommentAuthor($name); $akismet->setCommentAuthorURL($url); $akismet->setCommentContent($text); $akismet->setUserIP($ip); $akismet->setPermalink($COM_CONF['site_url'] . $path_to_page); $akismet->setCommentType('Comment'); $try = 0; while ($try <= 3) { // Check the comment for spam $result = $akismet->isCommentSpam(); // Possible values: 'false' (not spam), 'true' (spam), 'no connect' if ($result != 'false') { if ($result == 'true') { // The comment is spam return 1; } else { // Could not connect to the Akismet server $try++; } } else { return 0; } } return 3; // Could not connect to the Akismet server } function add() { global $comments_db_link, $COM_CONF, $COM_LANG; foreach ($_REQUEST as $key => $value) { if ($key == 'disc_body') { $comment_text=stripslashes($value); } $_REQUEST[$key] = str_replace('<', '<', $_REQUEST[$key]); $_REQUEST[$key] = str_replace('>', '>', $_REQUEST[$key]); if (get_magic_quotes_gpc()) { $_REQUEST[$key] = stripslashes($_REQUEST[$key]); } $_REQUEST[$key] = mysql_escape_string($_REQUEST[$key]); } $_REQUEST['href'] = str_replace('%2F', '/', $_REQUEST['href']); $_REQUEST['href'] = str_replace('%3F', '?', $_REQUEST['href']); $_REQUEST['href'] = str_replace('%26', '&', $_REQUEST['href']); $_REQUEST['href'] = str_replace('%3D', '=', $_REQUEST['href']); if ($_REQUEST['dont_show_email'] != '') { $dont_show="1"; } else { $dont_show="0"; } $error_message = check_for_errors(); $error_message .= flood_protection($_REQUEST); if ($COM_CONF['ckeck_for_spam']) { if (!$error_message) { $spam_check_result = spam_check($_REQUEST['disc_email'], $_REQUEST['disc_name'], "", $comment_text, $_REQUEST['href'], ""); if ($spam_check_result == 1) { $error_message .= "<br>Your comment suspected as spam."; mysql_query("INSERT INTO {$COM_CONF['dbjunktable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link); } if ($spam_check_result == 2) { $error_message .= "<br>Invalid WordPress API key"; } if ($spam_check_result == 3) { $error_message .= "<br>Could not connect to the Akismet server"; } } } if ($error_message) { print "The following errors occured:<br>$error_message<br><br> Please <a href=\"javascript:history.go(-1)\">get back</a> and try again."; return 0; } mysql_query("INSERT INTO {$COM_CONF['dbmaintable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link); if ($_REQUEST['email_me'] != '' && $_REQUEST['disc_email'] != '') { $result = mysql_query("select COUNT(*) from {$COM_CONF['dbemailstable']} where href='{$_REQUEST['href']}' AND email='{$_REQUEST['disc_email']}'", $comments_db_link); list ($count) = mysql_fetch_row($result); if ($count == 0) { $hash=md5($email . $COM_CONF['copy_random_seed']); mysql_query("INSERT INTO {$COM_CONF['dbemailstable']} VALUES (NULL, '{$_REQUEST['disc_email']}', '{$_REQUEST['href']}', '$hash')", $comments_db_link); } } if ($COM_CONF['email_admin']) { notify_admin($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email'], $comment_text, "{$_SERVER['REMOTE_ADDR']}, {$_SERVER['HTTP_USER_AGENT']}"); } notify_users($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email']); header("HTTP/1.1 302"); header("Location: {$COM_CONF['site_url']}{$_REQUEST['href']}"); print "<a href=\"{$COM_CONF['site_url']}{$_REQUEST['href']}\">Click here to get back.</a>"; } function notify_admin($href, $name, $email, $text, $ip) { global $comments_db_link, $COM_CONF, $COM_LANG; $headers = "From: Comments <{$COM_CONF['email_from']}>\r\n"; $text_of_message=" {$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href {$COM_LANG['email_from']}: $name <$email> $text $ip "; mail($COM_CONF['email_admin'], "{$COM_LANG['email_new_comment']} $href", $text_of_message, $headers); } function notify_users($href, $name, $email_from) { global $comments_db_link, $COM_CONF, $COM_LANG; $headers = "From: Comments <{$COM_CONF['email_from']}>\n"; $result=mysql_query("select email, hash from {$COM_CONF['dbemailstable']} where href='$href'", $comments_db_link); while (list($email, $hash) = mysql_fetch_row($result)) { if ($email != $email_from) { $text_of_message=" {$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href {$COM_LANG['email_from']}: $name {$COM_LANG['email_to_unsubscribe']} {$COM_CONF['site_url']}{$COM_CONF['script_url']}?action=unsub&page=$href&id=$hash "; mail($email, "{$COM_LANG['email_new_comment']} $href",$text_of_message, $headers); } } } function unsub() { global $comments_db_link, $COM_CONF, $COM_LANG; $id=mysql_escape_string($_REQUEST['id']); $href=mysql_escape_string($_REQUEST['page']); mysql_query("delete from {$COM_CONF['dbemailstable']} where href='$href' AND hash='$id'", $comments_db_link); if (mysql_affected_rows() > 0) { print "{$COM_LANG['unsubscribed']}"; } else { print "{$COM_LANG['not_unsubscribed']}"; } } function view() { global $comments_db_link, $COM_CONF, $COM_LANG; $request_uri = mysql_escape_string($_SERVER['REQUEST_URI']); $result = mysql_query("select time, text, author, email, dont_show_email from {$COM_CONF['dbmaintable']} where href='$request_uri' order by time {$COM_CONF['sort_order']} LIMIT 10", $comments_db_link); $comments_count=0; $time=$text=$author=$email=$dont_show_email=array(); while (list($time[$comments_count], $text[$comments_count], $author[$comments_count], $email[$comments_count], $dont_show_email[$comments_count])=mysql_fetch_array($result)) { $text[$comments_count] = wordwrap($text[$comments_count], 75, "\n", 1); $time[$comments_count] = format_date($time[$comments_count]); $comments_count++; } require("{$COM_CONF['full_path']}/templates/{$COM_CONF['template']}.php"); } function format_date ($date) { global $COM_LANG; $year = substr($date, 0, 4); $month = intval(substr($date, 5, 2)) - 1; $day = substr($date, 8, 2); $hour = substr($date, 11, 2); $min = substr($date, 14, 2); return "$day {$COM_LANG['months'][$month]} $year, $hour:$min"; } function is_email($Addr) { $p = '/^[a-z0-9!#$%&*+-=?^_`{|}~]+(\.[a-z0-9!#$%&*+-=?^_`{|}~]+)*'; $p.= '@([-a-z0-9]+\.)+([a-z]{2,3}'; $p.= '|info|arpa|aero|coop|name|museum)$/ix'; return preg_match($p, $Addr); } ?>
-
My first website - skoogO.com [Information Networking]
ohdang888 replied to chantown's topic in Website Critique
oh. hm. our high school uses it alot. its got some database problems every now and then, but for the most, not to shabby -
heres my code for people to upload a file to my site. i know its simple... <center> <font size=4> Upload a game to www.TheGameKing.Net! <br> <font size=2> <form method="post" action="thanks.php" enctype="multipart/form-data"> Name of Game:<input type="text" size="15" maxlength="30" name="game_name"/> <br/> Your First and Last Name:<input type="text" size="15" maxlength="50" name="name"/> <br/> Your E-mail Address:<input type="text" size="15" maxlength="30" name="email"/> <br/> Short Description of your game (10 words or less):<input type="text" size="15" maxlength="90" name="short"/> <br/> Long Description (between 15-30 words):<input type="text" size="30" maxlength="280" name="long"/> <br/> Possible Tags(list 4-8 words that describe your game (seperate by comma):<input type="text" size="15" maxlength="30" name="tags"/> <br/> Game dimensions(width x height,px) :<input type="text" size="15" maxlength="30" name="size"/> <br/> <font size=3> Pick the category of game that best decribes the game<font size=2><br> Action: <input type="radio" name="category" value="action" /> <br/> Sport/Racing: <input type="radio" name="category" value="sport" /> <br/> Puzzle: <input type="radio" name="category" value="puzzle" /> <br/> Strategy/Board: <input type="radio" name="category" value="board" /> <br/> Classic/Arcade: <input type="radio" name="category" value="classicandarcade" /> <br/> People: <input type="radio" name="category" value="people" /> <br/> <font size=3> Would you like your game to be sponsored by TheGameKing.Net?? To find out more, click <a href="http://localhost/sponsor.php">here</a> <br><font size=2> If you say "yes", then you are saying you agree to the terms of sponsorship. <br> <select name="sponsor"> <option value="yes">yes</option> <option value="no">no</option></select><br /> <input type="hidden" name="MAX_FILE_SIZE" value="20000000" /> Choose a file to upload(use .zip): <input name="uploadedfile" type="file" /><br /> <input type="submit" name="submit" value="Submit"/> </form> <?php $gamename = $_POST["game_name"]; $person_name = $_POST["name"]; $short = $_POST["short"]; $long = $_POST["long"]; $tags = $_POST["tags"]; $size = $_POST["size"]; $category = $_POST["category"]; $sponsor = $_POST["sponsor"]; $FH1 = fopen($gamename, 'w') or die("can't create file, contact ADMIN"); fwrite($FH1,$gamename); fclose($FH1); $FH2 = fopen($gamename, 'a') or die("can't write to file, contact ADMIN"); fwrite($FH2,$person_name . "/n"); fwrite($FH2,$short . "/n"); fwrite($FH2,$long . "/n"); fwrite($FH2,$tags . "/n"); fwrite($FH2,$size . "/n"); fwrite($FH2,$category . "/n"); fwrite($FH2,$sponsor . "/n"); fclose($FH2); ?> first of all, what php coe owuld i use to store the uploaded file into the same directory as this page. also, is nots working! i tried taking away the file upload stuff and "multi-part form data" part, but it still won't work. WHATS WRONG?!?!??!
-
wow. doesn't sound worth the work
-
hey. heres my counter code... <?php $file = "counter.txt"; $open = fopen($file, 'r'); $readdata = @fread($open, 10); fclose($open); $open = fopen($file, 'w'); //opens the file using only writing permissions $readdata++; //Adds one to the count. fwrite($open, $readdata); //Overwrites the file with the new page view count. fclose($open); //Closes the file. echo "Total Plays: $readdata"; //Displays the total views. ?> and counter.txt is locaed in the same folder... but i also want to display how many views in the last week... how would i do that?
-
My first website - skoogO.com [Information Networking]
ohdang888 replied to chantown's topic in Website Critique
pretty good idea. sites like this already exist. (look at www.moodle.org) its not exactly the same thing, schools have to host it on their own server, but its pretty much the same thing. one thing, if you are wanting to possibly recuirt colleges, then you really need to create a privacy policy and put it ob the footer. its not important to a lot of people, but when you talk about people uploading documents and such and possibly having user profiles, colleges need to know that you won't sell or give away any informatoin to 3rd parties -
hey jaupo2... i have the same exact function in php. visitors enter an e-mail and it gets stored in a text file... but i have a suggestion for you... (heres my code...) <?php if (!isset($_POST['submit'])) {?> <form method="post"> E-Mail:<input type="text" size="15" maxlength="30" name="email"/> <br/> <input type="submit" name="submit" value="Submit"/> <form> <?php } else { $email = $_POST["email"]; $emailfile = "../emaillist.txt"; $FH = fopen($emailfile, 'a') or die("can't open file"); fwrite($FH,$email . ','); //LOOK AT THIS PART fclose($FH); } ?> look at the part that the comment tells you too.... see the ',' in "fwrite($FH,$email . ','); ", this tells the script to write a comma after the name, this will make your life a whole lot easier, all you have to do is copy and paste the e-mails, rather tahn seperating it youself. also, unless you have a realy good reason to want to know their names, it unneccesary also, put the if(isset($_POST['submit']) before your html text fields, if they have already submitted, it will not show the fields. but one question.. what does "\r\n\r\n"); do?
-
but if i cchange permissions, won't mine work?
-
whats a context for the folder????? only i will be using this tool, its just to save me time. so i don't nee dto wrorry about others using this, it will be restricted to all others.... so i don;t need to think about the 2nd part? right?
-
so how do i change my permissions, i know its in htaccess but i can't figure it out and all the google searchs aren't coming up with anything understandable... any1 got any links?
-
the html code is right in the real thing (the < and >are messed up in the example)
-
heres my code to automatically create a folder and a index.php in it: but one problem, i'm getting an error of:? Warning: mkdir() [function.mkdir]: Permission denied in C:\xampp\htdocs\create\index.php on line 13 p.s.- i'm eventually going to add a template where it would add this info in certain specified sections of the page <html> <form method="post"> Name of game:<input type="text" size="15" maxlength="30" name="name"/> <br/> folder name:<input type="text" size="15" maxlength="30" name="folder"/> <input type="submit" name="submit" value="Submit"/> <?php $name = $_POST["name"]; $folder= $_POST["folder"]; mkdir("/$folder", 0700);// this creates the directory, but i think my permissions are messed up $newindex = "index.php"; $fh1 = fopen($newindex, 'w') or die("can't create file"); fwrite($fh1,$name); fclose($fh1); ?>
-
oh. lol. well is what i'm talking about possible?
-
i have a template. i want to create a code ( i know its gonna be more complicated then this but heres the jist of it...) textarea 1 textarea 2 textarea 3 textarea 4 name of new folder it would use the template and put the info i put into those text area and put them in the specified location of textarea 1, etc... create the new folder, open it, and save the new file as "index.php" i know huge sites like youtube and aol use this, i just don;t know how.
-
hey. i am a template and the entire site follows it. i'm wondering is it possible to create a page on my site (only i have access to it), that would have textareas, i could plug the unique info or code into it, specify the name of the folder and index.php to be created, and click go and it would create the page ??????????
-
hey. i am creating a gaming site. in one section, it will display related games... first of all, wahts the easiest way to do that?i'm thinking MYSQL might be the only way... when i get the results, i want it to pick 5 random ones and put them in a random order. any1 no the outline of that kind of code?
-
hey, i use a e-mail list as a text file that people can add their e-mails to via a php script. but for privacy concerns, i gotta make sure no one has access to that file but me. i use the following code in the script $emailfile = "../emaillist.txt" thats at... site.com/folder.. and the file is stored in the root directory... how do i make it call a file from TWO folders back???????????(the file in that the root directory is located in)