cvs: php-hosts-web / host-add.php login.php table.sql
| From: | jim winstead | Date: | Tue, 23 Apr 2002 03:15:31 +0000 |
| Subject: | cvs: php-hosts-web / host-add.php login.php table.sql | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-9800@lists.php.net to get a copy of this message | ||
jimw Mon Apr 22 23:15:31 2002 EDT
Modified files:
/php-hosts-web table.sql host-add.php login.php
Log:
no more users table, just store contact address and password in hosts table
Index: php-hosts-web/table.sql
diff -u php-hosts-web/table.sql:1.7 php-hosts-web/table.sql:1.8
--- php-hosts-web/table.sql:1.7 Mon Apr 22 22:28:08 2002
+++ php-hosts-web/table.sql Mon Apr 22 23:15:30 2002
@@ -34,6 +34,8 @@
HostCountry char(2) default NULL,
created datetime NOT NULL,
lastupdate datetime NOT NULL,
+ contact varchar(64) NOT NULL default '',
+ password varchar(13) NOT NULL default '',
PRIMARY KEY (HostID),
KEY HostName (HostName)
) TYPE=MyISAM;
@@ -82,18 +84,3 @@
PRIMARY KEY (ServiceID),
KEY ServiceName (ServiceName)
) TYPE=MyISAM;
-
---
--- Table structure for table 'users'
---
-
-CREATE TABLE users (
- UserUser varchar(8) NOT NULL default '',
- UserPass varchar(13) NOT NULL default '',
- HostID int(11) NOT NULL default '0',
- UserEmail varchar(64) default NULL,
- PRIMARY KEY (UserUser),
- KEY UserPass (UserPass),
- KEY HostID (HostID)
-) TYPE=MyISAM;
-
Index: php-hosts-web/host-add.php
diff -u php-hosts-web/host-add.php:1.7 php-hosts-web/host-add.php:1.8
--- php-hosts-web/host-add.php:1.7 Mon Apr 22 14:36:17 2002
+++ php-hosts-web/host-add.php Mon Apr 22 23:15:30 2002
@@ -14,8 +14,7 @@
if (ereg('<', $hostname)) { $ERRORS[]="HTML is not allowed in Name"; }
if (empty($hosturl)) { $ERRORS[]="URL of company left blank"; }
if (empty($hostemail)) { $ERRORS[]="Email for company left blank"; }
- if (empty($useruser)) { $ERRORS[]="User Name left blank"; }
- if (empty($useremail)) { $ERRORS[]="User Email left blank"; }
+ if (empty($useremail)) { $ERRORS[]="Contact Email left blank"; }
if (!get_magic_quotes_gpc()) {
$hostname2 = addslashes($hostname);
@@ -26,16 +25,11 @@
$hostfax2 = addslashes($hostfax);
$hostcity2 = addslashes($hostcity);
$hoststate2 = addslashes($hoststate);
- $useruser2 = addslashes($useruser);
$useremail2 = addslashes($useremail);
}
$hosturl2 = eregi_replace("^http://","",$hosturl2);
$hostinfourl2 = eregi_replace("^http://","",$hostinfourl2);
- $query = "SELECT * FROM $USERS_TABLE where UserUser='$useruser2'";
- $q1 = mysql_query($query) or die ("\"$query\" is a bad query.");
- if (mysql_num_rows($q1)) { $ERRORS[]="Username <B>$useruser</B> already
taken"; }
-
if ($ERRORS) {
echo "We can't add your listing because of the following errors:<BR>";
echo "<UL>\n";
@@ -45,34 +39,28 @@
echo "</UL>\n";
echo "Use your browser's back button to correct these errors.";
} else {
-
- $query = "INSERT INTO $HOSTS_TABLE
(HostName,HostURL,HostInfoURL,HostEmail,HostPhone,HostFax,HostCity,HostState,HostCountry,created,lastupate)
";
- $query.= "values
('$hostname2','$hosturl2','$hostinfourl2','$hostemail2','$hostphone2','$hostfax2','$hostcity2','$hoststate2','$hostcountry',NOW(),NOW())";
- $q1 = mysql_query($query) or die ("\"$query\" is a bad query.");
- $hostid = mysql_insert_id();
-
$password = randomstring(8);
$crypt = crypt($password,randomstring(2));
-
- $query = "INSERT INTO $USERS_TABLE (UserUser, UserPass, HostID, UserEmail) ";
- $query.= "values
('$useruser2','$crypt',$hostid,'$useremail2')";
+ $query = "INSERT INTO hosts
(HostName,HostURL,HostInfoURL,HostEmail,HostPhone,HostFax,HostCity,HostState,HostCountry,created,lastupate,contact,password)
";
+ $query.= "values
('$hostname2','$hosturl2','$hostinfourl2','$hostemail2','$hostphone2','$hostfax2','$hostcity2','$hoststate2','$hostcountry',NOW(),NOW(),'$useremail2','".addslashes($crypt)."')";
$q1 = mysql_query($query) or die ("\"$query\" is a bad query.");
+ $hostid = mysql_insert_id();
$msg = "You (or someone using your email address) has added your company to the ";
- $msg.= "listing of PHP Hosting Companies (at http://hosts.php.net).\n\n";
+ $msg.= "listing of PHP Hosting Companies (at http://hosts.php.net/).\n\n";
$msg.= "To update your listing, go to the \"Clients\" page, with the following
";
$msg.= "username and password:\n\n";
- $msg.= "\tUsername: $useruser\n";
+ $msg.= "\tUsername: ".stripslashes($useremail2)."\n";
$msg.= "\tPassword: $password\n\n";
$msg.= "If you have any questions, email webmaster@php.net.\n\n";
$from = "From: \"PHP Hosting Listing\" <webmaster@php.net>";
- mail($useremail,"PHP Hosting Companies Listing",$msg,$from);
+ mail(stripslashes($useremail2),"PHP Hosting Companies Listing",$msg,$from);
- echo "<P><B>".$hostname."</B> has been added to the list of PHP
hosting companies.</P>\n";
- echo "<P>An email has been sent to $useremail with information on how to edit your
listing.</P>\n";
+ echo "<P><B>".htmlentities(stripslashes($hostname2))."</B> has
been added to the list of PHP hosting companies.</P>\n";
+ echo "<P>An email has been sent to
".htmlentities(stripslashes($useremail))." with information on how to edit your
listing.</P>\n";
}
} else {
@@ -152,15 +140,9 @@
<TR VALIGN=top BGCOLOR="<? echo $COLOR["ltpurple"]; ?>">
<TD colspan=2><B>Contact Information</B><BR>
-You need to supply us with a username
-and password.
-</TD>
-</TR>
-
-<TR VALIGN=top>
-<TD ALIGN=right>User Name: </TD>
-<TD><INPUT TYPE="text" NAME="useruser" SIZE=15
MAXLENGTH=8>*<BR>
-<SMALL>Maximum 8 characters.</SMALL>
+You need to supply us with an email address that we can use to contact about
+this record. This is also where we will send the password that will allow you
+to modify your entry.
</TD>
</TR>
Index: php-hosts-web/login.php
diff -u php-hosts-web/login.php:1.1 php-hosts-web/login.php:1.2
--- php-hosts-web/login.php:1.1 Sun Apr 21 23:04:13 2002
+++ php-hosts-web/login.php Mon Apr 22 23:15:30 2002
@@ -10,7 +10,7 @@
$errors[] = "You need to supply your password to log in.";
}
if (!$errors) {
- $id = mysql_get_one("SELECT HostId FROM users WHERE UserEmail='$in[email]' AND
ENCRYPT('$in[pass]',UserPass) = UserPass");
+ $id = mysql_get_one("SELECT HostId FROM hosts WHERE contact='$in[email]' AND
ENCRYPT('$in[pass]',password) = password");
if ($id) {
setcookie("HOSTID","$id:".base64_encode($in['pass']));
header("Location: showinfo.php?hostid=$id&login=1");