Jump to content

mike12255

Members
  • Posts

    439
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by mike12255

  1. The number of textboxes displayed depends on a previously entered number by a user. so  i c reated a while statment and made textboxes while i was not equal to n(number entered by the user). I though i was giving the name/id of $i to the textboxes so when i went to call the $_POST of them i used the same method, a while statment calling the $_POST of I and increaseing I each time untill it equals n however my post returns blank each time does anyone know why? Below is my code:

     

    <?php
    
    if (isset($_POST['submit'])){
      
      if ($_GET['done'] ==1){
      $amount = $_GET['number'];
      $i=0;
      
    include "config.php";
      while ($i != $amount){
      $sql = "INSERT INTO pages (page) VALUES ('".$_POST['$i']."')";
      //mysql_query($sql) or die(mysql_error());
      echo $sql;
      echo $_POST['$i'];
      $i++;
      }
      }
      
      }
      
      
      
      
      
      $n = $_GET['number'];
      $i = 0 ;
    
      echo "<form action=\"step3.php?done=1&number=$n\" method=\"post\" class=\"form\">";
      
      while($i < $n){
      $over = $i+1;
      echo "<label for=\"username.$i\">Page.$over</label> ";
      echo "<div class=\"div_texbox\">";
      echo "<input name=\"$i\" type=\"text\" class=\"username\" id=\"$i\" />";
      echo "</div>";
      $i++;
      ?>
      }
      ?>

  2. ....

     

    Step 2 Post Data: Array ( [username] => username [password] => password [website] => www.website.com [email] => Youremail@email.com [pages] => 4 [db] => localhost/10.0.2.34.1 [dbuser] => CASteakComapny [dbpass] => dfsdfsdfsdfsd [dbname] => Database_Name [cname] => John Doe [cemail] => client@email.com [submit] => submit ) 

  3. ok heres a big headache i added this code to the top of index.php main the form post to the current page (index.php) and it works

     

     

    <?php
    
    
    if (isset($_POST['submit'])){
    
    $user =  $_POST['username'];
    $pass = $_POST['password'];
    
    echo $user." ".$pass;
    exit;
    }
    ?>

     

    seriously  :wtf: why wont this work on the other page

  4. Im not promising anything here and idk if you can use a "wildcard" in a query but i'd try something like this:

     

    $percent = celi((strlength*80)/100) = 80 percent of string

     

    then substr to $percent and add a * at the end of the string and run that through the query? just an idea if im not to clear tell me and ill explain better

  5. yeah i did it one step at a time first i made sure i could connect to the db then i made sure i could connect to the db name then i made sure i could create the table users now im trying to insert into and i cant

     

    edit: turned ini_set ("display_errors", "1"); on still nothing

  6. what you typing to get that appear im still getting a blank screen after typing print $pass; here are the two edited files:

     

    index.php

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
       background-color: #666666;
    }
    
    @charset "utf-8";
    /* CSS Document */
    
    body {
       background-color:#F7F7F7;
    }
    fieldset {
       border:1px dashed #CCC;
       padding:10px;
    }
    legend {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 90%;
       letter-spacing: -1px;
       font-weight: bold;
       line-height: 1.1;
       color:#fff;
       background: #666;
       border: 1px solid #333;
       padding: 2px 6px;
    }
    h1 {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 175%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#333;
    }
    label {
       width:142px;
       height:32px;
       margin-top:3px;
       margin-right:2px;
       padding-top:11px;
       padding-left:6px;
       background-color:#CCCCCC;
       float:left;
       display: block;
       font-family:Arial, Helvetica, sans-serif;
       font-size: 115%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#666;
    }
    .form {
       margin:0;
       padding:0;
    }
    #container {
       width:750px;
       margin:auto;
       padding:10px;
    }
    #top {
       width:680px;
       height:50px;
    }
    #leftSide {
       width:530px;
       padding-top:30px;
       float:left;
    }
    #rightSide {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    #websitebox {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #database {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #pages {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    .clear {
       clear:both;
    }
    .holder {
       background-color:#fff;
    
    }
    .div_texbox {
       width:347px;
       float:right;
       background-color:#E6E6E6;
       height:35px;
       margin-top:3px;
       padding-top:5px;
       padding-bottom:3px;
       padding-left:5px;
    }
    
    .textbox {
       background-image: url(images/16t.png);
       background-repeat: no-repeat;
       background-position:left;
       width:285px;
       font:normal 18px Arial;
       color: #999999;
       padding:3px 5px 3px 19px;
    }
    .textbox:focus, .textbox:hover {
       background-color:#F0FFE6;
    }
    
    .username {
           background-image: url(images/16m.png);
           background-repeat: no-repeat;
           background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .username:focus, .username:hover {
       background-color:#F0FFE6;
    }
       
    .password {
           background-image: url(images/16s.png);
           background-repeat: no-repeat;
          background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .password:focus, .password:hover {
       background-color:#F0FFE6;
    }
    
    .button_div {
       width:287px;
       float:right;
       background-color:#fff;
       border:1px solid #ccc;
       text-align:right;
       height:35px;
       margin-top:3px;
       padding:5px 32px 3px;
    }
    .buttons {
       background: #e3e3db;
       font-size:12px;
       color: #989070;
       padding: 6px 14px;
       border-width: 2px;
       border-style: solid;
       border-color: #fff #d8d8d0 #d8d8d0 #fff;
       text-decoration: none;
       text-transform:uppercase;
       font-weight:bold;
    }
    -->
    </style>
    
    <script language="text/javascript">
    <!--
    // PLEASE DO NOT REMOVE THIS. THANKS
    // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com
    var state = 'hidden';
    
    function showhide(layer_ref) {
    
    if (state == 'visible') {
    state = 'hidden';
    }
    else {
    state = 'visible';
    }
    if (document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.visibility = state");
    }
    if (document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].visibility = state;
    }
    if (document.getElementById && !document.all) {
    maxwell_smart = document.getElementById(layer_ref);
    maxwell_smart.style.visibility = state;
    }
    }
    //-->
    </script>
    
    </head>
    <body>
    <div id="container">
      <div id="top">
        <h1>Installation Step 1 Of 3</h1>
      </div>
      <div id="leftSide">
      <fieldset>
    <legend>Login details</legend>
    <form action="step2.php" method="post" class="form">
      <label for="username">Username</label>
        <div class="div_texbox">
        <input name="username" type="text" class="username" id="username" value="username" onclick="showhide('rightSide');" />
       </div>
        <label for="password">Password</label>
        <div class="div_texbox">
        <input name="password" type="password" class="password" id="password" value="password" />
       </div>
    
       </fieldset>
       <br /><hr size="1" /><br />
      <fieldset>
      <legend>Website Info</legend>
      <label for="website">Website Name</label>
      <div class="div_texbox">
      <input name="website" type="text" class="textbox" id="website" value="www.website.com" onclick="showhide('websitebox');"/>
      </div>
      <label for="email">Your Email</label>
      <div class="div_texbox">
        <input name="email" type="text" class="textbox" id="email" value="Youremail@email.com" />
       </div>
         <label for="email"># Of Pages</label>
      <div class="div_texbox">
        <input name="pages" type="text" class="textbox" id="Pages" value="4" onclick="showhide('pages');"/>
       </div>
       
      </fieldset>
         <br /><hr size="1"/><br />
       
         <fieldset>
      <legend>Database Info</legend>
      <label for="website">DB IP</label>
      <div class="div_texbox">
      <input name="db" type="database" class="textbox" id="db" value="localhost/10.0.2.34.1" onclick="showhide('database');"/>
      </div>
      <label for="email">DB User</label>
      <div class="div_texbox">
        <input name="dbuser" type="text" class="textbox" id="dbuser" value="CASteakComapny" />
       </div>
         <label for="email">DB Password</label>
      <div class="div_texbox">
        <input name="dbpass" type="password" class="password" id="dbpass" value="dfsdfsdfsdfsd" />
       </div>
         <label for="email">DB Name</label>
      <div class="div_texbox">
        <input name="dbname" type="text" class="textbox" id="dbname" value="Database_Name" />
       </div>
      </fieldset>
         <br /><hr size="1"/><br />
       
      <fieldset>
    <legend>Client Details</legend>
       <label for="name">Client Name</label>
        <div class="div_texbox">
        <input name="cname" type="text" class="textbox" id="cname" value="John Doe" />
       </div>
       <label for="address">Client Email</label>
       <div class="div_texbox">
        <input name="cemail" type="text" class="textbox" id="cemail" value="client@email.com" />
       </div>
       <div class="button_div">
       <input name="submit" type="submit" value="submit" class="buttons"/>
       </div>
    </form>
       </fieldset>
      </div>
      <div id="rightSide" style="visibility:hidden">
      <p>Be sure to write down your username and password on a peice of paper, this information CANNOT be retrevied once submitted and will require a new install to fix. (If a client forgets it charge him money for you to reinstall the website he he)
      </p></div>
        <div id="websitebox" style="visibility:hidden">
      <p>Do not include the http:// you just need to do www.website.com like in the exmaple provided
      </p></div>
        <div id="pages" style="visibility:hidden">
      <p>This should be the number of pages that a regular user would see. NOT ADMIN PAGES they are auto created. This includes things like index pictures products contactus all the pages that anybody cant view.
      </p></div>
      <div id="database" style="visibility:hidden">
      <p>Like Everything else in the installation, you cannot change this once installed so test first to make sure you got a db connection on this ip
      </p></div>
    
      <div class="clear"></div>
    </div>
    
    </body>
    </html>
    

     

     

    step2.php

     

    <?php
    //error_reporting(0);
    error_reporting(E_ALL);
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
       background-color: #666666;
    }
    
    @charset "utf-8";
    /* CSS Document */
    
    body {
       background-color:#F7F7F7;
    }
    fieldset {
       border:1px dashed #CCC;
       padding:10px;
    }
    legend {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 90%;
       letter-spacing: -1px;
       font-weight: bold;
       line-height: 1.1;
       color:#fff;
       background: #666;
       border: 1px solid #333;
       padding: 2px 6px;
    }
    h1 {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 175%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#333;
    }
    label {
       width:142px;
       height:32px;
       margin-top:3px;
       margin-right:2px;
       padding-top:11px;
       padding-left:6px;
       background-color:#CCCCCC;
       float:left;
       display: block;
       font-family:Arial, Helvetica, sans-serif;
       font-size: 115%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#666;
    }
    .form {
       margin:0;
       padding:0;
    }
    #container {
       width:750px;
       margin:auto;
       padding:10px;
    }
    #top {
       width:680px;
       height:50px;
    }
    #leftSide {
       width:530px;
       padding-top:30px;
       float:left;
    }
    #rightSide {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    #websitebox {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #database {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #pages {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    .clear {
       clear:both;
    }
    .holder {
       background-color:#fff;
    
    }
    .div_texbox {
       width:347px;
       float:right;
       background-color:#E6E6E6;
       height:35px;
       margin-top:3px;
       padding-top:5px;
       padding-bottom:3px;
       padding-left:5px;
    }
    
    .textbox {
       background-image: url(images/16t.png);
       background-repeat: no-repeat;
       background-position:left;
       width:285px;
       font:normal 18px Arial;
       color: #999999;
       padding:3px 5px 3px 19px;
    }
    .textbox:focus, .textbox:hover {
       background-color:#F0FFE6;
    }
    
    .username {
           background-image: url(images/16m.png);
           background-repeat: no-repeat;
           background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .username:focus, .username:hover {
       background-color:#F0FFE6;
    }
       
    .password {
           background-image: url(images/16s.png);
           background-repeat: no-repeat;
          background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .password:focus, .password:hover {
       background-color:#F0FFE6;
    }
    
    .button_div {
       width:287px;
       float:right;
       background-color:#fff;
       border:1px solid #ccc;
       text-align:right;
       height:35px;
       margin-top:3px;
       padding:5px 32px 3px;
    }
    .buttons {
       background: #e3e3db;
       font-size:12px;
       color: #989070;
       padding: 6px 14px;
       border-width: 2px;
       border-style: solid;
       border-color: #fff #d8d8d0 #d8d8d0 #fff;
       text-decoration: none;
       text-transform:uppercase;
       font-weight:bold;
    }
    -->
    </style>
    
    <script language="javascript">
    <!--
    // PLEASE DO NOT REMOVE THIS. THANKS
    // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com
    var state = 'hidden';
    
    function showhide(layer_ref) {
    
    if (state == 'visible') {
    state = 'hidden';
    }
    else {
    state = 'visible';
    }
    if (document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.visibility = state");
    }
    if (document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].visibility = state;
    }
    if (document.getElementById && !document.all) {
    maxwell_smart = document.getElementById(layer_ref);
    maxwell_smart.style.visibility = state;
    }
    }
    //-->
    </script>
    
    </head>
    <div id="container">
      <div id="top">
      <?php if ($_POST['submit']){ ?> 
        <h1>Installation Step 2 Of 3</h1>
      </div>
      <div id="leftSide">
      <?php
      if (mysql_connect($_POST['db'],$_POST['dbuser'],$_POST['dbpass'])){
      
      if (mysql_select_db($_POST['dbname'])){
    $sql1= " CREATE TABLE `schoolw1_admin`.`users` (
    `username` VARCHAR( 255 ) NOT NULL ,
    `password` VARCHAR( 255 ) NOT NULL
    ) ENGINE = MYISAM";
    
    if (mysql_query($sql1)){
    echo "Created users table, moving onto inserting user info";
    
    $user = $_POST['username'];
    $pass = md5($_POST['password']);
    print $pass;
    exit;
    
    $sql2 = "INSERT INTO users (username,password) VALUES('$user','$pass')";
    
    if (mysql_query($sql2)){
    
    echo "Username and password sucsesfully added!";
    }
    } 
      
      
      }else{
      echo "<div id=\"rightSide\">Error I could connect to the db but i couldnt select the requested db name</div>";
      }
      
      }else{
      echo "<div id=\"rightSide\">Error connecting to db on the entered IP</div>";
      }
      
      
      
      ?> 
      </div>
    
      <div class="clear"></div>
    </div>
    <?php }?>
    <body> 
    </body>
    </html>
    

  7. I got a huge form and im trying to retrive some data from it, the first two feilds, username and password to enter them into a database, however whenever i die my $_post['user']  an my $_post['pass'] they return empty can anyone see why?

     

    index.php

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
       background-color: #666666;
    }
    
    @charset "utf-8";
    /* CSS Document */
    
    body {
       background-color:#F7F7F7;
    }
    fieldset {
       border:1px dashed #CCC;
       padding:10px;
    }
    legend {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 90%;
       letter-spacing: -1px;
       font-weight: bold;
       line-height: 1.1;
       color:#fff;
       background: #666;
       border: 1px solid #333;
       padding: 2px 6px;
    }
    h1 {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 175%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#333;
    }
    label {
       width:142px;
       height:32px;
       margin-top:3px;
       margin-right:2px;
       padding-top:11px;
       padding-left:6px;
       background-color:#CCCCCC;
       float:left;
       display: block;
       font-family:Arial, Helvetica, sans-serif;
       font-size: 115%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#666;
    }
    .form {
       margin:0;
       padding:0;
    }
    #container {
       width:750px;
       margin:auto;
       padding:10px;
    }
    #top {
       width:680px;
       height:50px;
    }
    #leftSide {
       width:530px;
       padding-top:30px;
       float:left;
    }
    #rightSide {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    #websitebox {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #database {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #pages {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    .clear {
       clear:both;
    }
    .holder {
       background-color:#fff;
    
    }
    .div_texbox {
       width:347px;
       float:right;
       background-color:#E6E6E6;
       height:35px;
       margin-top:3px;
       padding-top:5px;
       padding-bottom:3px;
       padding-left:5px;
    }
    
    .textbox {
       background-image: url(images/16t.png);
       background-repeat: no-repeat;
       background-position:left;
       width:285px;
       font:normal 18px Arial;
       color: #999999;
       padding:3px 5px 3px 19px;
    }
    .textbox:focus, .textbox:hover {
       background-color:#F0FFE6;
    }
    
    .username {
           background-image: url(images/16m.png);
           background-repeat: no-repeat;
           background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .username:focus, .username:hover {
       background-color:#F0FFE6;
    }
       
    .password {
           background-image: url(images/16s.png);
           background-repeat: no-repeat;
          background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .password:focus, .password:hover {
       background-color:#F0FFE6;
    }
    
    .button_div {
       width:287px;
       float:right;
       background-color:#fff;
       border:1px solid #ccc;
       text-align:right;
       height:35px;
       margin-top:3px;
       padding:5px 32px 3px;
    }
    .buttons {
       background: #e3e3db;
       font-size:12px;
       color: #989070;
       padding: 6px 14px;
       border-width: 2px;
       border-style: solid;
       border-color: #fff #d8d8d0 #d8d8d0 #fff;
       text-decoration: none;
       text-transform:uppercase;
       font-weight:bold;
    }
    -->
    </style>
    
    <script language="javascript">
    <!--
    // PLEASE DO NOT REMOVE THIS. THANKS
    // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com
    var state = 'hidden';
    
    function showhide(layer_ref) {
    
    if (state == 'visible') {
    state = 'hidden';
    }
    else {
    state = 'visible';
    }
    if (document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.visibility = state");
    }
    if (document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].visibility = state;
    }
    if (document.getElementById && !document.all) {
    maxwell_smart = document.getElementById(layer_ref);
    maxwell_smart.style.visibility = state;
    }
    }
    //-->
    </script>
    
    </head>
    <div id="container">
      <div id="top">
        <h1>Installation Step 1 Of 3</h1>
      </div>
      <div id="leftSide">
      <fieldset>
    <legend>Login details</legend>
    <form action="index.php" method="POST" class="form">
      <label for="username">Username</label>
        <div class="div_texbox">
        <input name="username" type="text" class="username" id="username" value="username" onclick="showhide('rightSide');" />
       </div>
        <label for="password">Password</label>
        <div class="div_texbox">
        <input name="password" type="password" class="password" id="password" value="password" />
       </div>
    
       </fieldset>
       <br /><hr size="1"><br />
      <fieldset>
      <legend>Website Info</legend>
      <label for="website">Website Name</label>
      <div class="div_texbox">
      <input name="website" type="text" class="textbox" id="website" value="www.website.com" onclick="showhide('websitebox');"/>
      </div>
      <label for="email">Your Email</label>
      <div class="div_texbox">
        <input name="email" type="text" class="textbox" id="email" value="Youremail@email.com" />
       </div>
         <label for="email"># Of Pages</label>
      <div class="div_texbox">
        <input name="pages" type="text" class="textbox" id="Pages" value="4" onclick="showhide('pages');"/>
       </div>
       
      </fieldset>
         <br /><hr size="1"><br />
       
         <fieldset>
      <legend>Database Info</legend>
      <label for="website">DB IP</label>
      <div class="div_texbox">
      <input name="db" type="database" class="textbox" id="db" value="localhost/10.0.2.34.1" onclick="showhide('database');"/>
      </div>
      <label for="email">DB User</label>
      <div class="div_texbox">
        <input name="dbuser" type="text" class="textbox" id="dbuser" value="CASteakComapny" />
       </div>
         <label for="email">DB Password</label>
      <div class="div_texbox">
        <input name="dbpass" type="password" class="password" id="dbpass" value="dfsdfsdfsdfsd" />
       </div>
         <label for="email">DB Name</label>
      <div class="div_texbox">
        <input name="dbname" type="text" class="textbox" id="dbname" value="Database_Name" />
       </div>
      </fieldset>
         <br /><hr size="1"><br />
       
      <fieldset>
    <legend>Client Details</legend>
       <label for="name">Client Name</label>
        <div class="div_texbox">
        <input name="cname" type="text" class="textbox" id="cname" value="John Doe" />
       </div>
       <label for="address">Client Email</label>
       <div class="div_texbox">
        <input name="cemail" type="text" class="textbox" id="cemail" value="client@email.com" />
       </div>
       <div class="button_div">
       <input name="submit" type="submit" value="submit" class="buttons"/>
       </div>
    </form>
       </fieldset>
      </div>
      <div id="rightSide" style="visibility:hidden">
      <p>Be sure to write down your username and password on a peice of paper, this information CANNOT be retrevied once submitted and will require a new install to fix. (If a client forgets it charge him money for you to reinstall the website he he)
      </p></div>
        <div id="websitebox" style="visibility:hidden">
      <p>Do not include the http:// you just need to do www.website.com like in the exmaple provided
      </p></div>
        <div id="pages" style="visibility:hidden">
      <p>This should be the number of pages that a regular user would see. NOT ADMIN PAGES they are auto created. This includes things like index pictures products contactus all the pages that anybody cant view.
      </p></div>
      <div id="database" style="visibility:hidden">
      <p>Like Everything else in the installation, you cannot change this once installed so test first to make sure you got a db connection on this ip
      </p></div>
    
      <div class="clear"></div>
    </div>
    <body>
    </body>
    </html>
    

     

    step2.php

     

     

    <?php
    //error_reporting(0);
    error_reporting(E_ALL);
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
       background-color: #666666;
    }
    
    @charset "utf-8";
    /* CSS Document */
    
    body {
       background-color:#F7F7F7;
    }
    fieldset {
       border:1px dashed #CCC;
       padding:10px;
    }
    legend {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 90%;
       letter-spacing: -1px;
       font-weight: bold;
       line-height: 1.1;
       color:#fff;
       background: #666;
       border: 1px solid #333;
       padding: 2px 6px;
    }
    h1 {
       font-family:Arial, Helvetica, sans-serif;
       font-size: 175%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#333;
    }
    label {
       width:142px;
       height:32px;
       margin-top:3px;
       margin-right:2px;
       padding-top:11px;
       padding-left:6px;
       background-color:#CCCCCC;
       float:left;
       display: block;
       font-family:Arial, Helvetica, sans-serif;
       font-size: 115%;
       letter-spacing: -1px;
       font-weight: normal;
       line-height: 1.1;
       color:#666;
    }
    .form {
       margin:0;
       padding:0;
    }
    #container {
       width:750px;
       margin:auto;
       padding:10px;
    }
    #top {
       width:680px;
       height:50px;
    }
    #leftSide {
       width:530px;
       padding-top:30px;
       float:left;
    }
    #rightSide {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    #websitebox {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #database {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    #pages {
       background-color:#fff;
       width:200px;
       padding:5px;
       margin-top:40px;
       float:right;
       border:1px solid #CCC;
       font:normal 12px Arial;
       color:#CC0000
       
    }
    
    
    .clear {
       clear:both;
    }
    .holder {
       background-color:#fff;
    
    }
    .div_texbox {
       width:347px;
       float:right;
       background-color:#E6E6E6;
       height:35px;
       margin-top:3px;
       padding-top:5px;
       padding-bottom:3px;
       padding-left:5px;
    }
    
    .textbox {
       background-image: url(images/16t.png);
       background-repeat: no-repeat;
       background-position:left;
       width:285px;
       font:normal 18px Arial;
       color: #999999;
       padding:3px 5px 3px 19px;
    }
    .textbox:focus, .textbox:hover {
       background-color:#F0FFE6;
    }
    
    .username {
           background-image: url(images/16m.png);
           background-repeat: no-repeat;
           background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .username:focus, .username:hover {
       background-color:#F0FFE6;
    }
       
    .password {
           background-image: url(images/16s.png);
           background-repeat: no-repeat;
          background-position:left;
       width:285px;
           font:normal 18px Arial;
           color: #999999;
           padding:3px 5px 3px 19px;
    }
    .password:focus, .password:hover {
       background-color:#F0FFE6;
    }
    
    .button_div {
       width:287px;
       float:right;
       background-color:#fff;
       border:1px solid #ccc;
       text-align:right;
       height:35px;
       margin-top:3px;
       padding:5px 32px 3px;
    }
    .buttons {
       background: #e3e3db;
       font-size:12px;
       color: #989070;
       padding: 6px 14px;
       border-width: 2px;
       border-style: solid;
       border-color: #fff #d8d8d0 #d8d8d0 #fff;
       text-decoration: none;
       text-transform:uppercase;
       font-weight:bold;
    }
    -->
    </style>
    
    <script language="javascript">
    <!--
    // PLEASE DO NOT REMOVE THIS. THANKS
    // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com
    var state = 'hidden';
    
    function showhide(layer_ref) {
    
    if (state == 'visible') {
    state = 'hidden';
    }
    else {
    state = 'visible';
    }
    if (document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.visibility = state");
    }
    if (document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].visibility = state;
    }
    if (document.getElementById && !document.all) {
    maxwell_smart = document.getElementById(layer_ref);
    maxwell_smart.style.visibility = state;
    }
    }
    //-->
    </script>
    
    </head>
    <div id="container">
      <div id="top">
      <?php if ($_POST['submit']){ ?> 
        <h1>Installation Step 2 Of 3</h1>
      </div>
      <div id="leftSide">
      <?php
      if (mysql_connect($_POST['db'],$_POST['dbuser'],$_POST['dbpass'])){
      
      if (mysql_select_db($_POST['dbname'])){
    $sql1= " CREATE TABLE `schoolw1_admin`.`users` (
    `username` VARCHAR( 255 ) NOT NULL ,
    `password` VARCHAR( 255 ) NOT NULL
    ) ENGINE = MYISAM";
    
    if (mysql_query($sql1)){
    echo "Created users table, moving onto inserting user info";
    
    $user = $_POST['username'];
    $pass = md5($_POST['password']);
    die($pass);
    
    $sql2 = "INSERT INTO users (username,password) VALUES('$user','$pass')";
    
    if (mysql_query($sql2)){
    
    echo "Username and password sucsesfully added!";
    }
    } 
      
      
      }else{
      echo "<div id=\"rightSide\">Error I could connect to the db but i couldnt select the requested db name</div>";
      }
      
      }else{
      echo "<div id=\"rightSide\">Error connecting to db on the entered IP</div>";
      }
      
      
      
      ?> 
      </div>
    
      <div class="clear"></div>
    </div>
    <?php }?>
    <body> 
    </body>
    </html>
    

  8. so im trying to "create" a config file based on a users entered data so i setup myself kind of a test

     

    I want write this to the file:

     

    $dbuser = dffdd;

     

    instead im getting this:

     

    dffdd = dffdd

     

    can anyone help me change the first dffdd to the variable name $dbuser?

     

     

    <?php
    
    $fn = "config.php";
    
    $fh = fopen($fn ,'w') or die("can't open file");
    chmod($fn,0777);
    $dbuser = "dffdd";
    
    $info = "".$dbuser." = $dbuser";
    fwrite($fh, $info);
    fclose($fn);
    
    
    ?>

     

  9. one there seems to be a problem with my query while entering a username and password into a table

     

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/schoolw1/public_html/forjosh/step2.php on line 259

     

    <div id="container">
      <div id="top">
      <?php if ($_POST['submit']){ ?> 
        <h1>Installation Step 2 Of 3</h1>
      </div>
      <div id="leftSide">
      <?php
      if (mysql_connect($_POST['db'],$_POST['dbuser'],$_POST['dbpass'])){
      
      if (mysql_select_db($_POST['dbname'])){
    $sql1= " CREATE TABLE `schoolw1_admin`.`users` (
    `username` VARCHAR( 255 ) NOT NULL ,
    `password` VARCHAR( 255 ) NOT NULL
    ) ENGINE = MYISAM";
    
    if (mysql_query($sql1)){
    echo "Created users table, moving onto inserting user info";
    $sql2 = "INSERT INTO users (username,password) VALUES('$_POST['username']','md5($_POST['password']'))";
    if (mysql_query($sql2)){
    echo "Username and password sucsesfully added!";
    }
    } 
      
      
      }else{
      echo "<div id=\"rightSide\">Error I could connect to the db but i couldnt select the requested db name</div>";
      }
      
      }else{
      echo "<div id=\"rightSide\">Error connecting to db on the entered IP</div>";
      }
      
      
      

     

    I know its the way i entered my variables into the query, i just dont know how to fix it :S

     

    second, is it possible to use the fwrite function to create a php file

     

    for example user fills in a form and i create a file called config.php with that info?

  10. can anyone find out why my submit buttons does nothing?

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
    background-color: #666666;
    }
    
    @charset "utf-8";
    /* CSS Document */
    
    body {
    background-color:#F7F7F7;
    }
    fieldset {
    border:1px dashed #CCC;
    padding:10px;
    }
    legend {
    font-family:Arial, Helvetica, sans-serif;
    font-size: 90%;
    letter-spacing: -1px;
    font-weight: bold;
    line-height: 1.1;
    color:#fff;
    background: #666;
    border: 1px solid #333;
    padding: 2px 6px;
    }
    h1 {
    font-family:Arial, Helvetica, sans-serif;
    font-size: 175%;
    letter-spacing: -1px;
    font-weight: normal;
    line-height: 1.1;
    color:#333;
    }
    label {
    width:142px;
    height:32px;
    margin-top:3px;
    margin-right:2px;
    padding-top:11px;
    padding-left:6px;
    background-color:#CCCCCC;
    float:left;
    display: block;
    font-family:Arial, Helvetica, sans-serif;
    font-size: 115%;
    letter-spacing: -1px;
    font-weight: normal;
    line-height: 1.1;
    color:#666;
    }
    .form {
    margin:0;
    padding:0;
    }
    #container {
    width:750px;
    margin:auto;
    padding:10px;
    }
    #top {
    width:680px;
    height:50px;
    }
    #leftSide {
    width:530px;
    padding-top:30px;
    float:left;
    }
    #rightSide {
    background-color:#fff;
    width:200px;
    padding:5px;
    margin-top:40px;
    float:right;
    border:1px solid #CCC;
    font:normal 12px Arial;
    color:#CC0000
    
    }
    
    
    #websitebox {
    background-color:#fff;
    width:200px;
    padding:5px;
    margin-top:40px;
    float:right;
    border:1px solid #CCC;
    font:normal 12px Arial;
    color:#CC0000
    
    }
    
    #database {
    background-color:#fff;
    width:200px;
    padding:5px;
    margin-top:40px;
    float:right;
    border:1px solid #CCC;
    font:normal 12px Arial;
    color:#CC0000
    
    }
    
    #pages {
    background-color:#fff;
    width:200px;
    padding:5px;
    margin-top:40px;
    float:right;
    border:1px solid #CCC;
    font:normal 12px Arial;
    color:#CC0000
    
    }
    
    
    .clear {
    clear:both;
    }
    .holder {
    background-color:#fff;
    
    }
    .div_texbox {
    width:347px;
    float:right;
    background-color:#E6E6E6;
    height:35px;
    margin-top:3px;
    padding-top:5px;
    padding-bottom:3px;
    padding-left:5px;
    }
    
    .textbox {
    background-image: url(images/16t.png);
    background-repeat: no-repeat;
    background-position:left;
    width:285px;
    font:normal 18px Arial;
    color: #999999;
    padding:3px 5px 3px 19px;
    }
    .textbox:focus, .textbox:hover {
    background-color:#F0FFE6;
    }
    
    .username {
        	background-image: url(images/16m.png);
        	background-repeat: no-repeat;
        	background-position:left;
    width:285px;
        	font:normal 18px Arial;
        	color: #999999;
        	padding:3px 5px 3px 19px;
    }
    .username:focus, .username:hover {
    background-color:#F0FFE6;
    }
       
    .password {
        	background-image: url(images/16s.png);
        	background-repeat: no-repeat;
       	background-position:left;
    width:285px;
        	font:normal 18px Arial;
        	color: #999999;
        	padding:3px 5px 3px 19px;
    }
    .password:focus, .password:hover {
    background-color:#F0FFE6;
    }
    
    .button_div {
    width:287px;
    float:right;
    background-color:#fff;
    border:1px solid #ccc;
    text-align:right;
    height:35px;
    margin-top:3px;
    padding:5px 32px 3px;
    }
    .buttons {
    background: #e3e3db;
    font-size:12px; 
    color: #989070; 
    padding: 6px 14px;
    border-width: 2px;
    border-style: solid;
    border-color: #fff #d8d8d0 #d8d8d0 #fff;
    text-decoration: none;
    text-transform:uppercase;
    font-weight:bold;
    }
    -->
    </style>
    
    <script language="javascript">
    <!--
    // PLEASE DO NOT REMOVE THIS. THANKS
    // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com
    var state = 'hidden';
    
    function showhide(layer_ref) {
    
    if (state == 'visible') {
    state = 'hidden';
    }
    else {
    state = 'visible';
    }
    if (document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.visibility = state");
    }
    if (document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].visibility = state;
    }
    if (document.getElementById && !document.all) {
    maxwell_smart = document.getElementById(layer_ref);
    maxwell_smart.style.visibility = state;
    }
    }
    //-->
    </script> 
    
    </head>
    <div id="container">
      <div id="top">
        <h1>Installation Step 1 Of 3</h1>
      </div>
      <div id="leftSide">
      <fieldset>
    <legend>Login details</legend>
    <form action="index.php" method="POST" class="form">
      <label for="username">Username</label>
        <div class="div_texbox">
        <input name="username" type="text" class="username" id="username" value="username" onclick="showhide('rightSide');" />
    </div>
     <label for="password">Password</label>
        <div class="div_texbox">
        <input name="password" type="password" class="password" id="password" value="password" />
    </div>
    
    </fieldset>
    <br /><hr size="1"><br />
      <fieldset>
      <legend>Website Info</legend>
      <label for="website">Website Name</label>
      <div class="div_texbox">
      <input name="website" type="text" class="textbox" id="website" value="www.website.com" onclick="showhide('websitebox');"/>
      </div>
      <label for="email">Your Email</label>
      <div class="div_texbox">
        <input name="email" type="text" class="textbox" id="email" value="Youremail@email.com" />
    </div>
         <label for="email"># Of Pages</label>
      <div class="div_texbox">
        <input name="pages" type="text" class="textbox" id="Pages" value="4" onclick="showhide('pages');"/>
    </div>
        
      </fieldset>
      	<br /><hr size="1"><br />
        
         <fieldset>
      <legend>Database Info</legend>
      <label for="website">DB IP</label>
      <div class="div_texbox">
      <input name="db" type="database" class="textbox" id="db" value="localhost/10.0.2.34.1" onclick="showhide('database');"/>
      </div>
      <label for="email">DB User</label>
      <div class="div_texbox">
        <input name="dbuser" type="text" class="textbox" id="dbuser" value="CASteakComapny" />
    </div>
         <label for="email">DB Password</label>
      <div class="div_texbox">
        <input name="dbpass" type="password" class="password" id="dbpass" value="dfsdfsdfsdfsd" />
    </div>
         <label for="email">DB Name</label>
      <div class="div_texbox">
        <input name="dbname" type="text" class="textbox" id="dbname" value="Database_Name" />
    </div>
      </fieldset>
      	<br /><hr size="1"><br />
        
      <fieldset>
    <legend>Client Details</legend>
    <label for="name">Client Name</label>
        <div class="div_texbox">
        <input name="cname" type="text" class="textbox" id="cname" value="John Doe" />
    </div>
    <label for="address">Client Email</label>
    <div class="div_texbox">
        <input name="cemail" type="text" class="textbox" id="cemail" value="client@email.com" />
    </div>
    <div class="button_div">
    <input name="submit" type="button" value="submit" class="buttons"/>
    </div>
    </form>
    </fieldset>
      </div>
      <div id="rightSide" style="visibility:hidden">
      <p>Be sure to write down your username and password on a peice of paper, this information CANNOT be retrevied once submitted and will require a new install to fix. (If a client forgets it charge him money for you to reinstall the website he he) 
      </p></div>
        <div id="websitebox" style="visibility:hidden">
      <p>Do not include the http:// you just need to do www.website.com like in the exmaple provided
      </p></div>
        <div id="pages" style="visibility:hidden">
      <p>This should be the number of pages that a regular user would see. NOT ADMIN PAGES they are auto created. This includes things like index pictures products contactus all the pages that anybody cant view.
      </p></div>
      <div id="database" style="visibility:hidden">
      <p>Like Everything else in the installation, you cannot change this once installed so test first to make sure you got a db connection on this ip
      </p></div>
      
      <div class="clear"></div>
    </div>
    <body>
    </body>
    </html>
    

×
×
  • 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.