-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Surely thats easy to fix! in anycase try this <?php $code = preg_replace_callback('/(\[user=(.*?)\])/sim', "GetID", $code); function GetID($User) { $sql = mysql_query("SELECT ID FROM user_details WHERE username = '".mysql_real_escape_string($User[2])."' LIMIT 1"); $user = mysql_fetch_assoc($sql); if(mysql_num_rows($sql) == 0) { return "<a href=\"profile.php?user=$user['ID']\" target=\"_blank\">$user['ID']</a>;"; }else{ return "Invalid User!"; } } ?>
-
But this should be fine!!! $code = preg_replace('/\[user=(.*?)\]/sim', '<a href=\"profile.php?user=\1\" target=\"_blank\">\1</a>', $code); $code = preg_replace('%\[user\](.*?)\[/user\]%sim', '<a href=\"profile.php?user=\1\" target=\"_blank\">\1</a>', $code);
-
Yep.. the first replace is replacing them all!
-
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
Okay.. Backup your locator.php file and replace its contents with this one add the include on the Joomla Page and test this (of course i can't test it from here) <?php // ---------------------------------------------------------------------- // File : locator.php // Description : search and display list/view of stores // Version : 1.0 // Created : 1/6/2007 // // Version : 1.2 // Created : 08/04/2009 // // Copyright (c) 2007. All rights reserved. // // ---------------------------------------------------------------------- if(!isset($_GET['ajax'])) { ?> <script language="javascript"> function SubmitForm() { //we don't need to change anymore of this script var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); }catch(e){ // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { document.getElementById('locatorcontainer').innerHTML = xmlHttp.responseText; } } xmlHttp.open("GET", "locator.php?ajax=true&stateID="+document.getElementsByName('stateID').value+"&search="+document.getElementsByName('search').value+"&key="+document.getElementsByName('key').value,true); xmlHttp.send(null); } </script> <?php include("settings.php"); include("databasewrapper.php"); include("includes/countrydropdown.php"); print("<style>\n"); include("locator.css"); print("</style>\n"); } //Allow for magic quotes if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); $_REQUEST = array_map('stripslashes_deep', $_REQUEST); } //accept variables if (isset($_REQUEST['search'])) $strSearch = addslashes($_REQUEST['search']); else $strSearch = ""; if (isset($_REQUEST['key'])) $strKey = addslashes($_REQUEST['key']); else $strKey = ""; if (isset($_REQUEST['stateID'])) $strState = addslashes($_REQUEST['stateID']); else $strState = ""; if (isset($_REQUEST['country'])) $strCountry = addslashes($_REQUEST['country']); else $strCountry = ""; if (isset($_REQUEST['storeID'])) $intStoreID = addslashes($_REQUEST['storeID']); else $intStoreID = ""; if (isset($_REQUEST['pn'])) $intPage = $_REQUEST['pn']; else $intPage = 1; $intStartrecord = (($intPage*$intPublicpagesize)-($intPublicpagesize)); //maintain state between pages $strPublicstate = get_public_state(0); $strNavpublicstate = get_public_state(1); //main page control logic if(!isset($_GET['ajax'])) print("<div id=\"locatorcontainer\">\n"); if ($intStoreID != "") { location_info($intStoreID); }else{ if ($strSearch != "") { sql_prep(); $intRecordsfound = record_count($SQLstmt); $intTotalpages = get_page_total(); if ($intRecordsfound > 0) { sql_for_results(); search_feedback(); results_status(); location_list(); display_paged_navigation(); }else{ search_feedback(); no_records_found(); } }else{ location_search(); } } if(!isset($_GET['ajax'])) print("</div>\n"); // end locatorcontainer div // ---------------------------------------------------------------------- // Function : location_search // Description : prints a search form to query store locations // Usage : location_search() // // ---------------------------------------------------------------------- function location_search() { global $SetStateSearch, $SetCountrySearch; print("<div id=\"locatorform\">\n"); print("<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n"); print(" <tr>\n"); print(" <td class=\"locatorheading\">Find a Kitchen in your area</td>\n"); print(" </tr>\n"); print(" <tr><td align=\"right\" class=\"viewall\"><a href=\"" . $_SERVER['PHP_SELF'] . "?search=true\">view all</a></td></tr>\n"); print(" <tr>\n"); print("<form action=\"\" method=\"post\">\n"); print("<input type=\"hidden\" name=\"search\" value=\"true\">\n"); print(" <td class=\"formtext\"><span class=\"formheading\">Keyword</span> (Business Name, Postcode, Town or County etc.)<br>"); print("<input type=\"text\" name=\"key\"></td>\n"); print(" </tr>\n"); //if state search enabled if ($SetStateSearch == "ON") { print(" <tr>\n"); print(" <td>"); print("<span class=\"formheading\">County</span><br>\n"); include("includes/statedropdown.php"); print(" </td>\n"); print(" </tr>\n"); } //if country search enabled if ($SetCountrySearch == "ON") { print(" <tr>\n"); print(" <td>"); print("<span class=\"formheading\">Country</span><br>\n"); countrydropdown(); print(" </td>\n"); print(" </tr>\n"); } print(" <tr><td height=\"8\"></td></tr>\n"); print(" <tr>\n"); print(" <td><input type=\"image\" src=\"images/formbutton.gif\" value=\"submit\" onclick=\"SubmitForm();\" border=\"0\"></td>\n"); print(" </tr>\n"); print("</form>\n"); print("</table>\n"); print("</div>\n"); // end locatorform div } // ---------------------------------------------------------------------- // Function : location_list // Description : prints a list of stores based on search parameters // Usage : location_list() // // ---------------------------------------------------------------------- function location_list() { global $SQLstmt; global $strPublicstate; global $SetShowCountry; print("<div id=\"searchresults\">\n"); $resultSet = dbaction($SQLstmt); while ($row = getrsrow($resultSet)) { print("<div class=\"storerow\">\n"); if ($row['storename'] != "") print("<div class=\"rowheading\"><a href=\"" . $_SERVER['PHP_SELF'] . "?storeID=" . $row['storeID'] . "$strPublicstate\">" . $row['storename'] . "</a></div>\n"); if ($row['address'] != "") print $row['address'] . "<br>"; // build address remainder $strBuildaddress = ""; if ($row['suburb'] != "") $strBuildaddress .= $row['suburb']; if ($row['city'] != "") { if ($strBuildaddress != "") $strBuildaddress .= ", "; $strBuildaddress .= $row['city']; } if ($row['statename'] != "") { if ($row['suburb'] != "" || $row['city'] != "") $strBuildaddress .= ", "; $strBuildaddress .= $row['statename'] . "."; } if ($row['country'] != "" || $row['zippostcode'] != "") { $strBuildaddress .= "<br>"; if ($SetShowCountry == "ON") { if ($row['country'] != "") $strBuildaddress .= $row['country'] . " "; } if ($row['zippostcode'] != "") $strBuildaddress .= $row['zippostcode']; } if ($strBuildaddress != "") print $strBuildaddress; if ($row['telephone1'] != "") print "<br>" . $row['telephone1']; if ($row['telephone2'] != "") print "<br>" . $row['telephone2']; if ($row['maplink'] != "") { print("<div id=\"resultmaplink\">\n"); print("<a href=\"http://" . $row['maplink'] . "\" target=\"_blank\">View Profile</a> "); print("<a href=\"http://" . $row['maplink'] . "\" target=\"_blank\"><img src=\"images/mapicon.gif\" border=\"0\"></a>"); print("</div>\n"); } print("\n</div>\n"); // end storerow div } print("</div>\n"); // end searchresults div } // ---------------------------------------------------------------------- // Function : location_info // Description : prints complete information on a store // Usage : location_info($storeID) // // ---------------------------------------------------------------------- function location_info($storeID) { global $strPublicstate; global $SetShowStoreHours; global $SetShowCountry; $SQLstmt = "SELECT slstore.*, slstate.statename FROM slstore " . "LEFT JOIN slstate ON slstore.stateID = slstate.stateID " . "WHERE storeID = '$storeID'"; $resultSet = dbaction($SQLstmt); $row = getrsrow($resultSet); print("<div id=\"fullinfocontainer\">\n"); //return to results list link print("<div id=\"backtoresults\"><a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strPublicstate\">Back to results</a></div>\n"); print("<div id=\"fullinfotopsep\"></div>\n"); print("<div id=\"storename\">" . $row['storename'] ."</div>\n"); print("<div id=\"addressdescription\">\n"); print("<div id=\"addressbox\">\n"); if ($row['address'] != "") print $row['address'] . "<br>"; // build address remainder $strBuildaddress = ""; if ($row['suburb'] != "") $strBuildaddress .= $row['suburb']; if ($row['city'] != "") { if ($strBuildaddress != "") $strBuildaddress .= ", "; $strBuildaddress .= $row['city']; } if ($row['statename'] != "") { if ($row['suburb'] != "" || $row['city'] != "") $strBuildaddress .= ", "; $strBuildaddress .= $row['statename'] . "."; } if ($row['country'] != "" || $row['zippostcode'] != "") { $strBuildaddress .= "<br>"; if ($SetShowCountry == "ON") { if ($row['country'] != "") $strBuildaddress .= $row['country'] . " "; } if ($row['zippostcode'] != "") $strBuildaddress .= $row['zippostcode']; } if ($strBuildaddress != "") print $strBuildaddress; // telephone numbers if ($row['telephone1'] != "") print "<br>" . $row['telephone1']; if ($row['telephone2'] != "") print "<br>" . $row['telephone2']; print("</div>\n"); // end addressbox div print("<div id=\"descriptionbox\">\n"); if ($row['description'] != "") print $row['description']; print("</div>\n"); print("</div>\n"); // end addressdescription div //other comms if ($row['fax'] != "" || $row['website'] != "" || $row['email']) { print("<div id=\"othercomms\">\n"); print("<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">\n"); if ($row['fax'] != "") { print("<tr><td class=\"othercommstext\">Fax:</td><td class=\"othercommstext\">" . $row['fax'] . "</td></tr>\n"); } if ($row['website'] != "") { print("<tr><td class=\"othercommstext\">Website:</td><td class=\"othercommstext\"><a href=\"http://" . $row['website'] . "\" target=\"_blank\">" . $row['website'] . "</a></td></tr>\n"); } if ($row['email'] != "") { print("<tr><td class=\"othercommstext\">Email:</td><td class=\"othercommstext\"><a href=\"mailto:" . $row['email'] . "\">" . $row['email'] . "</td></tr>\n"); } print("</table>\n"); print("</div>\n"); } if ($SetShowStoreHours == "ON") { print("<div id=\"storehours\">\n"); if ($row['openmonday'] != "" || $row['closemonday'] != "" || $row['opentuesday'] != "" || $row['closetuesday'] != "" || $row['openwednesday'] != "" || $row['closewednesday'] != "" || $row['openthursday'] != "" || $row['closethursday'] != "" || $row['openfriday'] != "" || $row['closefriday'] != "" || $row['opensaturday'] != "" || $row['closesaturday'] != "" || $row['opensunday'] != "" || $row['closesunday'] != "") { //store hours print("<span class=\"fullheading\">Store Hours</span><br>\n"); print("<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">\n"); print(" <tr>\n"); print(" <td class=\"hourstext\"></td><td class=\"hourstext\">Open</td><td></td><td class=\"hourstext\">Close</td>\n"); print(" </tr>\n"); if ($row['openmonday'] != "" || $row['closemonday'] != "") { print(" <tr>\n"); print(" <td class=\"hourstext\" width=\"92\">Monday</td><td class=\"hourstext\">" . $row['openmonday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closemonday'] . "</td>"); print(" </tr>\n"); } if ($row['opentuesday'] !="" || $row['closetuesday'] != "") { print(" <tr>\n"); print(" <td class=\"hourstext\">Tuesday</td><td class=\"hourstext\">" . $row['opentuesday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closetuesday'] . "</td>"); print(" </tr>\n"); } if ($row['openwednesday'] !="" || $row['closewednesday'] != "") { print(" <tr>\n"); print(" <td class=\"hourstext\">Wednesday</td><td class=\"hourstext\">" . $row['openwednesday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closewednesday'] . "</td>"); print(" </tr>\n"); } if ($row['openthursday'] !="" || $row['closethursday'] != "") { print(" <tr>\n"); print(" <td class=\"hourstext\">Thursday</td><td class=\"hourstext\">" . $row['openthursday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closethursday'] . "</td>"); print(" </tr>\n"); } if ($row['openfriday'] !="" || $row['closefriday'] != "") { print(" <tr>\n"); print(" <td class=\"hourstext\">Friday</td><td class=\"hourstext\">" . $row['openfriday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closefriday'] . "</td>"); print(" </tr>\n"); } if ($row['opensaturday'] !="" || $row['closesaturday'] != "") { print(" <tr>\n"); print(" <td class=\"hourstext\">Saturday</td><td class=\"hourstext\">" . $row['opensaturday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closesaturday'] . "</td>"); print(" </tr>\n"); } if ($row['opensunday'] !="" || $row['closesunday'] != "") { print(" <tr>\n"); print(" <td class=\"hourstext\">Sunday</td><td class=\"hourstext\">" . $row['opensunday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closesunday'] . "</td>"); print(" </tr>\n"); } print("</table>\n"); } if ($row['opencloseinfo'] != "") { print ("<div id=\"extrahours\">" . $row['opencloseinfo'] . "</div>\n"); } print("</div>\n"); // end storehours div } //store manager if ($row['storemanager'] != "") print("<div id=\"storemanager\"><span class=\"fullheading\">Store Manager</span><br> " . $row['storemanager'] . "</div>\n"); //map link and directions if ($row['maplink'] != "") print("<div id=\"maplink\"><a href=\"http://" . $row['maplink'] . "\" target=\"_blank\">View Map</a></div>\n"); if ($row['directions'] != "") print("<div id=\"directions\"><span class=\"fullheading\">Directions</span><br>" . $row['directions'] . "</div>"); print("<div id=\"fullinfobottomsep\"></div>\n"); print("</div>\n"); // end fullinfocontainer } // ---------------------------------------------------------------------- // Function : sql_prep // Description : sets SQL variables to find number of records found // and prepare to run main query // Usage : sql_prep() // // ---------------------------------------------------------------------- function sql_prep() { global $SQLstmt, $SQLselect, $SQLfrom, $SQLwhere; global $strKey, $strState, $strCountry; global $SetDebug; //Build FROM part $SQLfrom = " FROM slstore LEFT JOIN slstate ON slstore.stateID = slstate.stateID"; //Build WHERE part $SQLwhere = " WHERE (recordstatus = 'active')"; if ($strKey != "" || $strState != "" || $strCountry != "") { if ($strKey != "") { $SQLwhere .= " AND (storename LIKE '%$strKey%' OR address LIKE '%$strKey%'" . " OR city LIKE '%$strKey%' OR suburb LIKE '%$strKey%' OR statename LIKE '%$strKey%'" . " OR country LIKE '%$strKey%' OR zippostcode LIKE '%$strKey%')"; } if ($strState != "") { $SQLwhere .= " AND (slstore.stateID = $strState)"; } if ($strCountry != "") { $SQLwhere .= " AND (country = '$strCountry')"; } } //SQL to find number of records $SQLselect = "SELECT COUNT(*)"; $SQLstmt = $SQLselect . $SQLfrom . $SQLwhere; if ($SetDebug == "ON") { print("<div class=\"debug\">$SQLstmt</div>"); } } // ---------------------------------------------------------------------- // Function : sql_for_results // Description : creates the remainder of the sql parts required and // sets the actual record retrieval SQL query // Usage : sql_for_results() // // ---------------------------------------------------------------------- function sql_for_results() { global $SQLstmt, $SQLselect, $SQLfrom, $SQLwhere, $SQLorder; global $intStartrecord; global $intPublicpagesize; global $SetDebug; //SQL to retrieve all or a subset of store records $SQLselect = "SELECT storeID, storename, address, city, suburb, country, " . "statename, zippostcode, telephone1, telephone2, maplink"; $SQLorder = " ORDER BY storename"; $SQLlimit = " LIMIT $intStartrecord, $intPublicpagesize"; $SQLstmt = $SQLselect . $SQLfrom . $SQLwhere . $SQLorder . $SQLlimit; if ($SetDebug == "ON") { print("<div class=\"debug\">$SQLstmt</div>\n"); } } // ---------------------------------------------------------------------- // Function : record_count // Description : returns number of records found during search // Usage : record_count($SQLstmt) // Parameters : $SQLstmt - SQL for total query record count // Returns : $intRecordsfound - how many records will be returned // by query // // ---------------------------------------------------------------------- function record_count($SQLstmt) { $resultSet = dbaction($SQLstmt); $row = getrsrow($resultSet); $intRecordsfound = $row[0]; return $intRecordsfound; } // ---------------------------------------------------------------------- // Function : get_page_total // Description : return the number of record result pages available // using the total number of records found and the // page size from the settings.php file // Usage : get_page_total() // Returns : intTotalpages - how many record result pages there are // given the number of records found and the page size // setting // // ---------------------------------------------------------------------- function get_page_total() { global $intRecordsfound; global $intPublicpagesize; if (fmod($intRecordsfound, $intPublicpagesize) == 0) { $intTotalpages = $intRecordsfound/$intPublicpagesize; } else { $intTotalpages = ceil($intRecordsfound/$intPublicpagesize); } return $intTotalpages; } // ---------------------------------------------------------------------- // Function : search_feedback // Description : prints feedback on search parameters // Usage : search_feedback() // // ---------------------------------------------------------------------- function search_feedback() { global $strKey, $strState, $strCountry; print("<div id=\"searchfeedback\">\n"); if ($strKey != "" || $strState != "" || $strCountry != "") { print("You searched on "); if ($strKey != "") print("Keyword: <span class=\"searchfeedbackbold\">" . stripslashes($strKey) . "</span> "); if ($strState != "") { $SQLstmt2 = "SELECT statename FROM slstate WHERE stateID = '$strState'"; $resultSet2 = dbaction($SQLstmt2); $row = getrsrow($resultSet2); print("County: <span class=\"searchfeedbackbold\">" . $row['statename'] . "</span> "); } if ($strCountry != "") print("Country: <span class=\"searchfeedbackbold\">" . stripslashes($strCountry) . "</span> "); } print("<span class=\"searchagain\"><a href=\"" . $_SERVER['PHP_SELF'] . "\">new search</a></span>\n"); print("</div>\n"); // end searchfeedback div } // ---------------------------------------------------------------------- // Function : results_status // Description : shows status info on the number of records returned in // a result list and which ones are currently shown // Usage : resultsstatus() // // ---------------------------------------------------------------------- function results_status() { global $intRecordsfound; global $intPage; global $intStartrecord; global $intPublicpagesize; print("<div id=\"recordsfound\">"); print("Showing results <span class=\"recordsfoundbold\">" . ($intStartrecord+1) . ""); print("</span> - <span class=\"recordsfoundbold\">"); if (($intPublicpagesize*$intPage) < $intRecordsfound) print($intPublicpagesize*$intPage); else print($intRecordsfound); print(" </span> of <span class=\"recordsfoundbold\">$intRecordsfound</span>"); print("</div>\n"); } // ---------------------------------------------------------------------- // Function : no_records_found // Description : print no records found message // Usage : norecordsfound() // // ---------------------------------------------------------------------- function no_records_found() { print("<div id=\"norecordsfound\">No records found</div>\n"); } // ---------------------------------------------------------------------- // Function : display_paged_navigation // Description : diplays the page navigation links when a search // result has more than 1 page of records // Usage : display_paged_navigation() // // ---------------------------------------------------------------------- function display_paged_navigation() { global $intTotalpages; global $intPage; global $intPublicchaptersize; global $strNavpublicstate; // only show page navigation links if number of pages > 1 if ($intTotalpages > 1) { // calculate current chapter based on current page if (fmod($intPage, $intPublicchaptersize) == 0) $intChapter = ($intPage/$intPublicchaptersize); else $intChapter = ceil($intPage/$intPublicchaptersize); // display paged record navigation bar print("<div id=\"pagenavcontainer\">\n"); print("<div id=\"pagenavigation\">\n"); // display previous chapter link if it exists if ($intChapter > 1) { print("<div id=\"pagenavprev\">"); print("<a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strNavpublicstate"); print("&pn=" . ((($intChapter-1)*$intPublicchaptersize)-$intPublicchaptersize+1) . ""); print("\">Prev $intPublicchaptersize pages</a>"); print("</div>\n"); } // display page links $intStartat = (($intChapter*$intPublicchaptersize) - ($intPublicchaptersize - 1)); if ($intTotalpages < ($intChapter*$intPublicchaptersize)) $intFinishat = $intTotalpages; else $intFinishat = ($intChapter*$intPublicchaptersize); for($x=$intStartat;$x<=$intFinishat;$x++) { if ($intPage == $x) { print("<div class=\"pagenavbox\">$x</div>\n"); } else { print("<div class=\"pagenavbox\">"); print("<a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strNavpublicstate&pn=$x"); print("\">$x</a></div>\n"); } } // display next chapter link if it exists if (($intChapter * $intPublicchaptersize) < $intTotalpages) { print("<div id=\"pagenavnext\">"); print("<a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strNavpublicstate"); print("&pn=" . (($intChapter*$intPublicchaptersize)+1) . ""); print("\">Next $intPublicchaptersize pages</a>"); print("</div>\n"); } print("</div>\n"); // end pagenavigation div print("</div>\n"); // end pagenavcontainer div } // end if total pages > 0 } // ---------------------------------------------------------------------- // Function : get_public_state // Description : return part of a querystring which can be added to // links to maintain search state // Usage : get_public_state($intMode) // Arguments : $intMode - identifies whether to return querystring // components for general or page navigation // links // // ---------------------------------------------------------------------- function get_public_state($intMode) { $strPublicstate = ""; $strNavpublicstate = ""; if (isset($_REQUEST['key'])) { if ($_REQUEST['key'] != "") { $strPublicstate .= "&key=" . urlencode($_REQUEST['key']); } } if (isset($_REQUEST['stateID'])) { if ($_REQUEST['stateID'] != "") { $strPublicstate .= "&stateID=" . urlencode($_REQUEST['stateID']); } } if (isset($_REQUEST['country'])) { if ($_REQUEST['country'] != "") { $strPublicstate .= "&country=" . urlencode($_REQUEST['country']); } } $strNavpublicstate = $strPublicstate; if (isset($_REQUEST['pn'])) { $strPublicstate .= "&pn=" . $_REQUEST['pn']; } //return result based on $intMode supplied if ($intMode == 0) { //pass back querystring version of current state return $strPublicstate; } else if ($intMode == 1) { //pass back querystring version of current state for navigation links return $strNavpublicstate; } } ?> -
Wanna click solved then ?
-
Sorry i have no idea, what logic your using here! Whats your input and expected output!
-
if your doing a lookup then i assume you mean this! if (preg_match('/\[user=(.*?)\]/s', $code, $regs)) { $sql = mysql_query("SELECT id FROM user_details WHERE username = '".mysql_real_escape_string($regs[1])."'") or die(mysql_error()); } however.. i'm not sure why your creating a link as the lookup would be from the html the link would of already be created! ???
-
And the problem is ?
-
erm.. maybe echo tempnam(NULL, 'abc');
-
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
Agreed.. Solutions: #1 Don't use code #2 Don't use joomla #3 Try Other extensions #4 find a work around! (maybe a redirect) #5 Fix code.. #5.1. ok i think the problem maybe due to a function that joomla considers "risky" only real way to check is to get the list of risky functions or review the code and debug! Infact i have just had an intresting idea! but its almost 3am so i need to get some sleep! i'll check back in the morning.. -
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
I don't know where Error: Error Number: 0 is coming from or even why! Just to check i am now going nuts can you create another file called "test.php" and add <?php include "locator.php"; ?> then open test.php and check it works.. i'm pretty sure this is a joomla issule! -
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
Okay Now #1 the artical should be {phpfile}locator.php{/phpfile} and locator.php should be the same as the one we started with but change print("<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">\n"); to print("<form action=\"\" method=\"post\">\n"); Give that ago and were see what see get! -
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
On the results page i am getting Error: Error Number: 0 maybe try different extention try IncludePHP and then try this {phpfile}locator.php{/phpfile} -
i don't use AMFPHP but to put it in a class <?php class SimpleClass { function __construct() { $link = mysql_connect('mysql.site.com', 'site', 'sitepass' ); if (! $link) print 'Failed to connect.<br>'; $rcode = mysql_select_db('db'); if (! rcode) echo 'Failed to select database<br>'; $sql = "INSERT INTO users (password, lastname, firstname) " . " Values ( 'password', 'fname', 'lname'); " ; echo $sql . '<br>'; $result = mysql_query($sql); if (! $result) echo 'Failed to insert<br>'; mysql_close($link); } } ?> usage <?php $myclass = New SimpleClass(); ?>
-
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
Okay well including a file seams to have some limitations, so try copying the contents of locator.php and pasting it into Joomla -
Alot of the time the problem is right under your nose.. but sometimes you need to rip up the floorboards to find it However.. what is going to happen after you get 999 memebers on a hub ?
-
Of course.. its not like you havn't read the rules or anything.. i'll start right after i get the transction id for my paypal payment!
-
run the same query again to double check also whats the highest login number that was in the 2000's
-
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
okay.. i kinda hoped for some better news! but from the main page i still get array(0) { } please confirm you added the && FALSE if you did then, let try something that should get a results at the top of the file <?php var_dump($_REQUEST);//HERE // ---------------------------------------------------------------------- // and revert back on the other change change if (get_magic_quotes_gpc() && FALSE) { back to if (get_magic_quotes_gpc()) { Also are you using an Entension for Joomla to include this file? -
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
its kinda strange but thats a good thing, were getting some where! okay leave that line in.. we need it to get some results okay.. i'm going to guess and say its the magic quotes routine that messing it up! lets disable it for now change if (get_magic_quotes_gpc()) { to if (get_magic_quotes_gpc() && FALSE) { edit: revised code -
run the query SELECT login FROM `members` WHERE hub='KSEA' ORDER BY login DESC LIMIT 1 if its 3000+ then review all that hub to find the point it messed up.. SELECT login FROM `members` WHERE hub='KSEA' ORDER BY login DESC if they are all 3000 then just update them with +1000
-
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
okay well that seams fine! remove var_dump($_REQUEST);//add and put it the locator.php file //main page control logic var_dump($_REQUEST);//HERE print("<div id=\"locatorcontainer\">\n"); -
Have to check the database as thats the likely problem!
-
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
I would guess so! but that also seams weird to me! try adding the following <?php var_dump($_REQUEST);//add include("http://www.viewmykitchen.com/locator.php"); ?> your going to want to remove that line later, its just to test to see if the requests are getting to their! -
Need help with displaying reults on same page please?
MadTechie replied to roldahayes's topic in PHP Coding Help
for some reason posts are not being picked up on the main page.. i'm not sure if that joomla it some other code edit.. other that this post have any other changes been made ?