Chrisj
-
Posts
551 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Chrisj
-
-
I have a web site host who provides MYSQL with the hosting package. And I have a script entitled: Member Mgmt Script, to manage users/members who register with my web site. I can set up most features of this script, except I know very little about setting up databases. The Members Mgmt script install instructions simply say: "Set database connection details in db_config.php".
Can someone tell me how to "set database connection details in db_config.php"?
Here is the db_config.php file, thanks:
<?php
/**
* file: db_config.php
*
* description: init db connection
*/
$db_name = "database name"; // database name
$db_user_name = "database user name"; // database user name
$db_user_password = "database password"; // datanase user password
$db_type = "mysql";
// note: for use mysqli lib set db_type = mysqli
$host = "localhost";
?>
-
I need a script, for my web site.
Thanks.
This is what I need:
Log-in page
If user can’t log-in, register and continue to Paypal Subscription Payment
Once payment is made, users get re-directed to log-in page.
Only registered/paid users can log-in.
Registered User info and Order info (subscription payment, date,etc)is added to database.
If Subscription expires without payment, user is blocked from logging-in.
Log-in privledge is re-instated once current subscription payment is received.
Log-in is users email address and password.
User can retreive password or user name if forgotten.
Log-in submission re-directs the user to the upload/browser box page.
Upload Page
Paid/registered logged-in users can access this page, only.
Upload box only accepts a limited number of vald extensions.
File is checked for viruses.
File size & date is added to the database
File name is changed to the users log-in name.extenstion.
File is directed to a specific directory.
-
I'm hoping someone might be interested in helping me add add a browse/upload-file field into an existing log-in page.
Plus, store the file size in a database to keep track of how much each registered user uploads, change the file name, and limit the uploaded file to a handful of extensions.
I have this code:
<?php
if (isset($_SESSION['customer_id']))
{
echo '
<form action="/WHEREVER IM GOING/"
enctype="multipart/form-data" method="post">
<p>
Please specify a filebr />
<input type="file" name="myfile" size="40">
</p>
<p>
<input type="submit" value="Send">
</p>
</form>';
}
if (!empty($_FILES)) {
$connection = mysql_connect("hostname", "username", "password");
$db = mysql_select_db("dbname", $connection);
mysql_query("INSERT INTO upload_track (customer_id, filesize) VALUES (" . $_SESSION['customer_id'] . ", " . $_FILES['myfile']['size'] . ")", $connection);
}
?>
And this code:
move_uploaded_file([uploadedfile],[path/to/filename.ext]);
and the log-in page code below. I just don't know how to put them together to make them function together with what I'd like the form to do, as outlined above.
Would anyone like to provide me with some assistance/guidance here?
Thank you.
<?php
/*
+--------------------------------------------------------------------------
| login.inc.php
| ========================================
| Start the session
+--------------------------------------------------------------------------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
exit;
}
$_GET['act'] = treatGet($_GET['act']);
if($_GET['act']=="login" && isset($_POST['username']) && isset($_POST['password'])){
$_POST['username'] = treatGet($_POST['username']);
$_POST['password'] = treatGet($_POST['password']);
$query = "SELECT customer_id FROM ".$glob['dbprefix']."CubeCart_customer WHERE email=".$db->mySQLSafe($_POST['username'])." AND password = ".$db->mySQLSafe(md5($_POST['password']))." AND type>0";
$customer = $db->select($query);
if($customer==FALSE) {
if($db->blocker($_POST['username'],$ini['bfattempts'],$ini['bftime'],FALSE,"f")==TRUE)
{
$blocked = TRUE;
}
} elseif($customer[0]['customer_id']>0) {
if($db->blocker($_POST['username'],$ini['bfattempts'],$ini['bftime'],TRUE,"f")==TRUE)
{
$blocked = TRUE;
}
else
{
$customerData["customer_id"] = $customer[0]['customer_id'];
$update = $db->update($glob['dbprefix']."CubeCart_sessions", $customerData,"sessId=".$db->mySQLSafe($_SESSION['ccUser']));
$_POST['remember'] = treatGet($_POST['remember']);
if($_POST['remember']==1){
setcookie("ccRemember","1",time()+$config['sqlSessionExpiry'], $GLOBALS['rootRel']);
}
// redirect
// "login","reg","unsubscribe","forgotPass"
if(isset($_GET['redir']) && !empty($_GET['redir']) && !eregi("logout|login|forgotPass|changePass",base64_decode($_GET['redir']))){
header("Location: ".str_replace("amp;","",treatGet(base64_decode($_GET['redir']))));
exit;
} else {
header("Location: ".$GLOBALS['rootRel']."index.php");
exit;
}
}
}
elseif(eregi("step1",base64_decode($_GET['redir'])))
{
header("Location: ".$GLOBALS['rootRel']."cart.php?act=step1");
exit;
}
}
$login = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/login.tpl");
$login->assign("LANG_LOGIN_TITLE",$lang['front']['login']['login']);
$login->assign("VAL_SELF",treatGet($_GET['redir']));
$login->assign("LANG_USERNAME",$lang['front']['login']['username']);
if(isset($_POST['username'])){
$login->assign("VAL_USERNAME",$_POST['username']);
}
$login->assign("LANG_PASSWORD",$lang['front']['login']['password']);
$login->assign("LANG_REMEMBER",$lang['front']['login']['remember_me']);
$login->assign("TXT_LOGIN",$lang['front']['login']['login']);
$login->assign("LANG_FORGOT_PASS",$lang['front']['login']['forgot_pass']);
if(isset($_POST['remember']) && $_POST['remember']==1) $login->assign("CHECKBOX_STATUS","checked='checked'");
if($ccUserData[0]['customer_id'] > 0 && isset($_POST['submit'])){
$login->assign("LOGIN_STATUS",$lang['front']['login']['login_success']);
} elseif($ccUserData[0]['customer_id'] > 0 && !isset($_POST['submit'])) {
$login->assign("LOGIN_STATUS",$lang['front']['login']['already_logged_in']);
} elseif($ccUserData[0]['customer_id'] == 0 && isset($_POST['submit'])) {
if($blocked == TRUE)
{
$login->assign("LOGIN_STATUS",sprintf($lang['front']['login']['blocked'],sprintf("%.0f",$ini['bftime']/60)));
}
else
{
$login->assign("LOGIN_STATUS",$lang['front']['login']['login_failed']);
}
$login->parse("login.form");
} else {
$login->assign("LOGIN_STATUS",$lang['front']['login']['login_below']);
$login->parse("login.form");
}
$login->parse("login");
$page_content = $login->text("login");
?>
Making the User Name an Email Address
in PHP Coding Help
Posted
I'm using script program with a Create Account Page. It asks for User Name, Password, Email Address etc., I want the User Name to be the Users Email Address, is there a way to combine these, so that the User Name is the email address?
Or is it possible to somehow require that the user enter an email address as a User Name?
And then store the user name where the email address would be stored?
Thank you.
Here is the code: