PHP - Override Redirect Interuption
What other ways are there of redirecting to a different page, other than the standard
Code: [Select] <meta HTTP-EQUIV="REFRESH" content="3; ... Ways that cannot be prevented by browsers? Similar TutorialsI have a function which echos an array output, which creates links on a page related to that page. It all works well, but the CSS is making the links blue and purple as standard, and I want to overwrite this to make the links white. What can I add to the code to overwrite the style of the echo? The font size is working, but the colour is being overridden. The code I currently have is: echo "<p> <font color='ffffff' size='4pt'>$echo</font></p>";
What am I doing wrong? Hi guys, I'm sending mail from php running on a cheap webhost with the following: Code: [Select] $to = 'name@domain.com.au'; $header = 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $header .= "From: Name <noreply@domain.info>" . "\r\n"; $subject = "Interest registered"; $message = "<!DOCTYPE HTML.. a bunch of html"; mail($to, $subject, $message, $header); As you can see I've set "from" in the headers. When I receive the email however, it says from: myusername@my.cheaphost.com on behalf of Name [noreply@domain.info] I need to get rid of the on behalf bit as it looks completely unprofessional. I just want it to say from: Name [noreply@domain.info] Obviously this is probably something to do with the setup of the server, some of which I have no control over. I have access to another mail server which I can use to send email, so I put this at the start of my code: Code: [Select] ini_set('SMTP', 'mail.myotherserver.com.au'); echo ini_get('SMTP'); Which returns mail.myotherserver.com.au however, when I use the mail function, it still comes from myusername@my.cheaphost.com on behalf of Name [noreply@domain.info] Is there something I'm missing, is the mail function not tied to the SMTP value? Thanks I need to add more code to an existing function located inside the parent class. I'm using code like this but can't get it working :
// Parent class Default_Fields { public function fields() { $this->_fields = array() // Default Code } } // Child class More_Fields extends Default_Fields { public function fields() { $this->_fields = array() // Modified Code } } $new = new More_Fields; $new->fields();
Do any of you know how to override the php.ini file on a webhost to allow uploads using php to be set for 2gig mx file size? .htaccess is not working and my host says it supports changing the php.ini but nothing seems to be working. This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=343981.0 Hi there,
I have a timetable plugin that shows booking entries.
The times are generated dynamically by the plugin.
Now I have the situation where I need to override the automatically created time that shows in a table row.
Here's the HTML code generated by the plugin:
<tr class="row_12"> <td class="tt_hours_column">00:00</td>Ist it possible to have a simple PHP script that does the following (please forgive my noobiness) ? if table row is "row_12" then insert "my own pre-defined time" Please don't hate on me, I know I have not the slightest idea about php. I'm just wondering how to solve my plugin problem and if PHP is the right way to do it. I highly appreciate any feedback from you guys I'm trying to put together a script that redirects visitors based on their IP, user agent and/or referral url. Basically I want the script to scan these three factors from the visitor, if any of them turn out to match my redirect-requirement it redirects the user. I know the code is horribly coded, I'm incredibly new to the php-scene and consider myself a complete noob. As you can see I want redirected visitors to go to google.com and un-redirected to msn.com(examples). Really thankful for all the help I can get! Right now nothing works, any suggestions? <?php function redirect($page) { Header( "HTTP/1.1 301 Moved Permanently" ); header('Location: ' . $page); exit; } $referrals=array('pitchingit.org','referral2'); $badAgents = array("useragent1", "useragent2"); $deny = array("78.105.191..*","100.101.103..*"); if (in_array($_SERVER['HTTP_REFERER'], $referrals, FALSE)) { header("Location: http://www.google.com"); } else { header("Location: http://www.msn.com"); } if(in_array($_SERVER['HTTP_USER_AGENT'],$badAgents)) { redirect("http://www.google.com/"); exit(); } $add=$_SERVER['REMOTE_ADDR']; foreach ($deny as $ip) { if (preg_match("^.$add.*^",$ip)) { redirect("http://www.google.com"); } } redirect("http://www.msn.com"); ?> How can one re-direct a visitor, without using a header re-direct? I'd like a page to show up, then after about 5 seconds I need the visitor sent to another page. How can I do this? Im setting up members on my site i want the profile url to be like www.mywebsite.com/NATHAN but not go to a folder on my server called nathan but instead go to mywebsite.com/?profile=Nathan
Can anyone enlighten me on why this doesn't redirect and if there's a better / different way of achieving a redirect deep within a page?
<?php echo"anything"; // remove this echo or even make it blank and it redirects as expected header("location:blah.php"); ?> Hi,
Can someone tell me what this redirect will do?
RewriteCond %{HTTP_HOST} ^(www\.)?website\.com/microsite$Thanks! Hi all, I have a page url that looks like this: jobs.php?view=view&id=5 Their is a login on this page, the form ends with this command: header("Location: ".$session->referrer); The fuction for this is: <?php function startSession(){ global $database; //The database connection session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /** * Set guest value to users not logged in, and update * active guests table accordingly. */ if(!$this->logged_in){ $this->username = $_SESSION['username'] = GUEST_NAME; $this->userlevel = GUEST_LEVEL; $database->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time); } /* Update users last active timestamp */ else{ $database->addActiveUser($this->username, $this->time); } /* Remove inactive visitors from database */ $database->removeInactiveUsers(); $database->removeInactiveGuests(); /* Set referrer page */ if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url']; }else{ $this->referrer = "/"; } /* Set current url */ $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; } ?> Basically $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; seems to cut my url to: jobs.php instead of: jobs.php?view=view&id=5 Can anyone here tell me how to fix this? Thanks Guys Hello, Basicly, I want to make a php index, but make a certain redirect from it, for example, make: http://mysite.com/index.php?goto=forums Go to forums of my link choice, is their a simple code I can use? Thanks <?php $get = fetch("SELECT number FROM dom") if "$get = 1" echo "<meta http-equiv='refresh' content='0;url=http://toxicpets.co.uk/down_for_maitenence.php'>"; elseif "$get = 0" echo "<meta http-equiv='refresh' content='0;url=http://toxicpets.co.uk/index.php'>"; ?> is this code right??? Ok I know I can redirect using: header( 'Location: URL' ) ; Now, is there a way to delay this after a short while of displaying or would I have to use Javascript? maybe a silly question, but when somebody visits my site i.e. domain.com i want it to redirect them to www.domain.com example can be seen @ facebook.com Hello everyone, I am new to php,and i am making my website......where i am unable to redirect a user to his respctive homepage.. Can anyone help me out with a sample script.......... Thanks, cool_techie how do i redirect page within an if/else statement I having trouble with my re-direct code on my php registration form. The form does submit data to the database but I'm getting the following error. "Warning: Cannot modify header information - headers already sent by (output started at /homepages/25/d232402382/htdocs/testencourage/registration.php:15) in /homepages/25/d232402382/htdocs/testencourage/registration.php on line 87" I would like the form goes to the thanks.php after submitting the data but its not doing its job. Here is the code. Code: [Select] <?php if ($_SERVER['HTTPS']) { header('location: https://www.fakewebsite.com'); } the regular html syntax <title>, site navigation, etc... ?> <?php if (isset($_POST['submitted'])){ $fields = array( 'email', 'state', 'district', 'gender', 'age', 'profession', ); if (safe($_POST['survey']=="Yes")){ $survey = "Yes"; } else{ $survey = "No"; } foreach($fields as $fieldName) { if(isset($_POST[$fieldName]) and safe(trim(stripslashes($_POST[$fieldName]))) !==''){ $$fieldName = safe(trim(stripslashes($_POST[$fieldName]))); }else { $errors[] = "Please enter your". $fieldName .""; //code to validate fields } } if(!isset($errors)){ require_once('Connections/encourage.php'); $query = "INSERT INTO participants (email, state, district, gender, age, profession, survey, registration_date) VALUES ('$email', '$state', '$district', '$gender', '$age', '$profession','$survey', NOW())"; //databasse connection $result = mysql_query ($query); if ($result){ $url = 'http://'. $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); if ((substr($url, -1) == '/') || (substr($url, -1) == '\\')) { $url = substr ($url, 0 -1); } $url .= '/thanks.php'; header("Location: $url");// this is line 87 exit(); }else{ echo '<h1 id="mainhead">System Error</hl> <p>Your registration could not be completed due to a system error We apologize for any incovience</p>';//gives system error echo 'p' . mysql_error(). '<br /><br />Query: ' . $query . '</p>'; exit(); } mysql_close(); } else { echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach($errors as $msg) { echo " - $msg<br/>\n"; } echo '</p><p>Please try again.</p><p><br/></p>'; } } function safe($string) { $pattern = "/\r|\n|\%0a|\%0d|Content\-Type:|bcc:|to:|cc:/i"; return preg_replace($pattern, '', $string); } ?> Also I'm going to set up my ssl on the server so I'm planning to use that https redirect syntax but since I'm very new at this, am I missing something. Your help will be greatly appreciated, thanks! what the syntax to get out from the actual folder and redirect to some file outside ?? <?php header("Location: ???file.php"); exit; ?> |