mirror of
https://github.com/michaelrsweet/mxml.git
synced 2025-02-22 02:05:29 +00:00
User account creation.
Make all emails consistent. Finalize links page.
This commit is contained in:
parent
7389cc6fc0
commit
989accb852
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: account.php,v 1.9 2004/05/20 02:04:44 mike Exp $"
|
||||
// "$Id: account.php,v 1.10 2004/05/20 21:37:57 mike Exp $"
|
||||
//
|
||||
// Account management page...
|
||||
//
|
||||
@ -470,6 +470,46 @@ switch ($op)
|
||||
|
||||
db_free($result);
|
||||
|
||||
print("<h2>New/Pending Links:</h2>\n");
|
||||
|
||||
$result = db_query("SELECT * FROM link WHERE is_published = 0 "
|
||||
."ORDER BY modify_date");
|
||||
$count = db_count($result);
|
||||
|
||||
if ($count == 0)
|
||||
print("<p>No new/pending links found.</p>\n");
|
||||
else
|
||||
{
|
||||
html_start_table(array("Id", "Name/Version", "Last Updated"));
|
||||
|
||||
while ($row = db_next($result))
|
||||
{
|
||||
$id = $row['id'];
|
||||
$title = htmlspecialchars($row['name'], ENT_QUOTES) . " " .
|
||||
htmlspecialchars($row['version'], ENT_QUOTES) .
|
||||
" <img src='images/private.gif' width='16' height='16' "
|
||||
."border='0' align='middle' alt='Private'/>";
|
||||
$date = date("M d, Y", $row['modify_date']);
|
||||
|
||||
if ($row["is_category"])
|
||||
$link = "<a href='links.php?UC$id'>";
|
||||
else
|
||||
$link = "<a href='links.php?UL$id'>";
|
||||
|
||||
html_start_row();
|
||||
|
||||
print("<td align='center' nowrap>$link$id</a></td>"
|
||||
."<td width='67%' align='center'>$link$title</a></td>"
|
||||
."<td align='center'>$link$date</a></td>");
|
||||
|
||||
html_end_row();
|
||||
}
|
||||
|
||||
html_end_table();
|
||||
}
|
||||
|
||||
db_free($result);
|
||||
|
||||
print("<h2>New/Pending STRs:</h2>\n");
|
||||
|
||||
$result = db_query("SELECT * FROM str WHERE status >= $STR_STATUS_PENDING "
|
||||
@ -612,6 +652,6 @@ switch ($op)
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: account.php,v 1.9 2004/05/20 02:04:44 mike Exp $".
|
||||
// End of "$Id: account.php,v 1.10 2004/05/20 21:37:57 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: articles.php,v 1.10 2004/05/19 21:17:47 mike Exp $"
|
||||
// "$Id: articles.php,v 1.11 2004/05/20 21:37:57 mike Exp $"
|
||||
//
|
||||
// Web form for the article table...
|
||||
//
|
||||
@ -41,7 +41,7 @@ notify_users($id, // I - Article #
|
||||
."Please approve or delete this article via the following "
|
||||
."page:\n\n"
|
||||
." $PHP_URL?L$id\n"),
|
||||
"From: noreply@easysw.com\r\n");
|
||||
"From: $PROJECT_EMAIL\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ switch ($op)
|
||||
$temp = htmlspecialchars($row["abstract"]);
|
||||
print("<tr><th align='right'>Abstract:</th><td class='left'>$temp</td></tr>\n");
|
||||
|
||||
$temp = htmlspecialchars($row["contents"]);
|
||||
$temp = fomat_text($row["contents"]);
|
||||
print("<tr><th align='right'>Contents:</th><td class='left'>$temp</td></tr>\n");
|
||||
|
||||
print("<tr><th colspan='2'>"
|
||||
@ -401,7 +401,7 @@ switch ($op)
|
||||
}
|
||||
|
||||
$result = db_query("SELECT * FROM article $query "
|
||||
."ORDER BY modify_date");
|
||||
."ORDER BY modify_date DESC");
|
||||
$count = db_count($result);
|
||||
|
||||
if ($count == 0)
|
||||
@ -665,7 +665,7 @@ switch ($op)
|
||||
else
|
||||
print("<tr><th align='right' valign='top'>Contents:</th>");
|
||||
print("<td><textarea name='CONTENTS' "
|
||||
."cols='80' rows='10' wrap='virtual'>"
|
||||
."cols='72' rows='12' wrap='virtual'>"
|
||||
."$contents</textarea>\n"
|
||||
."<p>The contents of the article may contain the following "
|
||||
."HTML elements: <tt>A</tt>, <tt>B</tt>, <tt>BLOCKQUOTE</tt>, "
|
||||
@ -840,7 +840,7 @@ switch ($op)
|
||||
else
|
||||
print("<tr><th align='right' valign='top'>Contents:</th>");
|
||||
print("<td><textarea name='CONTENTS' "
|
||||
."cols='80' rows='10' wrap='virtual'>"
|
||||
."cols='72' rows='12' wrap='virtual'>"
|
||||
."$contents</textarea>\n"
|
||||
."<p>The contents of the article may contain the following "
|
||||
."HTML elements: <tt>A</tt>, <tt>B</tt>, <tt>BLOCKQUOTE</tt>, "
|
||||
@ -859,6 +859,6 @@ switch ($op)
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: articles.php,v 1.10 2004/05/19 21:17:47 mike Exp $".
|
||||
// End of "$Id: articles.php,v 1.11 2004/05/20 21:37:57 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
BIN
www/images/black.gif
Normal file
BIN
www/images/black.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 B |
200
www/links.php
200
www/links.php
@ -1,6 +1,6 @@
|
||||
<?
|
||||
//
|
||||
// "$Id: links.php,v 1.2 2004/05/20 15:45:55 mike Exp $"
|
||||
// "$Id: links.php,v 1.3 2004/05/20 21:37:57 mike Exp $"
|
||||
//
|
||||
// Hierarchical link interface.
|
||||
//
|
||||
@ -166,7 +166,7 @@ for ($i = 0; $i < $argc; $i ++)
|
||||
{
|
||||
$listtype = $argv[$i][1];
|
||||
|
||||
if ($listtype == 'A')
|
||||
if ($listtype != 'C')
|
||||
$parent_id = -1;
|
||||
}
|
||||
break;
|
||||
@ -238,7 +238,7 @@ switch ($op)
|
||||
html_end_links();
|
||||
|
||||
print("<h1>Links</h1>\n");
|
||||
print("<form method='POST' action='$PHP_SELF'>\n"
|
||||
print("<form method='POST' action='$PHP_SELF?L$listtype'>\n"
|
||||
."<center>"
|
||||
."<input type='text' name='SEARCH' size='40' value='$search'/>"
|
||||
."<input type='submit' value='Search'/>"
|
||||
@ -304,17 +304,17 @@ switch ($op)
|
||||
// Show the categories...
|
||||
if ($query != "")
|
||||
$result = db_query("SELECT * FROM link "
|
||||
."WHERE ${ispublished}is_category = 1 AND "
|
||||
."WHERE ${is_published}is_category = 1 AND "
|
||||
."($query) "
|
||||
."ORDER BY name");
|
||||
else if ($parent_id >= 0)
|
||||
$result = db_query("SELECT * FROM link "
|
||||
."WHERE ${ispublished}is_category = 1 AND "
|
||||
."WHERE ${is_published}is_category = 1 AND "
|
||||
."parent_id = $parent_id "
|
||||
."ORDER BY name");
|
||||
else
|
||||
$result = db_query("SELECT * FROM link "
|
||||
."WHERE ${ispublished}is_category = 1 "
|
||||
."WHERE ${is_published}is_category = 1 "
|
||||
."ORDER BY name");
|
||||
|
||||
if ($parent_id < 0)
|
||||
@ -329,11 +329,15 @@ switch ($op)
|
||||
$id = $row["id"];
|
||||
$name = htmlspecialchars($row["name"]);
|
||||
|
||||
print("<li><a href='$PHP_SELF?L+P$id$options'>$name</a>");
|
||||
print("<li><a href='$PHP_SELF?L$listtype+P$id$options'>$name</a>");
|
||||
|
||||
if (!$row["is_published"])
|
||||
print(" <img src='images/private.gif' width='16' height='16' "
|
||||
."align='middle' alt='private'/>");
|
||||
|
||||
if ($LOGIN_LEVEL >= AUTH_DEVEL || $LOGIN_USER == $row["create_user"])
|
||||
{
|
||||
print(" [ <a href='$PHP_SELF?FC$id+P$parent_id$options'>Edit</a> |"
|
||||
print(" [ <a href='$PHP_SELF?UC$id+P$parent_id$options'>Edit</a> |"
|
||||
." <a href='$PHP_SELF?X$id+P$parent_id$options'>Delete</a> ]");
|
||||
}
|
||||
|
||||
@ -343,7 +347,7 @@ switch ($op)
|
||||
print("</ul>\n");
|
||||
|
||||
html_start_links();
|
||||
html_link("Submit New Category", "$PHP_SELF?FC+P$parent_id$options");
|
||||
html_link("Submit New Category", "$PHP_SELF?UC+P$parent_id$options");
|
||||
html_end_links();
|
||||
|
||||
db_free($result);
|
||||
@ -351,17 +355,17 @@ switch ($op)
|
||||
// Then show the listings...
|
||||
if ($query != "")
|
||||
$result = db_query("SELECT * FROM link "
|
||||
."WHERE ${ispublished}is_category = 0 AND "
|
||||
."WHERE ${is_published}is_category = 0 AND "
|
||||
."($query) "
|
||||
."ORDER BY name");
|
||||
else if ($parent_id >= 0)
|
||||
$result = db_query("SELECT * FROM link "
|
||||
."WHERE ${ispublished}is_category = 0 AND "
|
||||
."WHERE ${is_published}is_category = 0 AND "
|
||||
."parent_id = $parent_id "
|
||||
."ORDER BY name");
|
||||
else
|
||||
$result = db_query("SELECT * FROM link "
|
||||
."WHERE ${ispublished}is_category = 0 "
|
||||
."WHERE ${is_published}is_category = 0 "
|
||||
."ORDER BY name");
|
||||
|
||||
if ($parent_id < 0)
|
||||
@ -387,6 +391,10 @@ switch ($op)
|
||||
print(" in $category");
|
||||
}
|
||||
|
||||
if (!$row["is_published"])
|
||||
print(" <img src='images/private.gif' width='16' height='16' "
|
||||
."align='middle' alt='private'/>");
|
||||
|
||||
if ($age == 1)
|
||||
print(", <i>Updated 1 day ago</i>");
|
||||
else if ($age < 30)
|
||||
@ -506,7 +514,7 @@ switch ($op)
|
||||
if (array_key_exists("DESCRIPTION", $_POST))
|
||||
$description = $_POST["DESCRIPTION"];
|
||||
|
||||
if (array_key_exists("ANNOUNCEMENT", $_POST))
|
||||
if (array_key_exists("ANNOUNCEMENT", $_POST) && $type == 'L')
|
||||
$announcement = $_POST["ANNOUNCEMENT"];
|
||||
|
||||
if ($name != "" &&
|
||||
@ -531,7 +539,11 @@ switch ($op)
|
||||
else
|
||||
$opname = 'Create';
|
||||
|
||||
$heading = htmlspecialchars("$opname $typename $name");
|
||||
if ($havedata)
|
||||
$heading = htmlspecialchars("${opname}d $typename $name");
|
||||
else
|
||||
$heading = htmlspecialchars("$opname $typename $name");
|
||||
|
||||
html_header($heading);
|
||||
|
||||
html_start_links(1);
|
||||
@ -554,6 +566,7 @@ switch ($op)
|
||||
$download_url = db_escape($download_url);
|
||||
$user = db_escape($LOGIN_USER);
|
||||
$date = time();
|
||||
$what = strtolower("${opname}d");
|
||||
|
||||
if ($id == 0)
|
||||
{
|
||||
@ -581,34 +594,36 @@ switch ($op)
|
||||
|
||||
if ($announcement != "")
|
||||
{
|
||||
$links = "<p>[ <a href='links.php?V$id'>More Info</a>";
|
||||
if ($homepage_url != "")
|
||||
$links .= " | <a href='links.php?SH$id'>Home Page</a>";
|
||||
if ($download_url != "")
|
||||
$links .= " | <a href='links.php?SD$id'>Download</a>";
|
||||
$links .= " ]</p>\n";
|
||||
|
||||
$abstract = db_escape(abbreviate($announcement, 80));
|
||||
$announcement = db_escape("<p>[ <a href='links.php?V$id'>"
|
||||
."More Info</a> ]</p>\n"
|
||||
. $announcement);
|
||||
$announcement = db_escape($links . $announcement);
|
||||
|
||||
db_query("INSERT INTO article VALUES(NULL,$is_published,"
|
||||
db_query("INSERT INTO article VALUES(NULL,0,"
|
||||
."'$name $version','$abstract','$announcement',$date,"
|
||||
."'$user',$date,'$user')");
|
||||
|
||||
$article_id = db_insert_id();
|
||||
|
||||
//
|
||||
mail($PROJECT_EMAIL, "$PROJECT_NAME Article #$id $what",
|
||||
wordwrap("$row[create_user] has $what an article titled, "
|
||||
."'$row[title]' with the following abstract:\n\n"
|
||||
." $row[abstract]\n\n"
|
||||
// Notify the admin about the new article...
|
||||
mail($PROJECT_EMAIL, "$PROJECT_NAME Article #$article_id created",
|
||||
wordwrap("$user has created an article titled, "
|
||||
."'$name $version' with the following abstract:\n\n"
|
||||
." $abstract\n\n"
|
||||
."Please approve or delete this article via the following "
|
||||
."page:\n\n"
|
||||
." $PHP_URL?L$id\n"),
|
||||
"From: noreply@easysw.com\r\n");
|
||||
." $PHP_URL?L$article_id\n"),
|
||||
"From: $PROJECT_EMAIL\r\n");
|
||||
}
|
||||
|
||||
print("<h2>$typename '$NAME' $opname</h2>\n");
|
||||
|
||||
if ($is_published == 0)
|
||||
{
|
||||
// Send email to moderators...
|
||||
$what = strtolower("${opname}d");
|
||||
$message = wordwrap("'$name' has been $what on the $PROJECT_NAME "
|
||||
."links page and requires your approval before "
|
||||
."it will be made visible on the $PROJECT_NAME "
|
||||
@ -616,16 +631,22 @@ switch ($op)
|
||||
."process the submission:\n\n"
|
||||
." $PHP_URL?U$type$id\n");
|
||||
|
||||
mail($PROJECT_EMAIL, "$PROJECT_NAME $typename $opname",
|
||||
$message, "From: noreply@easysw.com\r\n");
|
||||
mail($PROJECT_EMAIL, "$PROJECT_NAME $typename ${opname}d",
|
||||
$message, "From: $PROJECT_EMAIL\r\n");
|
||||
|
||||
// Let the user know that the moderator must approve it...
|
||||
print("<p>Your submission will be made visible as soon as one of "
|
||||
."moderators approves it.</p>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("<p>Thank you, your submission is now visible on the site.</p>\n");
|
||||
|
||||
if ($announcement != "")
|
||||
print("<p>Your news announcement will be made visible as soon as "
|
||||
."one of moderators approves it.</p>\n");
|
||||
}
|
||||
|
||||
html_start_links();
|
||||
html_link("Return to Listing", "$PHP_SELF?L+P$parent_id");
|
||||
html_end_links();
|
||||
@ -732,13 +753,26 @@ switch ($op)
|
||||
print("<tr><th align='right' valign='top'>${hstart}Description:${hend}</th>");
|
||||
else
|
||||
print("<tr><th align='right' valign='top'>Description:</th>");
|
||||
print("<td><textarea name='DESCRIPTION' wrap='virtual' cols='60' "
|
||||
."rows='10'>$description</textarea></td></tr>\n");
|
||||
print("<td><textarea name='DESCRIPTION' wrap='virtual' cols='72' "
|
||||
."rows='12'>$description</textarea>"
|
||||
."<p>The description may contain the following "
|
||||
."HTML elements: <tt>A</tt>, <tt>B</tt>, <tt>BLOCKQUOTE</tt>, "
|
||||
."<tt>CODE</tt>, <tt>EM</tt>, <tt>H1</tt>, <tt>H2</tt>, "
|
||||
."<tt>H3</tt>, <tt>H4</tt>, <tt>H5</tt>, <tt>H6</tt>, <tt>I</tt>, "
|
||||
."<tt>IMG</tt>, <tt>LI</tt>, <tt>OL</tt>, <tt>P</tt>, <tt>PRE</tt>, "
|
||||
."<tt>TT</tt>, <tt>U</tt>, <tt>UL</tt></p></td></tr>\n");
|
||||
|
||||
print("<tr><th align='right' valign='top'>Announcment:</th>");
|
||||
print("<td><textarea name='ANNOUNCEMENT' wrap='virtual' cols='72' "
|
||||
."rows='12'>$announcement</textarea>"
|
||||
."<p>The announcement may contain the following "
|
||||
."HTML elements: <tt>A</tt>, <tt>B</tt>, <tt>BLOCKQUOTE</tt>, "
|
||||
."<tt>CODE</tt>, <tt>EM</tt>, <tt>H1</tt>, <tt>H2</tt>, "
|
||||
."<tt>H3</tt>, <tt>H4</tt>, <tt>H5</tt>, <tt>H6</tt>, <tt>I</tt>, "
|
||||
."<tt>IMG</tt>, <tt>LI</tt>, <tt>OL</tt>, <tt>P</tt>, <tt>PRE</tt>, "
|
||||
."<tt>TT</tt>, <tt>U</tt>, <tt>UL</tt></p></td></tr>\n");
|
||||
}
|
||||
|
||||
print("<tr><th align='right' valign='top'>Announcment:</th>");
|
||||
print("<td><textarea name='NEWS' wrap='virtual' cols='60' rows='10'>"
|
||||
."$announcement</textarea></td></tr>\n");
|
||||
print("<tr><th></th>"
|
||||
."<td><input type='submit' value='$opname $typename'/></td>"
|
||||
."</tr>\n");
|
||||
@ -810,6 +844,7 @@ switch ($op)
|
||||
html_start_links(1);
|
||||
html_link("Back To Listings", "$PHP_SELF?L+P$parent_id$options");
|
||||
html_link("Show Comments", "#_USER_COMMENTS");
|
||||
html_link("Submit Comment", "comment.php?r0+plinks.php_V$id");
|
||||
if ($LOGIN_LEVEL >= AUTH_DEVEL || $LOGIN_USER == $row["create_user"])
|
||||
{
|
||||
html_link("Delete Listing", "$PHP_SELF?X$id$options");
|
||||
@ -878,7 +913,7 @@ switch ($op)
|
||||
db_free($result);
|
||||
|
||||
print("<hr noshade/>\n"
|
||||
."<h2><a name='_USER_COMMENTS'>User Comments</a></h2>\n");
|
||||
."<h2><a name='_USER_COMMENTS'>Comments</a></h2>\n");
|
||||
html_start_links();
|
||||
html_link("Submit Comment", "comment.php?r0+plinks.php_V$id");
|
||||
html_end_links();
|
||||
@ -888,86 +923,67 @@ switch ($op)
|
||||
break;
|
||||
|
||||
case 'X' : // Delete listing...
|
||||
/*
|
||||
if ($id <= 0)
|
||||
{
|
||||
print("<h2>Error</h2>\n"
|
||||
."<p>No link ID provided...</p>\n");
|
||||
break;
|
||||
}
|
||||
|
||||
$result = db_query("SELECT * FROM link WHERE id = $id");
|
||||
|
||||
if (!$result)
|
||||
if (db_count($result) != 1)
|
||||
{
|
||||
print("<h2>Error</h2>\n"
|
||||
."<p>Link $id does not exist.</p>\n");
|
||||
break;
|
||||
db_free($result);
|
||||
header("Location: $PHP_SELF?L$options");
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = db_next($result);
|
||||
|
||||
if (!$row)
|
||||
if ($LOGIN_LEVEL < AUTH_DEVEL && $LOGIN_USER != $row["create_user"])
|
||||
{
|
||||
print("<h2>Error</h2>\n"
|
||||
."<p>Link $id does not exist.</p>\n");
|
||||
break;
|
||||
db_free($result);
|
||||
header("Location: $PHP_SELF?L$options");
|
||||
exit();
|
||||
}
|
||||
|
||||
$name = $row['name;
|
||||
$owner_email = $row['owner_email;
|
||||
$owner_password = $row['owner_password;
|
||||
$name = htmlspecialchars($row["name"], ENT_QUOTES);
|
||||
|
||||
db_free($result);
|
||||
|
||||
if (!$LOGIN_USER && !($OWNER_EMAIL && $OWNER_PASSWORD))
|
||||
if ($REQUEST_METHOD == "POST")
|
||||
{
|
||||
print("<h2>Delete $name</h2>\n");
|
||||
// Already confirmed it...
|
||||
db_query("DELETE FROM link WHERE id = $id");
|
||||
html_header("$name Deleted");
|
||||
|
||||
print("<form method='POST' action='$PHP_SELF?X$id+P$parent_id'>\n"
|
||||
."<center><table border='0'>\n");
|
||||
html_start_links(1);
|
||||
html_link("Return To Listings", "$PHP_SELF?L+P$parent_id$options");
|
||||
html_end_links();
|
||||
|
||||
print("<tr>"
|
||||
."<th align='right'>Owner Email:</th>"
|
||||
."<td><input type='text' name='OWNER_EMAIL' value='$owner_email' "
|
||||
."size='40' maxlength='128'></td>"
|
||||
."</tr>\n");
|
||||
print("<h1>$name Deleted</h1>\n");
|
||||
|
||||
print("<tr>"
|
||||
."<th align='right'>Owner Password:</th>"
|
||||
."<td><input type='password' name='OWNER_PASSWORD' "
|
||||
."size='32' maxlength='32'></td>"
|
||||
."</tr>\n");
|
||||
print("<p>The listing for '$name' has been deleted.</p>\n");
|
||||
|
||||
print("<tr>"
|
||||
."<th></th>"
|
||||
."<td><input type='submit' value='Delete'></td>"
|
||||
."</tr>\n");
|
||||
|
||||
print("</table></center>\n");
|
||||
print("</form>");
|
||||
break;
|
||||
html_footer();
|
||||
}
|
||||
else if (!$LOGIN_USER &&
|
||||
($OWNER_EMAIL != $owner_email ||
|
||||
$OWNER_PASSWORD != $owner_password))
|
||||
else
|
||||
{
|
||||
print("<h2>Error</h2>\n"
|
||||
."<p>Owner email or password doesn't match!</p>\n");
|
||||
break;
|
||||
// Confirm deletion...
|
||||
html_header("Delete $name");
|
||||
|
||||
html_start_links(1);
|
||||
html_link("Return To $name", "$PHP_SELF?V$id+P$parent_id$options");
|
||||
html_link("Return To Listings", "$PHP_SELF?L+P$parent_id$options");
|
||||
html_end_links();
|
||||
|
||||
print("<h1>Delete $name</h1>\n");
|
||||
|
||||
print("<form method='POST' action='$PHP_SELF?X$id+P$parent_id$options'>\n"
|
||||
."<center><input type='submit' value='Confirm Delete $name'></center>"
|
||||
."</form>\n");
|
||||
|
||||
html_footer();
|
||||
}
|
||||
|
||||
db_query("DELETE FROM link WHERE id=$id");
|
||||
|
||||
print("<h2>Deleted $name</h2>\n");
|
||||
print("<p><a href='$PHP_SELF?P$parent_id'>Return to listing.</a></p>\n");
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'R' : // Rate this entry...
|
||||
if (array_key_exists("RATING", $_POST))
|
||||
{
|
||||
$rating = (int)$_POST("RATING");
|
||||
$rating = (int)$_POST["RATING"];
|
||||
|
||||
if ($rating < 0)
|
||||
$rating = 0;
|
||||
@ -1019,6 +1035,6 @@ db_close();
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: links.php,v 1.2 2004/05/20 15:45:55 mike Exp $".
|
||||
// End of "$Id: links.php,v 1.3 2004/05/20 21:37:57 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
222
www/login.php
222
www/login.php
@ -1,32 +1,161 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: login.php,v 1.2 2004/05/19 01:39:04 mike Exp $"
|
||||
// "$Id: login.php,v 1.3 2004/05/20 21:37:57 mike Exp $"
|
||||
//
|
||||
// Login/registration form...
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
include_once "phplib/html.php";
|
||||
include_once "phplib/common.php";
|
||||
|
||||
$usererror = "";
|
||||
|
||||
if ($REQUEST_METHOD == "POST" &&
|
||||
array_key_exists("USERNAME", $_POST) &&
|
||||
array_key_exists("PASSWORD", $_POST))
|
||||
auth_login($_POST["USERNAME"], $_POST["PASSWORD"]);
|
||||
if ($REQUEST_METHOD == "POST")
|
||||
{
|
||||
if (array_key_exists("USERNAME", $_POST))
|
||||
$username = $_POST["USERNAME"];
|
||||
else
|
||||
$username = "";
|
||||
|
||||
if (array_key_exists("PASSWORD", $_POST))
|
||||
$password = $_POST["PASSWORD"];
|
||||
else
|
||||
$password = "";
|
||||
|
||||
if (array_key_exists("PASSWORD2", $_POST))
|
||||
$password2 = $_POST["PASSWORD2"];
|
||||
else
|
||||
$password2 = "";
|
||||
|
||||
if (array_key_exists("EMAIL", $_POST))
|
||||
$email = $_POST["EMAIL"];
|
||||
else
|
||||
$email = "";
|
||||
|
||||
if (array_key_exists("REGISTER", $_POST))
|
||||
$register = $_POST["REGISTER"];
|
||||
else
|
||||
$register = "";
|
||||
|
||||
if ($username != "" && !eregi("[a-z0-9._-]+", $username))
|
||||
$usererror = "Bad username - only letters, numbers, '.', '-', and '_' "
|
||||
."are allowed!";
|
||||
else if ($argc == 1 && $argv[0] == "A" && $username != "" &&
|
||||
$password != "" && $password == $password2 &&
|
||||
$email != "" && validate_email($email))
|
||||
{
|
||||
// Good new account request so far; see if account already
|
||||
// exists...
|
||||
$name = db_escape($username);
|
||||
$result = db_query("SELECT * FROM users WHERE name='$name'");
|
||||
if (db_count($result) == 0)
|
||||
{
|
||||
// Nope, add unpublished user account and send registration email.
|
||||
db_free($result);
|
||||
|
||||
$hash = md5("$username:$password");
|
||||
$demail = db_escape($email);
|
||||
$date = time();
|
||||
|
||||
db_query("INSERT INTO users VALUES(NULL, 0, '$name', '$demail', '$hash', "
|
||||
."0, $date, '$name', $date, '$name')");
|
||||
|
||||
$userid = db_insert_id();
|
||||
$hash = md5("$userid:$hash");
|
||||
|
||||
mail($email, "$PROJECT_NAME User Registration",
|
||||
wordwrap("Thank you for requesting an account on the $PROJECT_NAME "
|
||||
."home page. To complete your registration, go to the "
|
||||
."following URL:\n\n"
|
||||
." $PHP_URL?E\n\n"
|
||||
."and enter your username ($username), password, and the "
|
||||
."following registration code:\n\n"
|
||||
." $hash\n\n"
|
||||
."You will then be able to access your account.\n"),
|
||||
"From: $PROJECT_EMAIL\r\n");
|
||||
|
||||
html_header("Login Registration");
|
||||
print("<h1>Login Registration</h1>\n"
|
||||
."Thank you for requesting an account. You should receive an "
|
||||
."email from $PROJECT_EMAIL shortly with instructions on "
|
||||
."completing your registration.</p>\n");
|
||||
html_footer();
|
||||
exit();
|
||||
}
|
||||
|
||||
db_free($result);
|
||||
|
||||
$usererror = "Username already exists!";
|
||||
}
|
||||
else if ($argc == 1 && $argv[0] == "E" && $username != "" &&
|
||||
$password != "" && $register != "")
|
||||
{
|
||||
// Check that we have an existing user account...
|
||||
$name = db_escape($username);
|
||||
$result = db_query("SELECT * FROM users WHERE name='$name'");
|
||||
if (db_count($result) == 1)
|
||||
{
|
||||
// Yes, now check the registration code...
|
||||
$row = db_next($result);
|
||||
$hash = md5("$row[id]:$row[hash]");
|
||||
|
||||
if ($hash == $register)
|
||||
{
|
||||
// Good code, enable the account and login...
|
||||
db_query("UPDATE users SET is_published = 1 WHERE name='$name'");
|
||||
|
||||
if (auth_login($username, $password) == "")
|
||||
{
|
||||
db_query("UPDATE users SET is_published = 0 WHERE name='$name'");
|
||||
$usererror = "Login failed!";
|
||||
}
|
||||
}
|
||||
else
|
||||
$usererror = "Bad registration code!";
|
||||
}
|
||||
else
|
||||
$usererror = "Username not found!";
|
||||
|
||||
db_free($result);
|
||||
}
|
||||
else if (argc == 0 && $username != "" && $password != "")
|
||||
if (auth_login($username, $password) == "")
|
||||
$usererror = "Login failed!";
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = "";
|
||||
$password = "";
|
||||
$password2 = "";
|
||||
$email = "";
|
||||
$register = "";
|
||||
}
|
||||
|
||||
if ($LOGIN_USER != "")
|
||||
header("Location: account.php");
|
||||
else
|
||||
else if ($argc == 0 || $argv[0] != "E")
|
||||
{
|
||||
// Header + start of table...
|
||||
html_header("Login");
|
||||
|
||||
print("<h1>Login</h1>\n"
|
||||
."<p>Logins are currently only available to Mini-XML developers. "
|
||||
."If you are not a Mini-XML developer, please return to the "
|
||||
."<a href='index.php'>home page</a> and choose a different "
|
||||
."link.</p>\n"
|
||||
."<p><table width='100%' height='100%' border='0' cellpadding='0' "
|
||||
."cellspacing='0'>\n"
|
||||
."<tr><td valign='top'>\n");
|
||||
|
||||
// Existing users...
|
||||
print("<h2>Current Users</h2>\n");
|
||||
|
||||
if ($argc == 0 && $usererror != "")
|
||||
print("<p><b>$usererror</b></p>\n");
|
||||
|
||||
print("<p>If you are a registered $PROJECT_NAME developer, please enter "
|
||||
."your username and password to login:</p>\n"
|
||||
."<form method='POST' action='$PHP_SELF'>"
|
||||
."<p><table width='100%'>\n"
|
||||
."<tr><th align='right'>Username:</th>"
|
||||
@ -42,11 +171,82 @@ else
|
||||
."<tr><th></th><td><input type='submit' value='Login'/></td></tr>\n"
|
||||
."</table></p></form>\n");
|
||||
|
||||
// Separator...
|
||||
print("</td>"
|
||||
."<td> "
|
||||
."<img src='images/black.gif' width='1' height='80%' alt=''/>"
|
||||
." </td>"
|
||||
."<td valign='top'>\n");
|
||||
|
||||
// New users...
|
||||
print("<h2>New Users</h2>\n");
|
||||
|
||||
if ($argc == 1 && $usererror != "")
|
||||
print("<p><b>$usererror</b></p>\n");
|
||||
|
||||
$username = htmlspecialchars($username, ENT_QUOTES);
|
||||
$email = htmlspecialchars($email, ENT_QUOTES);
|
||||
|
||||
print("<p>If you are a not registered $PROJECT_NAME developer, please fill "
|
||||
."in the form below to register. An email will be sent to the "
|
||||
."address you supply to confirm the registration:</p>\n"
|
||||
."<form method='POST' action='$PHP_SELF?A'>"
|
||||
."<p><table width='100%'>\n"
|
||||
."<tr><th align='right'>Username:</th>"
|
||||
."<td><input type='text' name='USERNAME' size='16' maxsize='255' "
|
||||
." value='$username'/></td></tr>\n"
|
||||
."<tr><th align='right'>EMail:</th>"
|
||||
."<td><input type='text' name='EMAIL' size='16' maxsize='255' "
|
||||
." value='$email'/></td></tr>\n"
|
||||
."<tr><th align='right'>Password:</th>"
|
||||
."<td><input type='password' name='PASSWORD' size='16' maxsize='255'/>"
|
||||
."</td></tr>\n"
|
||||
."<tr><th align='right'>Password Again:</th>"
|
||||
."<td><input type='password' name='PASSWORD2' size='16' maxsize='255'/>"
|
||||
."</td></tr>\n"
|
||||
."<tr><th></th><td><input type='submit' value='Request Account'/></td></tr>\n"
|
||||
."</table></p></form>\n");
|
||||
|
||||
// End table
|
||||
print("</td></tr>\n"
|
||||
."</table></p>\n");
|
||||
|
||||
html_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
html_header("Enable Account");
|
||||
|
||||
print("<h1>Enable Account</h1>\n");
|
||||
|
||||
if ($usererror != NULL)
|
||||
print("<p><b>$usererror</b></p>\n");
|
||||
|
||||
$username = htmlspecialchars($username, ENT_QUOTES);
|
||||
$register = htmlspecialchars($register, ENT_QUOTES);
|
||||
|
||||
print("<p>Please enter the registration code that was emailed to you "
|
||||
."with your username and password to enable your account and login:</p>\n"
|
||||
."<form method='POST' action='$PHP_SELF?E'>"
|
||||
."<center><table width='100%'>\n"
|
||||
."<tr><th align='right'>Registration Code:</th>"
|
||||
."<td><input type='text' name='REGISTER' size='32' maxsize='32' "
|
||||
."value = '$register'/>"
|
||||
."</td></tr>\n"
|
||||
."<tr><th align='right'>Username:</th>"
|
||||
."<td><input type='text' name='USERNAME' size='16' maxsize='255' "
|
||||
."value='$username'/></td></tr>\n"
|
||||
."<tr><th align='right'>Password:</th>"
|
||||
."<td><input type='password' name='PASSWORD' size='16' maxsize='255'/>"
|
||||
."</td></tr>\n"
|
||||
."<tr><th></th><td><input type='submit' value='Enable Account'/></td></tr>\n"
|
||||
."</table></center></form>\n");
|
||||
|
||||
html_footer();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: login.php,v 1.2 2004/05/19 01:39:04 mike Exp $".
|
||||
// End of "$Id: login.php,v 1.3 2004/05/20 21:37:57 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?
|
||||
//
|
||||
// "$Id: common.php,v 1.11 2004/05/20 03:38:42 mike Exp $"
|
||||
// "$Id: common.php,v 1.12 2004/05/20 21:37:57 mike Exp $"
|
||||
//
|
||||
// Common utility functions for PHP pages...
|
||||
//
|
||||
@ -128,46 +128,46 @@ format_text($text) // I - Original string
|
||||
{
|
||||
case '<' :
|
||||
$col ++;
|
||||
if (tolower(substr($text, $i, 8)) == "<a href=" ||
|
||||
tolower(substr($text, $i, 8)) == "<a name=" ||
|
||||
tolower(substr($text, $i, 4)) == "</a>" ||
|
||||
tolower(substr($text, $i, 3)) == "<b>" ||
|
||||
tolower(substr($text, $i, 4)) == "</b>" ||
|
||||
tolower(substr($text, $i, 12)) == "<blockquote>" ||
|
||||
tolower(substr($text, $i, 13)) == "</blockquote>" ||
|
||||
tolower(substr($text, $i, 6)) == "<code>" ||
|
||||
tolower(substr($text, $i, 7)) == "</code>" ||
|
||||
tolower(substr($text, $i, 4)) == "<em>" ||
|
||||
tolower(substr($text, $i, 5)) == "</em>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h1>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h1>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h2>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h2>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h3>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h3>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h4>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h4>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h5>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h5>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h6>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h6>" ||
|
||||
tolower(substr($text, $i, 3)) == "<i>" ||
|
||||
tolower(substr($text, $i, 4)) == "</i>" ||
|
||||
tolower(substr($text, $i, 5)) == "<img " ||
|
||||
tolower(substr($text, $i, 4)) == "<li>" ||
|
||||
tolower(substr($text, $i, 5)) == "</li>" ||
|
||||
tolower(substr($text, $i, 4)) == "<ol>" ||
|
||||
tolower(substr($text, $i, 5)) == "</ol>" ||
|
||||
tolower(substr($text, $i, 3)) == "<p>" ||
|
||||
tolower(substr($text, $i, 4)) == "</p>" ||
|
||||
tolower(substr($text, $i, 5)) == "<pre>" ||
|
||||
tolower(substr($text, $i, 6)) == "</pre>" ||
|
||||
tolower(substr($text, $i, 4)) == "<tt>" ||
|
||||
tolower(substr($text, $i, 5)) == "</tt>" ||
|
||||
tolower(substr($text, $i, 3)) == "<u>" ||
|
||||
tolower(substr($text, $i, 4)) == "</u>" ||
|
||||
tolower(substr($text, $i, 4)) == "<ul>" ||
|
||||
tolower(substr($text, $i, 5)) == "</ul>")
|
||||
if (strtolower(substr($text, $i, 8)) == "<a href=" ||
|
||||
strtolower(substr($text, $i, 8)) == "<a name=" ||
|
||||
strtolower(substr($text, $i, 4)) == "</a>" ||
|
||||
strtolower(substr($text, $i, 3)) == "<b>" ||
|
||||
strtolower(substr($text, $i, 4)) == "</b>" ||
|
||||
strtolower(substr($text, $i, 12)) == "<blockquote>" ||
|
||||
strtolower(substr($text, $i, 13)) == "</blockquote>" ||
|
||||
strtolower(substr($text, $i, 6)) == "<code>" ||
|
||||
strtolower(substr($text, $i, 7)) == "</code>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<em>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</em>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<h1>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</h1>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<h2>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</h2>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<h3>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</h3>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<h4>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</h4>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<h5>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</h5>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<h6>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</h6>" ||
|
||||
strtolower(substr($text, $i, 3)) == "<i>" ||
|
||||
strtolower(substr($text, $i, 4)) == "</i>" ||
|
||||
strtolower(substr($text, $i, 5)) == "<img " ||
|
||||
strtolower(substr($text, $i, 4)) == "<li>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</li>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<ol>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</ol>" ||
|
||||
strtolower(substr($text, $i, 3)) == "<p>" ||
|
||||
strtolower(substr($text, $i, 4)) == "</p>" ||
|
||||
strtolower(substr($text, $i, 5)) == "<pre>" ||
|
||||
strtolower(substr($text, $i, 6)) == "</pre>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<tt>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</tt>" ||
|
||||
strtolower(substr($text, $i, 3)) == "<u>" ||
|
||||
strtolower(substr($text, $i, 4)) == "</u>" ||
|
||||
strtolower(substr($text, $i, 4)) == "<ul>" ||
|
||||
strtolower(substr($text, $i, 5)) == "</ul>")
|
||||
{
|
||||
while ($i < $len && $text[$i] != '>')
|
||||
{
|
||||
@ -327,6 +327,9 @@ format_text($text) // I - Original string
|
||||
if ($list)
|
||||
$ftext .= "</ul>";
|
||||
|
||||
if ($pre)
|
||||
$ftext .= "</pre>";
|
||||
|
||||
return ($ftext);
|
||||
}
|
||||
|
||||
@ -673,6 +676,6 @@ validate_email($email) // I - Email address
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: common.php,v 1.11 2004/05/20 03:38:42 mike Exp $".
|
||||
// End of "$Id: common.php,v 1.12 2004/05/20 21:37:57 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: globals.php,v 1.8 2004/05/20 15:45:55 mike Exp $"
|
||||
// "$Id: globals.php,v 1.9 2004/05/20 21:37:57 mike Exp $"
|
||||
//
|
||||
// Global PHP constants and variables...
|
||||
//
|
||||
@ -13,6 +13,8 @@
|
||||
|
||||
$PROJECT_NAME = "Mini-XML"; // Title of project
|
||||
$PROJECT_EMAIL = "mxml@easysw.com"; // Default notification address
|
||||
$PROJECT_REGISTER = "mxml-register@easysw.com";
|
||||
// User registration email
|
||||
$PROJECT_MODULE = "mxml"; // CVS module
|
||||
$PAGE_MAX = 10; // Max items per page
|
||||
|
||||
@ -36,6 +38,6 @@ else
|
||||
$PHP_URL = "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]$_SERVER[PHP_SELF]";
|
||||
|
||||
//
|
||||
// End of "$Id: globals.php,v 1.8 2004/05/20 15:45:55 mike Exp $".
|
||||
// End of "$Id: globals.php,v 1.9 2004/05/20 21:37:57 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
16
www/str.php
16
www/str.php
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: str.php,v 1.11 2004/05/20 02:04:44 mike Exp $"
|
||||
// "$Id: str.php,v 1.12 2004/05/20 21:37:57 mike Exp $"
|
||||
//
|
||||
// Software Trouble Report page...
|
||||
//
|
||||
@ -135,7 +135,7 @@ notify_users($id, // I - STR #
|
||||
."\n$contents"
|
||||
."________________________________________________________________\n"
|
||||
."Thank you for using the $PROJECT_NAME Software Trouble Report page!",
|
||||
"From: noreply@easysw.com\r\n");
|
||||
"From: $PROJECT_EMAIL\r\n");
|
||||
|
||||
$ccresult = db_query("SELECT email FROM carboncopy WHERE url = 'str.php_L$id'");
|
||||
if ($ccresult)
|
||||
@ -159,7 +159,7 @@ notify_users($id, // I - STR #
|
||||
."\n$contents"
|
||||
."________________________________________________________________\n"
|
||||
."Thank you for using the $PROJECT_NAME Software Trouble Report page!",
|
||||
"From: noreply@easysw.com\r\n");
|
||||
"From: $PROJECT_EMAIL\r\n");
|
||||
}
|
||||
|
||||
db_free($ccresult);
|
||||
@ -186,7 +186,7 @@ notify_users($id, // I - STR #
|
||||
." Subsystem: $subsystem\n"
|
||||
."Fix Version: $fix_version\n"
|
||||
."\n$contents",
|
||||
"From: noreply@easysw.com\r\n");
|
||||
"From: $PROJECT_EMAIL\r\n");
|
||||
|
||||
db_free($result);
|
||||
}
|
||||
@ -1187,11 +1187,11 @@ switch ($op)
|
||||
}
|
||||
print("</select><br />\n");
|
||||
|
||||
print("<textarea name='CONTENTS' COLS='72' ROWS='12' WRAP='VIRTUAL'>"
|
||||
print("<textarea name='CONTENTS' cols='72' rows='12' wrap='virtual'>"
|
||||
."</textarea></td></tr>\n");
|
||||
|
||||
print("<tr><TH ALIGN='CENTER' COLSPAN='2'>"
|
||||
."<INPUT type='SUBMIT' value='Update Trouble Report'></th></tr>\n");
|
||||
print("<tr><th align='center' colspan='2'>"
|
||||
."<input type='submit' value='Update Trouble Report'/></th></tr>\n");
|
||||
print("</table></p></form>\n");
|
||||
|
||||
print("<hr noshade/><p><b>Trouble Report Files:</b> "
|
||||
@ -1890,6 +1890,6 @@ switch ($op)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: str.php,v 1.11 2004/05/20 02:04:44 mike Exp $".
|
||||
// End of "$Id: str.php,v 1.12 2004/05/20 21:37:57 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user