PHP - Do I Need A Php Expert To Solve This Problem?
Hi,
My hosting company (Bluehost) told me when someone goes to my home page, it sends these series of queries and this is the reason for my high cpu usage and this is why my site says Error Establishing Database. The hosting company gave me these: Each script is using a decent about of CPU. [2:09:33 AM] hollane3 31881 6.2 0.1 186084 49000 ? RN 01:59 0:26 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 934 6.6 0.1 184012 48652 ? RN 01:59 0:25 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 5344 7.1 0.1 184008 48440 ? RN 02:01 0:21 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/wp-cron.php hollane3 5164 7.1 0.1 186444 48772 ? RN 02:01 0:22 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 7246 6.9 0.1 184116 48196 ? RN 02:02 0:18 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 11221 5.8 0.1 185160 47852 ? RN 02:03 0:09 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 11236 6.4 0.1 182992 47620 ? RN 02:03 0:10 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/wp-cron.php hollane3 12595 5.4 0.1 183088 47264 ? RN 02:04 0:07 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 13969 5.4 0.1 184648 47396 ? RN 02:04 0:05 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 14161 6.1 0.1 182480 47140 ? RN 02:04 0:06 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/wp-cron.php hollane3 14198 6.7 0.1 183092 47204 ? RN 02:04 0:06 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 16343 4.9 0.1 181968 46496 ? RN 02:05 0:02 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php I am not well versed with scripting, so I don't know what this mean. Can anyone PLEASE help me to answer these questions: + Is this related to a particular plugin or widget or theme? + What could be the possible source of this issue, that is, which file should I look at to resolve this? + Can I fix this myself or do I need a php coder to help me? Thanks! Similar TutorialsThis is how it should look. basic xml file http://wiistream.net/php/user/pictures/gallery.xml but this is how it looks. http://wiistream.net/php/user/pictures/gallery.php?username=Mancent&user_folder=Mancent_Pictures mysql php xml file with category's. This is whats making it so hard the category's Im using 3 tables one table is for my friends and one table is the category folder name and the other table is the picture holder with the category folder name so I thought i could do a if statement if user_folder = user_folder from the two tables it would keep the correct images in the correct category. But 3 weeks later still no luck. Heres what I got so far. <?php //lets get the mysql connection information. include "../../connect.php"; //we need this because the flash stores the xml file in temp internet history. Header('Cache-Control: no-cache'); Header('Pragma: no-cache'); //ok flash sent out the username $username = mysql_real_escape_string($_GET['username']); //ok flash sent out the folder name $user_folder = mysql_real_escape_string($_GET['user_folder']); $user_folder = (isset($_GET['friend'])) ? ' AND b.user_folder = \'' . mysql_real_escape_string($_GET['user_folder']) . '\' ' : NULL; //this part will be used becasue we need to see if friendship has ben made. $friend = (isset($_GET['friend'])) ? ' AND b.friend = \'' . mysql_real_escape_string($_GET['friend']) . '\' ' : NULL; //Ok lets select the username from the accounts table to see if they are a user.. $get_username = "SELECT * FROM accounts WHERE username = '$username'"; $username_results = mysql_query($get_username) or die("Data not found."); //Get the number of results from the query. $check_username_mysql_rows = mysql_num_rows($username_results); //If there is a match for the username, echo the the users xml data. if($check_username_mysql_rows == 1) { $sql1 = "SELECT a.username,a.user_folder,b.username FROM user_image_folders as a JOIN `user_friends_list` as b ON (b.friend = a.username)WHERE (b.username = '$username' $user_folder $friend AND b.status = 1)"; $result1 = mysql_query($sql1); //TODO MAKE THE FRIENDSHIP WORK WITH THIS $sql = "SELECT a.username,a.user_folder,a.user_folder,a.large_pic,a.small_pic,a.pic_title,a.pic_discription,b.username FROM user_photo_gallery as a JOIN `user_friends_list` as b ON (b.friend = a.username)WHERE (b.username = '$username' $user_folder $friend AND b.status = 1)"; $result2 = mysql_query($sql); $user_xml = "<?xml version=\"1.0\"?>\n"; $user_xml .= "<settings>\n"; $user_xml .= "<sceneHeight>600</sceneHeight>\n"; $user_xml .= "<sceneWidth>1000</sceneWidth>\n"; $user_xml .= "<titleColor>#000000</titleColor>\n"; $user_xml .= "<descriptionBgAlpha>70</descriptionBgAlpha>\n"; $user_xml .= "<showFullscreenBtn>no</showFullscreenBtn>\n"; $user_xml .= "<waterMark useImage=\"no\"><![CDATA[THIS]]></waterMark>\n"; $user_xml .= "</settings>\n"; $user_xml .="<galleries>\n"; //{ while ($i_get_myfriends = mysql_fetch_assoc($result1)) { $user_xml .="<gallery theName=\"". $i_get_myfriends['user_folder'] ."\" itemsPerRow=\"3\" autoStart=\"no\" playTime=\"5\" autoResize=\"yes\" xOffset=\"5\" yOffset=\"10\" showTitleOnThumbs=\"yes\" allowDownload=\"yes\">\n"; while ($i_get_myfriends2 = mysql_fetch_assoc($result2)) { //if($i_get_myfriends['user_folder'] ==$i_get_myfriends2['user_folder']) //{ $user_xml .="<picture largePicture=\"". $i_get_myfriends2['large_pic'] ."\" smallPicture=\"". $i_get_myfriends2['small_pic'] ."\" theTitle=\"". $i_get_myfriends2['pic_title'] ."\"><![CDATA[". $i_get_myfriends2['pic_discription'] ."]]>\n"; $user_xml .="</picture>\n"; //} } $user_xml .="</gallery>\n"; } $user_xml .="</galleries>\n"; echo $user_xml; } else { echo "Wiistream Eorror!\n"; } ?> See all the images are going into one folder.. and they are sopost to go into the friends folder it they are the friends pictures. but they are all in my folder.. Code: [Select] Warning: SimpleXMLElement::addChild() [simplexmlelement.addchild]: unterminated entity reference limit=50&method=GET&access_token=AAACd5Mcn7VQBAKaupEZCocujRuoBzzWeZCj945ZApHEsv5BZAxZCJfS62cSSz4txlZBUZAec03GcjpHdk0NTotnglt2ZB41GzzeYl8xqIZBmsvlS6UZAoHZB1A4&offset=50 in /home/content/71/8432771/html/facebook/get/friends.php on line 62 Code: [Select] <?php /** * Copyright 2011 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ require '../../src/facebook.php'; // Create our Application instance (replace this with your appId and secret). $facebook = new Facebook(array( 'appId' => 'APPID', 'secret' => 'SECRET', )); // Get User ID $user = $facebook->getUser(); // We may or may not have this data based on whether the user is logged in. // // If we have a $user id here, it means we know the user is logged into // Facebook, but we don't know if the access token is valid. An access // token is invalid if the user logged out of Facebook. if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me/friends?fields=id,name,first_name,last_name,picture&limit=50'); } catch (FacebookApiException $e) { error_log($e); $user = null; } } // Login or logout url will be needed depending on current user state. if ($user) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } $profile = array ($user_profile); $xml = new SimpleXMLElement('<root/>'); arrayToXML( $xml, $profile ); echo $xml->asXML(); function arrayToXML( SimpleXMLElement &$xml, $array ) { foreach( $array as $name => $value ) { if( !is_array($value) ) $xml->addChild( $name, $value ); else { $child = $xml->addChild( $name ); <----------------------------------------------LINE 64 arrayToXML( $child, $value ); } } } ?> Here is the array Code: [Select] { "data": [ { "name": "Pauline Latty", "id": "312293" }, { "name": "Noah Ethan Schinasi", "id": "55101245" }, { "name": "Luis Guerrero", "id": "194803212" }, { "name": "Nakia Johnson", "id": "500350828" }, { "name": "Bethany Vallerie", "id": "502062429" }, { "name": "Caroline Franks", "id": "505331027" }, { "name": "Andrew Shivers", "id": "505749817" }, { "name": "Sandra G Garcia", "id": "508006303" }, { "name": "Catherine Davis", "id": "511006416" }, { "name": "Marc Watson", "id": "511201074" }, { "name": "Laura Clarke", "id": "513653820" }, { "name": "Amanda Rice", "id": "514062403" }, { "name": "Scott Alan Buss", "id": "514197867" }, { "name": "Evangelist Josephus", "id": "515837621" }, { "name": "Chet Fontenot", "id": "516199085" }, { "name": "Sharon Howard", "id": "516580144" }, { "name": "Chatt Franco", "id": "517211511" }, { "name": "Lydgia Vanessa Staples", "id": "518094760" }, { "name": "Corry Bell", "id": "521043483" }, { "name": "Lessie Tyson", "id": "521855454" }, { "name": "Jawahar Peter", "id": "523159934" }, { "name": "Sheena Shiko", "id": "523461577" }, { "name": "Pat Larry Thomas", "id": "523555768" }, { "name": "Oyenuga Kunle Johnson Matthew", "id": "524263978" }, { "name": "Angela Whitten", "id": "524631356" } ], "paging": { "next": "https://graph.facebook.com/me/friends?limit=25&access_token=2227470867|2.AQAMMvJya05xkLhR.3600.1318057200.0-100001957015772|IUAhNlekyalf7sxy-OjdJd7KCwo&offset=25" } } its that paging, I can not seem to get that to work yet. My code is $answer = (1/212500); output is 4.90205690308E-6 while I need I output as 0.00000470588 Please help, and tell me what is the specific problem, Hi, I would like to become a php expert. How to achieve this? I have already read 2-3 books but I don't feel like knowing php. How to sharpen my skills? Thanks for your answers This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=316214.0 Hello I need a expert php programmer to create website. Please send me your hourly rate and availability.
I will send work requirements once I have a successful candidate.
Requirements at the moment:
Create forms
Capture data
Display data in graphs
Create interactive community.
Must be written PHP OOP , MYSQL.
I will retain ownership and control of code and data, details will be provided.
Any one php expert help me,
URL imgslink.biz
when i upload an image and try to open it, i get error
here is my htaccess code
RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?imgslink\.biz/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ nohotlink.gif [L] <Files ~ "\.(php|sql|php3|php4|phtml|pl|py|jsp|asp|htm|shtml|sh|cgi)$"> order allow,deny allow from all </Files> I've just implemented PHPass into an application that I am working on, and I am seeing a strange inconsistency. The issue is, the application is installed on one site, and it works perfectly. But the same application works on another site, and the login nor registration works. Does anyone know what might be the issue that registration and login works on one site but not the other with PHPass? Thanks. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=351799.0 Can some PHP guru help me with this scenarios? I've been wondering around these for hours and can't find my way around it. Please... 1. Write a function in PHP that takes three parameters (representing day, month and year) and calculates the day/month/year of the following day (for example, if the parameter is 31/10/2010, the result should be 01/11/2010). No need to take into account leap years. You cannot use any date/time specific functions, you must do it "by hand" (no built-in functions).. 2. Write a function in PHP that takes a string and counts the number of occurrences of any given letter in it (for example, given the string "HELLO" as a parameter, there are two occurrences of "L", one of "H", one of "E", one of "O" and zero of any other character). If you are a PHP expert, then I really your help. I have a question regarding PHP sessions and their security. So here is my story ... I created a login script (login.php) for my website. When a user goes to the login.php page, they see a login form that they must fill with their username and password to login to the members' area and view their profile, etc. On that login page, when the user enters their username and password and then clicks the "Login" button, my script filters the data, sends MySQL query and checks if the login is valid. If the login is NOT valid, then they get a "Login Failed" message. If the login is valid, I register their username and the password in sessions and redirect them to the members.php page. Here is some of my code for my login.php page after mysql confirms the login is valid <?php $query = mysql_query('SELECT * FROM `users` WHERE username='$user' AND password='$pass'"); $numRows = mysql_num_rows($query); if ( $numRows ) { // login is valid $_SESSION['username'] = $user; $_SESSION['pass'] = $pass; // redirect user to members area header('Location: /members.php'); } else { // login is invalid echo "Login failed"; } ?> My question is ... is this login script secured? I mean, I am not generating any session id or any cookie. I am just storing the username and the password in two session variables and those are the things that i will use to display the user's profile, etc. Can attackers attack this script? Is this secured or is there any other way I can make it stronger?
<!DOCTYPE html> <html> <body> <form action="Practice 1.1.php" method="post"> Catagory Code:<input type="text" name="n" size="2"><br> Units Used <input type="text" name="u" size="2"> <br> <input type="submit" value="Calculate"> </form> <?php $a=$_POST['n']; $b=$_POST['u']; if ($b<=3.75) { echo ""; } ?> </body> </html>
I have following errors in below coding. Can anyone point out me where i went wrong?? Undefined variables: fname,focu,foad,ftp,fmf,mname,mocu,moad,mtp,mmf,gname,gocu,goadd,gtp,gmf in C:\wamp\www\Student registration\manage studnt parent details\manageStudentRegistrationParentDetailsForm.php manageStudentRegistrationParentDetailsForm.php Code: [Select] <?php $query="SELECT state,name,occupation,office_address,office_telephone,mobile_number FROM parent_info where admission_no='$admission_no'"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $first=$row['state']; if($first=='father'){ $fname=$row['name']; $focu=$row['occupation']; $foadd=$row['office_address']; $ftp=$row['office_telephone']; $fmf=$row['mobile_number']; } if($first=='mother'){ $mname=$row['name']; $mocu=$row['occupation']; $moadd=$row['office_address']; $mtp=$row['office_telephone']; $mmf=$row['mobile_number']; } if($first=='guardians'){ $gname=$row['name']; $gocu=$row['occupation']; $goadd=$row['office_address']; $gtp=$row['office_telephone']; $gmf=$row['mobile_number']; } } ?> ---- ---- <tr> <td> </td> <td colspan="5"><h3> <label><strong>Parents/Guardian information</strong></label> <strong> </strong></h3></td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><label>Admission No</label> </td> <td colspan="2" align="left"><?php echo $admission_no ;?></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> <input type="checkbox" name="checkbox" id="checkbox" <?php if($fname!=null){ ?> checked="checked" <?php }?> onclick="father()" /> <label>fathers details</label></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label> Name</label> </td> <td><input type="text" name="Name1" id="textfield" value="<?php echo $fname; ?>" disabled="disabled" /></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Occupation</label> </td> <td> <input type="text" name="Occupation1" id="textfield2" value="<?php echo $focu; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Address</label> </td> <td> <textarea name="Office_Address1" id="office_address" cols="45" rows="5" disabled="disabled"><?php echo $foadd; ?></textarea> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Telephone Number</label> </td> <td> <input type="text" name="Office_tel1" id="textfield4" value="<?php echo $ftp; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Mobile Phone Number</label></td> <td> <input type="text" name="Mobile_pho1" id="textfield5" value="<?php echo $fmf; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> <input type="checkbox" name="checkbox2" id="checkbox2" <?php if($mname!=null){ ?> checked="checked" <?php }?> onclick="mother()" /> <label>Mothers details</label></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label> Name</label> </td> <td> <input type="text" name="Name2" id="textfield3" value="<?php echo $mname; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Occupation</label> </td> <td> <input type="text" name="Occupation2" id="textfield7" value="<?php echo $mocu; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Address</label> </td> <td> <textarea name="Office_Address2" id="textarea" cols="45" rows="5" disabled="disabled"><?php echo $moadd; ?></textarea> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Telephone Number</label> </td> <td> <input type="text" name="Office_tel2" id="textfield8" value="<?php echo $mtp; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Mobile Phone Number</label> </td> <td> <input type="text" name="Mobile_pho2" id="textfield9" value="<?php echo $mmf; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> <input type="checkbox" name="checkbox3" id="checkbox3" <?php if($gname!=null){ ?> checked="checked" <?php }?> onclick="Guardian()"/> <label>Guardian details</label></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label> Name</label> </td> <td> <input type="text" name="Name3" id="textfield6" value="<?php echo $gname; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Occupation</label> </td> <td> <input type="text" name="Occupation3" id="textfield10" value="<?php echo $gocu; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Address</label> </td> <td> <textarea name="Office_Address3" id="textarea2" cols="45" rows="5" disabled="disabled"><?php echo $goadd; ?></textarea> </td> <td> </td> <td> </td> <td> </td></tr> <tr> <td> </td> <td colspan="2"><label>Office Telephone Number</label> </td> <td> <input type="text" name="Office_tel3" id="textfield11" value="<?php echo $gtp; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr><td> </td> <td colspan="2"><label>Mobile Phone Number</label> </td> <td> <input type="text" name="Mobile_pho3" id="textfield12" value="<?php echo $gmf; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> <input type="submit" name="button" id="button" value="Save" /> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <p> </p> <p> </p></td> </tr> Hey.. hoping someone can help me on a this issue I have been having for 4 days now. My host has tried to figure out what is causing it and has told me they are finding it very strange, everytime my website is up on their server it will take 600%-800% CPU so they must take it down for fair usage on other customers of course. They said they can easily track and trace websites that are overloading the resources but mine seems too complicated to understand as it is having legitmate traffic (on average 30 users online and 300 visits daily) which would never be the cause of CPU spikes to 600%-800%. They either believe it is a "clever attack" or some PHP script perhaps looping like mad. Anyone help me and my host figure out the problem as we obviously both don't like the website to continue to be offline. The website has very standard content CMS running and clean database it makes no sense to the both of us. Like to mention the last activity I had done on the website was when I tried to insert into database:- Code: [Select] Query failed: errorno=126 error=Incorrect key file for table './teamxcom_webspell/ws_bi2_cup_matches.MYI'; try to repair it query=DELETE FROM ws_bi2_cup_matches WHERE matchno='5' && type='gs' && ladID='0' && 1on1='1' Then after I tried to perform query from database: Code: [Select] Error SQL query: SELECT * FROM `ws_bi2_cup_matches` ORDER BY `ws_bi2_cup_matches`.`matchID` DESC LIMIT 0 , 30 MySQL said: #1030 - Got error 134 from storage engine Then found out the table on phpmyadmin had wrong page numbers in sequence:- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 379, 746, 1113, --, --, --7349 After I contacted web host they mentioned it is causinga massive problem and took it down after that. Anyone can shed some light on this please? Sorry if it is posted in wrong section! Thanks very much Hello guys, I'm trying to solve my hometask . I tried in many different ways to solve the task related with Advanced SQL Syntax. Please check the pic below: The Quiz is asking for make location appear in all uppercase letters, the character associated with a given ASCII value and the table is people. I tried the last one in this way: SELECT CONCAT(name,'is from',strtoupper(location),' The ASCII character of the number ',number,' is ',ASCII(number)) FROM `people` WHERE 1 but it doesn't work. Can someone help me? Thanks This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=306725.0 Hello! I have this approach on form validation(I'm just a newbie) Code: [Select] <?php if(isset($_POST['submit'])) { $proj_name = me_mysql_prep(trim($_POST['proj_name'])); $proj_content = me_mysql_prep($_POST['proj_content']); if(empty($_POST['proj_name'])) { $empty_name = array('Project Name Cannot Be Empty'); } if(empty($_POST['proj_content'])) { $empty_content = array('Content Cannot Be Empty'); } if(isset($empty_name) || isset($empty_content)); { $error_merge = array_merge($empty_name, $empty_content); } if(!empty($error_merge)) { foreach($error_merge as $error) { echo "<span class=\"error_validation\">*". $error . "<br></span>"; } } else { $query = "INSERT into rec_projects (proj_name, content, date_reg) VALUES('{$proj_name}', '{$proj_content}', '{$datenow}')"; $result = mysql_query($query,$connection); } echo "<br><br>"; } ?> My problem is at this line Code: [Select] <?php if(isset($empty_name) || isset($empty_content)); { $error_merge = array_merge($empty_name, $empty_content); } ?> because if, let's say $empty_name is not set, I'm going to have an error like Quote "undefined $empty_name" or something like that. I wonder if there's a PHP function that disregard a value in an array if it's not set.. or you guys have different approach to solve and simplify this?? This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=327462.0 Hi, I read the HEADER advice on the forum but I think that I still need help to figure out what I am doing wrong with header("location: page_to_load"). In local, the redirection works without problems. When I test online on a free server (p4o.net), it works fine; but when I test it on the paid server (mediaserve.com), the redirect loads a blank page. After the blank page is loaded, I manually load the protected page (MyAccount.php) and all the information were displayed successfuly. I logged out and signed in with wrong credential. The result is a blank page. I manually loaded MyAccount.php again and I had "Access denied". I then concluded that the redirection deos not work. Is there any work arround for this situation? Please help. Thanks Login.php Code: [Select] <form id="login" method="POST" action="handlers/login_handler.php"> <strong>Username</strong> <input name="TextBoxEmailAdress" type="text" id="TextBoxEmailAddress" /> <strong>Password</strong> <input name="TextBoxPassword" type="password" id="TextBoxPassword" /> <input name="ButtonSubmit" value="Login" id="ButtonSubmit" type="submit" /> </form> login_handler.php Code: [Select] <?php ob_start(); //Start session session_start(); //Include database connection details require_once('../includes/WebConfig.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $Var_EmailAddress = clean($_POST['TextBoxEmailAddress']); $Var_Password1 = clean($_POST['TextBoxPassword']); //Input Validations if($Var_EmailAddress== '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($Var_Password1== '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } //If there are input validations, redirect back to the login form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: ../index.php?PageId=login"); exit(); } //Create query $Var_Password1 = md5($Var_Password1); $query="SELECT * FROM $tbl_member WHERE EmailAddress='$Var_EmailAddress' AND Password1='$Var_Password1'"; $result=mysql_query($query); //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['Member_Id']; $_SESSION['SESS_FIRST_NAME'] = $member['FirstName']; $_SESSION['SESS_LAST_NAME'] = $member['LastName']; $_SESSION['SESS_EMAIL_ADDRESS'] = $member['EmailAddress']; $_SESSION['SESS_ADMIN_ROLE'] = $member['AdminRole']; $_SESSION['SESS_CONTRIB_EMAIL'] = ""; session_write_close(); header("location: ../MyAccount.php"); exit(); } else { //Login failed header("location: ../index.php?PageId=login-failed"); exit(); } } else { //echo "mysql error: " .mysql_error(); //echo "<br> mysql error number: " .mysql_errno(); //die("Query failed"); //Login failed header("location: ../index.php?PageId=login-failed"); } ?> |