Jump to content

Search the Community

Showing results for tags 'header'.

  • 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 (Dreamweaver, Zend, 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

  1. I've got an issue with a header redirect that is confusing me. I haven't been able to find any similar problems that have help me solve it and the PHP man page on headers isn't helping me either. <?php if(isset($_POST['add_cat'])) { $cat_obj->add_category($_POST['cat_title']); header("Location: admin/category.php"); } ?> This code is in a file called add_category.php which is in the same directory as the category.php file I want it to redirect to. without the 'header..' line it works perfectly; but with the 'header..' line I get the following warning - but there's no other place sending headers (that I can see) and to my inexperienced eye it seems like it's cyclical logic as it's saying the same line I want to send the redirect is the one that already sent it. Would someone mind giving me an ELI5 breakdown of why this isn't working properly and maybe a route to solving the problem, please? TIA
  2. I am trying to redirect to the login page if a user is not logged in. I have the following piece of code: $slashpos= strrpos($_SERVER['SCRIPT_NAME'], '/'); $path=substr($_SERVER['SCRIPT_NAME'],0,($slashpos+1)); header('Location: '. $_SERVER['HTTP_HOST'].$path.'login.php?message=This%20page%20is%20only%20for%20gallery%20personnel'); //echo 'Location: '. $_SERVER['HTTP_HOST'].$path.'login.php?message=This%20page%20is%20only%20for%20gallery%20personnel'; exit(''); If I execute the script as is I get nothing - a blank page. If I uncomment the echo line I get: Location: localhost:8888/Art3/theme/login.php?message=This%20page%20is%20only%20for%20gallery%20personnel which seems right to me. I have the following lines at the top of the script and I'm getting no errors ini_set('display_errors', 1); error_reporting(0); I have tried: just using 'Location: login.php?message=foo' and constructing the URL from $_SERVER['SERVER_NAME'] and $_SERVER['SERVER_PORT']
  3. Hi Guys I've across an issue With my project im working on and I cannot solve it When accessing my reports page I get this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/virtual/crmtech.co.uk/minicrm/htdocs/header.php:104) in I have eliminated the issues down to my javascript scripts in the header :| but I just cannot work out why it would be causing the issue. here is the header.php <?php require ('secure/session.php'); require ('Functions/functions.php'); error_reporting(E_ALL); ini_set('display_errors', 1); ?> <!DOCTYPE html> <html> <head> <!--favicon--> <link rel="icon" href="<?php echo url();?>Images/favicon.ico" type="image/x-icon" /> <!--Style Sheets--> <link rel="stylesheet" type="text/css" href="<?php echo url();?>bootstrap/css/style.css"> <link rel="stylesheet" type="text/css" href="<?php echo url();?>bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="<?php echo url();?>bootstrap/css/custom.css"> <!--Script Links--> <script src="<?php echo url();?>bootstrap/js/jquery/jquery.js"></script> <script src="<?php echo url();?>bootstrap/js/bootstrap.min.js"></script> <script src="<?php echo url();?>bootstrap/js/typeahead/typeahead.js"></script> <script src="<?php echo url();?>bootstrap/js/bootstrap-datepicker/bootstrap-datepicker.js"></script> <!-- For Displaying Modals--> <script type="text/javascript"> $(".btn-group").find(':input:checked').parent('.btn').addClass('active'); </script> <!--This is the datepicker --> <script type="text/javascript"> $('.datepicker').datepicker({ format: 'mm/dd/yyyy', startDate: '-3d' }) </script> <!--lets use the better to typeahead for search forms --> <script type="text/javascript"> $(function (){ $("#typeaheadCust").typeahead({ source: function(customer, process) { $.ajax({ url: '<?php echo url();?>Functions/Getter.php', type: 'POST', data: 'customer=' + customer, dataType: 'JSON', async: true, success: function(data) { process(data); } }); } }); }); </script> and here is the my reporting/main.php page <?php //this is going to be the main section for reporting include('../header.php'); //lets check the user is authorised to be here! if ($userLevel > 3){ echo "you are authorised to be here!"; } else { echo "you are not allowed here naughty!"; //sleep(10); echo "lets send you here ". SERVER_PATH; header('Location: ../index.php'); } ?> here is the page result, sorry i had to delete the server path Any help would be massively appreciated Thanks!
  4. Trying to figure out how, when I press my logout button, do I get my page to go back to it's original page without the ?variable=something at the end: header('Location: '.$_SERVER['PHP_SELF'].'?activationsent=1'); I own this site: http://www.golden-wand.com/phpfreaks.txt
  5. I didn't found any nice materials comparing the two ways of information unload to user. Neither have I a firm understanding of how high my learning curve should be in both cases, which of which to choose for better way. I'm a beginner asking for your professional word of advice. Help me to better formulate for search what I want, Please. I know keeping files and images in fs is better served by os/fs-drivers but i'm just learning and just trying to remember select * for "poking around". + i do hate images text analyzing it'll will be! Is it better to save files from MySQL fields via http headers, or it's even more better to perform the saving of the kept txt files (in one specific folder) and all the maintenance of tempfiles on server (archiving, indexing, cron/planning)? So: 1. Learning & get experience in file maintenance? vs 2. Finding out how to deal with protocols (download resuming) What I've found so far: header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length:'); There's a textfield full of appended edits of a specific user (for example list-ordering/or article appending). Headers should deliver it as a file, while skiping the file creation on a server. Or do I just learn how to do it with files and save just file link then accomplish the persistent file-links cleaning (because there would be lots of them)? One one side there is a certain straightforwardness in dealing with files, but then again I'd prefer the both ways while considering continuing to study MySQL-approach. I understand protocols/headers with PHP are no easy task that's why I'm hopefully leaving the last word for the professional.... Thanks in advance!
  6. Hi, I'm new to this forum and I'm Italian, so I'm so sorry for my bad English. Anyway, I need some help with header of my blog, I hope someone can help me! I'm not an expert of php I bought a new theme for my blog (the developer doesn't help with code), and I found this problem: logo has a fixed width, I have to change it to have a bigger logo, and to put an ads on the right. The code is below, the theme can be viewed at this url http://www.industrialthemes.com/engine/ Any help or suggestions are accepted. Thanks in advance! <?php $postid = isset($post) ? $post->ID : ''; #theme options $logo_url=it_get_setting('logo_url'); $logo_url_hd=it_get_setting('logo_url_hd'); $logo_width=it_get_setting('logo_width'); $logo_height=it_get_setting('logo_height'); $logo_color_disable=it_get_setting('logo_color_disable'); $link_url=home_url(); $dimensions = ''; $tagline_disable = true; if(!it_get_setting('description_disable') && get_bloginfo('description')!=='') $tagline_disable = false; #category specific logo $category_id = it_page_in_category($postid); if($category_id) { $categories = it_get_setting('categories'); foreach($categories as $category) { if(is_array($category)) { if(array_key_exists('id',$category)) { if($category['id'] == $category_id) { if(!empty($category['logo'])) $logo_url=$category['logo']; if(!empty($category['logohd'])) $logo_url_hd=$category['logohd']; if(!empty($category['logowidth'])) $logo_width=$category['logowidth']; if(!empty($category['logoheight'])) $logo_height=$category['logoheight']; if(array_key_exists('tagline_disable',$category)) { if($category['tagline_disable']) $tagline_disable = true; } break; } } } } } if(!empty($logo_width)) $dimensions .= ' width="'.$logo_width.'"'; if(!empty($logo_height)) $dimensions .= ' height="'.$logo_height.'"'; $termargs = array('num' => 7, 'tax' => array('post_tag','category')); ?> <?php if (!it_component_disabled('header', $postid)) { ?> <div class="container-fluid no-padding"> <div id="header-bar"> <div class="row"> <div class="col-md-12"> <div id="header-inner" class="container-inner"> <?php echo it_background_ad(); #full screen background ad ?> <?php if(!it_component_disabled('logo', $postid)) { ?> <div id="logo"<?php if($logo_color_disable) { ?> class="no-color"<?php } ?>> <?php if(it_get_setting('display_logo') && $logo_url!='') { ?> <a href="<?php echo $link_url; ?>/"> <img id="site-logo" alt="<?php bloginfo('name'); ?>" src="<?php echo $logo_url; ?>"<?php echo $dimensions; ?> /> <img id="site-logo-hd" alt="<?php bloginfo('name'); ?>" src="<?php echo $logo_url_hd; ?>"<?php echo $dimensions; ?> /> </a> <?php } else { ?> <h1><a class="textfill" href="<?php echo $link_url; ?>/"><?php bloginfo('name'); ?></a></h1> <?php } ?> <?php if(!$tagline_disable) { ?> <div class="subtitle"><?php bloginfo('description'); ?></div> <?php } ?> </div> <?php } ?> <?php if(!it_component_disabled('header_posts', $postid)) { ?> <div id="header-posts"> <div align="center"> SOMETHING IS CHANGING!!! <br /> TESTING <br /></div> </div> <?php } ?> <?php if(!it_component_disabled('header_terms', $postid)) { ?> <?php $terms = it_get_trending_terms($termargs); ?> <div id="header-terms"> <div class="shadowed"> <div class="term-panel first"><span class="theme-icon-flame"></span><span class="trending-label"><?php _e('TRENDING',IT_TEXTDOMAIN); ?></span></div> <?php $i = 0; foreach($terms as $term) { $i++; $cssalt = ($i % 2 == 0) ? '' : ' alt'; ?> <div class="term-panel<?php echo $cssalt; ?>"> <a href="<?php echo get_term_link($term); ?>"><?php echo $term->name; ?></a> </div> <?php } ?> </div> </div> <?php } ?> </div> </div> </div> </div> </div> <?php } ?>
  7. I was wondering if it's possible to retain loaded files and the current error setttings after a header("Location: xxxx.php") is issued, for example in this: // Start up the session - not used yet but there just in case session_start(1); // Enable the Autoloader and initialise it require_once 'Autoloader.php'; Autoloader::init(); // Check if the application has been installed yet ---------------------------- if(!file_exists('Engine/config.php')){ session_write_close(); header("Location: install/index.php"); die(); } And I get a class not found error when I open the install/index.php session_start(1); // @todo: Disable this in the production version .... I already did this in the main index -- do I have to do this on all pages that may error? error_reporting(E_ALL & ~E_STRICT); ini_set("display_errors",1); // Because we jumped here, we have to reinstall the autoloader -- why? require_once '../Autoloader.php'; Autoloader::init(); While I can understand I wouldn't want this if I was firing off to a completely different site, is there anyway to retain the settings within the same server environment or do I have to reset everything as above. I even tried using session in the hope that this would 'remember' but it didn't work.
  8. I am trying to redirect the user to a different Web site after they enter a password. I have two problems, I think. a. My phone file is not retrieving the 'input' from my html5 form. b. My phone header is not working: header (' location: http://filefippo.com'); What is wrong with my coding? <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="keywords" content="html"> <meta http-equiv="refresh" content "1800"> <link rel="stylesheet" href="menu_blue.css" type="text/css" media="screen" /> <title>Members 2</title> <script src="http://1.2.3.4/bmi-int-js/bmi.jsversion=1350564613" language="javascript"> </script> <!--[if IE 6]> <style> body {behavior: url("csshover3.htc");} #menu li .drop {background:url("img/drop.gif") no-repeat right 8px; </style> <![endif]--> </head> <body bgcolor="#000080"> <ul id="menu"> <li> <a href="index.html">Home</a> <!-- Home page --> </li> <!-- End Home page --> <li> <a href="contactform.html">Contact</a> <!-- Contact page --> </li> <!-- End Contact page --> <li> <a href="feedbackform.html">FeedBack</a> <!-- Feedback Page --> </li> <!-- End Feedback page --> <li> <a href="construc.html">Free Estimate</a> <!-- Free Estimate Page --> </li> <!-- End Free Estimate page --> <li> <a href="construc.html">Humor</a> <!-- Humor Page --> </li> <!-- End Free Humor page --> <li> <a href="#" class="drop">Other Links</a> <!-- Other Links Page --> <div class="dropdown_1column align_right"> <div class="col_1"> <ul class="simple"> <li> <a href="construc.html"> Members</a></li> <li> <a href="military.html"> Military</a></li> </ul> </div> </div> </li><!-- End Other Links page --> <li> <a href="repair_upgradeform.html">Repair/Upgrade</a> <!-- Repair/Upgrade Page --> </li><!-- End Repair/Upgrade page --> <li class="menu_right"> <a href="#" class="drop">Training</a> <!-- Training Page --> <div class="dropdown_1column align_right"> <div class="col_1"> <ul class="simple"> <li> <a href="tng_appsform.html"> Applications</a></li> <li> <a href="tng_hardwareform.html"> Hardware</a></li> <li> <a href="tng_osform.html"> Operating Systems</a></li> </ul> </div> </div> </li><!-- End Training page --> </ul> <br> <form name="myform" method="post" action="members2.php"> <table width="100%" align="center" bgcolor="#000080"> <tr> <th align="center" > <font size="+2" color=#ffff00"> ~ ~ ~ Member ~ ~ ~ </font> <br> </th> </tr> </table> <br> <table width="699" bgcolor="#000080" align="center"> <tr align="center"> <td align="center"> <input type="password" name="password" maxlength="15" size="15"> </td> </tr> </table> <table width="699" bgcolor="#000080" align="center"> <tr align="center"> <td align="center"> <font color="#ffffffff" size="+1"> (Please enter the password on your receipt) </font> </td> </tr> </table> <br> <table width="669" bgcolor="#000080" align="center"> <tr> <td align=center> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </td> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> //You should create the validator only after the definition of the HTML form var frmvalidator = new Validator("myform"); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("Password","req","Please enter the Password."); frmvalidator.addValidation("Password","maxlen=15","Max length for the Password is 15"); frmvalidator.addValidation("Password","alnum_s","Password - Alphabetic and Numeric chars"); </script> </body> </html> <script language="javascript"><!--//bmi_orig_img 0 // --> </script> PHP CODE <?php ob_start(); // Process membersform2.html error_reporting(-1) ; // Get Data From Form if ($_SERVER["REQUEST_METHOD"] == "POST") { if(isset($_POST["password"])) { $password = $_POST["passwords"]; trim($password); echo "$Password"; } else { if(empty($_POST["password"])) { echo "Password is required"; } } } // Validate Pwd if($password == "Z0y1X2w3V"){ header(' Location: http://filehippo.com/ '); exit; }else { members(); } // FUNCTION function members(){ // Print to browser global $password; // echo " <html>\n"; echo " <head>\n"; echo " <title>Redirect</title>\n"; echo " </head>\n"; echo " <body BGCOLOR=\"#000080\" TEXT=\"#ffff00\">\n"; echo " <table width=\"600\" Align=\"center\">\n"; echo " <tr>\n"; echo " <td width=\"600\" Align=\"left\">\n"; echo " You will be redirected to the members page in a moment.\n"; echo " <br />\n"; echo " $password \n"; echo " <br /><br />\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </body>\n"; echo " </html>"; } ob_flush(); ?>
  9. I have a page with results from a query that displays that has a link (works fine - passes variables etc) that deletes that line item from a database. It goes to the delete.php and actually executes and removes the item from the database and then has the line header("Location: page.php"); which returns BACK to the page displaying the results. However, it shows the old results until I hit Refresh in the browser. Its like the header is redirecting to a cached version of the page. NOTE: This script used to work fine untouched when we where on a shared hosting account. We JUST updates to VPS hosting by the same host. Now this problem has risen and I can't figure out what is wrong. From what I can guess is there is something in php.ini that is either not set, set or set wrong. Any help would be greatly appreciated. Thanks.
  10. Hi, I am trying to get my contact form from page into header. I have been at his for days now, I can get the contact form into the header with this <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ); ?> but can not get it to sit centrally and in front of image. This is my site, http://www.cloudchasing.co.uk/ The site style that I am trying to emulate is this one http://www.premierwindscreens.co.uk/ Pleeeease help a newcomer
  11. I dont understand why my header(Location) isnt working. Does any one see why? <?php include 'core/init.php'; logged_in_redirect(); include 'includes/overall/header.php'; if (empty($_POST) === false) { $required_fields = array('first_name', 'last_name', 'username', 'password', 'password_again', 'email'); foreach($_POST as $key=>$value) { if (empty($value) && in_array($key, $required_fields) === true) { $errors[] = 'All field are required'; break 1; } } if (empty($errors) === true) { if (user_exists($_POST['username']) === true) { $errors[] = 'Sorry, the user \'' . $_POST['username'] . '\' is already taken'; } if (preg_match("/\\s/", $_POST['username']) == true) { $errors[] = 'Your username can not have spaces'; } if (strlen($_POST['password']) < 6) { $errors[] = 'Your password must be at least 6 characters long'; } if ($_POST['password'] !== $_POST['password_again']) { $errors[] = 'Your passwords do not match'; } if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'A valid email address is required'; } if (email_exists($_POST['email']) === true) { $errors[] = 'Sorry, the email \'' . $_POST['email'] . '\' is already is use. Please contact your site adimn is this is incorrect.'; } } } if (isset($_GET['success']) && empty($_GET['success'])) { echo '<div class="container"><div class="background-success text-center"><div class="alert alert-success center-background">You\'ve be registered successfully! Please check your email to activate your account</div><div class="center-background"><div class="center-text-background">if any issues occur please send us an email!! support@bettergamerzunited.com</div></div></div>'; } else { if(empty($_POST) === false && empty($errors) === true) { $register_data = array( 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'username' => $_POST['username'], 'password' => $_POST['password'], 'email' => $_POST['email'], 'email_code' => md5($_POST['username'] + microtime()) ); register_user($register_data); header('Location: register.php?success'); exit(); } ?> <div class="container background"> <form action="" method="POST" class="form-horizontal" role="form"> <div class="form-group"> <label for="inputfirstname3" class="col-sm-2 control-label">First Name</label> <div class="col-sm-10"> <input type="text" name="first_name" class="form-control" id="inputfirstname3" value="" autocomplete="off" placeholder="First Name"> </div> </div> <div class="form-group"> <label for="inputlastname3" class="col-sm-2 control-label">Last Name</label> <div class="col-sm-10"> <input type="text" name="last_name" class="form-control" id="inputlastname3" value="" autocomplete="off" placeholder="Last Name"> </div> </div> <div class="form-group"> <label for="inputusername3" class="col-sm-2 control-label">Username</label> <div class="col-sm-10"> <input type="text" name="username" class="form-control" id="inputusername3" value="" autocomplete="off" placeholder="Username"> </div> </div> <div class="form-group"> <label for="inputemail3" class="col-sm-2 control-label">Email</label> <div class="col-sm-10"> <input type="email" name="email" class="form-control" id="inputemail3" value="" autocomplete="off" placeholder="Email Address"> </div> </div> <div class="form-group"> <label for="inputpassword3" class="col-sm-2 control-label">Password</label> <div class="col-sm-10"> <input type="password" name="password" class="form-control" id="inputpassword3" autocomplete="off" placeholder="Password"> </div> </div> <div class="form-group"> <label for="inputpassword_again3" class="col-sm-2 control-label">Validate Password</label> <div class="col-sm-10"> <input type="password" name="password_again" class="form-control" id="inputpassword_again3" autocomplete="off" placeholder="Validate Password"> </div> </div> <div class="form-group"> <div class="col-sm-10"> <p class="info">Please be aware that this does not mean that you are a member of Better Gamerz United. If you would like to be come a member please contuine with the registration and then fill out our application. Other wise you will have limited use of this site. Thank you Team BGU!! </p> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary pull-right register">Register</button> </div> </div> </form> </div> <?php } include 'includes/overall/footer.php'; ?>
  12. I am using PHP 5.3 iis7 and SLQ Server 2005. I know the script gets to the session part and creates a temp file in C:/windows/temp folder (see info below), but when I try to login and redirect to the index.php it give a 500 error on the login.php page. login.php index.php conifg.php temp file - C:\windows\temp <?php //set ini ini_set('session.gc_maxlifetime', 900); if(!ini_get('session.auto_start')){ session_start(); } // include file include ('config.php'); include (LIB_PATH.'functions.php'); include(LIB_PATH.'sqlsrv_connect.php'); if($_SESSION['user_id']){ Header("Location: index.php"); } if($_POST['submit']){ $user1 = trim($_POST['user']); $pass1 = trim($_POST['pass']); $user= "'$user1'"; $pass= "'$pass1'"; if($user == '' or $pass == ''){ $error = 'You forgot to enter your user_name and your password!'; }else{ $query = "SELECT * FROM users WHERE user_name = $user and pass = $pass"; $params = array(); $options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET ); $r = sqlsrv_query ($database, $query, $params, $options); $num = sqlsrv_num_rows($r); if ($num >0) { while ($user_data = sqlsrv_fetch_array($r, SQLSRV_FETCH_ASSOC)) { $_SESSION['user_id'] = $user_data['user_id']; $_SESSION['user_name'] = $user_data['user_name']; $_SESSION['user_level'] = $user_data['user_level']; $_SESSION['user_rep'] = $user_data['rep'];} Header("Location: index.php"); }else{ $error = 'Wrong username or password!'; } } } //template include(TEMP_PATH.'login_tpl.php'); ?> <?php //set ini ini_set('session.gc_maxlifetime', 900); if(!ini_get('session.auto_start')){ session_start(); } // include file include ('config.php'); //include (LIB_PATH.'functions.php'); include(LIB_PATH.'sqlsrv_connect.php'); if(!$_SESSION['user_id']){ Header("Location: login.php"); } $database //template include(TEMP_PATH.'index_tpl.php'); ?> <?php date_default_timezone_set('America/Los_Angeles'); //config directory define( 'DS', DIRECTORY_SEPARATOR ); define( 'DS', D ); define('SITE_PATH', dirname(__FILE__) . DS); define('LIB_PATH', SITE_PATH . 'lib' . DS); define('TEMP_PATH', SITE_PATH . 'templates' . DS); define('SO_PER_PAGE',20); ?> user_id|s:1:"6";user_name|s:2:"EM";user_level|s:1:"1";user_rep|s:0:"";
  13. I have this working code except I can't redirect to a thank you page when a new user registers. When they login it works without issue. I just don't know where or what to put for the registration part. Here is my Code. Any help would be much appreciated. <?php include_once('config.php'); // Reset errors and success messages $errors = array(); $success = array(); // Login attempt if(isset($_POST['loginSubmit']) && $_POST['loginSubmit'] == 'true'){ $loginEmail = trim($_POST['email']); $loginPassword = trim($_POST['password']); if (!eregi("^[^@]{1,64}@[^@]{1,255}$", $loginEmail)) $errors['loginEmail'] = 'Your email address is invalid.'; if(strlen($loginPassword) < 6 || strlen($loginPassword) > 12) $errors['loginPassword'] = 'Your password must be between 6-12 characters.'; if(!$errors){ $query = 'SELECT * FROM users WHERE email = "' . mysql_real_escape_string($loginEmail) . '" AND password = MD5("' . $loginPassword . '") LIMIT 1'; $result = mysql_query($query); if(mysql_num_rows($result) == 1){ $user = mysql_fetch_assoc($result); $query = 'UPDATE users SET session_id = "' . session_id() . '" WHERE id = ' . $user['id'] . ' LIMIT 1'; mysql_query($query); header('Location: index.php'); exit; }else{ $errors['login'] = 'No user was found with the details provided.'; } } } // Register attempt if(isset($_POST['registerSubmit']) && $_POST['registerSubmit'] == 'true'){ $registerEmail = trim($_POST['email']); $registerPassword = trim($_POST['password']); $registerConfirmPassword = trim($_POST['confirmPassword']); if (!eregi("^[^@]{1,64}@[^@]{1,255}$", $registerEmail)) $errors['registerEmail'] = 'Your email address is invalid.'; if(strlen($registerPassword) < 6 || strlen($registerPassword) > 12) $errors['registerPassword'] = 'Your password must be between 6-12 characters.'; if($registerPassword != $registerConfirmPassword) $errors['registerConfirmPassword'] = 'Your passwords did not match.'; // Check to see if we have a user registered with this email address already $query = 'SELECT * FROM users WHERE email = "' . mysql_real_escape_string($registerEmail) . '" LIMIT 1'; $result = mysql_query($query); if(mysql_num_rows($result) == 1) $errors['registerEmail'] = 'This email address already exists.'; if(!$errors){ $query = 'INSERT INTO users SET email = "' . mysql_real_escape_string($registerEmail) . '", password = MD5("' . mysql_real_escape_string($registerPassword) . '"), date_registered = "' . date('Y-m-d H:i:s') . '"'; if(mysql_query($query)){ $success[header('Location: index.php')]; }else{ $errors['register'] = 'There was a problem registering you. Please check your details and try again.'; } } } ?> //login code <form class="box400" name="loginForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <h2>Login</h2> <?php if($errors['login']) print '<div class="invalid">' . $errors['login'] . '</div>'; ?> <label for="email">Email Address</label> <input type="text" name="email" value="<?php echo htmlspecialchars($loginEmail); ?>" /> <?php if($errors['loginEmail']) print '<div class="invalid">' . $errors['loginEmail'] . '</div>'; ?> <label for="password">Password <span class="info">6-12 chars</span></label> <input type="password" name="password" value="" /> <?php if($errors['loginPassword']) print '<div class="invalid">' . $errors['loginPassword'] . '</div>'; ?> <label for="loginSubmit"> </label> <input type="hidden" name="loginSubmit" id="loginSubmit" value="true" /> <input type="submit" value="Login" /> </form> //registration code <form class="box400" name="registerForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <h2>Register</h2> <?php if($success['register']) print '<div class="valid">' . $success['register'] . '</div>'; ?> <?php if($errors['register']) print '<div class="invalid">' . $errors['register'] . '</div>'; ?> <label for="email">Email Address</label> <input type="text" name="email" value="<?php echo htmlspecialchars($registerEmail); ?>" /> <?php if($errors['registerEmail']) print '<div class="invalid">' . $errors['registerEmail'] . '</div>'; ?> <label for="password">Password</label> <input type="password" name="password" value="" /> <?php if($errors['registerPassword']) print '<div class="invalid">' . $errors['registerPassword'] . '</div>'; ?> <label for="confirmPassword">Confirm Password</label> <input type="password" name="confirmPassword" value="" /> <?php if($errors['registerConfirmPassword']) print '<div class="invalid">' . $errors['registerConfirmPassword'] . '</div>'; ?> <label for="registerSubmit"> </label> <input type="hidden" name="registerSubmit" id="registerSubmit" value="true" /> <input type="submit" value="Register" /> </form>
  14. I have a client that would like me to identify if the user has a mobile device, and if so redirect them to a mobile webpage; if not, then redirect them to a non-mobile webpage. I have used the code listed below with success for another client, but for my latest client it is not working. Here is the code: <?php $mobileURL='http://my.url/mobile/index.php'; $url='http://my.url/index.php'; function isMobile() { return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); } // If the user is on a mobile device, redirect them if(isMobile()){ // echo '<a href="'.$mobileURL.'">'.$mobileURL.'</a>'; header('Location: $mobileURL'); /* Make sure that code below does not get executed when we redirect. */ exit; }else{ // echo '<a href="'.$url.'">'.$url.'</a>'; header('Location: $url'); } ?> The code works fine when I use the echo statements in the if/then statement, but not if I use the header() coding. The following is what I get: On Laptop: (the emoticon below is supposed to read the number 8 with a closed paranthesis) On iPhone: (the emoticon below is supposed to read the number 8 with a closed paranthesis) Please let me know what I am doing wrong and how to fix it.
  15. Dear All, I am new to php i have created login/Sign up pages and problem is i needd code to display logout after users login into system but in my system both login/Register is dislaying after login also Please help me in this one..
  16. I'm new to PHP and working on a mailform with phpmailer with attachment. Everything works fine but the received mail keeps having my Gmail address in the from header. The AddReplyTo address works fine but I don't want to show the gmail address. This is what my code looks like: require('C:\xampp\htdocs\PHPMailer\class.phpmailer.php'); $mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 2; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail $mail->Host = 'smtp.gmail.com'; $mail->Port = 465; $mail->Username = 'myaccount@gmail.com'; $mail->Password = 'mypassword'; $mail->SetFrom('e-mail@address.com', 'email@address.com'); $mail->AddReplyTo('e-mail@address.com', 'e-mail@address.com'); $mail->AddAddress("myaccount@gmail.com", "MyAccount"); $mail->Subject = "TestMail"; $mail->Body = "This is the message body"; $mail->AddAttachment("test.txt", "test.txt"); // optional name if(!$mail->Send()) { echo "Error"; exit; } else { echo "OK"; } I only want to use the gmail smtp but want to show another e-mail address (e-mail@address.com in thie example) in the header. But it keeps showing myaccount@gmail.com. Also in the class.phpmailer.php I've configurated the $From, $FromName and $Sender as e-mail@address.com but this doesn't work. Can somebody help me with this?
  17. Hello, I am using this theme on a site build. I would like to replace the static header image with the Slidedeck 2 Pro, image slider. Their code provided for placing into the header is below. <?php echo do_shortcode( '[SlideDeck2 id=XXXX iframe=1]' ); ?> The pertinent part of my theme's header code is as follows: <div id="header-wrapper"> <div id="header"> <div class="container"> <a href="<?php bloginfo('url'); ?>"><?php $logo = (get_option('myproduct_logo') <> '') ? get_option('myproduct_logo') : get_bloginfo('template_directory').'/images/top-bg.jpg'; ?> <img src="<?php echo esc_url($logo); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" id="logo"/></a> I have also attached the complete header file. header.php Any help on this would be greatly appreciated, as I am a noob, and do not have the knowledge to perform this task. Thank You, Paul
  18. I realy don´t understand whay it don´t working. It is some problem with header. <?php require_once 'includes/constanses.php'; session_start(); if (empty($_SESSION['brukernavn']) || empty($_SESSION['passord'])) { header("Location: loginpage.php"); } elseif ($_SESSION['passord'] != BRUKERNAVN && $_SESSION['passord'] != PASSORD) { header("Location: loginpage.php?status=Feil brukernavn eller passord"); } else { ?> <?php require_once 'includes/db123.php'; require_once 'includes/db_conn.php'; echo "4"; ?> <?php echo "5"; if(isset($_GET['id'])){ echo "6"; $info = select_by_id($_GET['id'], $con); header("Location:https://login.lodo.no//lodo.php?DB_NAME_LOGIN={$info['1']}&username={$info['2']}&password={$info['4']}&t=lib.login"); } else{ echo "7"; header('Location: index.php'); } }} require 'includes/footer.php'; ?> I error is the attach.
  19. I've set up code to allow users to purchase mp3 files. I keep the files in a non web-accessible directory and use a script that verifies that the user is logged in and has purchased the file before it lets them download it. Once the user has been validated it outputs the header specifying a file transfer and sends the file. The problem is that iPhone and iPad users are complaining that their devices won't download the file. It works for everybody else. Is there a fix for this? Some alternate way of doing this that would work on an Apple mobile device? This is the relevant part of the code if(file_exists($path)) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file }
  20. Hi There, My WordPress header.php is giving me some grief. It was working just fine until I went into theme options and tried to specify a new page to appear on the main menu. Then the main menu broke! I get this error message: Warning: implode() [function.implode]: Invalid arguments passed in/nfs/c05/h04/mnt/83132/domains/gwrobinson.com/html/wp/wp-content/themes/gwr/header.php on line 54 Can any of you far superior php experts out there help me figure out how to fix this error message?? Thank you!!! The line of code in question is as follows: <?php $top_pages = get_pages('sort_column=menu_order&include=' . implode(',', get_option('top_navigation', array()))); ?> [/code} The whole header.php file is [code] <!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" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?>: Energy Efficient homes for sale in Garison Way & Turnberry Lake</title> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_head(); ?> <!--[if lte IE 6]> <style type="text/css" media="screen"> #featured-home .holder .box { background-image: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php bloginfo('stylesheet_directory'); ?>/images/featured-home-box.png', sizingMethod='scale'); bottom: -1px; /* height: 250px; /* emulate max-height in ie6 */ } </style> <script type="text/javascript" charset="utf-8"> var isIE6 = true; </script> <![endif]--> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/cufon-yui.js" type="text/javascript" charset="utf-8"></script> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/Trajan_Pro_400.font.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> jQuery(function ($) { Cufon.replace('h2, h3, h4'); Cufon.replace('h3 .featuredtitle'); Cufon.replace('span.hthree'); if (typeof isIE6 != "undefined") { var slides_box = $('#featured-home .holder .box'); if ($(slides_box).height() > 250) { $(slides_box).height(250); } var innerpagebox = $('.innerpagebox'); if ($(innerpagebox).height() < 188) { $(innerpagebox ).height(188); } } }); </script> </head> <body <?php body_class(); ?>> <div class="shell"> <div id="header"> <h1 id="logo" class="fl notext"><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1> <div class="header-right"> <?php $top_pages = get_pages('sort_column=menu_order&include=' . implode(',', get_option('top_navigation', array()))); ?> <div id="social"> <div id="facebook"><a href="http://www.facebook.com/pages/GW-Robinson-homes/344500372268786" rel="nofollow" title="Become our fan on Facebook!" onClick="window.open(this.href); return false"></a></div> <div id="twitter"><a href="https://twitter.com/#!/GWRobinsonHomes" rel="nofollow" title="Follow us on Twitter!" onClick="window.open(this.href); return false"></a></div> </div> <p> <?php $i = 1; foreach ($top_pages as $_p): ?> <a href="<?php echo get_permalink($_p->ID); ?>"><?php echo apply_filters('the_title', $_p->post_title); ?></a> <?php if ($i!==count($top_pages)): ?> | <?php endif ?> <?php $i++; endforeach ?> </p> <div id="navigation"> <ul> <?php wp_list_pages('title_li=&sort_column=menu_order&link_before=<span>&link_after=</span>&include=' . implode(',', get_option('header_navigation', array()))) ?> </ul> </div> </div> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-40896628-1', 'gwrobinson.com'); ga('send', 'pageview'); </script> <div id="content">
  21. Hi Guys, I have a website that has a homepage without a title bar but the rest of the pages in the site do have it. I want to apply this same bar to the homepage can anyone help. See below the 3 main pieces of code: This is the code for the Header <?php ?><!DOCTYPE html> <!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]--> <!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]--> <!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--><html <?php language_attributes(); ?>> <!--<![endif]--> <!-- head --> <head> <!-- meta --> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta http-equiv="X-UA-Compatible" content="IE=9" /> <?php if( mfn_opts_get('responsive') ) echo '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'; ?> <title><?php global $post; if( mfn_opts_get('mfn-seo') && is_object($post) && get_post_meta( get_the_ID(), 'mfn-meta-seo-title', true ) ){ echo stripslashes( get_post_meta( get_the_ID(), 'mfn-meta-seo-title', true ) ); } else { global $page, $paged; wp_title( '|', true, 'right' ); bloginfo( 'name' ); if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'bretheon' ), max( $paged, $page ) ); } ?></title> <!-- stylesheet --> <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" media="all" /> <?php do_action('wp_styles'); ?> <!-- wp_head() --> <link rel="shortcut icon" href="<?php mfn_opts_show('favicon-img',THEME_URI .'/images/favicon.ico'); ?>" type="image/x-icon" /> <?php if( is_single() ): ?> <script>var switchTo5x=true;</script> <script src="http://w.sharethis.com/button/buttons.js"></script> <script>stLight.options({publisher: "ur-6568e777-919c-a5dd-ac31-98a6fa2e6b2d"}); </script> <?php endif; ?> <?php do_action('wp_seo'); ?> <?php wp_head();?> </head> <!-- body --> <body <?php body_class(); ?>> <div id="Wrapper"> <?php get_template_part( 'includes/header', 'top-area' ); if( ! is_404() ){ $slider = false; if( get_post_type()=='page' ) $slider = get_post_meta( get_the_ID(), 'mfn-post-slider', true ); if( $slider ){ if( $slider == 'mfn-offer-slider' ){ // Mfn Offer Slider get_template_part( 'includes/header', 'offer-slider' ); } else { // Revolution Slider echo '<div id="mfn-rev-slider">'; putRevSlider( $slider ); echo '</div>'; } } elseif( trim( wp_title( '', false ) ) ){ // Page title echo '<div id="Subheader">'; echo '<div class="container">'; echo '<div class="sixteen columns">'; if( get_post_type()=='page' || is_single() ){ echo '<h1>'. $post->post_title .'</h1>'; } else { echo '<h1>'. trim( wp_title( '', false ) ) .'</h1>'; } mfn_breadcrumbs(); echo '</div>'; echo '</div>'; echo '</div>'; } } ?> This is the code for the Index page which is the homepage <?php get_header(); $sidebar = mfn_sidebar_classes(); ?> <!-- #Content --> <div id="Content"> <div class="container"> <!-- .content --> <?php if( $sidebar ) echo '<div class="content">'; echo '<div class="the_content the_content_wrapper">'; while ( have_posts() ) { the_post(); get_template_part( 'includes/content', get_post_type() ); } // pagination if(function_exists( 'mfn_pagination' )): mfn_pagination(); else: ?> <div class="nav-next"><?php next_posts_link(__('← Older Entries', 'bretheon')) ?></div> <div class="nav-previous"><?php previous_posts_link(__('Newer Entries →', 'bretheon')) ?></div> <?php endif; echo '</div>'; if( $sidebar ){ echo '</div>'; } else { echo '<div class="clearfix"></div>'; } ?> <!-- Sidebar --> <?php if( $sidebar ){ get_sidebar( 'blog' ); } ?> </div> </div> <?php get_footer(); ?> This is the code for the inner pages which contain the title bar <?php get_header(); $sidebar = mfn_sidebar_classes(); ?> <!-- Content --> <div id="Content"> <div class="container"> <!-- .content --> <?php if( $sidebar ) echo '<div class="content">'; while ( have_posts() ) { the_post(); get_template_part( 'includes/content', 'page' ); } if( $sidebar ){ echo '</div>'; } else { echo '<div class="clearfix"></div>'; } ?> <!-- Sidebar --> <?php if( $sidebar ){ get_sidebar(); } ?> </div> </div> <?php get_footer(); ?>
  22. Hey all, I am designing a new template and I am trying a new navigation method. It is an onclick(with js disabled fallback) menu. I have it positioned where I want it but there is a gap between my header_inner div and header_wrapper div. I have viewed it in Opera, FF, Chrome, IE, and Safai, and they all displayed the gap. Help? You can find the site here http://synesterpiercing.webs.com/index.htm
  23. Hey guys, I am currently trying to finalize my registration page, and i am have some issues with the header() function. i know there are certain rules like no html can be above the header. and what not but i am fairly new to this and can figure out why i am outputting an error. my code is : <?if (isset($_GET['success']) && empty($_GET['success'])) { echo '<h1> Thank you for your registration </h1>'; } else { if (empty($_POST) === false && empty($errors) === true ) { $register_data = array( 'email' => $_POST['register_email'], 'username' => $_POST['register_username'], 'password' => $_POST['password'], 'gender' => $_POST['gender'], 'month' => $_POST['month'], 'date' => $_POST['date'], 'year' => $_POST['year'], 'country' => $_POST['country'], ); user_register($register_data); header('Location: register.php?success'); exit(); } else if ( empty($errors) === false) { echo '<div class="register_errors">'; echo '<span style="color:red"><h3>'; echo output_errors($errors); echo '</h3></span>'; echo '</div>'; } } ?> All of the code works for me until i try to send send the message. The error i get is the following : it directs me to my header.php file <!DOCTYPE html> <div> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="author" content="#"> <meta name="keywords" content="#"> <meta name="description" content="#"> <meta name="robots" content="#"> <meta name="revisit-after" content="7 days"> <link href="css/style.css" rel="stylesheet" type="text/css"> <link href="css/normalize.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="jscript/sidebar.js"></script> <script type="text/javascript" src="jscript/mootools.js"></script> <body> <div class="top"> Any suggestions ? cant seem to figure this one out
  24. I have a php file and need to redirect to other pages from middle of the page as header() needs to be put on the top is there any other way please.
  25. I have a page that contains both a login and registration form. I set the actions on the forms to be index.php#login and index.php#register so that if the form failed, the user would be taken down the form they were just working with. The problem I am running into is that a successful form completion either logs the user in or brings them to a screen letting them know that they need to verify their email and the #login or #register anchor is being included in the next page's URL. So a user visits my /login.php page, successfully logs in to the site, and sees the next page of /page.php#login instead of just /page.php I read though the manual for header() but didn't really see anything relevant to anchors being preserved or how to flush URL information. Is this information being stored somewhere by the browser and I can just purge it from memory? I was able to find this thread on StackOverflow, but my issue here is that I'm not listing the anchor (fragment as they call it) in the redirect. So according to one of the answers, it should get discarded. I've tried structuring the redirect in two different ways to see if anything can be done as well: header('Location: http://example.com/page.php'); header('Location: /page.php'); Any ideas here? Thanks.
×
×
  • 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.