Jump to content

oliverj777

Members
  • Posts

    98
  • Joined

  • Last visited

    Never

Posts posted by oliverj777

  1. Well, the thing is, is that you need to retrieve the table ID (or whatever form of ID it is using) from the website. From there, you can get PHP to connect to the HTTP and find the particular table ID with a _GET and then simply do an echo

  2. Okay, I may of solved it. Just copy and paste this code and see if it works -->

     

     

    <?php
    
    require_once( "_inc/glob.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" xml:lang="en">
    
    <head>
    
    	<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
    
    	<title>radiPanel</title>
    
    	<script type="text/javascript" src="_js/prototype.js"></script>
    	<script type="text/javascript" src="_js/scriptaculous.js"></script>
    	<script type="text/javascript" src="_js/validation.js"></script>
    	<script type="text/javascript" src="_js/radi.js"></script>
    
    	<style type="text/css" media="screen">@import url('_img/style.css');</style>
    
    </head>
    
    <body>
    
    		<?php
    
    			//This is what is causing the problem .. the script is checking to see if the person is logged in       -->
                                    //if( $user->loggedIn ) {
    
    		?>
    
    	<div style="width: 800px; margin: auto;">
    
    		<div>
    
    			<div style="float: right; width: 500px; text-align: right; padding-top: 12px;">
    
    				Welcome, <strong><?php echo $user->data['fullUsername']; ?></strong>!
    
    			</div>
    
    			<big>radiPanel</big>
    
    		</div>
    
    		<div style="float: left; width: 200px;">
    
    			<?php
    
    				$url = $_GET['url'] ? $core->clean( $_GET['url'] ) : 'core.home';
    
    				$query3 = $db->query( "SELECT * FROM menu WHERE url = '{$url}'" );
    				$array3 = $db->assoc( $query3 );
    
    				if( !$array3['usergroup'] ) {
    
    					$array3['usergroup'] = "invalid";
    
    				}
    
    				$query = $db->query( "SELECT * FROM usergroups ORDER BY weight ASC" );
    
    				while( $array = $db->assoc( $query ) ) {
    
    					if( in_array( $array['id'], $user->data['uGroupArray'] ) ) {
    
    			?>
    
    			<div class="box">
    
    				<div class="square menu" style="background: #<?php echo $array['colour']; ?>;" onclick="Radi.menuToggle('<?php echo $array['id']; ?>');">
    
    					<img id="menutoggle_<?php echo $array['id']; ?>" class="menutoggle" src="_img/<?php echo ( $array['id'] != $array3['usergroup'] ) ? 'plus' : 'minus'; ?>_white.png" alt="Toggle" align="right" />
    
    					<strong><?php echo $array['name']; ?></strong>
    
    				</div>
    
    				<div class="menuitems"<?php if( $array['id'] != $array3['usergroup'] ) { ?> style="display: none;"<?php } ?> id="mitems_<?php echo $array['id']; ?>">
    
    				<?php
    
    					$query2 = $db->query( "SELECT * FROM menu WHERE usergroup = '{$array['id']}' ORDER BY weight ASC" );
    
    					$i      = "a";
    
    					while( $array2 = $db->assoc( $query2 ) ) {
    
    				?>
    
    					<a href="<?php echo $array2['url']; ?>" class="<?php echo $i; ?>">
    						<?php echo $array2['text']; ?>
    					</a>
    
    				<?php
    						$i++;
    
    						if( $i == "c" ) {
    
    							$i = "a";
    
    						}
    
    					}
    				?>
    
    				</div>
    
    			</div><br>
    			<?php
    
    					}
    
    				}
    
    			?>
    
    		</div>
    		<br>
    		<div style="float: left; width: 590px; padding-left: 10px;">
    
    			<?php
    				if( !in_array( $array3['usergroup'], $user->data['uGroupArray'] ) ) {
    
    					echo "Permission denied.";
    
    				}
    				elseif( !@include_once( $array3['resource'] ) ) {
    
    					echo "Error has occurred looking for " . $array3['resource'];
    
    				}
    
    			?>
    
    		</div>
    
    		<br clear="all" />
    
    	</div>
    
    		<?php
    
    			}
    			// Below is what a unlogged in person will see - if you want, you may want to remove the below HTML -->
                                     //else {
    
    		?>
                     <!------------ remove all this from here ------------->
    	<div style="width: 500px; margin: auto;">
    
    		<big>
    			Log in
    		</big>
    
    
    		<form method="post" action="" id="login">
    
    			<div class="box">
    
    			<?php /*
    				if( $_POST['submit'] ) {
    
    					try {
    
    						$username = $_POST['username'];
    						$password = $_POST['password'];
    						$user->login( $username, $password );
    						echo $core->redirect( "?" );
    
    					}
    					catch( UserException $e ) {
    
    						echo "<div class=\"square bad\">";
    						echo "<strong>Error</strong>";
    						echo "<br />";
    						echo $e->getMessage();
    						echo "</div>";
    
    					}
    
    				}
    			 */ ?>
    
    				<table width="100%" cellpadding="3" cellspacing="0">
    
    					<?php /*
    
    						echo $core->buildField( "text",
    												"required",
    												"username",
    												"Username",
    												"Your username." );
    
    						echo $core->buildField( "password",
    												"required",
    												"password",
    												"Password",
    												"Your password." );
    
    					*/ ?>
    
    				</table>	
    
    			</div>
    
    			<div class="box" align="right">
    
    				<input class="button" type="submit" name="submit" value="Log in" />
    
    			</div>
    
    		</form>
    
    		</div>
    
    	</div> <!----------------------- to here ------------------------>
    		<?php
    
    				echo $core->buildFormJS("login");
    
    			}
    
    		?>
    
    </body>
    
    </html>

  3. PHP does not show up as a source code in a browser. All you will see is your HTML language. If you can see your PHP code within an editor (dreamweaver) then trust me ... its there. But like I said, PHP is not displayed in the source code from a browser, even if you 'save as' the web page, you will still not see any of the PHP code.

     

    On to the problem, let me get my understanding correct. Am I right in thinking that your login script is missing a load of code, causing it not to function?

  4. Hello,

     

    I have a field in which when a user types something into it, it saves it into a table in my SQL. But is it possible to remove a particular phrase from the field if the user enters it.

     

    Example:

     

    I have a text field that says 'please enter your website domain here'. The user then enters 'www.domain.com'. Is it possible for PHP to remove the 'www.' and only save the 'domain.com' to my SQL (bearing in mind that not all users may enter www.)

     

    Here is the code for the text field:

     

    <input name="website_name" type="text" class="text-box" id="website_name" value="<?php echo $website_name; ?>" size="24" />

     

    Here is the code for the _POST:

     

    if(isset($_POST['send']))
                {
    		$database->updateUserField($session->username, "website_name", $_POST['website_name']);	
    }

     

    (the code so far all works fine - I just want to add an extra 'variable', if you will, to the code)

     

    Thanks for your help!!

  5. class Form
    {
       var $values = array();  //Holds submitted form field values
       var $errors = array();  //Holds submitted form error messages
       var $num_errors;   //The number of errors in submitted form
    
       /* Class constructor */
       function Form(){
          /**
           * Get form value and error arrays, used when there
           * is an error with a user-submitted form.
           */
          if(isset($_SESSION['value_array']) && isset($_SESSION['error_array'])){
             $this->values = $_SESSION['value_array'];
             $this->errors = $_SESSION['error_array'];
             $this->num_errors = count($this->errors);
    
             unset($_SESSION['value_array']);
             unset($_SESSION['error_array']);
          }
          else{
             $this->num_errors = 0;
          }
       }
    
       /**
        * setValue - Records the value typed into the given
        * form field by the user.
        */
       function setValue($field, $value){
          $this->values[$field] = $value;
       }
    
       /**
        * setError - Records new form error given the form
        * field name and the error message attached to it.
        */
       function setError($field, $errmsg){
          $this->errors[$field] = $errmsg;
          $this->num_errors = count($this->errors);
       }
    
       /**
        * value - Returns the value attached to the given
        * field, if none exists, the empty string is returned.
        */
       function value($field){
          if(array_key_exists($field,$this->values)){
             return htmlspecialchars(stripslashes($this->values[$field]));
          }else{
             return "";
          }
       }
    
       /**
        * error - Returns the error message attached to the
        * given field, if none exists, the empty string is returned.
        */
       function error($field){
          if(array_key_exists($field,$this->errors)){
             return '<div class="errormsg_index">'.$this->errors[$field].'</div>';
          }else{
             return "";
          }
       }
    
       /* getErrorArray - Returns the array of error messages */
       function getErrorArray(){
          return $this->errors;
       }
    };
    
    
    

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