PHP - Could Some One Tell Me How Can I Achieve This Type Of Redirection
Hi, what i am after is for instance, the user is viewing my website. He is in a different section on my website and there is a sign in button. The user goes to the sign in page, now what i want is when the user logs in, the user to be redirected back to the section which he was viewing before signing in. Basically in more clear words, I want the user to return to the content he was viewing after logging in.
Similar TutorialsHi, I have table called done in mysql and there is a row which is filled with the users id and another row with todays date. Now what I want to know which three users participated the most with filling out stuff on the website according to todays date. For instance First user filled out 5 2nd user filled out 3 3rd user filled out 2 You get the idea. I dont know what type of query should I write to extract the data based on the users id and how many times they participated on the particular day. Another example of the table is 1st column user id = 20 time= todays date 2nd column user id= 20 time = todays date Showing the user participated twice on the day. Thanks any help is appreciated. I was thinking of ways I could use use PHP to make an iframe dissapear when the user has clicked the submit button in the iframe. I was thinking there is probably no way to tell if the user has submitted the form in the iframe? I tried using unset(), with the iframe code being a variable. I echoed the iframed form, and placed a submit button below the iframe. When the user is done with the iframe form, they click the submit button below it and it will dissapear. Ive done that, but I was wondering would it be possible at all to make the frame dissapear once the user has clicked the submit button IN the iframe? If not possible with PHP maybe javascript? IDK, suggestions would be appreciated. Thanks I have a form which has both radio buttons and textfields. Each individual radio button is associated with a form field. For this example, lets say the Radio button references a tool name and the form field represents a quantity, or number of tools needed for a certain job. So the form would look as follows: Quote o Some Tool Quantity ___ (<-- lets pretend thats a form field) The question is, how would I go about adding the tool and quantity to the same row in the database if I am creating a new row? The simple way would be have each radio button and quantity be its own entity in the HTML. For example: Code: [Select] <input name="tool1" type="radio" value="Hammer" /> <input name="tool_quantity1" type="text" /> <input name="tool2" type="radio" value="Wrench" /> <input name="tool_quantity2" type="text" /> However easy this method may be, and however functional it may work, it is not how I wish to achieve this because we are talking maybe 100 tools. I think it would be easier using some kind of loop function that goes through an array of anything that has some form of data stored in it. For example, instead of the code being the above, I would like to change it to the following: Code: [Select] <input name="tools[]" type="radio" value="Hammer" /> <input name="tools_quantity[]" type="text" /> I understand the basic foreach function Code: [Select] foreach ($_POST['tools'] as $someVariableName) { //do some stuff } But I don't understand how I can get the value of 2 different form fields and have them associated with one another. I want the tool and the quantity of tools to be stored in the same row. How is this done? Is this even possible using a loop function like foreach or while? Please help! As always, any help would be greatly appreciated!! Bl4ck Maj1k There are two effects that I have seen on website and keep wondering how they have been achieved. The first is when you go on Facebook and you type a link into your status bar. Then Facebook will automatically get some information about that article. The second effect is something I have seen on twitter and other websites. If you scroll down to the bottom of the page it will detect this and then load more content. If anyone could link me to any article or tutorials explain how these effects have been done that would be great. Thanks for any help. hi there, i am fairly new to OOPs in php, i get an error when i declare the argument type (as object) in a function and pass the same type (object). class eBlast { public static function getEmail(object $result) { return $result->email; } } $r = mysql_fetch_object($query); eBlast::getEmail($r); echo gettype($r); // outputs: object error is : Code: [Select] Catchable fatal error: Argument 1 passed to eBlast::getEmail() must be an instance of object, instance of stdClass given, called in C:\wamp\www\integra\client\pl_eblast\admin\send_emails.php on line 145 and defined in C:\wamp\www\integra\client\pl_eblast\app\app.eBlast.php on line 8 if i remove the type declaration in the function it works, but just would like to know why it shows error when pass the same type, also isnt mysql_fetch_object is the instance of stdclass? thanks in advance! Hello all, I'm looking for some advice on a problem. I have a very basic web page containing three section, the header, the content and the footer in that order. What I would like is the header and footer always on the page and only the content section change by means of links in a navigation bar. I've looked into iframes, php include, javascript and something called Ajax and must say I'm all a bit confused by it all. Which would be most advisable and how would I excecute it. My pages are as follows. Home page is. index.php Pages I would like to show in the content Div. about.php contact.php home.php If you need any more information, please let me know. Thank you in advance for your help.
I am following the below module, Hi i have multilang website when you entered homepage default site if you are from polonia it redirect to you polonia page this script works perfect but the problem is if you are trying to see www.server.com instead server.pl and if you are from polonia you not able see because of redirection on google they solved this problem like www.google.com/ncr post is there something i can do like this for example server.com/ncr and this will disable redirect function would be nice if you help me to how to do it thanks in advance Code: [Select] <?php function redirect() { $Destination['en-au'] = 'http://www.server.com.au'; //austr$Destination['pl'] = 'http://www.server.pl'; //polonia $Destination['se'] = 'http://www.server.se'; //sweden $DefaultDestination = 'http://www.server.com'; //us $lang = preg_replace('/;.*$/','',$_SERVER['HTTP_ACCEPT_LANGUAGE']); $lang = preg_replace('/,.*$/','',strtolower($lang)); $dest = ''; if( isset($Destination[$lang]) ) { $dest = $Destination[$lang]; } if( empty($dest) ) { $lang = substr($lang,0,2); if( isset($Destination[$lang]) ) { $dest = $Destination[$lang]; } else { $dest = $DefaultDestination; } } if( ! empty($dest) ) { header("Location: $dest"); exit; } } redirect(); ?>[/code] Hi, for sometime i have tried to create what this person is doing below with his script, when a user clicks the buy it now button he redirects them to another url. Is it possible to replicate what he has done? I plan using the body onload to redirect the user however im not sure how i can get the url from the url redirected from? Quote http://searchchief.co.uk/Search/Essential-Michael-Jackson If i have not made myself clear please let me know as I'm totally new to PHP. Thanks, Hi All, I'm doing some testing using Google Website Optimiser and i have a problem which i wonder if you might be able to help me with. Basically with website optimiser you need a common conversion page that all variations land at to track conversions. My problem is this that the pages i want to test are all very different in design and have different conversion (thankyou) pages based on teh site design. So i'm wondering if i can put some sort of bridge page that all conversion come through to before being redirected to the thank you page. so for example index1.html goes to conversion.php page which then redirects to thanks1.html index2.html goes to conversion.php page then redirecting to thanks2.html this would get over the issue of having one common conversion page. I know to redirect a page i can use the following code: <?php header( 'Location: http://www.yoursite.com/new_page.html' ) ; ?> But i need to add this to redirect specific incoming pages to different thank you pages. Any ideas? Thanks hello Guys, Please refer this site http://www.dreamvacationrent.com/, it is having a link called "Our Rental Properties" now when you click on it it will show the url with the page name "properties-rental.html" but actually the page is "properties.php" like wise is has done with other links values passed through url are seen by using + or - sign, so how could this be done. Please help me... Thank you. Ok so what I am trying to do is have multiple folders pull from one folder. So if I have this structu Code: [Select] /test1/some_folder /test2/some_folder /test3/some_folder I would want all of those folders named some_folder to read from a master directory. I dont need them to be able to go that specific url just need it to include the files from the main directory in each of those. Imagine I was setting up shared functions and just wanted to store them in one place but be able to include them on any site. I didnt know what to google (tried folder redirection but didnt seem right) so if anyone can offer a suggestion as to what to google or wants to provide an answer it would be appreciated. Hi I have coded a form, and dependant upon the result I would like to re-direct to a different page. The problem is I am getting the "headers already sent" message..Is there a way around this, I can't use JS re-direction because of accessibility. E.G: <?php //Do stuff with form data if($result = y){ header(Location: "mysite.php/thankyou.php"); } else{ header(Location: "mysite.php/error.php"); } ?> In-fact whilst typing this I have an idea, why not do all of this at the top of the page before headers are sent? I'll go ahead and try it now, in the meantime if anybody knows how or if headers can be sent after output please let me know thanks. Hi, I am having a little problem with my coding and was wondering if someone could please help me. The code below is a working login script where when a user logs in they are redirected to a URL which I have in my SQL database. The problem I am having is I would like to create a link on every page which says something like "My Account" - and when a user clicks the link the script automatically knows who is logged on and redirects to the page which matches the URL in the database. I hope I am making sense as I've been working on it for days and cannot figure out how to do it. Code: [Select] <?php session_start(); require 'config.php'; $user_name = $_POST['username']; $user_password = $_POST['password']; $qry = "SELECT id, redirect FROM users WHERE username = '".$user_name."' AND password = '".$user_password."'"; $result = mysql_query($qry); $count = (int)mysql_num_rows($result); if($count != 0) { $row = mysql_fetch_assoc($result); $_SESSION['loggedIn'] = true; header('Location: '.$row['redirect']); } else { header('Location: index.php'); } exit; ?> The config.php has basically my login details for phpmyadmin and nothing else. If anyone can help me it would be greatly appreciated. Kind regards, Robert. 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-i...sion=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(); ?> Hi, Working on a URL re-direction site. http://ziz.im At the moment, it's not using the most effecient of redirections. I want to change this to a 301 redirect. But I can't quite figure out how to get it to work. Currently: - I am using a .htaccess rewrite to re-direct all shortened urls to a page (parse.php) which is providing the public variable 'q' containing the shortened keywork (e.g. GTRfdrtlls). - This is then checked through the DB to find if its valid, then redirects to that URL. How can I get it to use 301 Redirects, like the below: <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url.com" ); ?> I need to be able to query the database to get the URL / Check if its valid before I can specify the URL. But you need to specify the headers at the start. Confused. Cheers. Hi all, we are new bee to php, I am developing a project that has config and other sub folders under admin directory ROOT/ADMIN, ROOT/ADMIN/FOLDER1,2,3... how to manage redirection from one file to another folder. Hi, Have a project, http://ziz.im URL Shortener. For some reason, shortened youtube links don't work. When used, they go to the youtube page, displaying a message saying the video is not available. But it's the same link (once redirected) as the original link. Any idea what could be causing this ? Hi Guys, This is my first time posting so let me get right to this. I'm trying to create a PHP MYSQL webpage that would create a session, allowing an anonymous (guest) user to view a particular page.. lets say "page1.php" for a certain amount of time "30 mins" and then be redirected to "page2.php" if they go back (or refresh) "page1.php" when that time runs out. The auto-redirection should only last about 3 hours ( session timeout ). Then they should be able to view "page 1" again. This sounds so simple in theory but i just cant wrap my head around doing it. Any help would be very appreciated. |