Jump to content

shanejeffery86

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Everything posted by shanejeffery86

  1. Well, my God...I figured it out... My rewrite rule was being stupid. My final rule: RewriteRule ^wow-armory-profile-([^/]*)\.html$ /armory.php?profileID=$1 [L] Thanks again for the help
  2. Hey Cags. I do need the URL to be that, but I also need the PHP file to fire (armory.php) as that is where all of the data is being pulled from. I think my Rewrite Rule is close, but it is still not working. So, what I am doing is this: On the header redirect, I have: header("Location: wow-armory-profile/" . $profileID); In the htaccess, I have this: RewriteRule ^wow-armory-profile/(.*)$ /armory.php?profileID=$1 [L]
  3. Hey Cags. So, what I am doing is this: On the header redirect, I have: header("Location: wow-armory-profile/" . $profileID); In the htaccess, I have this: RewriteRule ^wow-armory-profile/(.*)$ /armory.php?profileID=$1 [L] Still not working, but I have a feeling I am getting closer.
  4. I have a PHP header redirect happening in my index.php file. The code reads: header("Location: armory.php?profileID=" . $profileID); Upon that redirect, I need that URL to be rewritten to: wow-armory-profile/$profileID I cannot just simply put that rewrite in the header redirect as the redirect would not know where it is going. Any idea on how to achieve this? I am currently using this Rewrite Rule: RewriteRule ^wow-armory-profile/(.*)$ /armory.php?profileID=$1 [L], but no luck with it.
  5. Hey all. I am trying to figure out how something is done and I am missing a logic step here. Let's just say that a user submits a form. Once that form is submitted, an ID is generated in the database and you call mysql_last_id() to get the last inserted ID. After you get the ID, you send the user to a new URL while attaching the ID to the URL WITH REWRITING! So, you go from index.php to nextpage.php?id=231, but the user sees in the URL -- domain.com/nextpage/231. How would something like this be done? I am trying to figure out the clean way to do this. Thanks!
  6. Hey all. My previous post in the wrong forum explains in more detail what I am trying to achieve: http://www.phpfreaks.com/forums/index.php/topic,301173.msg1425323.html#msg1425323 I am redirecting in my PHP file like this: header("Location: wow-armory-profile/" . $profileID); exit; I need to make it so that when this location is hit, the armory.php file that I have knows that it needs to be executed. So, I need to figure out how to check at the server level if this URL is being hit and then execute my armory.php file WITHOUT rewriting the URL to the armory.php. Any ideas on how to do this? Thanks!
  7. Hey Alex. The problem with that is that location does not correspond to anything. I want the armory.php to be hit when the Location you have listed is hit ("Location: wow-armory-profile/" . $profileID). How do I go about doing that? So, when I redirect to "wow-armory-profile/" . $profileID", I want the armory.php to recognize that it needs to run, but I want to keep the URL as "wow-armory-profile/" . $profileID". I painted myself into quite a corner here and having trouble getting out. Thanks.
  8. Doing further research, I think I figured out a possible solution: RewriteCond %{QUERY_STRING} ^profileID=([0-9]*)$ RewriteRule wow-armory-profile/(.*) /armory.php?profileID=%1 [L] So, if we find the profileID in the condition, we execute the rewrite rule below.
  9. From what I am understanding, I am wanting to rewrite a redirect. Still googling like mad to see if I can find an answer
  10. Hey all. I currently am redirecting to another PHP file via a header redirect. Upon that header redirect, I need a rewrite to be done. How do I do this? header("Location: armory.php?profileID=" . $profileID); exit; Hits the armory page and then this rule takes affect in the .htaccess file: RewriteRule wow-armory-profile/(.*) armory.php?profileID=$1 Is it even possible to do this? If not, please let me know and as I am going to have to move around quite a lot of code to make this work correctly for rewriting.
  11. Did a bit more research into it, but still not working. Options +FollowSymLinks RewriteEngine on RewriteCond %{QUERY_STRING} ^FeatureID=$ [NC] RewriteRule http://(myurl)$ [L,R=301]
  12. Hey all. I have heard that this is the best solution to my current situation, but heck if I can figure out how to implement it properly. What I want to do is a mod rewrite match 301 redirect. Here is the HTAccess code that I have at the moment: RewriteCond %{FeatureID} ^string1$ [NC] RewriteRule (my site url)\string2 [L,R=301] What I want to happen is that if the "FeatureID" is found on the URL, to take the FeatureID value and give it to the RewriteRule. Such as: index.cfm?fuseaction=Feature.showFeature&FeatureID=363 to /363 Any ideas what I am doing wrong? Thanks!
  13. Woot! str_replace > preg_replace. Worked perfectly! Solved.
  14. Since I am not using REGEX, I am thinking that str_replace might be a better solution here. I will let you guys know how that goes.
  15. Hey all. I have a very large soruce of body texts in the database and I need to do a preg_replace all on all of the rows. What I am trying to do is this: 1) Call the function 2) Do a preg_match to see if the String can be found in the source. 3) If it is found, then do a preg_replace on the row body. If not found, then just return the value of the original parameter (as nothing has changed, the value will be the same). Here is my current code to get this done: function changeDirectory($data){ if(preg_match('/_images/uploads/', $data)) return preg_replace('/_images/uploads/', '/sites/default/files/images-from-old-site/', $data); else return $data; } What is happening is that when the function is called, somehow the preg_replace is killing the entire body. It is setting it to blank. And yes, the function is returning to a PHP variable after the fact. Any ideas on what I am doing wrong? Thanks!
  16. Figured it out. Stupid logic on my end. $start = 0; foreach($_FILES as $file){ if($file['name'] != ''){ $target_path = "../account_images/large/"; if($start == 0){ $target_path = "../account_images/small/"; $custom_image = "http://www.khaccounts.net/account_images/small/" . basename($file['name']); } else { $screenshot[$start] = "http://www.khaccounts.net/account_images/large/" . basename($file['name']); } $target_path = $target_path . basename($file['name']); if(!move_uploaded_file($file['tmp_name'], $target_path)){ echo "Failure to upload file: " . $file['name'] . ". Please contact Knucklehead for further troubleshooting."; die; } } $start++; } Thanks anyways!
  17. Hey all. Got an odd file upload issue and I am perplexed. $i = 0; foreach($_FILES as $file){ if($file['name'] != ''){ if($i == 0){ $target_path = "../account_images/small/"; $custom_image = "http://www.khaccounts.net/account_images/small/" . basename($file['name']); } else { $target_path = "../account_images/large/"; $screenshot . "_" . $i = "http://www.khaccounts.net/account_images/large/" . basename($file['name']); } $target_path = $target_path . basename($file['name']); if(!move_uploaded_file($file['tmp_name'], $target_path)){ echo "Failure to upload file: " . $file['name'] . ". Please contact Knucklehead for further troubleshooting."; die; } } $i++; } So, what I want to do is run through my $_FILES global and run a series of actions against each element of that $_FILES global. I do foreach statement to make things more simplistic. What I want to do is if the picture is the first one of the bunch (the custom image), then I want it to upload to the /account_images/small directory and if it beyond that, I want it to go to the /account_images/large directory. What is happening in this code is that the first file, the custom image is getting uploaded to the proper /small folder, and then 2nd image is getting uploaded to the /large folder, and then the rest of the images are being uploaded back to the small folder when they should be going to large folder. Am I missing an error in my code or something? If I comment out everything below the if/else statement that creates the $target_path the first time around and then do an echo, the target paths are correct. No idea. You guys have any!? Thanks!
  18. Blah no ideas? I am really stuck as hell on this one.
  19. Hey guys. I am running Lightbox to display some screenshots and then I am displaying some text that is loaded via AJAX. What is currently happening is that the text is loading after the screenshots finish loading. I want to flip the priority. Here is an example of the site page on which it is happening: http://www.khaccounts.net/character.php?acc_id=33 The text that is loading last via AJAX is in the bottom left box on the page. Any help is appreciated! Thanks!
  20. Alright, getting closer to narrowing it now: <span id=\"fname\">" . $user_data['fname'] . "</span></td><a href=\"\" onClick=\"editBox(document.getElementById('fname'))\" \">edit</a> This function is being hit: function editBox(actual) { //alert(actual.nodeName+' '+changing); if(!changing){ width = widthEl(actual.id) + 20; height =heightEl(actual.id) + 2; if(height < 40){ if(width < 100) width = 150; actual.innerHTML = "<input id=\""+ actual.id +"_field\" style=\"width: "+width+"px; height: "+height+"px;\" maxlength=\"254\" type=\"text\" value=\"" + actual.innerHTML + "\" onfocus=\"highLight(this);\" onblur=\"noLight(this); return fieldBlur(this,'" + actual.id + "');\" />"; }else{ if(width < 70) width = 90; if(height < 50) height = 50; actual.innerHTML = "<textarea name=\"textarea\" id=\""+ actual.id +"_field\" style=\"width: "+width+"px; height: "+height+"px;\" onblur=\"noLight(this); return fieldBlur(this,'" + actual.id + "');\">" + actual.innerHTML + "</textarea>"; } //alert(actual.innerHTML); changing = true; } alert(actual.id); } If I put an alert in the highlight function, the alert pops up. If I put an alert into fieldBlur or fieldEnter, the alert does not pop up. So, after this function call to editBox and then after it calls the highlight function, the page reloads for some reason. Any ideas? The full JS file in the OP.
  21. I think it is the onblur event that is the issue. Look at the editBox function. When I do the onclick event in the HTML page, it calls the editBox function. Since I am technically not focused on the box that is being edited, it could just be auto-running the fieldBlur function, thereby refreshing the page.
  22. Well, I figured out the problem, now just needing to figure out a solution. <span id=\"fname\" class=\"editText\">" . $user_data['fname'] . "</span><a href=\"\" onClick=\"editBox(document.getElementById('fname'))\">edit</a> When the editBox() function is being called, the entire page is refreshing after the call. Is there anyway to detect or stop a JS refresh?
  23. I am not trying to follow the example. What I want to do is have an edit button that is separate from the text, so that it is much more intuitive. Users are going to have an issue figuring out to do if I just stick with the base of this script. I need to figure out the set of functions that are being called and the order they are being called in, in order to replicate it with a edit button on the left side of the text that will also pop up the inline edit.
  24. Hey all. I am using a script I found the web for doing an AJAX inline text edit. Here is the JS that is in the script: Found at: http://www.yvoschaap.com/index.php/weblog/ajax_inline_instant_update_text_20/ <!-- //script by http://www.yvoschaap.com //XMLHttpRequest class function function datosServidor() { }; datosServidor.prototype.iniciar = function() { try { // Mozilla / Safari this._xh = new XMLHttpRequest(); } catch (e) { // Explorer var _ieModelos = new Array( 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP' ); var success = false; for (var i=0;i < _ieModelos.length && !success; i++) { try { this._xh = new ActiveXObject(_ieModelos[i]); success = true; } catch (e) { } } if ( !success ) { return false; } return true; } } datosServidor.prototype.ocupado = function() { estadoActual = this._xh.readyState; return (estadoActual && (estadoActual < 4)); } datosServidor.prototype.procesa = function() { if (this._xh.readyState == 4 && this._xh.status == 200) { this.procesado = true; } } datosServidor.prototype.enviar = function(urlget,datos) { if (!this._xh) { this.iniciar(); } if (!this.ocupado()) { this._xh.open("GET",urlget,false); this._xh.send(datos); if (this._xh.readyState == 4 && this._xh.status == 200) { return this._xh.responseText; } } return false; } var urlBase = "update.php"; var formVars = ""; var changing = false; function fieldEnter(campo,evt,idfld) { evt = (evt) ? evt : window.event; if (evt.keyCode == 13 && campo.value!="") { elem = document.getElementById( idfld ); remotos = new datosServidor; nt = remotos.enviar(urlBase + "?fieldname=" +encodeURI(elem.id)+ "&content="+encodeURI(campo.value)+"&"+formVars,""); //remove glow noLight(elem); elem.innerHTML = nt; changing = false; return false; } else { return true; } } /*function fieldBlur(campo,idfld) { if (campo.value!="") { elem = document.getElementById( idfld ); remotos = new datosServidor; nt = remotos.enviar(urlBase + "?fieldname=" +escape(elem.id)+ "&content="+escape(campo.value)+"&"+formVars,""); alert(nt); elem.innerHTML = nt; changing = false; return false; } }*/ //edit field created function editBox(actual) { if(!changing){ width = widthEl(actual.id) + 20; height =heightEl(actual.id) + 2; if(height < 40){ if(width < 100) width = 150; actual.innerHTML = "<input id=\""+ actual.id +"_field\" style=\"width: "+width+"px; height: "+height+"px;\" maxlength=\"254\" type=\"text\" value=\"" + actual.innerHTML + "\" onkeypress=\"return fieldEnter(this,event,'" + actual.id + "')\" onfocus=\"highLight(this);\" onblur=\"noLight(this); return fieldBlur(this,'" + actual.id + "');\" />"; }else{ if(width < 70) width = 90; if(height < 50) height = 50; actual.innerHTML = "<textarea name=\"textarea\" id=\""+ actual.id +"_field\" style=\"width: "+width+"px; height: "+height+"px;\" onfocus=\"highLight(this);\" onblur=\"noLight(this); return fieldBlur(this,'" + actual.id + "');\">" + actual.innerHTML + "</textarea>"; } changing = true; } actual.firstChild.focus(); } function printObject(object) { var str = ''; for(prop in object) { if(object.hasOwnProperty(prop)) str += prop + " : " + object[prop] + "\n"; } alert(str); } //find all span tags with class editText and id as fieldname parsed to update script. add onclick function function editbox_init(){ if (!document.getElementsByTagName){ return; } var spans = document.getElementsByTagName("span"); // loop through all span tags for (var i=0; i<spans.length; i++){ var spn = spans[i]; if (((' '+spn.className+' ').indexOf("editText") != -1) && (spn.id)) { spn.onclick = function () { editBox(this); } spn.style.cursor = "pointer"; spn.title = "Click to edit!"; } } } //crossbrowser load function function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener){ elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent){ var r = elm.attachEvent("on"+evType, fn); return r; } else { alert("Please upgrade your browser to use full functionality on this page"); } } //get width of text element function widthEl(span){ if (document.layers){ w=document.layers[span].clip.width; } else if (document.all && !document.getElementById){ w=document.all[span].offsetWidth; } else if(document.getElementById){ w=document.getElementById(span).offsetWidth; } return w; } //get height of text element function heightEl(span){ if (document.layers){ h=document.layers[span].clip.height; } else if (document.all && !document.getElementById){ h=document.all[span].offsetHeight; } else if(document.getElementById){ h=document.getElementById(span).offsetHeight; } return h; } function highLight(span){ //span.parentNode.style.border = "2px solid #D1FDCD"; //span.parentNode.style.padding = "0"; span.style.border = "1px solid #000000"; } function noLight(span){ //span.parentNode.style.border = "0px"; //span.parentNode.style.padding = "2px"; span.style.border = "0px"; } //sets post/get vars for update function setVarsForm(vars){ formVars = vars; } addEvent(window, "load", editbox_init); --> Now, with that Javascript, I am using the following line: <b>First Name:</b><span id=\"fname\">" . $user_data['fname'] . "<a href=\"\" onClick=\"editBox(document.getElementById('fname'))\">edit</a> So, as you guys can see, I am trying to have an edit button next to the field that is supposed to get the inline text edit. Whenever I click the edit button, it gives me the edit box for that field, but then the edit box just goes away. I cannot figure out what in the JS or the call the issue is. Any ideas? Please let me know if you need any further code. Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.