PHP - Javascript/php Problem On Browser Close/unload Event
i am trying to set user status as offline when user close browser but i am facing a problem ...
i am calling a function when body unload which will set guest user status to "0" when user close the browser but it not working ... it execute php before function is called.. any idea why this is happening ...please help it's making me crazy Similar TutorialsHi there, I was wondering if it is possible to (on the closing of a browser to a logged in user) to automatically destroy that session. Thanks in advance. I have a problem, where i need to know when user leave or close tha browser tab. I tryd to make a ajax post, after unload, make a POST into kill_browser.php and after 1 minute when session_expire, php code will be execute and save time into database. But it not seems to work :/ I'm glad if some 1 can say what im doing wrong, or is there eny better way to detect it.
@home.php
var leaved = 'leaved'; $(window).unload( function(){ $.ajax({ url: 'kill_browser.php', global: false, type: 'POST', data: leaved, async: false, success: function() { console.log('leaved'); } }); }); @kill_browser.php <?php require('class/connection.php'); $conn = new connection(); session_cache_limiter('private'); $cache_limiter = session_cache_limiter(); session_cache_expire(1); $cache_expire = session_cache_expire(); session_start(); $_SESSION['leaved'] = $_POST['leaved']; if($_SESSION['leaved'] == null || $_SESSION['leaved'] == " "){ $conn->logOut($_SESSION['userID'], $_SESSION['userIP'], $_SESSION['LAST_GENERATED_ID']); session_regenerate_id(true); unset($_SESSION); session_destroy(); header('location:index.php'); } ?> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=352282.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=351266.0 Good day! I created a webpages and i have a login page consist of Username and Department. And i encountered problem in adding event in my calendar. This is the flow of my webpage: First I have a separate table for the user and calendar. In my user table it has a Username, Department, and Permission. In the permission I put True or False, only one user i put True because i want that user is the one who permitted to add event or if she is login the add event link appear, but if other login the add even0t did not appear. This is my code in login: <?php session_start(); session_regenerate_id(); if($_SESSION['loggedin']){ //the user is already logged in, lets redirect them to the other page header("Location:company.php"); } //require_once 'conn.php'; $db_name="dspi"; mysql_connect("localhost", "root", "") or die("Cannot connect to server"); mysql_select_db("$db_name")or die("Cannot select DB"); $department = mysql_real_escape_string($_POST['department']); $username = mysql_real_escape_string($_POST['username']); $sql=mysql_query("SELECT `Department`, `Username` FROM `tbllogin` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mysql_error()); $ct = mysql_num_rows($sql); if($ct == 1) { // im guessing this means that the user is valid. $_SESSION['loggedin'] = true; // now that the user is valid we change the session value. $row = mysql_fetch_assoc($sql); $_SESSION['username'] = $row['Username'] ; $_SESSION['department'] = $row['Department']; $Departments=array('Accounting', 'Engineering', 'Finishing_Goods', 'HRAD', 'MIS', 'Packaging_and_Design', 'Production', 'Purchasing_Logistic', 'QA_and_Technical', 'Supply_Chain'); if (in_array($row['Department'], $Departments)){ header ('Location:company.php'); }else{ echo "Incorrect Username or Department"; header ('Location:index.php'); } } ?> and this is my code in calendar page: <?php session_start(); $host = "localhost"; $username = ""; $password = ""; $dbCnx = @mysql_connect($host, $username, $password) or die('Could not Connect to the database'); $dbName = 'dspi'; mysql_select_db($dbName); ?> <html> <body> <script> function goLastMonth(month, year){ // If the month is January, decrement the year if(month == 1){ --year; month = 13; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month-1)+'&year='+year; } //next function function goNextMonth(month, year){ // If the month is December, increment the year if(month == 12){ ++year; month = 0; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month+1)+'&year='+year; } function remChars(txtControl, txtCount, intMaxLength) { if(txtControl.value.length > intMaxLength) txtControl.value = txtControl.value.substring(0, (intMaxLength-1)); else txtCount.value = intMaxLength - txtControl.value.length; } function checkFilled() { var filled = 0 var x = document.form1.calName.value; //x = x.replace(/^\s+/,""); // strip leading spaces if (x.length > 0) {filled ++} var y = document.form1.calDesc.value; //y = y.replace(/^s+/,""); // strip leading spaces if (y.length > 0) {filled ++} if (filled == 2) { document.getElementById("Submit").disabled = false; } else {document.getElementById("Submit").disabled = true} // in case a field is filled then erased } </script> <?php //$todaysDate = date("n/j/Y"); //echo $todaysDate; // Get values from query string $day = (isset($_GET["day"])) ? $_GET['day'] : ""; $month = (isset($_GET["month"])) ? $_GET['month'] : ""; $year = (isset($_GET["year"])) ? $_GET['year'] : ""; //comparaters for today's date //$todaysDate = date("n/j/Y"); //$sel = (isset($_GET["sel"])) ? $_GET['sel'] : ""; //$what = (isset($_GET["what"])) ? $_GET['what'] : ""; //$day = (!isset($day)) ? $day = date("j") : $day = ""; if(empty($day)){ $day = date("j"); } if(empty($month)){ $month = date("n"); } if(empty($year)){ $year = date("Y"); } //set up vars for calendar etc $currentTimeStamp = strtotime("$year-$month-$day"); $monthName = date("F", $currentTimeStamp); $numDays = date("t", $currentTimeStamp); $counter = 0; //$numEventsThisMonth = 0; //$hasEvent = false; //$todaysEvents = ""; //run a selec statement to hi-light the days function hiLightEvt($eMonth,$eDay,$eYear){ //$tDayName = date("l"); $todaysDate = date("n/j/Y"); $dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; if($todaysDate == $dateToCompare){ //$aClass = '<span>' . $tDayName . '</span>'; $aClass='class="today"'; }else{ //$dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; //echo $todaysDate; //return; $sql="select count(calDate) as eCount from calTbl where calDate = '" . $eMonth . '/' . $eDay . '/' . $eYear . "'"; //echo $sql; //return; $result = mysql_query($sql); while($row= mysql_fetch_array($result)){ if($row['eCount'] >=1){ $aClass = 'class="event"'; }elseif($row['eCount'] ==0){ $aClass ='class="normal"'; } } } return $aClass; } ?> <div id="Calendar_Event"> <table width="350" cellpadding="0" cellspacing="0"> <tr> <td width="50" colspan="1"> <input type="button" value=" < " onClick="goLastMonth(<?php echo $month . ", " . $year; ?>);"> </td> <td width="250" colspan="5"> <span class="title" style="color:#FFFFFF"><?php echo $monthName . " " . $year; ?></span><br> </td> <td width="50" colspan="1" align="right"> <input type="button" value=" > " onClick="goNextMonth(<?php echo $month . ", " . $year; ?>);"> </td> </tr> <tr> <th>M</td> <th>T</td> <th>W</td> <th>T</td> <th>F</td> <th>S</td> <th>S</td> </tr> <tr> <?php for($i = 1; $i < $numDays+1; $i++, $counter++){ $dateToCompare = $month . '/' . $i . '/' . $year; $timeStamp = strtotime("$year-$month-$i"); //echo $timeStamp . '<br/>'; if($i == 1){ // Workout when the first day of the month is $firstDay = date("N", $timeStamp); for($j = 1; $j < $firstDay; $j++, $counter++){ echo "<td> </td>"; } } if($counter % 7 == 0 ){ ?> </tr><tr> <?php } ?> <!--right here--><td width="50" <?=hiLightEvt($month,$i,$year);?>><a href="<?=$_SERVER['PHP_SELF'] . '?month='. $month . '&day=' . $i . '&year=' . $year;?>&v=1"><?=$i;?></a></td> <?php } ?> </table> </div> <div id="New_Event"> <?php if(isset($_GET['v'])){ if(isset($_POST['Submit'])){ $sql="insert into calTbl(calName,calDesc,calDate,calStamp) values('" . $_POST['calName'] ."','" . $_POST['calDesc'] . "','" . $_POST['calDate'] . "',now())"; mysql_query($sql); } $sql="select calName,calDesc, DATE_FORMAT(calStamp, '%a %b %e %Y') as calStamp from calTbl where calDate = '" . $month . '/' . $day . '/' . $year . "'"; //echo $sql; //return; $result = mysql_query($sql); $numRows = mysql_num_rows($result); $check=mysql_query("SELECT * FROM tbllogin WHERE Username='xxx' AND Department='HRAD' AND Permission='True'"); mysql_fetch_array($check); if($check['Username']=='xxx' && $check['Department']=='HRAD'){ $_SESSION['isallowed'] = $check['Permission']; //if (mysql_num_rows($check)>0){ ?> <a href="<?=$_SERVER['PHP_SELF'];?>?month=<?=$_GET['month'] . '&day=' . $_GET['day'] . '&year=' . $_GET['year'];?>&v=1&f=true">Add Even</a><a href="<?=$_SERVER['PHP_SELF'];?>?month=<?=$_GET['month'] . '&day=' . $_GET['day'] . '&year=' . $_GET['year'];?>&v=1&f=true">t</a><?php }else{ echo 'You cannot Add New Event'; }?> </div> <div id="Cal_Event"> <?php if(isset($_GET['f'])){ include 'calform.php'; } if($numRows == 0 ){ echo ''; }else{ //echo '<ul>'; echo '<h3>Event Listed</h3>'; while($row = mysql_fetch_array($result)){ ?> <h5><?=$row['calName'];?></h5> <?=$row['calDesc'];?><br/> Listed On: <?=$row['calStamp'];?> <?php } } } ?> </div> </body> </html> In that code when the user log is xxx and when she click a date she want to add event the appear is "You cannot Add Event". I hope somebody can help me.. Thank you in advance... my problem is if my local date is february 1 or march 30... if i press previous month i cant see the month of february, but if i press the change the local date to february 2 or march 29 i can see the month of february in my event calendar... what should i do to see the month of february even i set the local date in february 1 or march 30.... heres the code Code: [Select] if (isset($_GET['day'])){ $day = $_GET['day']; } else { $day = date("j"); } if(isset($_GET['month'])){ $month = $_GET['month']; } else { $month = date("n"); } if(isset($_GET['year'])){ $year = $_GET['year']; }else{ $year = date("Y"); } $currentTimeStamp = strtotime( "$day-$month-$year"); $monthName = date("F", $currentTimeStamp); $numDays = date("t", $currentTimeStamp); This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=330163.0 I have a listener which executes a HTTP request to a remote API before the User entity is persisted and uses the response to set one of the entity's properties. It will also listen for update and remove and will make the appropriate HTTP request to the API but will not modify the entity. All works as desired... Almost. If when persisting the entity, I have some error, the remote API and my application become out of sync. I wish to change my application to perform a second call to the API if an error occurs and reverse the previous call. My thoughts on how to implement a Place a try/catch block when executing the query. Don't like this approach. Add an ExceptionListener which somehow retrieves the entity and makes the applicable changes. Maybe part of the solution, but too complicated to be the full solution. When adding, updating, or deleting a user from the remote API under UserListener's three methods, adding a callback which gets executed upon a PDOException. I think this is the best approach and expanded my thoughts below.
<?php namespace App\EventListener; use Doctrine\Persistence\Event\LifecycleEventArgs; use App\Service\HelpDeskClient; use App\Entity\AbstractUser; final class UserListner { private $helpDeskClient; public function __construct(HelpDeskClient $helpDeskClient) { $this->helpDeskClient = $helpDeskClient; } public function prePersist(AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->addUser($user); //$user will be updated with the HTTP response } public function preUpdate(AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->updateUser($user); } public function preRemove (AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->deleteUser($user); } } Okay, how do I actually do this? Was thinking of modifying UserListner as follows: //... use Symfony\Component\HttpKernel\KernelEvents; final class UserListner { // ... public function prePersist(AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->addUser($user); $event->getObjectManager()->getEventManager()->addEventListener(KernelEvents::EXCEPTION, function($something) use($user) { // Use $this->helpDeskClient to reverse the changes }); } // Similar for update and remove }
But when trying this approach, I get a PDOException, but my callback never gets excecated. I've also tried replacing KernelEvents::EXCEPTION with '\PDOException' (note the quotes) with no success. Any ideas what I should be doing differently? Maybe some totally different approach? I suppose I could make the request to the API after the DB query is complete for updating and deleting, but not for adding. hello guys, this is my first post on this forum and I really need your help on this. What I have is: I created a login page a home page and a index page. The index page checks if the session is set. If it's not the login page will be shown. If it is the homepage will be shown. Whenever the user logs in, the session gets set. The problem is is that whenever I login and the user presses the back button on his browser my session will always be returned false which means that whenever a user has logged in, the index page doesn't show home but shows the login page again even though the user has already logged in. Here is my code to make you understand a little bit better: session.php: Code: [Select] <?php class Session { function __construct() { } function set($name, $value) { $_SESSION[$name] = $value; } function get($name) { return $_SESSION[$name]; } function stopSession() { unset($_SESSION); session_destroy(); } function startSession() { if(!isset($_SESSION)) { session_start(); } } function check_session() { if(isset($_SESSION['username']) && !empty($_SESSION['username'])) { return true; } else { return false; } } } ?> login.php: Code: [Select] <?php class Handler_Login extends Action_Handler { function __construct($action_handle) { parent::construct($action_handle); $this->action = $action_handle; } function secured_handler() { $password = $_POST['password']; $username = $_POST['username']; $login = $this->dbh->Login($username, $password); if ($login == true) { $this->session->startSession(); $this->session->set('username', $username); $this->view->displayHome(); $this->view->display(); } else { //This is going to get more advanced later on, I'm currently working on resolving my session issue before I continue on this. echo "you are not logged in"; } } } ?> index.php: Code: [Select] <?php class Handler_home extends Action_Handler { public function __construct($action_handle) { parent::construct($action_handle); $this->action = $action_handle; } function secured_handler() { // for some reason this always returns false when the user goes back in history :( if ($this->session->check_session() == false) { $this->view->displayLogin(); $this->view->display(); } else { $this->view->displayHome(); $this->view->display(); } } } ?> anyone has an idea why the login page is always shown ? im testing the following script and it wont send 1 2 3 until the script has finished executing. What can i do to flush the buffer after every echo statement?? <?php echo "1"; ob_flush();flush(); sleep(5); echo "2"; ob_flush();flush(); sleep(5); echo "3"; ob_flush();flush(); ?> Is this necessary? mysql_close($link); $query = "SELECT * FROM db_one WHERE field1 = '".$MyVar."'"; $results = mysql_query($query); while($line = mysql_fetch_array($results)) { echo $line["a"].",,"; echo $line["b"].",,"; echo $line["c"].",,"; echo $line["d"].",,"; echo $line["e"].",,"; echo $line["f"].",,"; echo $line["g"].",,"; echo $line["h"].",,"; echo $line["i"].",,"; echo $line["j"].",,"; echo $line["k"].",,"; echo $line["l"].",,"; } mysql_close($link); Hi,
Ive been trying to come up with a simple solution.
I run a scheduled task every 1 minute, it checks for a certain message in a MySQL DB.
If the message is there then i need to access a link such as:
https://www.somedoma...00000&body=This is the SMS to be sent&plaintext=1
This essentially sends an SMS to a user.
both the recipient and the body need to be a variable.
Is there a way then to get PHP to load/run the link without actually opening a browser?
ive been trying to check out allow_url_fopen but i cant seem to find any examples of how this works.
Any info or pointers would be great thanks.
I am trying to create a login menu where senior salesman get redirected to one page and salesman get redirected to another. Trying to figure out my game map. Here is what's going on: Any player can view themself on the map and also the user at this location: x:50, y50. For some reason the map will not show anyone else. If you would like to see it, just go to http://www.gglegends.net/map.php and login with the credentials below (only 1 user can be logged in at a time): Credential for Demo Account - (I have restricted areas that affect others gameplay and areas that change the demo account) Username: demo Password: pass Other map locations to try out: x:60, y:60 x:19, y:79 x:98, y:72 x:75, y:51 x:97, y:26 x:66, y:12 Here is the complete code to my map: <?php require 'includes/header.php'; //Check to see if user exists in the map table, if not redirect location to get coordinates $user_map_check_results = $db->query ("SELECT * FROM map WHERE uID=".$user['uID'].""); $user_map_check = mysql_num_rows($user_map_check_results); if ($user_map_check == 0){ echo '<META HTTP-EQUIV="Refresh" Content="0; URL=firstrun.php">'; die(); } //Fetch the largest x coordinate in the map table. $map_size_x_result = $db->query( "SELECT MAX(x) AS map_max_x FROM map" ); $map_size_x = $db->fetch( $map_size_x_result ); //Fetch the largest y coordinate in the map table. $map_size_y_result = $db->query( "SELECT MAX(y) AS map_max_y FROM map" ); $map_size_y = $db->fetch( $map_size_y_result ); //Set map size. Determined by largest x and y coordinates. $grid_x = (int)$map_size_x['map_max_x']; $grid_y = (int)$map_size_y['map_max_y']; //x and y rows to display at a time. $display_rows = (int)10; //Fetch all user locations. $users_map_result = $db->query( "SELECT * FROM map LEFT JOIN users ON map.uID=users.uID" ); $users_map = $db->fetch( $users_map_result ); //Fetch user map location from database. $user_location_result = $db->query( "SELECT * FROM map LEFT JOIN users ON map.uID=users.uID WHERE map.uID=".$user['uID']."" ); $user_location = $db->fetch( $user_location_result ); //default display coordinate if none specified - will be user map location. $x = (int)$user_location['x']; $y = (int)$user_location['y']; $param_x = $_REQUEST["xcord"]; $param_y = $_REQUEST["ycord"]; if (isset($param_x) && isset($param_y)) { //validate that the parameter is a legit point. if (($param_x <= $grid_x) && ($param_x >= 1) && ($param_y <= $grid_y) &&($param_y >= 1)) { $x = (int)$param_x; $y = (int)$param_y; } } //set map location to the center of the map. $display_half = round($display_rows / 2); $other_half = $display_rows - $display_half; //display the target in the middle. $start_x = ($x - $display_half) +1; $end_x = $x + $other_half; //if the $start_x variable is less than 1 the grid would be in the negatives. so set it to 1. if ($start_x < 1) { $start_x = 1; $end_x = $display_rows; } else //if $end_x is off the grid we have to compensate and add the remaining rows to the start. if ($end_x > $grid_x) { $extra = $end_x - $grid_x; $end_x = $grid_x; $start_x = $start_x - $extra; } //same applies for the y axis. $start_y = ($y - $display_half) +1; $end_y = $y + $other_half; //if the $start_y variable is less than 1 the grid would be in the negatives. so set it to 1. if ($start_y < 1) { $start_y = 1; $end_y = $display_rows; } else //if $end_y is off the grid we have to compensate and add the remaining rows to the start. if ($end_y > $grid_y) { $extra = $end_y - $grid_y; $end_y = $grid_y; $start_y = $start_y - $extra; } ?> <b><tl>World Map</tl></b><br /> <img alt="" src="images/seperator.gif" /><br /> Click anywhere on the map to begin moving around. You can click on players name's to view their profile.<br /><br /> Move to Map Location or <a href="map.php"><u>Return to base</u></a>. <?php echo "Current Map Coordinates: X $x - Y $y"; ?><br /> <!-- Search custom coordinates --> <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="GET"> <input name="xcord" type="text" size="3" maxlength="2" onblur="if ( this.value == '' ) this.value = this.defaultValue" onfocus="if ( this.value == this.defaultValue ) this.value = ''" value="x"> <input name="ycord" type="text" size="3" maxlength="2" onblur="if ( this.value == '' ) this.value = this.defaultValue" onfocus="if ( this.value == this.defaultValue ) this.value = ''" value="y"> <input type="submit" value="Submit"> </form> <br /><br /> <!-- Show map --> <table width="750" cellspacing="0" cellpadding="1" border="0"> <?php //these 2 for loops represent the y and x axis //using the data collected above the loops will properly display the grid. for ($Ty = $start_y; $Ty <= $end_y; $Ty++) { //start new row echo '<tr>'; for ($Tx = $start_x; $Tx <= $end_x; $Tx++) { //show grid DisplayGrid($Tx,$Ty); } echo '</tr>'; } ?> </table> <?php //Function to disaply the map. function DisplayGrid($grid_x,$grid_y) { global $x, $y, $user_location, $users_map; $bgimg = 'grass.gif'; $building = ''; if ($grid_x == $user_location['x'] && $grid_y == $user_location['y']) { $building = '<img src="images/map/building.gif" alt="" border="0" /><br />'; $user_map_name = '<br /><a href="player_profile.php?id='.$user_location['uID'].'" target="_blank"><u><b>'.$user_location['uLogin'].'</b></u></a><br />'; } if ($grid_x == $users_map['x'] && $grid_y == $users_map['y']) { $building = '<img src="images/map/building.gif" alt="" border="0" /><br />'; $user_map_name = '<br /><a href="player_profile.php?id='.$users_map['uID'].'" target="_blank"><u><b>'.$users_map['uLogin'].'</b></u></a><br />'; } echo "<td width=\"75\" height=\"75\" style=\"background-image: url('images/map/$bgimg');background-repeat: repeat;\" align=center valign=center onclick=\"window.location.href='map.php?xcord=$grid_x&ycord=$grid_y'\">$building $user_map_name</td>"; } require 'includes/footer.php'; ?> I'd like to use an application that's not browser based, on Internet Explorer. I've read somewhere that this is possible with a PHP script, but which one? If you can get me on the right track, I'd really appreciate it. Cheers. Hello, I'm having a bit of trouble with the following: <?php echo htmlentities('<img src="<?php bloginfo('template_directory');?>/images/my-image.png" / rel="nofollow">'); ?> As you can see, I am trying to use php to call the template directory but it isn't being recognized as a php statement. I'm new to php and I'm pretty certain my syntax is not right. Can someone provide a bit of guidance? Thank you. Quint hope i'm in the right place. Hello,my name is carlton. i have a html form i created in dreamweaver cs. i have the accompanying .php script to forward user details to the server. i fill in the form, hit the submit button and nothing appears in the table i created. the testing server has been successfully configured the database "babiesnmovies" is recognized by dreamweaver. PLS tell me what i'm missing. below is a copy of the form and the script. Thank you so much. //this is the HTML registration web form i created in dreamweaver// Code: [Select] <legend>Parents Contact Information</legend> </h3> <form id="form1" name="form1" method="PUT" action="babiesnmovies.php"> <p> <label for="babiesnmovies.com/register">Your First Name</label> <input type="text" name="yourfirstname" id="babiesnmovies.com/register" /> <label for="babiesnmovies.com/registered">Your Last Name</label> <input type="text" name="yourlastname" id="babiesnmovies.com/registered" /> </p> <label for="babiesnmovies.com/yourname">Your Phone Number</label> <input type="text" name="yourphonenumber" id="babiesnmovies.com/yourname" /> <label for="babiesnmovies.com/email">Your E-mail</label> <input type="text" name="youremail" id="babiesnmovies.com/email" /> </p> </form> <p> </p> <h3> <legend>Baby's Vitals</legend> </h3> <form id="form2" name="form2" method="PUT" action="babiesnmovies.php"> <p> <label for="babiesnmovies.com/baby'slast">Baby's First Name</label> <input type="text" name="babysfirstname" id="babiesnmovies.com/baby'sfirst" /> <label for="babiesnmovies.com/babies">Baby's Middle Name</label> <input type="text" name="babysmiddlename" id="babiesnmovies.com/babies" /> </p> <p> <label for="babyslastname">Baby's Last Name</label> <input type="text" name="babyslastname" id="babyslastname" /> </p> <p> <label for="babiesnmovies.com/babybday">Baby's Birthdate</label> <input type="text" name="babysbirthdate" id="babiesnmovies.com/babybday" /> <label for="babiesnmovies.com/babyage">Baby's Age</label> <input type="text" name="babysage" id="babiesnmovies.com/babyage" /> </p> <p> <label for="babiesnmovies.com/baby">Baby's Height</label> <input type="text" name="babysheight" id="babiesnmovies.com/baby" /> <label for="babiesnmovies.com/babyweight">Baby's Weight</label> <input type="text" name="babysweight" id="babiesnmovies.com/babyweight" /> </p> <p> <label for="babiesnmovies.com/babyeyes">Baby's Eye Color</label> <input type="text" name="babyseyecolor" id="babiesnmovies.com/babyeyes" /> <label for="babiesnmovies.com/babyhair">Baby's Hair Color</label> <input type="text" name="babyshaircolor" id="babiesnmovies.com/babyhair" /> </p> <p> <label for="babiesnmovies.com/babyrace">Baby's Ethnicity</label> <input type="text" name="babysethnicity" id="babiesnmovies.com/babyrace" /> </p> <p><input name="formsubmit" type="submit" value="Submit" /> </form> //this is the babiesnmovies.php script// <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_babiesnmovies = "XXX"; $database_babiesnmovies = "XXX"; $username_babiesnmovies = "XXX"; $password_babiesnmovies = "XXX"; $babiesnmovies = mysql_pconnect($hostname_babiesnmovies, $username_babiesnmovies, $password_babiesnmovies) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db("db337879506", $con); $sql="INSERT INTO register (id, YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName, BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ( 'NULL','$yourfirstname', '$yourlastname', '$yourphonenumber', 'youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname', '$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')"; $yourfirstname = $_POST ['YourFirstName']; $yourlastname = $_POST ['YourLastName']; $yourphonenumber = $_POST ['YourPhoneNumber']; $youremailaddress = $_POST ['YourE-mailAddress']; $babysfirstname = $_POST ['BabysFirstName']; $babysmiddlename = $_POST ['BabysMiddleName']; $babyslastname = $_POST ['BabysLastName']; $babysbirthdate = $_POST ['BabysBirthdate']; $babysage = $_POST ['BabysAge']; $babysheight = $_POST ['BabysHeight']; $babysweight = $_POST ['BabysWeight']; $babyseyecolor = $_POST ['BabysEyeColor']; $babyshaircolor = $_POST ['BabysHairColor']; $babysethicity = $_POST ['Babys Ethnicity']; ?> Thank you. Hey there, I currently have a banning system on my site that doesn't allow users to login with the banned account. But the cookies are set to remember them for a year. How can I destroy their cookie, so that they don't stay logged in and continue to use the site? I have a script there download a lot of images from a website it crawls, but when ever i started a crawler, it will keep downloading images. Even if i close firefox, it will continue to download images from the site. How can i stop it?. I need to close a window if referer not valid, but it cannot be in HTML, needs to be php. This is what I have so far: Code: [Select] if (ereg("http://www.mysite.com/test.php", $_SERVER['HTTP_REFERER']) != true){ header('Location: ?????????'); exit; } I get a header already sent message if I use a URL. I need it to close the window after 3 seconds. Any ideas? |