Jump to content

Search the Community

Showing results for tags 'index'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 12 results

  1. Right now my website url appears like this. http://www.mywebsite.com/index.php I was wondering if there is a way to remove the index.php and just have it show like this when someone goes to the website? http://www.mywebsite.com
  2. hi, can anyone tell me anything wrong with my coding as it keeps mentioned undefined index,id tambahitem.php
  3. Hello. I need help. It is posible to make php file.. index. The main page on website like <?php //sillence is golden I want this but i want to know it is posible? Please help
  4. Hey guys, So I making a basic website form to do CRUD operations on a database, and all of my components work, but I keep getting 500 - Internal server error on my index.php Heres my code: <?php require_once('config.php'); require_once('menu.php'); echo '<h1>View All Alien Interactions</h1>'; /* Start the table with the fields we want to display Remember $fields is now in config.php */ echo '<table> <tr>'; foreach($fields AS $label){ // th is a table header; the column's title or label. echo "<th>{$label}</th>"; } //Add the edit and delete columns at the end of the table echo '<th>Edit</th><th>Delete</th>'; echo '</tr>'; /* Select the fields we want, from all the rows The first line takes the array keys from our $fields array and implodes them, using backticks and commas. The end result will look like `first_name`, `last_name`, `phone_number`... The next line creates a SELECT query using that string. */ $fields_str = '`contact_id`, `'.implode(array_keys($fields), '`, `').'`'; $sql = "SELECT {$fields_str} FROM `aliens_abduction`"; foreach($dbh->query($sql) as $row) { echo '<tr>'; // Loop through the fields again to display them for this row. // Note: The tutorial originally contained an error here, this has been updated. foreach($fields AS $field=>$value){ // if the field is blank, we want to empty a blank space, otherwise the HTML won't work properly echo '<td>'.(isset($row[$field]) && strlen($row[$field]) ? $row[$field] : '&nbsp'.'</td>'); } echo '</tr>'; echo '<td><a href="edit.php?contact_id='.$row['contact_id'].'">Edit</a></td>'; echo '<td><a href="delete.php?contact_id='.$row['contact_id'].'">Delete</a></td>'; echo '</tr>'; echo '</table>'; ?> and heres my config.php code (idk if this is the root of the problem, i dummied out my credentials): <?php //Connect to the database $dbh = new PDO('mysql:host=xxxxxxxxx;dbname=db_demo', 'xxxxx', 'xxxxx'); //Set the default fetch mode to be an associative array. $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); //Define the fields for our CRUD application $fields = array( 'first_name' => 'First Name', 'last_name' => 'Last Name', 'when_it_happened' => 'When it happened', 'how_many' => 'How many', 'alien_description' => 'Alien description', 'what_they_did' => 'What they did', 'fang_spotted' => 'Fang spotted', 'email' => 'Email' ); ?>
  5. Hey guys, i have a .htaccess file that i am trying to modify. apparently i modified this before to remove extensions from being necessary ( i.e .php) then i made a modification to remove the www from the URL so that it would be strictly http://websitenamehere.com this did not work and i tried to remove the code from the .htaccess file, as you will see there is no code now for this. Yet, when go to the site it works and shows its SERP as websitename.com. this is extremely frustrating and looks very amateurish. .HTACCESS FILE RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /profile.php?username=$1 # ---- Establish a custom 404 ErrorDocument 404 /filenotfound.php # ---- Prevent directory file listing index IndexIgnore * # ---- Make Pages render with no ext Options +Multiviews AuthName "websitename.com" AuthUserFile "/home/websitename/.htpasswds/public_html/passwd" also on a side issue if anyone has any input, how can i remove the .index extension from showing, i want to to a redirect from the .htaccess file, where instead of index.php it would just show the domain.name. Thank a bunch guys, any suggestions or help would be great.
  6. Hello, I've been having some troubles in form submitting with HTML and PHP dynamic pages. In this case, the link to register at my site is index.php?p=r Inside this link, I have a form where the user fills and then have a button to submit it: <form class="form-horizontal margin-none" id="registerform" method="_GET" autocomplete="on" action="index.php?p=r"> <!-- Widget --> <div class="widget widget-heading-simple widget-body-gray"> <div class="widget-body"> <h4>Personal Details</h4> <!-- Row --> <div class="row-fluid"> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="firstname">First name</label> <div class="controls"><input class="span12" id="firstname" name="firstname" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="lastname">Last name</label> <div class="controls"><input class="span12" id="lastname" name="lastname" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="email">E-mail</label> <div class="controls"><input class="span12" id="email" name="email" type="email" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="username">Username</label> <div class="controls"><input class="span12" id="username" name="username" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="password">Password</label> <div class="controls"><input class="span12" id="password" name="password" type="password" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="confirm_password">Confirm password</label> <div class="controls"><input class="span12" id="confirm_password" name="confirm_password" type="password" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <h4>Billing Details</h4> <!-- Row --> <!-- Alert --> <div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">x</button> <strong>Why we need your billing details?</strong> We need your billing details because as a seller/buyer, we need to know where to send the cards. So insert that data carefully, otherwhise can happen shipment mistakes. </div> <!-- // Alert END --> <div class="row-fluid"> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="address">Address</label> <div class="controls"><input class="span12" id="address" name="address" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="zipcode">Zip Code</label> <div class="controls"><input class="span12" id="zipcode" name="zipcode" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="city">City</label> <div class="controls"><input class="span12" id="city" name="city" type="text" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="State">State</label> <div class="controls"><input class="span12" id="state" name="state" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="confirm_password">Country</label> <div class="controls"><input class="span12" id="confirm_password" name="confirm_password" type="text" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <!-- Row --> <div class="row-fluid uniformjs"> <!-- Column --> <div class="span4"> <h4 style="margin-bottom: 10px;">Policy & Newsletter</h4> <label class="checkbox" for="agree"> <input type="checkbox" class="checkbox" id="agree" name="agree" /> I agree with <a href="#TOS" data-toggle="modal">Terms of Services</a> </label> <label class="checkbox" for="newsletter"> <input type="checkbox" class="checkbox" id="newsletter" name="newsletter" checked="true"/> Receive Newsletter </label> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <!-- Form actions --> <div class="form-actions" align="right"> <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Register</button> </div> <!-- // Form actions END --> </div> </div> <!-- // Widget END --> </form> <!-- // Form END --> The problems keeps in this part of code: <!-- Form actions --> <div class="form-actions" align="right"> <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Register</button> </div> <!-- // Form actions END --> When I click the Register Button, it redirects me to index.php?username......password.... Instead of reloading in the same page (index.php?p=r&username=.... ) I would like too the browser link doesn't show that data ( username, password ). Already tried to change the method to POST but it doesn't work. Can anyone help me please?
  7. <?php //connect to the database require_once('connectvars.php'); $firstname = ( $_POST['firstname']); $lastname = ( $_POST['lastname']); $username = ( $_POST['username']); $password = ( $_POST['password1']); $email = ( $_POST['email']); //insert data into table $query = "INSERT INTO summerfun_users (username, password, email, first_name, last_name) VALUES ($username, '$password', '$email', '$firstname', '$lastname')"; mysqli_query($dbc, $query); //confirm success with the user echo "congrats friend, you are now a member of summer fun"; ?> i am getting undefined index errors on all my variables, please help
  8. I have a problem. I have this array. Example... [0] hi.jpg [1] bye.gif [2] blah.png [3] 0000.jpg If I enter a value to a field like "bye.gif". Or let's say I put this on the address bar... http://mysite.com/somepage.php?view=bye.gif I want to get the array index and put that into a variable. Like somehow I want to do a "$_GET['view']" maybe and get the array value and put it into a variable. Like... $imageVar = "index of $_GET['view']" So when run it's like... $imageVar = 1 Hope this doesnt sound like jibberish. i'm kind of a noob. D=
  9. Greetings, Working with an assignment in my school I am having an issue getting an Index to validate. Been bashing my head against this all day. I am new to PHP and still learning. <?php /* Students, this script needs 4 files located in the www (Windows) or htdocs (Mac) area in the unit03 subfolder: 1. This file named index.php (this is the core script). 2. The header.html located in the includes subfolder of unit03, which minimally needs to contain HTML document structure tags up to and including the opening body tag. 3. The footer.html located in the includes subfolder of unit03, which minimally needs to contain closing body and html tags. 4. The styles.css located in the includes subfolder of unit03. This project is buggy and your task is to debug it. */ //Set the value of the page title $pagetitle = 'John Doe, IT250 Unit 3'; //Include HTML document structure tags in the header include('includes/header.php'); ?> <!-- Form elements have pre-defined styles in the related CSS. --> <form action="index.php" method="post" name="greeting"> <input type="hidden" name="hour" id="hour" value="" /> <input type="hidden" name="minute" value="" /> <fieldset> <legend>Enter Your Name</legend> <label for="fname">First</label><input type="text" name="fname" size="10"/> <label for="lname">Last</label><input type="text" name"lname" size="10" /> <input type="reset" value="Reset"/> <input type="submit" value="Submit"/> </fieldset> </form> <!-- Gets the user's time and passes it to the hidden input in the form above. Used to customize the greeting. Note the script must be after the form in order to pass the value to the form --> <script type="text/javascript"> var d = new Date(); var h = d.getHours(); var m = d.getMinutes(); document.greeting.hour.value = h; document.greeting.minute.value = m; </script> <?php /*Check if the form was submitted. The following code block will execute upon click of the submit button, otherwise it will just show the form.*/ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // This line of code contained a syntax error $Server should be $_SERVER. //Validate data was entered if (!empty($_POST['fname']) && !empty($_POST['lname'])) { //If data is validated, initialize the text variables and convert them to proper nouns $fname = ucfirst(strtolower($_POST['fname'])); // Here I added a missing ) because it needed the ) to close the statement. $lname = ucfirst(strtolower($_POST['lname'])); // The index was incorrect here so I fixed the name. $hour = $_POST['hour']; $minute = $_POST['minute']; //Decide if it is morning, afternoon, or evening if ($hour < 12) { // This line had a closing semi colon which ended the entire else if arguments. $timeofday = "morning"; } else if ($hour < 18) { // This code was using a ( instead of an opening {. $timeofday = 'afternoon'; } else if ($hour < 24) { $timeofday = 'evening'; } echo '<p class="message">Good ' . $timeofday . " " . $fname . " " . $lname . '!</p>'; // $Fname was incorrectly spelled with a capital F. echo '<p class="message">It is ' . $hour . ':' . $minute . ' your time</p>'; echo '<a href="index.php">Start Over</a>'; } else { //Message to display if data doesn't validate echo '<p class="message">Please enter your name.</p>'; } } // This if else structure was missing a closing bracket. //Include HTML document structure tags in the footer include('includes/footer.php'); ?> I fixed quite a few errors already but I can't for the life of me figure out why the lname index is not validating. Any help or suggestions are much appreciated. Best Regards, Nightasy
  10. Guest

    Mobile Redirection

    When trying to view our website from a mobile phone or an iPad, it redirects to another website which does not exist. I can see where the redirection is taking place in the index.php file, but I do not know what I need to remove in order for the redirect to stop. From a mobile device or iPad it should just go to our normal website, www.u-a-s.com, we do not have a mobile version as of yet. I tried a few things, but do not know enough to know what to take out. Can anyone help? Here is the code: ************************ $ua = $_SERVER['HTTP_USER_AGENT']; if ( stristr($ua, "Windows CE") or stristr($ua, "AvantGo") or stristr($ua,"Mazingo") or stristr($ua, "Mobile") or stristr($ua, "T68") or stristr($ua,"Syncalot") or stristr($ua, "Blazer") ) { $DEVICE_TYPE = "MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { header ("Location:http://lahori.org/mydev/universal/mobile/"); exit; } define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); ?>
  11. All, I had someone request a function to be written. Here's what they said: can you take a list of ints and get back a list of indices that add up to a variable 'X'?? here's what they asked for (as an example)... Input: ([1,4,7,2], X=3) output: [[0,1]] I'm not quite sure I'm following it. Anyone shed some light on this for me? I'm just not getting what they want, probably because I don't have formal training in coding. Vocabs are always mismatched. thanks.
  12. Shortly I need to block a group of users at once according to their role status (banned or not) instead of blocking users one by one. I tried using fk on update cascade to control the role status by making a fk user_role_status column in the users table refers to role_status column in the roles table but without luck because when I change a role status in roles table it changes the whole user_role_status column in users table not only the role I changed then it blocks all users not only the group I want to block because role_status in roles table is not unique and I can't make it unique because its all cells contain value='1', so I deleted the column and gave up that idea // role_status in roles table is a fk refers to id in statuses table. statuses_table id is_active ------------------ 0 no 1 ok roles_table id role role_status -------------------------------------- 1 Admins 1 2 Editors 1 3 Users 1 users_table id user_name user_level --------------------------------------- 1 Admin 1 2 Editor1 2 3 User1 3 4 Editor2 2 5 User2 3 6 User3 3 and this is the function I use -------------------------------------------------------------- Find role status -------------------------------------------------------------- function find_by_current_rolStatus($role_status) { global $db; $sql = "SELECT users.id FROM users JOIN roles ON roles.id = users.user_level WHERE roles.role_status = '{$db->escape($role_status)}'"; $result = $db->query($sql); return($db->num_rows($result) === 0 ? true : false); } -------------------------------------------------------------- Function for checking if user role status banned or allowed -------------------------------------------------------------- function login_require_roleStatus($require_role_status) { global $session; $current_user = current_user(); $current_user_role_status = find_by_current_rolStatus($current_user['role_status']);//line 155 //if Role status Deactive if ($current_user['role_status'] === '0')://line 157 $session->msg('Banned'); redirect('home.php',false); //if user role allowed elseif($current_user['role_status'] === '1')://line 161 return true; endif; } and I got this error I am trying to get the users whose user_level = role_id which its status = '0' or '1', I checked this SQL query with phpmyadmin and it is working fine, and actually I don't know what to do after that :( , I mean I don't know what to write with $current_user['role_status'] instead of role_status to get what I want.
×
×
  • 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.