PHP - <meta> Vs <head> Help Needed \= Redirecting Problems >.<
How would I redirect if the code is after the <head> tag?
My code is a bit complicated and needs to go under my html code but wont redirect successfully because of <head>. I'm using Code: [Select] print("<meta http-equiv='Refresh' content='0;index.php' />"); to redirect. Similar TutorialsI have made a classified website. it works and I am proud of it. But as far as securing it goes, I have done almost nothing and I am sure, if in case the site becomes popular, it would be compromised with ease. So I have started reading a book ' essential php security' and am reading several articles on php security online , but am still unable to wrap my head around the whole security issue. Can someone help me ? there are a lot of unfamiliar topics, filtering, escaping , validating, session hijacking etc etc and it all goes over my head. Its a classified website , considering this on what should I concentrate on as far as security goes ? btw what I have managed to do is use mysql_real_escape_string on every var going into a mysql $query. Thanks Ok, so I've read a few tutorials of OOP and have a basic understanding of how it works but where is it generally handy? I have a basic site created with PHP that consists of a form that submits data to MySQL and then lists the data from the MySQL database on another page. Kind of like a little online planner. I don't see how me converting my site to use OOP would help here. Maybe it's best for more complex situations such as a shopping cart where data needs to be shared across multiple pages? hey guys how you doing? I've been having a little bit of problem with php, in fact I'm frustrated, so please if you can help me in any tight of way, please do, I've been trying to make this php code work, but it won't, i don't know what I'm doing wrong, I'm new to php and mysql every time i try it, it saids one thing Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\siteN\approvescore.php:3) in C:\xampp\htdocs\siteN\authorize.php on line 17 <?php require_once ('authorize.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Guitar Wars - Approve a High Score</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <h2>Guitar Wars - Approve a High Score</h2> <?php require_once('appvars.php'); require_once('connectvars.php'); if (isset($_GET['id']) && isset($_GET['date']) && isset($_GET['name']) && isset($_GET['score'])) { // Grab the score data from the GET $id = $_GET['id']; $date = $_GET['date']; $name = $_GET['name']; $score = $_GET['score']; $screenshot = $_GET['screenshot']; } else if (isset($_POST['id']) && isset($_POST['name']) && isset($_POST['score'])) { // Grab the score data from the POST $id = $_POST['id']; $name = $_POST['name']; $score = $_POST['score']; } else { echo '<p class="error">Sorry, no high score was specified for approval.</p>'; } if (isset($_POST['submit'])) { if ($_POST['confirm'] == 'Yes') { // Connect to the database $dbc = mysqli_connect('localhost', '999', 'adsd', 'guitarwars3'); // Approve the score by setting the approved column in the database $query = "UPDATE gtwars1 SET approved = 1 WHERE id = $id"; mysqli_query($dbc, $query); mysqli_close($dbc); // Confirm success with the user echo '<p>The high score of ' . $score . ' for ' . $name . ' was successfully approved.'; } else { echo '<p class="error">Sorry, there was a problem approving the high score.</p>'; } } else if (isset($id) && isset($name) && isset($date) && isset($score)) { echo '<p>Are you sure you want to approve the following high score?</p>'; echo '<p><strong>Name: </strong>' . $name . '<br /><strong>Date: </strong>' . $date . '<br /><strong>Sco </strong>' . $score . '</p>'; echo '<form method="post" action="approvescore.php">'; echo '<img src="' . GW_UPLOADPATH . $screenshot . '" width="160" alt="Score image" /><br />'; echo '<input type="radio" name="confirm" value="Yes" /> Yes '; echo '<input type="radio" name="confirm" value="No" checked="checked" /> No <br />'; echo '<input type="submit" value="Submit" name="submit" />'; echo '<input type="hidden" name="id" value="' . $id . '" />'; echo '<input type="hidden" name="name" value="' . $name . '" />'; echo '<input type="hidden" name="score" value="' . $score . '" />'; echo '</form>'; } echo '<p><a href="admin.php"><< Back to admin page</a></p>'; ?> Hi All, I am trying to use headers at the end of functions to put the user where they need to be. header("location: register.php?user_may_exist"); I understand how they work and their qwuirks. My issue is, in my head file, i am outputting which causes issues for the headers which come after. I have the following in head.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> <?php if(isset($currentPageTitle)){ echo $currentPageTitle; }else{ echo 'Cricket Club'; }; ?> </title> <?php if(isset($currentPageMeta)){ echo "<meta name='description' content='$currentPageMeta'>"; }else{ echo "<meta name='description' content='All the latest from CC'>"; }; ?> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> Is there a better way for me to achieve this? first i have a standard html page. Just a form that submits data to upload.php http://pixel.imgboard.co.uk here is upload.php - note i know i have some weird echo's but ive been trying for 2 hours to get upload.php to display something... but nothing happens.. i cant even get it to output html. It just goes to upload.php and has a blank page. When i view source there is nothing there. Its literally a blank page. I can't work it out. someone please help. I'm going to crack up. <?php ini_set("display_errors", "1"); error_reporting(E_ALL); session_start(); include 'http://www.imgboard.co.uk/includes/functions.php'; $start = " <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> <link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.imgboard.co.uk/style/pixel.css\" /> <title> Pixel - Image Hosting Beta</title> </head> <body> <div id =\"wrapper\"> <div class = 'titlebar'> <div class = 'titlebarlinkbox'> <a href = 'http://www.imgboard.co.uk'>Forum</a> <a href = 'http://www.imgboard.co.uk/Wiki.php'>Wikis</a> <a href = 'http://www.imgboard.co.uk/bulletins/0'>Bulletins</a> <a href = 'http://www.imgboard.co.uk/faq/0'>Faq's</a> </div> </div> <div class = \"logo\"></div> "; $end = " <div class = 'footerLinks'> Pixel @ 2010 - 2015 ! <br /> <a href = 'http://www.imgboard.co.uk'>Forum</a> | <a href = 'http://www.imgboard.co.uk/Wiki.php'>Wikis</a> | <a href = 'http://www.imgboard.co.uk/bulletins/0'>Bulletins</a> | <a href = 'http://www.imgboard.co.uk/faq/0'>Faq's</a> | <a href = 'http://www.imgboard.co.uk/pixel/report.php'>Report Image</a> </div> <div class = 'TnC'>Pixel is a Trademark of imgboard.co.uk. Please ensure all content uploaded is decent. No Taboo, cp, gore allowed. Porn / memes / misc themes all welcome. Any offensive content will be removed and deleted. Any misuse of the service and result in banning and in seviere cases prosecution.</div> </div> </body> </html> "; if(isset($_GET['uploadfile'])){ echo $start; echo $end; $validExtensions = array("png", "gif", "jpeg", "jpg", "bmp"); $ext = end(explode(".",$_FILES["image"]["name"])); $ext2= strtolower($ext); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/bmp") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 10000000)) && in_array($ext2,$validExtensions)) { //create a unique name. $newname = date(dmYhis); $newname .= rand(1111,9999); //preg replace non alpha numeric characters $fname = $_FILES['file']['name']; $newname = $newname . "." .$ext2; $location = "http://www.imgboard.co.uk/images/".$newname; //copy the file. if(move_uploaded_file($_FILES['file']['tmp_name'],$location)){ //file uploaded create display Page. $t = $_POST['tags']; add_uploaded_image($location,$t); file_upload_display_page($location); } else{ die("Error Occured Moving File"); } } else{ die("wrong mime type"); } } function add_uploaded_image($link, $tags){ $c = protect($_COOKIE['supercookie']); $ip = $_SERVER['REMOTE_ADDR']; $t = protect($tags); mysql_query("INSERT INTO pixel (filename,tags,date,ip,cookie) VALUES ('$link','$t',NOW(),'$ip','$c')") or die(mysql_error()); } function file_upload_display_page($location){ echo " <table class = 'uploadTable' cellspacing = '0'> <tr> <td class = \"label\"> Image Uploaded: </td><td><img src = '$location' HEIGHT = '150'/> </td> </tr> <tr> <td class = \"label\"> Direct Link: </td><td><input type = 'text' name = 'file' id = 'file' value = '$location'/> </td> </tr> <tr> <td class = \"label\"> Html Code </td><td><input type = 'text' name = 'tags' value = \"<img src = '$location' ALT = 'Hosted On http://Pixel.imgboard.co.uk'/>\"/> </td> </tr> <tr> <td> <td class = \"label\"> BB Code: </td><td><input type = 'text' name = 'file' id = 'file' value = '[img]http://$location[/img]'/> </td> </td> </tr> </table> "; } how you doing guys. I'm having a little bit of a problem right now, with this thing call view-profile.php, i hope you guys know what it is, I'm new to php, so please try to help. it says the same thing everytime. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\siteS\viewprofile.php on line 26 There was a problem accessing your profile <h3>Mismatch - View Profile</h3> <?php require_once('appvars.php'); require_once('connectvars.php'); // Connect to the database $dbc = mysqli_connect('localhost', '***', '*****', '*****'); // Grab the profile data from the database if (!isset($_GET['user_id'])) { $query = "SELECT username, first_name, last_name, gender, birthdate, city, state, picture FROM mismatch_user WHERE user_id = '$user_id'"; } else { $query = "SELECT username, first_name, last_name, gender, birthdate, city, state, picture FROM mismatch_user WHERE user_id = '" . $_GET['user_id'] . "'"; } $data = mysqli_query($dbc, $query); line26-----------> if (mysqli_num_rows($data) == 1) { // The user row was found so display the user data $row = mysqli_fetch_array($data); echo '<table>'; if (!empty($row['username'])) { echo '<tr><td class="label">Username:</td><td>' . $row['username'] . '</td></tr>'; } if (!empty($row['first_name'])) { echo '<tr><td class="label">First name:</td><td>' . $row['first_name'] . '</td></tr>'; } if (!empty($row['last_name'])) { echo '<tr><td class="label">Last name:</td><td>' . $row['last_name'] . '</td></tr>'; } if (!empty($row['gender'])) { echo '<tr><td class="label">Gender:</td><td>'; if ($row['gender'] == 'M') { echo 'Male'; } else if ($row['gender'] == 'F') { echo 'Female'; } else { echo '?'; } echo '</td></tr>'; } if (!empty($row['birthdate'])) { if (!isset($_GET['user_id']) || ($user_id == $_GET['user_id'])) { // Show the user their own birthdate echo '<tr><td class="label">Birthdate:</td><td>' . $row['birthdate'] . '</td></tr>'; } else { // Show only the birth year for everyone else list($year, $month, $day) = explode('-', $row['birthdate']); echo '<tr><td class="label">Year born:</td><td>' . $year . '</td></tr>'; } } if (!empty($row['city']) || !empty($row['state'])) { echo '<tr><td class="label">Location:</td><td>' . $row['city'] . ', ' . $row['state'] . '</td></tr>'; } if (!empty($row['picture'])) { echo '<tr><td class="label">Pictu </td><td><img src="' . MM_UPLOADPATH . $row['picture'] . '" alt="Profile Picture" /></td></tr>'; } echo '</table>'; if (!isset($_GET['user_id']) || ($user_id == $_GET['user_id'])) { echo '<p>Would you like to <a href="editprofile.php">edit your profile</a>?</p>'; } } // End of check for a single row of user results else { echo '<p class="error">There was a problem accessing your profile.</p>'; } mysqli_close($dbc); ?> I'm trying to create a web ' order form ' basically i've been trying to miss match different guides online and im very confused! Can someone fix it so it would e-mail me the data I have a PHP enabled web host / server... all this is very new to me and its a complex form i need Thanks In advance! this is the code I have : </head> <body> <form> <form method="POST" action="thanks.php"> <table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#3E55A7" bgcolor="#C7CFE9"> <tr> <td colspan="10" bgcolor="3e55a7" class="style9"><div align="center">CUSTOMER ORDER FORM </div> <div align="center"></div></td> </tr> <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9"> <td colspan="10" bgcolor="#C7CFE9"><div align="center"></div></td> </tr> <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9"> <td colspan="4" class="style17"><strong>NAME <input name="custname" type="text" class="style17" tabindex="1" size="53"> </strong></td> <td width="86"> </td> <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9"> <td colspan="4" class="style17"><strong>ADDRESS<span class="style15"> <textarea name="custadd" cols="50" class="style17" tabindex="2"></textarea> </span></strong></td> <td class="style15"> </td> </tr> <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9"> <td height="24" colspan="4" class="style17">TOWN<span class="style15"> <input name="custtown" type="text" class="style17" id="custtown" tabindex="3" size="53"> </span></td> <td class="style15"> </td> </tr> <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9"> <td height="24" colspan="4" class="style17"><strong>POSTCODE<span class="style15"> <input name="custcode" type="text" class="style17" id="custcode" tabindex="3.5" size="53"> </span></strong></td> <td class="style15"> </td> </tr> <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9"> <td height="27" colspan="4" class="style17"><strong>PHONE<span class="style15"> <input name="custphone" type="text" class="style17" id="custphone" tabindex="4" size="53"> </span></strong></td> <td class="style15"> </td> </tr> <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9"> <td height="42" colspan="4" class="style17"><strong>EMAIL<span class="style15"> <input name="re_Email" type="text" class="style17" id="re_Email" tabindex="5" size="53"> </span></strong></td> <td class="style15"> </td> </tr> <tr bgcolor="#F5F4FD"> <td width="94">Item Number </td> <td width="86">Page Number </td> <td width="84">Product Code </td> <td width="215">Description</td> <td>Price</td> <td width="62">QTY</td> <td width="57">Total</td> </tr> <tr bgcolor="#F5F4FD"> <td>1</td> <td><input name="pg2" type="text" class="style17" id="pg2" tabindex="13" size="8"></td> <td><input name="pg2" type="text" class="style17" id="pg2" tabindex="13" size="8"></td> <td><input name="cd2" type="text" class="style17" id="cd2" tabindex="14" size="9"></td> <td><input name="desc2" type="text" class="style17" id="desc2" tabindex="15" size="12"></td> <td bordercolor="#3E55A7"><input name="price2" type="text" class="style17" id="price2" tabindex="16" size="6"></td> <td><input name="qty2" type="text" class="style17" id="qty2" tabindex="17" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>2</td> <td><input name="pg3" type="text" class="style17" id="pg3" tabindex="18" size="8"></td> <td><input name="pg3" type="text" class="style17" id="pg3" tabindex="18" size="8"></td> <td><input name="cd3" type="text" class="style17" id="cd3" tabindex="19" size="9"></td> <td><input name="desc3" type="text" class="style17" id="desc32" tabindex="20" size="12"></td> <td><input name="price3" type="text" class="style17" id="price3" tabindex="21" size="6"></td> <td><input name="qty3" type="text" class="style17" id="qty3" tabindex="22" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>3</td> <td><input name="pg4" type="text" class="style17" id="pg4" tabindex="23" size="8"></td> <td><input name="pg4" type="text" class="style17" id="pg4" tabindex="23" size="8"></td> <td><input name="cd4" type="text" class="style17" id="cd4" tabindex="24" size="9"></td> <td><input name="desc4" type="text" class="style17" id="desc42" tabindex="25" size="12"></td> <td><input name="price4" type="text" class="style17" id="price4" tabindex="26" size="6"></td> <td><input name="qty4" type="text" class="style17" id="qty42" tabindex="27" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>4</td> <td><input name="pg5" type="text" class="style17" id="pg5" tabindex="28" size="8"></td> <td><input name="pg5" type="text" class="style17" id="pg5" tabindex="28" size="8"></td> <td><input name="cd5" type="text" class="style17" id="cd5" tabindex="29" size="9"></td> <td><input name="desc5" type="text" class="style17" id="desc5" tabindex="30" size="12"></td> <td><input name="price5" type="text" class="style17" id="price5" tabindex="31" size="6"></td> <td><input name="qty5" type="text" class="style17" id="qty5" tabindex="32" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>5</td> <td><input name="pg6" type="text" class="style17" id="pg6" tabindex="33" size="8"></td> <td><input name="pg6" type="text" class="style17" id="pg6" tabindex="33" size="8"></td> <td><input name="cd6" type="text" class="style17" id="cd6" tabindex="34" size="9"></td> <td><input name="desc6" type="text" class="style17" id="desc6" tabindex="35" size="12"></td> <td><input name="price6" type="text" class="style17" id="price6" tabindex="36" size="6"></td> <td><input name="qty6" type="text" class="style17" id="qty6" tabindex="37" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>6</td> <td><input name="pg7" type="text" class="style17" id="pg7" tabindex="38" size="8"></td> <td><input name="pg7" type="text" class="style17" id="pg7" tabindex="38" size="8"></td> <td><input name="cd7" type="text" class="style17" id="cd7" tabindex="39" size="9"></td> <td><input name="desc7" type="text" class="style17" id="desc7" tabindex="40" size="12"></td> <td><input name="price7" type="text" class="style17" id="price172" tabindex="41" size="6"></td> <td><input name="qty7" type="text" class="style17" id="qty7" tabindex="42" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>7</td> <td><input name="pg8" type="text" class="style17" id="pg8" tabindex="43" size="8"></td> <td><input name="pg8" type="text" class="style17" id="pg8" tabindex="43" size="8"></td> <td><input name="cd8" type="text" class="style17" id="cd8" tabindex="44" size="9"></td> <td><input name="desc8" type="text" class="style17" id="desc8" tabindex="45" size="12"></td> <td><input name="price8" type="text" class="style17" id="price8" tabindex="46" size="6"></td> <td><input name="qty8" type="text" class="style17" id="qty8" tabindex="47" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>8</td> <td><input name="pg9" type="text" class="style17" id="pg9" tabindex="48" size="8"></td> <td><input name="pg9" type="text" class="style17" id="pg9" tabindex="48" size="8"></td> <td><input name="cd9" type="text" class="style17" id="cd9" tabindex="49" size="9"></td> <td><input name="desc9" type="text" class="style17" id="desc9" tabindex="50" size="12"></td> <td><input name="price9" type="text" class="style17" id="price9" tabindex="51" size="6"></td> <td><input name="qty9" type="text" class="style17" id="qty9" tabindex="52" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>9</td> <td><input name="pga" type="text" class="style17" id="pga" tabindex="53" size="8"></td> <td><input name="pga" type="text" class="style17" id="pga" tabindex="53" size="8"></td> <td><input name="cda" type="text" class="style17" id="cda" tabindex="54" size="9"></td> <td><input name="desca" type="text" class="style17" id="desca" tabindex="55" size="12"></td> <td><input name="pricea" type="text" class="style17" id="pricea" tabindex="56" size="6"></td> <td><input name="qtya" type="text" class="style17" id="qtya" tabindex="57" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td>10</td> <td><input name="pgb" type="text" class="style17" id="pgb" tabindex="58" size="8"></td> <td><input name="pgb" type="text" class="style17" id="pgb" tabindex="58" size="8"></td> <td><input name="cdb" type="text" class="style17" id="cdb" tabindex="59" size="9"></td> <td><input name="descb" type="text" class="style17" id="descb" tabindex="60" size="12"></td> <td><input name="priceb" type="text" class="style17" id="priceb" tabindex="61" size="6"></td> <td><input name="qtyb" type="text" class="style17" id="qtyb" tabindex="62" size="3"></td> </tr> <tr bgcolor="#F5F4FD"> <td> </td> <td> </td> <td> </td> <td> </td> <td><div align="right">Total</div></td> <td><input name="pricec" type="text" class="style17" id="pricec" tabindex="66" size="6"></td> <td><input name="qtyc" type="text" class="style17" id="qtyc" tabindex="67" size="3"></td> </tr> <tr bgcolor="#3E55A7"> <td colspan="10" class="style9"> </td> </tr> <tr align="left" valign="top" bordercolor="#FFFFFF" bgcolor="#C7CFE9"> <td colspan="10" class="style10"><span class="style17">COMMENTS / DELIVERY INSTRUCTIONS: </span><br> <textarea name="comments" cols="30" rows="3" class="style17" id="comments"></textarea> <br></td> </tr> <tr bgcolor="#3E55A7"> <td colspan="10" class="style13"> </td> </tr> <tr bgcolor="#3E55A7"> <td colspan="10" class="style13"> </td> </tr> </table> <table width="80%" border="0"> <tr> <th scope="col"> </th> </tr> </table> <input type="SUBMIT" name="Submit" value="Submit Order"> It's not usual I ask questions on here - I usually help rather than be helped but alas, this is really confusing ! Short Story (You can skip this to "Your Mission") Without going into unnecessary detail i'll try to explain what i'm trying to do; Take an array (example provided...) Array( // These must be here, they are initially read by the template parser to get a starting point. "data"=>Array( "template"=>"main", // Template to start from (base template) "content"=>"%custom_topmenu% <Br/>Table<Br/> %bigtablecustom1%", // replace %content% tag,Shows 2 Examples, A Custom Menu, and Main Table with Smaller Tables inside ), // Below is numerically indexed arrays of content that will replace tags in the above "content" item 0=>Array( "data"=>Array( "rkey"=>"%bigtablecustom1%", // MUST have this item "template"=>"bigtable_single", // MUST have this item 0=>Array( "%title%"=>"Some Table Heading", "%footer%"=>"Some Table Footer Message (author?)", "%content%"=>"Some Content for the table with another rkey: %smalltablecustom1% --- %smalltablecustom2%", "%title_note%"=>"Some Time and Date" ) ), 0=>Array( "data"=>Array( "rkey"=>"%smalltablecustom1%", "template"=>"smalltable_single", 0=>Array( "%title%"=>"Small Title", "%content%"=>"Some Small Content or Note" ) ) ), 1=>Array( "data"=>Array( "rkey"=>"%smalltablecustom2%", "template"=>"smalltable_single", 0=>Array( "%title%"=>"Small Title 2", "%content%"=>"Some Small Content or Note" ) ) ) ) 1=>Array( // The menu is dynamically created by the module using it's inherited protected methods. "data"=>Array( "rkey"=>"%custom_topmenu%", "template"=>"custom_topmenu", 0=>Array( "%item1_name%"=>"Sub-Link 1", "%item1_link%"=>"#", "%item2_name%"=>"Sub-Link 2", "%item2_link%"=>"#", "%item3_name%"=>"Sub-Link 3", "%item3_link%"=>"#", "%item4_name%"=>"Sub-Link 4", "%item4_link%"=>"#" ) ) ) ) Turn this array into a single document, basically collpase all items with their children in the parent code. The Problem (You can skip this to "Your Mission") Now to make it easier and to (try) to prevent cross-tag contamination (so templates dont replace content that is supposed to be there from other template files...) I have wrote a recursion function that fills out all the content and removes the content sub-array from the data arrays (half the job). So now I have a multi-dimensional array that needs collapsing into a single document (variable), I am getting confused with how to go through this array (below - not above) so that all the template items are "inserted" inside their parent array items. The Function I made // Recursive, goes through an array and converts any "data" into actual templates. (Puts the content into a template) private function parse_template_data_array($array){ // First let's count how many items are in the array that was passed to us $item_count = count($array); // This should never happen, each array should have at least a "data" array inside. if($item_count < 1){ // Template Parser Fatal Object Syntax Error exit("FATAL PARSER ERROR1"); // If there is only one item, we don't need to recurse (There are no "child" elements) and so we skip the recursive section. }else if($item_count == 1){ // No items to parse, move on // So there are some child elements we must recurse through. }else{ // So this loops each "Child" element and passes that array to this function (recurse), Once it's finished it saves the array (result). for($i=0;$i<($item_count-1);$i++){ // -1 from the count, 1 to get rid of the data array. $array[$i] = $this->parse_template_data_array($array[$i]); } } // This part does the initial "template expansion", it finds the template needed for this item and saves it with the content to this item. // So we count how many data items we have $dcount = count($array['data']); // Count Data Items (minimum of 2 - Each data array must have "rkey" and "template") // If there isn't at least two items then someone made a booboo. if($dcount < 2){ // Template Parser Fatal Object Syntax Error exit("FATAL PARSER ERROR2"); // Otherwise let's sort this content out (We don't check if we only have the 2 minimum items since templates might not have Tags to replace). }else{ // Load Template file using the "template" item in the data array. $template = $this->get_file($array['data']['template']); // Count the amount of data items (content) to replace tags inside the loaded template (If there is no content sub-array then put to 0 to skip the below part). $dstrcount = (isset($array['data'][0]))? count($array['data'][0]) : 0; // No template content, maybe no tags, just give the template content back. if($dstrcount < 1){ // No items to parse // We have some content to replace. }else{ // We need the keys of the content sub-array so we can use (a neat feature of) the str_replace function. $akeys = array_keys($array['data'][0]); $template = str_replace($akeys ,$array['data'][0],$template); } // Save the result into this array item so we can pass the whole item back (This is also what happens when it recurses above) $array['data']['content'] = $template; } // Return the result array. return $array; } The Array returned by the above function Array ( [data] => Array ( [rkey] => %cdb_res_tpl_blk% [template] => main [content] => <html><head></head><body>%custom_topmenu%<br />%bigtablecustom1%</body></html> ) [0] => Array ( [data] => Array ( [rkey] => %bigtablecustom1% [template] => bigtable_single [content] => "Some Table Heading"=>"Some Table Heading", "Some Table Footer Message (author?)"=>"Some Table Footer Message (author?)", "Some Content for the table with another rkey: %smalltablecustom1% --- %smalltablecustom2%"=>"Some Content for the table with another rkey: %smalltablecustom1% --- %smalltablecustom2%", "Some Time and Date"=>"Some Time and Date" ) [0] => Array ( [data] => Array ( [rkey] => %smalltablecustom1% [template] => smalltable_single [content] => "Small Title"=>"Small Title", "Some Small Content or Note"=>"Some Small Content or Note" ) ) [1] => Array ( [data] => Array ( [rkey] => %smalltablecustom2% [template] => smalltable_single [content] => "Small Title 2"=>"Small Title", "Some Small Content or Note"=>"Some Small Content or Note" ) ) ) [1] => Array ( [data] => Array ( [rkey] => %custom_topmenu% [template] => custom_topmenu [content] => "Sub-Link 1"=>"Sub-Link 1", "#"=>"#", "Sub-Link 2"=>"Sub-Link 2", "#"=>"#", "Sub-Link 3"=>"Sub-Link 3", "#"=>"#", "Sub-Link 4"=>"Sub-Link 4", "#"=>"#" ) ) ) Your mission (Should you choose to accept ofc ), is to take the above array and turn it into a single html variable, with all the child elements inside their parent templates by replacing the tags in the array. All the data required is in the array, all that is needed is to "collapse" the array. Things to bear in mind: %cdb_res_tpl_blk% - This is in the original template file, so the result of a successfull collapse will replace this tag with the result. Dont worry about this one [rkey] - This is the "Tag" to replace in the "parent" content. [template] - This is the template file. [content] - This is the content that needs to go inside the parent item. Expected Result <html><head></head><body>"Sub-Link 1"=>"Sub-Link 1", "#"=>"#", "Sub-Link 2"=>"Sub-Link 2", "#"=>"#", "Sub-Link 3"=>"Sub-Link 3", "#"=>"#", "Sub-Link 4"=>"Sub-Link 4", "#"=>"#"<br />"Some Table Heading"=>"Some Table Heading", "Some Table Footer Message (author?)"=>"Some Table Footer Message (author?)", "Some Content for the table with another rkey: "Small Title"=>"Small Title","Some Small Content or Note"=>"Some Small Content or Note" --- "Small Title 2"=>"Small Title","Some Small Content or Note"=>"Some Small Content or Note""=>"Some Content for the table with another rkey: %smalltablecustom1% --- %smalltablecustom2%", "Some Time and Date"=>"Some Time and Date"</body></html> I will be working on this myself and if I find a solution I will post here. It is just that the way I code is I put my idea in my head, then try to code it in my head categorically, but when I think I find a solution it seems there is a bug, such as it will only collpase the main element, the bigtable, and the first small table, it wont do the other small table and not the menu either so basically it doesnt recurse items in the same array, only those underneath it. I'm so close but yet...so far... THANK YOU for ANY light you can shed on this situation it's been bugging me for a few days now (admittely have not coded since my first attempt - so tired.) My Code I won't provide the code I've done for it now since it just flat-out doesn't work, I've lost the code that I mentioned earlier that was bugged I modified and to be perfectly honest can't be bothered to reproduce it (it won't get me anywhere). Hi all i provided a little code to someone in the misc thread to block users based on the user agent language as an alternative to ipaddresses. I used switch for this but the each line is executed even if my language code is different. Anyone have an idea why the switch code below is messing with me? <?php if ( isset( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ) ){ $languages = strtolower( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ); // $languages = ' fr-ch;q=0.3, da, en-us;q=0.8, en;q=0.5, fr;q=0.3'; // need to remove spaces from strings to avoid error $languages = str_replace( ' ', '', $languages ); $languages = explode( ",", $languages ); // do something when you don't like the language switch ($languages[0]) { // first array item case 'ko': // korea echo "do something or set a variable"; break; case 'ru-md'||'ru': // russia echo "do something or set a variable"; break; case 'zh-cn'||'zh-hk'||'zh-mo'||'zh-sg'||'zh-tw'||'zh': // china echo "do something or set a variable"; break; case 'ne': // india echo "do something or set a variable"; break; default: echo "good"; } } ?> I changed it to a different code that uses in_array() which works, but i really would love to know why the above is not working as intended, i looked at php.net, but didn't found something nice in the comments. Maybe a guru out here that knows? <?php if ( isset( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ) ){ $languages = strtolower( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ); // $languages = ' fr-ch;q=0.3, da, en-us;q=0.8, en;q=0.5, fr;q=0.3'; // need to remove spaces from strings to avoid error $languages = str_replace( ' ', '', $languages ); $languages = explode( ",", $languages ); // do something when you don't like the language $lang_array = array('ko','ru-md','ru','zh-cn','zh-hk','zh-mo','zh-sg','zh-tw','zh','ne'); if (in_array($languages[0], $lang_array)){ echo 'bad stuff'; }else{ echo 'good stuff'; } } ?> Thanks guys!! I am working on a temporary mobile site while I try and fix my main site. As I do this, I am trying to look at better ways to code. Is there any problem/danger to including the HTML Head? Since this block of code repeats - except for the < title > - I figure why code it multiple times. I was thinking of using an INCLUDE on this...
<head> <!-- METADATA --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width", height="device-height", initial-scale=1> <!-- TITLE --> <title>$title</title> <!-- STYLES --> <link type="text/css" rel="stylesheet" href="css/styles.css" /> </head>
Thoughts?
My website www.staceyxsolomon.com is only loading the header of my index.PHP page The full page is there i had double checke in the FTP It happened after my host put me onto another server, all settings carried over, please can somebody advise help if this is PHP related? include "header.php"; if(isset($_GET['post_id'])) { $select=mysqli_query($con,"select...."); while($data=mysqli_fetch_array($select)) { echo "bla bla bla"; to_head("<title>asd</title><meta itemprop="name" content="asdfasdf">..."); } } include "footer.php";This is samthing what i want... I have header.php and footer.php and any script ex news.php where how news and read SEO stuff from database and put in HEAD of the document. I tried with jquery like $("head").append(str); and it works but then i read google don't run jquery when vist website. This is done with drupal, wordpress and php-fusion Drupal: https://api.drupal.o...add_html_head/7 php-fusion: https://www.php-fusi...thread_id=30959 so it is possible but i don't know how. Any idea? Are there any problems with calling an include file from within the <header> tags? The reason I'm asking is that I'm trying to load a speficied Style sheet based on a user's location and so I'm running a short script to determine which Style sheet needs to be displayed ... and that script is called from within the header tag. I haven't heard of any problems with doing this in the past, but the script seems to be generating an extra set of <HTML> tags in my source code and I can't figure out why this might be! Thanks, Hey everyone, have taken a bit of a break (a couple of years) from all things PHP and generally web related, but now a project has popped up that I am really interested in figuring out. I am so, so sorry if this ends up being a very long and confusing post, but I am really hoping somebody out there might have some experience in doing this sort of thing, or maybe it is just MUCH simpler than I have convinced myself of, and I am making things unnecessarily hard for myself. First of all, I am not sure if this is as much of a coding question, or if I am just not managing to sort out the logic of it all in my head, but for some reason I just cant figure out where to get started. I am not looking for someone to tell me what to write per say, but just any advice at all that can head me in the right direction. Anyhow, here goes.. I have an automatically generated roster file, created by sabre airline solutions, that is automatically emailed out to all employees of the airline. It is a 28 day roster, and I am wanting to write a script of some sort that will automatically convert it into an ICS or Ical file for further integration with things I am doing. I have done a lot of reading about the formats of ics files, and I understand how they work, it is just writing something that will interpret the initial roster correctly that is stumping me, once I get the information out of it in a logical way, I think I can easily turn it into an ics. I was heading down the array pathway before, but I just keep getting to dead ends and methods that just arent practical. Here is a snippit from the original roster format: "31 AKL7494 LO APW 1250 APW 1210* - APW 23:20 0450 0620 01 AKL7494 0630 0091 AKL 0730 APW 1220- 03:50 24:50 73P AKL7494 1210 0094 APW 1310 AKL 1615* 04:05 00:30 73P 02 AKL7494 RST AKL 1645 AKL 0445* - AKL 0405 0535 34:15 12:00 03 AKL7506 0500 GT AKL 0500 HLZ 0700 02:00 - AKL7506 0085 HLZ 0800 BNE 0840 03:40 00:30 73P AKL7506 LO BNE 0910 BNE 0830* - BNE 23:20 0340 0710 04 AKL7506 0830 0074 BNE 0930 DUD 1610 03:40 00:50 73P AKL7506 0075 DUD 1700 BNE 1745 03:45 00:30 73P AKL7506 LO BNE 1815 BNE 1430* - BNE 20:15 0725 0945 05 AKL7506 LO APW 0050 APW 1210 - APW 11:20 0725 0945 AKL7506 1210 0094 APW 1310 AKL 1615* 04:05 -21:-4573P AKL7506 1430 0097 BNE 1530 APW 0020 04:50 17:25 73P 06 AKL7506 RST AKL 1645 AKL 0445* - AKL 0450 0620 83:45 12:00 " if a little clarification is needed.. (i know I needed it when I first began recieving these rosters!) the 31, 01, 02 etc are the dates of the month, the 31 only comes up if the month before ends halfway through a trip where the person is still away for work when the month turns over. the AKL,APW,BNE etc are airport/location codes, LO is layover (eg spending the night there) the other various times are departure times, arrival times (all in local time to wherever the person happens to be at the time) and also flight times, total duty times. The airport codes with numbers (eg AKL7506) is the trip code, meaning for that whole period you will be with the same crew, and away from your home port/base. The first problem I have encountered, is it is not consistent, some days will have 1 line, but layovers will take up one or two or more lines, so I cannot just separate the entries via line, i guess it has to be started wherever a numerical/date value begins the line? Also how do i split the data, based on white space in between (if that makes sense) I hope maybe this makes a little sense to someone, I know somebody has managed to write exactly what I am trying to do, for the exact same roster system, but for a different purpose, but I have had no luck getting in touch with this person. Thanks so much to anyone who can shed any light on this situation, Anna For eg. I would prefer to have a link like this in the head section.
<head> <script src="js/code.js"></script> </head>as oppose to like this. <head> <script> var _debug = false; var _placeholderSupport = function() { var t = document.createElement("input"); t.type = "text"; return (typeof t.placeholder !== "undefined"); }(); window.onload = function() { var arrInputs = document.getElementsByTagName("input"); var arrTextareas = document.getElementsByTagName("textarea"); var combinedArray = []; for (var i = 0; i < arrInputs.length; i++) combinedArray.push(arrInputs[i]); for (var i = 0; i < arrTextareas.length; i++) combinedArray.push(arrTextareas[i]); for (var i = 0; i < combinedArray.length; i++) { var curInput = combinedArray[i]; if (!curInput.type || curInput.type == "" || curInput.type == "text" || curInput.type == "textarea") HandlePlaceholder(curInput); else if (curInput.type == "password") ReplaceWithText(curInput); } if (!_placeholderSupport) { for (var i = 0; i < document.forms.length; i++) { var oForm = document.forms[i]; if (oForm.attachEvent) { oForm.attachEvent("onsubmit", function() { PlaceholderFormSubmit(oForm); }); } else if (oForm.addEventListener) oForm.addEventListener("submit", function() { PlaceholderFormSubmit(oForm); }, false); } } }; function PlaceholderFormSubmit(oForm) { for (var i = 0; i < oForm.elements.length; i++) { var curElement = oForm.elements[i]; HandlePlaceholderItemSubmit(curElement); } } function HandlePlaceholderItemSubmit(element) { if (element.name) { var curPlaceholder = element.getAttribute("placeholder"); if (curPlaceholder && curPlaceholder.length > 0 && element.value === curPlaceholder) { element.value = ""; window.setTimeout(function() { element.value = curPlaceholder; }, 100); } } } function ReplaceWithText(oPasswordTextbox) { if (_placeholderSupport) return; var oTextbox = document.createElement("input"); oTextbox.type = "text"; oTextbox.id = oPasswordTextbox.id; oTextbox.name = oPasswordTextbox.name; //oTextbox.style = oPasswordTextbox.style; oTextbox.className = oPasswordTextbox.className; for (var i = 0; i < oPasswordTextbox.attributes.length; i++) { var curName = oPasswordTextbox.attributes.item(i).nodeName; var curValue = oPasswordTextbox.attributes.item(i).nodeValue; if (curName !== "type" && curName !== "name") { oTextbox.setAttribute(curName, curValue); } } oTextbox.originalTextbox = oPasswordTextbox; oPasswordTextbox.parentNode.replaceChild(oTextbox, oPasswordTextbox); HandlePlaceholder(oTextbox); if (!_placeholderSupport) { oPasswordTextbox.onblur = function() { if (this.dummyTextbox && this.value.length === 0) { this.parentNode.replaceChild(this.dummyTextbox, this); } }; } } function HandlePlaceholder(oTextbox) { if (!_placeholderSupport) { var curPlaceholder = oTextbox.getAttribute("placeholder"); if (curPlaceholder && curPlaceholder.length > 0) { Debug("Placeholder found for input box '" + oTextbox.name + "': " + curPlaceholder); oTextbox.value = curPlaceholder; oTextbox.setAttribute("old_color", oTextbox.style.color); oTextbox.style.color = "#c0c0c0"; oTextbox.onfocus = function() { var _this = this; if (this.originalTextbox) { _this = this.originalTextbox; _this.dummyTextbox = this; this.parentNode.replaceChild(this.originalTextbox, this); _this.focus(); } Debug("input box '" + _this.name + "' focus"); _this.style.color = _this.getAttribute("old_color"); if (_this.value === curPlaceholder) _this.value = ""; }; oTextbox.onblur = function() { var _this = this; Debug("input box '" + _this.name + "' blur"); if (_this.value === "") { _this.style.color = "#c0c0c0"; _this.value = curPlaceholder; } }; } else { Debug("input box '" + oTextbox.name + "' does not have placeholder attribute"); } } else { Debug("browser has native support for placeholder"); } } function Debug(msg) { if (typeof _debug !== "undefined" && _debug) { var oConsole = document.getElementById("Console"); if (!oConsole) { oConsole = document.createElement("div"); oConsole.id = "Console"; document.body.appendChild(oConsole); } oConsole.innerHTML += msg + "<br />"; } } </script> </head>How can I make that happen? I rather not show that awful long code in the head. Hello,
I've made a function that contains the html header (<head>). When I call that function in a other file, with the header file included, it puts the header function in the body. So all the meta tags are in the body, instead of the head.
Would it be possible to load this all in the head?
The head function does contain the html and head tags. However, without them, it still doesn't want to go to the head.
I've been trying to wrap my head around this for about two hours now. The file uploads just fine, the entry goes into the database just fine, EXCEPT for the file name like it's supposed to do. I wrote the code from scratch... it worked fine, then it broke (that's the way it's supposed to work, right?) Anyways, if anyone could take a look-see and point out what I'm missing? I've tried throwing errors on all the queries, I've made sure the filename is passed from the upload form, the form does have the proper enctype. require 'dbconfig.php'; $title = escape($_POST['title']); $content= escape($_POST['content']); $time = time(); //Check the file. if (!empty($_FILES['attachment'])) { //$filename = the name as saved on user's the computer. //$filename = $_FILES['attachment']['name']; if($_FILES['attachment']['type'] === 'image/jpeg' || $_FILES['attachment']['type'] === 'image/jpg' || $_FILES['attachment']['type'] === 'application/pdf') { //Move the file only if it's uploaded. if (is_uploaded_file($_FILES['attachment']['tmp_name'])) { //Whoops, an error. if (!move_uploaded_file($_FILES['attachment']['tmp_name'], './attachments/' . $_FILES['attachment']['name'])) { die('Error: File not uploaded. Please make sure it is a JPEG image or a PDF document.'); } else { $filename = $_FILES['attachment']['name']; } } } } if( $filename = '' || empty($_FILES['attachment'] )) { die('No attachment found. Please <a href="javascript: history.go(-1)">Go back</a>'); } if ($title === '') { die('News title is empty. Please <a href="javascript: history.go(-1)">Go back</a>'); } if ($content === '') { die('News content is empty. Please <a href="javascript: history.go(-1)">Go back</a>'); } else { if (mysql_query("INSERT INTO news (news_title, news_content, news_posted, news_edited, news_attach_path) VALUES ('$title', '$content', '$time', '0', '$filename')") or die(mysql_error())) { $posted = true; } else { $posted = false; } } ?> This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=319963.0 I'm trying to use a simple wsdl file and make a soap call but for the life of me I can't get it to work. Here's the wsdl file: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="urn:gnHPD_Staging_Table_Submit_Generic" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s="urn:gnHPD_Staging_Table_Submit_Generic" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xsd:schema elementFormDefault="qualified" targetNamespace="urn:gnHPD_Staging_Table_Submit_Generic"> <xsd:element name="Submit" type="s:InputMapping"/> <xsd:complexType name="InputMapping"> <xsd:sequence> <xsd:element name="Assigned_To_Group" type="xsd:string"/> <xsd:element name="AutoPush" type="s:AutoPushType"/> <xsd:element name="Case_Type" type="s:Case_TypeType"/> <xsd:element name="Category" type="xsd:string"/> <xsd:element name="Description" type="xsd:string"/> <xsd:element name="Details" type="xsd:string"/> <xsd:element name="Entry_Number" type="xsd:string"/> <xsd:element name="Integration_Application" type="xsd:string"/> <xsd:element name="Item" type="xsd:string"/> <xsd:element name="Priority" type="s:PriorityType"/> <xsd:element name="Source" type="s:SourceType"/> <xsd:element name="Submitter_UNIX" type="xsd:string"/> <xsd:element name="Summary" type="xsd:string"/> <xsd:element name="Type" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:simpleType name="AutoPushType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Auto Push"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="Case_TypeType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Incident"/> <xsd:enumeration value="Question"/> <xsd:enumeration value="Request"/> <xsd:enumeration value="Problem"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="PriorityType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="4"/> <xsd:enumeration value="3"/> <xsd:enumeration value="2"/> <xsd:enumeration value="1"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="SourceType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Phone"/> <xsd:enumeration value="Requester"/> <xsd:enumeration value="Email"/> <xsd:enumeration value="Web"/> <xsd:enumeration value="NMP"/> </xsd:restriction> </xsd:simpleType> <xsd:element name="SubmitResponse" type="s:OutputMapping"/> <xsd:complexType name="OutputMapping"> <xsd:sequence> <xsd:element name="StagingTable_ID" type="xsd:string"/> <xsd:element name="HelpDesk_ID" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="AuthenticationInfo" type="s:AuthenticationInfo"/> <xsd:complexType name="AuthenticationInfo"> <xsd:sequence> <xsd:element name="userName" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/> <xsd:element minOccurs="0" name="authentication" type="xsd:string"/> <xsd:element minOccurs="0" name="locale" type="xsd:string"/> <xsd:element minOccurs="0" name="timeZone" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </wsdl:types> <wsdl:message name="SubmitSoapOut"> <wsdl:part element="s:SubmitResponse" name="parameters"/> </wsdl:message> <wsdl:message name="SubmitSoapIn"> <wsdl:part element="s:Submit" name="parameters"/> </wsdl:message> <wsdl:message name="ARAuthenticate"> <wsdl:part element="s:AuthenticationInfo" name="parameters"/> </wsdl:message> <wsdl:portType name="gnHPD_Staging_Table_Submit_GenericPortType"> <wsdl:operation name="Submit"> <wsdl:input message="s:SubmitSoapIn"/> <wsdl:output message="s:SubmitSoapOut"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="gnHPD_Staging_Table_Submit_GenericSoapBinding" type="s:gnHPD_Staging_Table_Submit_GenericPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="Submit"> <soap:operation soapAction="urn:gnHPD_Staging_Table_Submit_Generic/Submit" style="document"/> <wsdl:input> <soap:header message="s:ARAuthenticate" part="parameters" use="literal"></soap:header> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="gnHPD_Staging_Table_Submit_GenericService"> <wsdl:documentation>Generic Submit for HD</wsdl:documentation> <wsdl:port binding="s:gnHPD_Staging_Table_Submit_GenericSoapBinding" name="gnHPD_Staging_Table_Submit_GenericSoap"> <soap:address location="http://gremedydev:9090/midtier/services/ARService?server=gremedydev&webService=gnHPD_Staging_Table_Submit_Generic"/> </wsdl:port> </wsdl:service> </wsdl:definitions> Here's my php code: $params = array( "Submitter_UNIX"=>'myunix', "Source"=>'Web', "Summary"=>'Test1', "Description"=>'Test1', "Category"=>'test services', "Type"=>'test solutions', "Item"=>'Problem', "Assigned_To_Group"=>'test solutions', "Case_Type"=>'Problem', "Priority"=>'4', "AutoPush" => 'Auto Push', "Details"=>'Test Details', "Entry_Number"=>'', "Integration_Application"=>'MyMobile' ); $client = new SoapClient('http://gremedydev:9090/midtier/WSDL/gremedydev/gnHPD_Staging_Table_Submit_Generic',array('trace' => 1 )); $result = $client->Submit($params); I get this reply Code: [Select] Fatal error: Uncaught SoapFault exception: [ns1:Server.userException] MessageType: 2 MessageNum: 149 MessageText: A user name must be supplied in the control record AppendedText: in D:\Inetpub\wwwroot\myMobile\test\testwsdl2.php:29 Stack trace: #0 [internal function]: SoapClient->__call('Submit', Array) #1 D:\Inetpub\wwwroot\myMobile\test\testwsdl2.php(29): SoapClient->Submit(Array) #2 {main} thrown in D:\Inetpub\wwwroot\myMobile\test\testwsdl2.php on line 29 The only thing I can think of missing here is headers but I have no idea how to configure that. Any insight is greately appreciated! Hi, I am trying to extract a address from a txt file (Emergency Pager Messages) and I've got to the point where I strip everything not needed in the string but I am left with this: BURNOFF THREATENING 33 SOMEPLACE RD MONTROSE My question is this, how do I strip everything BEFORE (which could be numerous different words) the number leaving just: 33 SOMEPLACE RD MONTROSE And second question how can I strip everything after the number (including the number itself) leaving just: BURNOFF THREATENING There can be a thousand different words before the number describing the job and yer as I said I need to strip them to leave the address but also need to strip the address leaving the description only... I hope that makes sense and I'd REALLY appreciate any pointers in the right direction... |