-
Posts
969 -
Joined
-
Last visited
Everything posted by Destramic
-
k well maybe i should update my validation script...
-
bah sorry thats not possible it have to be $_SERVER['PHP_SELF'] as i have a form validation class that runs on the same page.. here is the code if you wanna have a quick look...you may understand better: code: http://rafb.net/p/sbPyde45.html page: http://82.45.55.177/cp/news_add.php i need to be able to do a include or header location... thanks for your quick reply ricky
-
i have a form when you submit the form i want it go to add.php where all my querys for ever query insert. problem is when i use any one of these functions...it will not carry over the $_POST array so i have no value for the array. anyone know how i could solve this please? [code] if (!isset($_POST['submit'])) { // i could simply put the query here but wouldnt be benificial. header("Location: add.php?type=news"); //require_once $document_root . "cp/add.php?type=news"; } [/code] thanks ricky
-
ok thanks for that :D destramic
-
im just having problems getting the result with addedslashes without using print_r(); as you can see if you run script and echo $b
-
ive been working on one..this may help you out one function for it all :D [code] <SCRIPT> var checkbox_state = true; function toggle_checkboxes(the_form) { var button = document.getElementById("toggle_checkboxes"); var elements = the_form.parentNode.elements; for (var i = 0; i < elements.length; i++) { var element = elements[i]; var type = element.type == "checkbox"; if (type) { element.checked = checkbox_state; } } if (checkbox_state) { checkbox_state = false; button.innerHTML = "<b>Unselect All</b>"; } else { checkbox_state = true; button.innerHTML = "<b>Select All</b>"; } } </SCRIPT> <META content="MSHTML 6.00.2900.2995" name=GENERATOR></HEAD> <BODY> <FORM id=edit_remove name=edit_remove action=page.php method=post> <INPUT class=check id=row[] type=checkbox value=Yes name=1><BR> <INPUT class=check id=row[] type=checkbox value=Yes name=2><BR> <INPUT class=check id=row[] type=checkbox value=Yes name=row[]><BR> <INPUT class=check id=row[] type=checkbox value=Yes name=row[]><BR> <INPUT class=check id=row[] type=checkbox value=Yes name=row[]><BR> <div id="toggle_checkboxes" onclick="toggle_checkboxes(this);"><b>Select All</b></div> </FORM> [/code]
-
im having trouble with this addslashes wrapper....basically if i addslashes to a string/array all commas will have a slash infront of it. So when i call the variable after running it through the function it should have a slash if needed. but when variable is called it has no slash...you can only see the slash when using print_r(); it will work this way...but i should have to do it like that?[code]$b = add_slashes($b);[/code] can anyone help please? (here is the script below..) [code] <?php function add_slashes($value) { // Check if string exists if (is_string($value)) { return addslashes($value); } elseif (is_array($value)) { return array_map('add_slashes', $value); } } $a = array(0,"This's an string's","This's an string's",array("This's an string's",array("This's an string's","This's an string's")),"This's an string's","This's an string's"); print_r( add_slashes($a)); $b = "This's an string's"; print_r( add_slashes($b)); // If i was to echo $b it would echo This's an string's without slashes? why echo $b; ?> [/code] thank you destramic
-
anyone know why the function works but when i call $_POST['name'] it doesnt have a slash added
-
ive gotten it to work now using: [code] $_POST = add_slashes($_POST); [/code] but when data is in the database..it doesnt have any slashes now..
-
thanks all for your replies...ive found something strange...ive used this function to add slashes before data is added to the database..it does the $_POST array and returns it with slashes as required..but when i call $_POST['name'] it will display with no slash...very wierd? it should have a slash infront of the single quote.. can anyone explain? thanks [code] function add_slashes($value) { // Check if string exists if (is_string($value)) { return addslashes($value); } elseif (is_array($value)) { return array_map('add_slashes', $value); } } //Add slashes add_slashes($_POST); print_r(add_slashes($_POST)); echo $_POST['name']; Array ( [name] => o\'really [email] => destramic@hotmail.com [error_type] => Broken Link [reason_occurred] => test ) o'really [/code]
-
thank you...in affect wouldnt using this script be goin back on your self? striping slashes. adding slashes (back to square one)? thanks [code] <?php function sql_quote($value) { if(get_magic_quotes_gpc()) $value = stripslashes($value); return mysql_real_escape_string($value); } ?> [/code]
-
well then there is no point in addslashes when im entering the data into the database? as it will already have slashes? thanks ricky
-
im having problems with my forms. every time i enter the input eg. "o'really" it will return as "o\'really" i have setup my so that it shouldnt happen..here is my file...can anyone help? .htaccess [code] php_value magic_quotes_sybase off php_value magic_quotes_gpc off php_value magic_quotes_runtime off [/code]
-
ok getting it to replace a string in a var works....but include the current form and changing a label doesnt seem to work... content: <label for"name">Name:</label> [code] $uri = $_SERVER['REQUEST_URI']; ob_start(); require_once $document_root . $uri; $contents = ob_get_contents(); ob_end_clean(); $regex = "|<label for=\"name\">(.+?)</label>|"; $replace = "<label for=\"name\" class=\"error\">$1</label>"; $contents = preg_replace($regex, $replace, $contents); return $contents; [/code]
-
thanks ive used what you have given me and changed it a bit...but i doesnt seem to work can you have a look please? [code] <?php $contents = "<label for=\"test\">hello</label><input type=\"text\">"; $regex = "|<label for=\"test\">(.+?)</label>|"; $replace = "<label for=\"test\" class=\"error\">$1</label>"; $contents = preg_replace($regex, $replace, $contents); return $contents; ?> [/code]
-
this is a function which is apart of my form validation script...basically i want to replace a selected <label.... and change the class (class="error")..i think i have the script sorted....just the regular expression if someone could please help? the text inbetween the <label></label> tags in undecided and i want to copy that value into the relaced script....hope that explains what i need that destramic [code] public function mark_label($input_name) { $filename = $_SERVER['SCRIPT_NAME']; ob_start(); require_once $document_root . $filename; $contents = ob_get_contents(); ob_end_clean(); $contents = str_replace("<label for=\"$input_name\">(.*)</label>", "<label for=\"$input_name\" class=\"\"></label>", $contents); return $contents; } [/code]
-
that hasnt made it work either... the problem is displaying this: [code] document.getElementById('toggle_checkboxes').innerHTML = "<a href=\"#\" onclick=\"toggle_checkboxes(this);\">Unselect all</a>" [/code] it wont display Unselect all
-
could get it to work..could you help please? http://rafb.net/paste/results/VIRRly58.html thanks destramic
-
my script seems to be working but when you click on select all the conent will dispear of some reason? can this be easily explained please? see here: http://rafb.net/paste/results/t2lvb839.html thanks destramic
-
using mysql_real_escape_string you wouldnt need to use the function addslashes to the value aswell? (so on what instants would you use this addslashes?) and when mysql_real_escape_string is used to insert data would you use stripslashes while selecting data from the database? thank destramic
-
here: http://rafb.net/paste/results/nRrdOh42.html
-
well when you click on the text it wont start/run the javascript
-
thank you fenway for your advice...ive done that now.. script works fine..but script cannot be activated by text? view here: http://localhost/test.html
-
thank you...that works great
-
thank you for your replywildteen88 i thought there might of been a easier way...but this is what ive done so far..doesnt work...dont think the regual expression is right...can you help? [code] $file = $document_root . "/core/configuration.php"; // Check if file exists if (file_exists($file)) { // Open configuration file $handle = fopen($file, "w+"); $contents =ob_get_contents(); $replace = preg_match("define(/\"WEBSITE_URI\", \"[^\.\/]\"/);", $var, $contents); $write = fputs ($handle, $string); // Close opened file fclose($handle); } else { echo "Unable to configuration file.<br />\n"; } [/code]