Jump to content

Twister1004

Members
  • Posts

    201
  • Joined

  • Last visited

Posts posted by Twister1004

  1. Hey everyone! As you know it is me! I'm just having a little more trouble. This time it includes the $_GET method. I know how it work but I just recently figured it out! *yay go me!* However, I've got part of it right,but now, I can't get the second part right.

     

    Objective: To figure out why this query isnt working which is using the $_GET method to get its information for the query.

     

    The problem starts here,

    $account = mysql_query("SELECT first_name, last_name, age FROM `account` WHERE `first_name` = $getuser");
    if (!$account) {
        echo 'There is an error in your profile. Please contact the adminstartor with the following error.2: ' . mysql_error();
        exit();
    }

     

    Here is where the value of the variable,

    $getuser = $_GET['username']; 
    $getid = $_GET['user'];

     

    This is how the link is made,

    <input name="button4" type="button" onClick='parent.window.location.href = "./profile.php?user=<?php echo $user; ?>&username=<?php echo $username; ?>"' value="Profile" />

     

    This is how i set the link equal

    		@$user = $_SESSION['login_id'];
    	@$username = $_SESSION['login_first'];

     

    Any help or suggestion or hints would be greatly appreciated =D

  2. I have no idea what I just did, but now it actually fixed and loaded the page. Now I'm getting like 50 errors on the page X_X

     

    Notice: Undefined index: age in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit_info.php on line 96
    
    Notice: Undefined index: email in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit_info.php on line 97
    
    Notice: Undefined index: dob in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit_info.php on line 98
    
    Notice: Undefined index: status in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit_info.php on line 99
    
    Notice: Undefined index: going in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit_info.php on line 100
    
    Notice: Undefined index: looking in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit_info.php on line 101
    
    Notice: Undefined index: life in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit_info.php on line 102
    Please put in your age.

  3. ooh geese, this is rediclious. I am getting problems like crazy D=. anyone wish to help me?

     

    Objective: Don't know why but I'm getting the error with

    $sql = ('UPDATE `account` WHERE (age, email, dob) VALUES ("'.$age.'", "'.$email.'", "'.$dob.'")');
    $result = mysql_query($sql);
    if($result){
    echo "Part one was successfully completed";
    }
    else{
    	echo "There was an error with some information. Please contact an Admin.1";
    	exit();a
    }

     

    and

    	$sql2 = ('UPDATE `profile` WHERE (looking, sexual, status, life) VALUES ("'.$looking.'", "'.$going.'", "'.$status.'", "'.$life.'")');
    $result2 = mysql_query($sql2);
    	if($result2){
    	echo "Part one was successfully completed";
    	}
    else{
    	echo "There was an error with some information. Please contact an Admin.2";
    	exit();
    }

     

    <?php session_start(); error_reporting(E_ALL); require("login.php");
    // DO NOT USE THIS PAGE!!!!!!?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>iMatch | Edit You</title>
    <style>
    #Banner {	position:absolute;
    left:0px;
    top:0px;
    width:960px;
    height:119px;
    z-index:2;
    background-color: #FF00FF;
    }
    </style>
    </head>
    <body>
    <?php
    if(!isset($_SESSION['login_id'])) {
    die('You can not view this page unless you are logged in');
    }
    ?>
    <div id="Banner"><img src="images/bannertest1.jpg" alt="iMatch!" width="960" height="119" /></div>
    <?php
    $sql = mysql_query("SELECT about FROM `profile` WHERE `accountid` = '{$_SESSION['login_id']}'");
    /*$sql2 = mysql_query("SELECT ");*/
    $result = mysql_fetch_row($sql);
    ?>
    <div style="position:absolute; top:150px; left:139px;">
    Edit your profile information:<br />
    <form METHOD="POST" ACTION="">
    <table width="396" border="1" cellspacing="1" cellpadding="2">
      <tr>
        <td><center>Your Age:</center></td>
        <td><center><input type="text" name="age" maxlength="2" ></center></td>
      </tr>
      <tr>
        <td><center>E-mail:<br/> Please do not fake your E-mail</center></td>
        <td><center><input type="text" name="email" maxlength="30" ></center></td>
      </tr>
      <tr>
        <td><center>Date of Birth:<br/>YYYY-MM-DD</center></td>
        <td><center><input type="text" name="dob" value="YYYY-MM-DD"maxlength="10" ></center></td>
      </tr>
      <tr>
        <td><center>Second or Real Life?</center></td>
        <td><center>
    			<select name="life">
    			<option value="Real">Real Life</option>
    			<option value="Second" selected="selected">Second Life</option>
    			</select>
    	</center></td>
      </tr>
      <tr>
        <td><center>Looking for:</center></td>
        <td><center>	
    			<select name="looking">
    			<option value="Friends" selected="selected">Friends</option>
    			<option value="Men">Male</option>
    			<option value="Women">Female</option>
    			</select>
    	</center></td>
      </tr>
      <tr>
        <td><center>Sexuality:</center></td>
        <td><center>
    			<select name="going">
    			<option value="Straight">Straight</option>
    			<option value="Gay">Gay</option>
    			<option value="Bi">Bi</option>
    			</select>
    	</center></td>
      </tr>
      <tr>
        <td><center>Status:</center></td>
        <td><center>
    			<select name="status">
    			<option value="unknown">Not Telling</option>
    			<option value="Single">Single</option>
    			<option value="Married">Married</option>
    			</select>
    	</center></td>
      </tr>
    </table>
    
    <input name="submit" type="submit" id="submit" value="Submit" /><br/>
    <?php
    if(!isset($_POST['submit'])){
    // echo "Sorry, your information could not be completed at this time. Please contact an Admin.";
    }
    else{
    isset($_SESSION['login_user']);
    $age = mysql_real_escape_string($_POST['age']);
    $email = mysql_real_escape_string($_POST['email']);
    $dob = mysql_real_escape_string($_POST['dob']);
    $status = mysql_real_escape_string($_POST['status']);
    $going = mysql_real_escape_string($_POST['going']);
    $looking = mysql_real_escape_string($_POST['looking']);
    $life = mysql_real_escape_string($_POST['life']);
    if($age == ""){
    	echo "Please put in your age.";
    	exit();
    	}
    if($email == ""){
    	echo "Please enter your E-mail. Please also do not put in a fake E-mail!";
    	exit();
    	}
    if($dob == ""){
    echo "Please enter your birth day by the following, YYYY-MM-DD.";
    exit();
    }
    $sql = ('UPDATE `account` WHERE (age, email, dob) VALUES ("'.$age.'", "'.$email.'", "'.$dob.'")');
    $result = mysql_query($sql);
    if($result){
    echo "Part one was successfully completed";
    }
    else{
    	echo "There was an error with some information. Please contact an Admin.1";
    	exit();a
    }
    $sql2 = ('UPDATE `profile` WHERE (looking, sexual, status, life) VALUES ("'.$looking.'", "'.$going.'", "'.$status.'", "'.$life.'")');
    $result2 = mysql_query($sql2);
    	if($result2){
    	echo "Part one was successfully completed";
    	}
    else{
    	echo "There was an error with some information. Please contact an Admin.2";
    	exit();
    }
    echo "Your information was altered successfully!";
    }
    ?>
    </form>
    </div>
    </body>
    </html>
    

     

    The problem is with the SQL statements. I can't really figure it out O_o.

     

    Thanks for any hints tips reading or helping =)

  4. I could be wrong, but to call out stuff in the database you need to use the select statement in php and all that stuff.

     

    *~I did not try it!~*

     

    <?php
    
    $selectmovie = mysql_query("SELECT * FROM `table here` WHERE `column name here` = 'movie here'");
    
    echo $selectmovie;
    ?>
    

  5. Hey everyone, just a slight problem. I I'm kinda thinking about it too hard and confusing myself about how to call a value from a select in Hmtl.

     

    objective: Can ya help me figure out how to call its value?

     

    info:

     

    Well, as i described, this is basically a FORM going through with values of a select option.

    This here is the layout of the stuff.

    <form METHOD="POST" ACTION="">
    <table width="396" border="1" cellspacing="1" cellpadding="2">
      <tr>
        <td><center>Your Age:</center></td>
        <td><center><input type="text" name="age" maxlength="2" ></center></td>
      </tr>
      <tr>
        <td><center>E-mail:<br/> Please do not fake your E-mail</center></td>
        <td><center><input type="text" name="email" maxlength="30" ></center></td>
      </tr>
      <tr>
        <td><center>Date of Birth:<br/>YYYY-MM-DD</center></td>
        <td><center><input type="text" name="dob" maxlength="10" ></center></td>
      </tr>
      <tr>
        <td><center>Second or Real Life?</center></td>
        <td><center>
    			<select name="life">
    			<option value="Real">Real Life</option>
    			<option value="Second" selected="selected">Second Life</option>
    			</select>
    	</center></td>
      </tr>
      <tr>
        <td><center>Looking for:</center></td>
        <td><center>	
    			<select name="looking">
    			<option value="Friends" selected="selected">Friends</option>
    			<option value="Men">Male</option>
    			<option value="Women">Female</option>
    			</select>
    	</center></td>
      </tr>
      <tr>
        <td><center>Sexuality:</center></td>
        <td><center>
    			<select name="going">
    			<option value="Straight">Straight</option>
    			<option value="Gay">Gay</option>
    			<option value="Bi">Bi</option>
    			</select>
    	</center></td>
      </tr>
      <tr>
        <td><center>Status:</center></td>
        <td><center>
    			<select name="status">
    			<option value="unknown">Not Telling</option>
    			<option value="Single">Single</option>
    			<option value="Married">Married</option>
    			</select>
    	</center></td>
      </tr>
    </table>
    
    <input name="submit" type="submit" id="submit" value="Submit" />
    </form>
    

     

    Now what I don't get is how to call the value from a select option.

    here is my php script for it so far

    <?php
    
    if(!isset($_POST['submit'])){
    // echo "Sorry, your information could not be completed at this time. Please contact an Admin.";
    }
    else{
    isset($_SESSION['login_user']);
    $age = mysql_real_escape_string($_POST['age']);
    $email = mysql_real_escape_string($_POST['email']);
    $dob = mysql_real_escape_string($_POST['dob']);
    }
    ?>
    

     

    As you see, I havent done anything with the ones from the select option.

     

    Any hints or tips? =)

  6. Thank you everyone!

    Id like to call out Andy H and mjdamato.

    Thank you Andy for putting in the mysql_real_escape_string I so carelessly left out. And mjdamato, which helped me find my error.

     

    How careless of me.... I kinda forgot to add in my config.php which allowed me to access the database XD

  7. Hey everyone! I'm Back =D.

     

    So here is what I'm trying to do

     

    Objective: I am trying to get rid of this error,

    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\iMatch\edit\about.php on line 11

     

    Problem: I can't really figure it out, I've tried many things, but I havent had luck yet =(

     

    Script

    <?php session_start(); error_reporting(E_ALL); require("login.php");?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>iMatch | Edit About You</title>
    <style>
    </style>
    </head>
    <body>
    
    <?php
    $sql = mysql_query("SELECT about FROM `profile` WHERE `accountid` = '{$_SESSION['login_id']}'");
    $result = mysql_fetch_assoc($sql);
    ?>
    Edit about your self: Please use less than 350 character(s). <br />
    <form METHOD="POST" ACTION="">
    <textarea name="about" id="about" rows="10" cols="60" MAXLENGTH="350" />
    <?php echo $result[0]; ?>
    </textarea><br />
    <input name="submit" type="submit" id="submit" value="Submit" /><br/>
    <?php
    
    if(!isset($_POST['submit'])){
    // echo "Sorry, your information could not be completed at this time. Please contact an Admin.";
    }
    elseif(!isset($_SESSION['login_id'])){
    echo "You are not logged in! Please login before you try to edit your account information";
    }
    else{
    $content = $_POST['about'];
    $enter = mysql_real_escape_string("UPDATE `profile` SET `about` = '$content' WHERE profileid = '{$_SESSION['login_id']}'");
    echo "Your information has been edited.";
    }
    ?>
    </form>
    </body>
    </html>
    

     

    The problem is here

    $result = mysql_fetch_assoc($sql);

     

    And hints or tips? =)

     

    Thanks for your help! It is very appreciated!

  8. Wow, the edit thing should be enables for the last message the person wrote. o.o

     

     

    Anyways, I've played around all day with codes, and I'm not getting any errors now, however the code isnt executing for the URL. any ideas? ._.

     

    Edit: Nvm, I'm now getting a error X_X

    Notice: Undefined index: username in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\Abysmal-Essence\cp.php on line 3

     

    If you would like to view the page, here ya go,

    <?php session_start(); ?>
    <?php error_reporting(E_ALL);?>
    <?php $username = $_GET['username']; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="style.css" rel="stylesheet" type="text/css" />
    <title>Abysmal Essence | Control Pannel</title>
    <style>
    body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    }
    body {
    background-color: #000000;
    background-image: url(images/bg-soft.PNG);
    background-repeat: repeat;
    }
    #loggedin_info {
    position:absolute;
    left:159px;
    top:100px;
    width:218px;
    height:400px;
    z-index:1;
    margin:auto;
    padding:0px;
    }
    #header{
    position:absolute;
    background:#000000;
    top:2px;
    left:100px;
    }
    #notloggedin{
    position:absolute;
    left: 405px;
    top: 198px;
    width: 444px;
    height: 32px;
    }
    #content_loggedin{
    position:absolute;
    top:99px;
    left:381px;
    width: 528px;
    height: 399px;
    }
    #side_rename{
    position:absolute;
    top:99px;
    left:920px;
    width: 189px;
    height: 401px;
    }
    #nav{
    position:absolute;
    left:4px;
    top:102px;
    width:145px;
    height:388px;
    color:white;
    background:#4682B4;
    }
    #button_account{
    position:absolute;
    top:473px;
    left:209px;
    width: 150px;
    }
    #content_account{
    position:absolute;
    top:472px;
    left:586px;
    }
    #unknown_account{
    position:absolute;
    top:474px;
    left:955px;
    }
    </style>
    </head>
    
    <body>
    <div id = login>
    <?php
    include('header.php');
    $result = mysql_query("SELECT about,content,unknown FROM `profile` WHERE `accountid` = {$_SESSION['login_id']}");
    if (!$result) {
        echo 'Could not run query: ' . mysql_error();
        exit();
    }
    $row = mysql_fetch_row($result);
    $getuser = mysql_query("SELECT * FROM `accounts` WHERE `username` = '$username'"); 
    /*
    //Get users progile id
    $profileid = $_REQUEST['username'];
    
    // you'll need to change the values here to suit your db
    $query1 = "SELECT * FROM `accounts` WHERE `username` = '$profileid'";
    
    $result1 = mysql_query($query1) or die ("There was an error");
    $row1 = mysql_fetch_row($result1);*/
    ?>
    </div>
    <?php if (isset($_SESSION['login_user'])){ ?>
    <div id="loggedin_info">
    <p align = center>
    About me, <br/><?php echo htmlentities($row[0]); ?></p>
    </div>
    <div id = content_loggedin>
      <p align = center>About your self,<br/> <?php echo htmlentities($row[1]); ?></p>
    </div>
    <div id = side_rename>
      <p align = center>Personal Use <br/><?php echo htmlentities($row[2]); ?></p>
    </div>
    <?php
    }
    else{
    ?>
      <div id = notloggedin>
        <center>
    <strong>You must be loggedin to view your profile!</strong><br/> The profiles is currently, not done, or functional. Please wait while we get this online, ASAP!<br/> Thank you!</center></div>
    <?php } ?>
    <div id = nav>
    <center>
    <hr />
    <a href = "./index.php">Home</a><br/><hr />
    <a href = "./faq.php">FAQ</a><br/><hr />
    <a href = "./about.php">About Us</a><br/><hr />
    <a href = "./index.php">Projects</a><br/><hr />
    </center>
    </div>
    
    </body>
    
    </html>
    

     

    I'm so sorry I sound like a nub, however, Learning PHP isn't easy just learning it online. ._.

  9. From what you say, I thought about it this way.

     

    • Make a SQL statement altering the "logged_in" column when the user logs in. Set the default as 1.
    • "If the account is attempted to be logged in from another place and the 1 is still there" - From that i would log their IP or something like that (I don't know how to log someone's IP dont ask, lol) then if their not from that IP, then deny their access.
    • "every 2 hours goes through and changes all the 1s to 0s" - This is just me saying it. Set a timer at certin times to alter that field at specific times to go to a 0.

  10. I've tried and I've tried, I just can't seem to fix what ever the problem is -_- *Sigh* any other suggestions?

     

    Also, what ever it is saying "Undefined Index" is really making me mad. I can't figure out what it is trying to say.

     

    Anyone with an idea what that is trying to tell me and how it could be fixed? It is driving me insaine. That is about all the errors i get now, :P

  11. OK, when I'm on the front page, of the site (The link to get to cp.php) I click the profile link (cp.php) when i got there, this is listed in my URL

    http://5.3.17.155/dreamweaver%20sites/abysmal-essence/cp.php?user=%3Cbr%20/%3E%3Cb%3ENotice%3C/b%3E:%20%20Undefined%20variable:%20username%20in%20%3Cb%3EC:\Documents%20and%20Settings\Compaq_Owner\Desktop\Server%20Files\Web%20Server\xampp\htdocs\dreamweaver%20sites\Abysmal-Essence\header.php%3C/b%3E%20on%20line%20%3Cb%3E51%3C/b%3E%3Cbr%20/%3E

     

    and this is on the page.

    Notice: Undefined index: username in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\Web Server\xampp\htdocs\dreamweaver sites\Abysmal-Essence\cp.php on line 4

     

    If you would like to view the whole file, i will gladly share it.

    (The files are 2 separate things. header.php which has all the login stuff and all that stuff. and cp.php which loads the whole profile.)

     

    If you are cerious, about team viewer, it is kind of like a remote assistance kind of thing. Except it is less stressing for the computer. It stresses the net and relies on the person's RAM.

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