Jump to content

Chrisj

Members
  • Posts

    551
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Chrisj

  1. 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:

     

    <?php global $account; ?>
    
    <form method="POST" action="index.php">
    <table align="center" cellpadding="1" width="70%" height="100%">
    <tr><td> </td></tr>
    <tr><td> </td></tr>
    <input class='field' type='hidden' name='command' value='account'>
    <input class='field' type='hidden' name='param' value='signup'>
    <tr><td colspan='2' class='pageTitle'><div class='hLine'>Create new account</div></td></tr>
    <tr><td> </td></tr>
    <tr>
    <td class='fieldLabel' width="30%">Membership type</td>
    <td align="center">[account_type_panel]</td></tr>
    <tr><td> </td></tr>
    <tr>
    <td class='fieldLabel' width="30%">User Name</td>
    <td><input class='field' type='text' size='30' maxlength="30" name='user_name' value='<?=$account->user_name ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('user_name') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Password</td>
    <td><input class='field' type='password' size='30' maxlength="30" name='password' value='<?=$account->password ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('password') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Re-enter Password</td>
    <td><input class='field' type='password' size='30' maxlength="30" name='reenter_password' value='<?=$account->reenter_password ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('reenter_password') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Name </td>
    <td ><input class='field' type='text' size='40' maxlength="50" name='first_name' value='<?=$account->first_name ?>'>
    <span class='requiredField'> *&nbsp</span><span class='errorMessage'><?=$account->get_error('first_name') ?></span></td>
    
    </tr>
    <tr>
    <td class='fieldLabel'>business / company name</td>
    <td><input class='field' type='text' size='40' maxlength="50" name='last_name' value='<?=$account->last_name ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('last_name') ?></span></td>
    </tr>
    <tr><td> </td></tr>
    <tr>
    <td class='fieldLabel'>Email address</td>
    <td><input class='field' type='text' size='40' maxlength="50" name='email' value='<?=$account->email ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('email') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Address</td>
    <td><input class='field' type='text' size='40' maxlength="70" name='address' value='<?=$account->address ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('address') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Address 2</td>
    <td><input class='field' type='text' size='40' maxlength="70" name='address_second' value='<?=$account->address_second ?>'></td>
    
    </tr>
    <tr>
    <td class='fieldLabel'>City</td>
    <td><input class='field' type='text' size='40' maxlength="50" name='city' value='<?=$account->city ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('city') ?></span></td>
    </tr>
    
    <tr>
    <td class='fieldLabel'>Zip/Postal code</td>
    <td><input class='field' type='text' size='35' maxlength="35" name='zip_postal_code' value='<?=$account->zip_code ?>'>
    <span class='requiredField'> * </span><span class='errorMessage'><?=$account->get_error('zip_code') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Phone Number</td>
    <td><input class='field' type='text' size='35' maxlength="35" name='phone' value='<?=$account->phone ?>'></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Mobile Phone Number</td>
    <td><input class='field' type='text' size='35' maxlength="35" name='mobile_phone_number' value='<?=$account->mobile_phone_number ?>'></td>
    </tr>
    <tr><td> </td></tr>
    
    
    
    <tr><td> </td></tr>
    <tr><td colspan="2" class='hLine' align="right"> <span class='requiredField'> *</span>   Required field</td></tr>
    <tr><td colspan='2' align="right"><input class='button' type='submit' value='create'></td></tr>
    <tr><td colspan="2"> </td></tr>
    </table>
    </form>

         

     

  2. 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";

     

    ?>

  3. 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.

     

  4. 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");

    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.