PHP - Redirecting User
i am trying to redirect a user to a certain page, if the credentials are not right. if there is no session user, they are kicked out. if it is set, but to the guest account, they go to the login page with a special error message. here is my code for it:
Code: [Select] if (!isset($_SESSION['user'])) { header('Location: portal.php?logintocontinue'); exit; } elseif($_SESSION['user'] == "guest") { header('Location: portal.php?invalidLogin'); exit; } else { } after attempting to run the page, with session user = guest, i get this error message: The page isn't redirecting properly. does it have to do with headers already being sent? Similar Tutorialsso the user is reading a story, to finish reading he has to click a link that redirects them to the signup page. Code: [Select] <?php session_start(); $beginurl = $_SERVER['HTTP_REFERER']; $_SESSION['beginurl'] = $beginurl; echo $_SESSION['beginurl']; ?> <html> <head> </head> <body> <script type="text/javascript"><!-- location.replace("http://www.mysite.com/members/"); //--></script> </body> </html> When they get to the second page, they have to click a link that opens up a modal. this is the code that runs when they hit the register button Code: [Select] session_start(); $beginurl = $_SESSION['beginurl']; $beginurl= (isset($_SESSION['beginurl'])) ? $_SESSION['beginurl'] : 'Error'; if( $_SESSION['status'] ='authorized') $_SESSION['$makemodal'] = 0; //sends the user to the page upon successful password credential if(!isset($_SESSION['SESS_USERID'])||(trim($_SESSION['SESS_USERID']=='admin'))) { echo '<script language="javascript">'; echo "top.location.href = $beginurl"; echo '</script>'; exit(); } Am I passing this variable correctly? and I'm not sure if the top.location.href towards the bottom is correct either, right now after I hit the register button I'm redirected to a blank page where the url is, "http://www.mysite.com/function Error() { [native code]}" Hey guys, If my php looks like this: (notify if errors) <?php $user=$_POST['user']; $pass=$_POST['pass']; if(($user=="testing") && ($pass=="testing123")) echo "Access Granted"; if other echo "Access Denied!" ?> If after the "Access Granted" It could redirect the user to another webpage, index2.html for instance. Thanks in advance I do know that nothing should be printed out before a header() redirect, yet this error message: Code: [Select] Warning: Cannot modify header information - headers already sent by Is pointing to a meta tag, why does a meta tag become considered as a print out? The meta tags are as usually located in between the header tags of the whole website. What would you rather recommend in this case to accomplish a redirecting after a successful log in? I would appreciate your assistance, there are tons of login scripts and they work just fine. However I need my operators to login and then list their activities for the other operators who are logged in to see and if desired send their clients on the desired activity. I have the login working like a charm and the activities are listed just beautifully. How do I combine the two tables in the MySQL with PHP so the operator Logged in can only make changes to his listing but see the others. FIRST THE ONE script the member logges in here to the one table in MSQL: <?php session_start(); require_once('config.php'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $login = clean($_POST['login']); $password = clean($_POST['password']); if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login-form.php"); exit(); } $qry="SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); if($result) { if(mysql_num_rows($result) == 1) { 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_write_close(); header("location: member-index.php"); exit(); }else { header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?> ................................................. ................................ Now I need the person who logged in to the table above to be able to make multiple entries to the table below <? $ID=$_POST['ID']; $title=$_POST['title']; $cost=$_POST['cost']; $activity=$_POST['activity']; $ayear=$_POST['aday']; $aday=$_POST['ayear']; $seats=$_POST['special']; $special=$_POST['seats']; mysql_connect("xxxxxx", "xxx350234427", "========") or die(mysql_error()); mysql_select_db("xxxx") or die(mysql_error()); mysql_query("INSERT INTO `activity` VALUES ('ID','$title', '$cost','$activity', '$aday', '$ayear', '$special', '$seats')"); Print "Your information has been successfully added to the database!" ?> Click <a href="member-profile.php">HERE</a> to return to the main menu <?php ?> hi, i have made a website where people resgister their details of them and products. they have to enter the following details in form Name of company name of the product company address email id password mobile number contact and brief details about their company
user can then login with email id and pwd. now after login ..user will get a page where he can upload the photos of products images and their price, so now my question is that when he finishes uploading (|by clicking on upload button) the product images and price text box ..then on final uploaded webspage it should show all other things which he registerd before (company name , mobile number etc) along with images and price...hence the main question that user does not need to enter mobile and address while uploading images and filling proce ..but on the final page it should show mobile and address along with price and images..as user is not going to enter mobile and address again and again as he will have multiple products to upload.
Can Someone please look at the following zip file and edit index and code-gen so when someone refer required amount of visitors, php echo will redirect them to complete.php
I have got css and js but not uploading as they are too big
Thanks (please help me)
script.zip 29.95KB
3 downloads
why won't this header redirect? it doesn't seem to like the mysql_close. can i update the database before redirecting to another page? is it possible? Code: [Select] <?php session_start(); $name = "uname"; $lastLogin = date('l jS \of F Y h:i:s A'); require_once('../Connections/uploader.php'); mysql_select_db($database_uploader, $uploader); $query = "SELECT * FROM members WHERE uname='" . $name . "'"; $result = mysql_query($query) or die(mysql_error()); // connect to database here MYSQL_CONNECT($server, $user, $password) or die ("Server unreachable"); MYSQL_SELECT_DB($database) or die ("Database non existent"); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result) or die(mysql_error()); mysql_query("UPDATE members SET lastLogin='$lastLogin' WHERE uname='$name'") // ERROR MESSAGE?? or die(mysql_error()); mysql_close($con); header('Location: redirect.php'); } ?> thanks in advance. Hi guys Another basic question. I have this dynamic link when I click it, it redirect to this link below, Code: [Select] http://samplesite.com/adventure/\'google.com\' How do I remove the main site --> samplesite.com redirect only to google.com? I also tried to remove the two slashes using stripslashes() but it won't. By the way here is the stripslashes() codes, Code: [Select] while ($db_field = mysql_fetch_assoc($result)) { $title = $db_field['title']; print "Title: " . stripslashes($title) . "<br>"; print "Description: " . $db_field['description'] . "<br>"; print "Version: " . $db_field['version'] . "<br>"; print "Started: " . $db_field['started'] . "<br>"; print "Finished: " . $db_field['finished'] . "<br><br>"; } Thanks in advanced. Hi Guys,
I have a Url which allows me to send sms to a number. The url usually asks for id , number and few other things. When I paste the url in browser and press enter it opens and a sms is sent.
Now I want to code in php a way to send sms without redirecting to that page. For e.g. I ask user his mobile number and then I should be able to call/run that url and a sms should be sent to his number. If I use php header then it redirects to that page. I have tried using file_get_contents and php cURL but it has not worked so far.
Can you guys help me out ?
Thank you,
Cheers,
GR
As the title says, my headers not redirecting. Login.php: <?php include("global.php"); if (isset($_POST['login'])) { // Form data $email = $_POST['email']; $password = $_POST['password']; // If email and password are both filled in if ($email && $password) { mysql_select_db("social_site") or die("Can\'t find database!"); $query = mysql_query("SELECT * FROM users where email = '$email'"); $numrows = mysql_num_rows($query); // If email in database if ($numrows != 0) { // Login while ($row = mysql_fetch_assoc($query)) { $dbemail = $row['email']; $dbpassword = $row['password']; } if ($email == $email && $password == $dbpassword) { // User is logged in header(' location: index.php '); } else { echo "Incorrect password."; } } else { echo "That email does not exist."; } } else { echo "Please fill in <strong>all</strong> fields."; } } ?> <p> <html> <form action = 'login.php' method = 'POST'> Email: <input type = 'text' name = 'email'> <p> Password: <input type = 'text' name = 'password'> <p> <input type = 'submit' name = 'login' value = 'Login'> </form> </html> Global.php: <?php // This is the global file for the entire website // Start a session session_start(); // Start MySQL connection mysql_connect('localhost', 'root', 'root'); ?> Any ideas? Is it okay to redirect a user to another page - which displays an outcome message - after a form is submitted? Debbie Is there anyway to do this: my form is posting to self, then checking login creds. if they are incorrect it spits out "invaild bla bla" but if they are correct send them to a different page? here is the short version of what I have. if(isset($_POST['submit'])) { //check inputs vs db if ($check) { header("Location: http://". $_SERVER['SERVER_NAME']."/include/process_renew.php"); } else { echo "<font color='red'>Username or Password did not match.</font> <br /><br />"; } } } I tested it using echo first and it worked fine then replaced the echo with header and now when I submit it just refreshes the page. is this not possible? Hello I have moved my web site from local machine to a hosted server (Ionos) I seem to be having issues with any code that has redirects or checks if the user is logged in, I just get a blank page, any idea's ? works fine on my local Xamp version two examples below (if I remove the code the page runs)
// We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: login.php'); exit(); } ?>
<?php // database connect include('../db_connect.php'); // We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: login.php'); exit(); } // if submit button selected run code if(isset($_POST['submit'])){ $_SESSION['district'] = $_POST['district']; header('Location: add_d_choice.php'); } ?> <!DOCTYPE html> <html> <head> </head>
Hi again, I have created a comment script, which is working pretty good. Now the problem I am facing is for instance this is one page www.mysite.com/blah1 and this is another www.mysite.com/blah2. They both have options to comment, now what is happening some one posts on blah2, it redirects to blah 1 and some one posts on blah 1 redirects to itself what I want to achieve is when a person posts a comment on any given page PHP redirects the person to the page where they posted from (itself) not the other one. Thanks any help or guidance would be appreciated. I hope was clear enough! Hello, I'm having some problems with a redirect situation. I start on a page called Create Assignment. From this page I pass (using GET) the variable assignment_id to a page called Add_questions (the user can add questions to this specific assignment). When a user wants to add a question, they hit a link which brings them to my Database Update script. All works great so far! After the update, however, I want to redirect them BACK to the Add_questions page while keeping the same Assignment number. I've tried using: header('Location: list_assignment_question.php?assignment_id'); but I get this error: Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/algebra_book/main_scripts/db_insert_assignment_question.php:6) in /Applications/MAMP/htdocs/algebra_book/main_scripts/db_insert_assignment_question.php on line 12 Any thoughts? I'd be more than happy to provide more code as needed. For some reason the below is always redirecting to ./index.php?usercp=ideas&message=error I'm assuming it's something to do with mysql_affected_rows. <?php session_start(); require_once 'db_select.php'; require_once 'func.php'; $donor_id=$_POST['donor_id']; $donor_id=sanitize($donor_id); $username=$_POST['username']; $username=sanitize($username); $name=$_POST['name']; $name=sanitize($name); $amount=$_POST['amount']; $amount=sanitize($amount); $idea_message=$_POST['idea_message']; $idea_message=sanitize($idea_message); $_SESSION['idea_message']=$idea_message; $subject=$_POST['subject']; $subject=sanitize($subject); $_SESSION['subject']=$subject; $confirm_agreement=$_POST['confirm_agreement']; $confirm_agreement=sanitize($confirm_agreement); if($subject==""){ $error0=1; } else{ $error0=0; } if($idea_message==""){ $error1=1; } else{ $error1=0; } if(($confirm_agreement!="no" && $confirm_agreement!="yes") || $confirm_agreement=="no"){ $error2=1; } else{ $error2=0; } $error="".$error0."".$error1."".$error2.""; if($error!="000"){ header("Location: ./index.php?usercp=ideas&error=".$error.""); } else{ $sql="INSERT INTO $tbl_name5 (message_number, donor_id, username, name, amoutn, message) VALUES ('$message_number', '$donor_id', '$username', '$name', '$amount', '$message')"; mysql_query($sql); if(mysql_affected_rows()==1){ header("Location: ./index.php?usercp=ideas&message=submitted"); unset($_SESSION['idea_message']); unset($_SESSION['subject']); } else{ header("Location: ./index.php?usercp=ideas&message=error"); } } ?> Hello everyone, i have a "bug" i'd like you to see and help me solve if possible. Let me tell you about when the redirection starts. In my script, it checks if the two words you've entered in two boxes, if they match with the two words on the mysql database then send them to /php/userpanel.php if they doesnt send them to /php/loginerror1.php My problem is, that when you've been redirected to ex. /php/loginerror1.php then when you click to a new page in the menu, it sends you to /php/loginerror1.php/index.php /php/loginerror1.php also dont have any design, i think it doesnt load the .css properly. Anyone had this, or anyone knows how to fix it? Thanks Niixie Hi, so far I have managed to set up a somewhat basic login website with a mysql database backend. Once they have logged on they go to a "main menu" page. What I need to define is that user A sees button A but only that button, etc. (Then of course that same rule would have to apply if they tried to directly go to the page, but I am guessing I can do that in the same way that I currently do to force a login). If anyone has any tutorials or sample code I would much appreciate it. Thanks, Actually, what i want to do is to use the email to fetch the $email,$password and $randomnumber from database after There seems to be something wrong with my code when run in Firefox I get an error, the full code is: Code: [Select] <head> <script type="text/javascript" src="tabber.js"></script> <link rel="stylesheet" href="example.css" TYPE="text/css" MEDIA="screen"> <link rel="stylesheet" href="example-print.css" TYPE="text/css" MEDIA="print"> <script type="text/javascript"> </script> </head> <div class="tabber"> <?php if (!isset($_GET["name"]) || empty($_GET["name"])) { $corpname = rawurlencode(stripslashes($_POST['corpname'])); } else { $corpname = rawurlencode(stripslashes($_GET['name'])); } //Check if Corp is in DataBase $sql = "SELECT * FROM `corps` where `name` = '$corpname'"; $result = mysql_query($sql); $num = mysql_num_rows($result); // If Corp Is In DB if ($num > 0) { While ($row = mysql_fetch_array($result)) { ?> <div class="tabbertab"> <h2>Corp Info</h2> <table width ="700" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="128" rowspan="7"><?php echo "<img src=http://image.eveonline.com/Corporation/".$row['id']."_128.png width=128 height=128 />"; ?></td> <td width="128">Corp Name</td> <td><?php echo "<a href= http://eve.battleclinic.com/killboard/combat_record.php?type=corp&name=".rawurlencode($row['name'])." target=_blank>".$row['name']."</a>"; ?></td> </tr> <tr> <td width="128">Ticker</td> <td><?php echo $row['ticker']; ?></td> </tr> <tr> <td width="128">Allance</td> <td><?php $alliance = $row['alliance']; if($alliance =="0") { $alliance0 = "No Alliance"; echo $alliance0; } Else { $sql = "SELECT * FROM `alliance` WHERE `id` = '$alliance'"; $result = mysql_query($sql); $num=mysql_numrows($result); $i=0; while ($i < $num) { $alliance0=mysql_result($result,$i,"name"); $i++; } echo $alliance0; } ?></td> </tr> <tr> <td width="128">CEO Name</td> <td><?php echo "<a href=main.php?id=pilotsearch.php&name=".$row['ceo'].">".$row['ceo']."</a>"; ?></td> </tr> <tr> <td width="128">Headquarters</td> <td><?php echo $row['hq']; ?></td> </tr> <tr> <td width="128">Tax Rate</td> <td><?php echo $row['tax']; ?> %</td> </tr> <tr> <td width="128">Member Count</td> <td><?php echo $row['members']; ?></td> </tr> </table> </div> <div class="tabbertab"> <?php $query=mysql_query("SELECT DISTINCT(name) FROM `characters` WHERE `corporation` = '$corpname' ORDER BY name ASC") or die("Error Occured,please try again"); $numm = mysql_num_rows($query); echo "<h2>Known Members (".$numm."/".$row['members'].") </h2>"; echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>"; $left = true; while($row=mysql_fetch_array($query)) { if ($left) { echo "<tr>"; } echo "<td align='left' width='50%' cellspacing='0' cellpadding='0' >"; echo "<a href=main.php?id=pilotsearch.php&name=".rawurlencode($row['name']).">".$row['name']."</a>"; echo"</td>"; if (!$left) { echo"</tr>"; } $left = !$left; } echo"</table>"; ?> </div> <div class="tabbertab"> <?php $sql = "SELECT * FROM `corpwhsystems` WHERE `corpname` = '$corpname'"; $result = mysql_query($sql); $num_rows = mysql_num_rows($result); echo"<h2>WH Locations (".$num_rows.")</h2>"; $i=0; ?> <table width="728" border="0"> <tr> <td><strong>System Name</strong></td> <td><strong>System Class</strong></td> <td><strong>Effect</strong></td> <td><strong>Date Added</strong></td> <td><strong>Added By</strong></td> </tr> <?php while ($i <= $num_rows) { $sname=mysql_result($result,$i,"systemname"); $sclass=mysql_result($result,$i,"systemtype"); $anomaly=mysql_result($result,$i,"anomaly"); $addedby=mysql_result($result,$i,"updatedby"); $dateupdated=mysql_result($result,$i,"dateupdated"); ?> <tr> <td> <?php echo $sname; ?></td> <td> <?php echo $sclass; ?></td> <td> <?php echo $anomaly; ?></td> <td> <?php echo $dateupdated; ?></td> <td> <?php echo $addedby; ?></td> <?php $i++; } ?> </tr> </table> <hr /> <form action="main.php?id=addwh.php" method="post"> Add WH Location: <input name="location" type="text" /> <select name="systemtype"> <option value="Class 1">Class 1</option> <option value="Class 2">Class 2</option> <option value="Class 3">Class 3</option> <option value="Class 4">Class 4</option> <option value="Class 5">Class 5</option> <option value="Class 6">Class 6</option> </select> <select name="anomaly"> <option value="None">None</option> <option value="Magnetar">Magnetar</option> <option value="Red Giant">Red Giant</option> <option value="Pulsar">Pulsar</option> <option value="Wolf Rayet">Wolf Rayet</option> <option value="Cataclysmic Variable">Cataclysmic Variable</option> <option value="Black Hole">Black Hole</option> </select> <input name="corpname" type="hidden" value="<?php echo $cnamedb; ?>" /> <input name="addwh" type="submit" value="Add" /> </form> </div> <div class="tabbertab"> <?php $sql = "SELECT * FROM `corps` WHERE `name` = '$corpname' AND `notedate` != '0000-00-00'"; $result = mysql_query($sql); $num_rows = mysql_num_rows($result); echo"<h2>Notes(".$num_rows.")</h2>"; $i=0; ?> <table width="700" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="480"><strong>Note</strong></td> <td width="119"><strong>Note Date</strong></td> <td width="101"><strong>Added By</strong></td> </tr> <?php while ($i <= $num_rows) { $notes=mysql_result($result,$i,"notes"); $notedate=mysql_result($result,$i,"notedate"); $updatedby=mysql_result($result,$i,"updatedby"); ?> <tr> <td><br /> <?php echo $notes; ?></td> <td width="136"><br /> <?php echo $notedate; ?></td> <td width="105"><br /> <?php echo $updatedby; ?></td> </tr> <?php $i++; } ?> </table> <hr /> <form action="main.php?id=updatecorptint.php" method="post"> <strong>Add Notes:</strong> <textarea name="notes" cols="50" rows="10"></textarea> <input name="cname" type="hidden" value="<?php echo $cnamedb; ?>" /> <input name="add" type="submit" value="Add Notes" /> </form> </div> <div class="tabbertab"> <?php $sql = "SELECT * FROM `pos` WHERE `corp` = '$corpname'"; $result = mysql_query($sql); $num_rows = mysql_num_rows($result); echo"<h2>POS (".$num_rows.")</h2>"; $i=0; ?> POS: <table width="700" border="0" cellspacing="0" cellpadding="0"> <tr> <td><strong>Location</strong></td> <td><strong>Type</strong></td> <td><strong>Size</strong></td> <td><strong>Corp Hangars</strong></td> <td><strong>Ship Hangars</strong></td> <td><strong>Notes</strong></td> </tr> <?php while ($i <= $num_rows) { $location=mysql_result($result,$i,"location"); $type=mysql_result($result,$i,"type"); $size=mysql_result($result,$i,"size"); $changar=mysql_result($result,$i,"changar"); $shangar=mysql_result($result,$i,"shangar"); $notes=mysql_result($result,$i,"notes"); ?> <tr> <td><br /><?php echo $location; ?></td> <td><br /><?php echo $type; ?></td> <td><br /><?php echo $size; ?></td> <td><br /><?php echo $changar; ?></td> <td><br /><?php echo $shangar; ?></td> <td><br /><?php echo $notes; ?></td> </tr> <?php $i++; } ?> </table> <hr /> <form action="main.php?id=addpos.php" method="post"> <table width="350" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Location:</td> <td><label for="location"></label> <input type="text" name="location" id="location" /></td> <td>Type:</td> <td><select name="type"> <option value="Amarr">Amarr</option> <option value="Angel">Angel</option> <option value="Blood">Blood</option> <option value="Caldari">Caldari</option> <option value="Dark Blood">Dark Blood</option> <option value="Domination">Domination</option> <option value="Dread Guristas">Dread Guristas</option> <option value="Gallente">Gallente</option> <option value="Gurstas">Gurstas</option> <option value="Minmatar">Minmatar</option> <option value="Sansha">Sansha</option> <option value="Serpentis">Serpentis</option> <option value="Shadow">Shadow</option> <option value="True Sansha">True Sansha</option> </select></td> <td>Size:</td> <td><select name="size"> <option value="Large">Large</option> <option value="Medium">Medium</option> <option value="Small">Small</option> </select></td> </tr> <tr> <td>Corp Hangars:</td> <td><input name="changar" type="text" size="10" /></td> <td>Ship Hangars:</td> <td><input name="shangar" type="text" size="10" /></td> <td>Notes:</td> <td><textarea name="notes"></textarea></td> </tr> </table> <input name="cname" type="hidden" value="<?php echo $cnamedb; ?>" /> <input name="submit1" type="submit" value="Add POS" /> </form> </div> </div> <?php }} // IF Corp Is Not In DB ELSE { $url = 'http://api.eve-dev.com/eve/CharacterID.xml.aspx?names='.$corpname.''; $xml = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA); $url = 'http://api.eve-dev.com/eve/CharacterID.xml.aspx?names='.$corpname.''; $xml = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA); $corpid = $xml->result->rowset->row['characterID']; $url1 = 'http://api.eve-dev.com/corp/CorporationSheet.xml.aspx?CorporationID='.$corpid.''; $xml1 = simpleXML_load_file($url1,"SimpleXMLElement"); $cname = $xml1->result->corporationName; if($corpid == 0 OR $cname =="") { Echo $corpname."<br>No Corp Found In EVE Database"; } ELSE { $url1 = 'http://api.eve-dev.com/corp/CorporationSheet.xml.aspx?CorporationID='.$corpid.''; $xml1 = simpleXML_load_file($url1,"SimpleXMLElement"); $cname = $xml1->result->corporationName; $url1 = 'http://api.eve-dev.com/corp/CorporationSheet.xml.aspx?CorporationID='.$corpid.''; $xml1 = simpleXML_load_file($url1,"SimpleXMLElement"); $cname = $xml1->result->corporationName; $ticker = $xml1->result->ticker; $ceo = $xml1->result->ceoName; $station = $xml1->result->stationName; $descrption = $xml1->result->description; $alliance = $xml1->result->allianceID; $tax = $xml1->result->taxRate; $members = $xml1->result->memberCount; $username = $_SESSION['username']; mysql_query("INSERT INTO `corps` (`editid` , `id` , `name` , `ticker` , `alliance` , `ceo` , `tax` , `members` , `hq` , `apidate` , `notes` , `notedate` , `updatedby`) VALUES ( '' , '$corpid', '$cname', '$ticker', '$alliance', '$ceo', '$tax', '$members', '$station', NOW(), '', '', '$username')"); header('Location: main.php?id=corpsearch.php&name='.$corpname); exit; } } ?> The problem area is somewhere in here (I think): Code: [Select] // IF Corp Is Not In DB ELSE { $url = 'http://api.eve-dev.com/eve/CharacterID.xml.aspx?names='.$corpname.''; $xml = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA); $url = 'http://api.eve-dev.com/eve/CharacterID.xml.aspx?names='.$corpname.''; $xml = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA); $corpid = $xml->result->rowset->row['characterID']; $url1 = 'http://api.eve-dev.com/corp/CorporationSheet.xml.aspx?CorporationID='.$corpid.''; $xml1 = simpleXML_load_file($url1,"SimpleXMLElement"); $cname = $xml1->result->corporationName; if($corpid == 0 OR $cname =="") { Echo $corpname."<br>No Corp Found In EVE Database"; } ELSE { $url1 = 'http://api.eve-dev.com/corp/CorporationSheet.xml.aspx?CorporationID='.$corpid.''; $xml1 = simpleXML_load_file($url1,"SimpleXMLElement"); $cname = $xml1->result->corporationName; $url1 = 'http://api.eve-dev.com/corp/CorporationSheet.xml.aspx?CorporationID='.$corpid.''; $xml1 = simpleXML_load_file($url1,"SimpleXMLElement"); $cname = $xml1->result->corporationName; $ticker = $xml1->result->ticker; $ceo = $xml1->result->ceoName; $station = $xml1->result->stationName; $descrption = $xml1->result->description; $alliance = $xml1->result->allianceID; $tax = $xml1->result->taxRate; $members = $xml1->result->memberCount; $username = $_SESSION['username']; mysql_query("INSERT INTO `corps` (`editid` , `id` , `name` , `ticker` , `alliance` , `ceo` , `tax` , `members` , `hq` , `apidate` , `notes` , `notedate` , `updatedby`) VALUES ( '' , '$corpid', '$cname', '$ticker', '$alliance', '$ceo', '$tax', '$members', '$station', NOW(), '', '', '$username')"); header('Location: main.php?id=corpsearch.php&name='.$corpname); exit; } } ?> Any one with any ideas? |