timothyarden
Members-
Posts
149 -
Joined
-
Last visited
Everything posted by timothyarden
-
Wanting to hide signup page within PHP Login script
timothyarden replied to daniel27lt's topic in PHP Coding Help
You could change it so that it only showed the register form if they submit a unique code that you would generate on the Thankyou page (and add to database) when the user pays. Hope this helps, Timothy -
Adding a Uncertain Amount of Parameters to a Function
timothyarden replied to timothyarden's topic in PHP Coding Help
Okay, thanks heaps, I can see kind of how it works. Ill leave this unsolved for now & see if I can figure out how to work it in. Thankyou -
Adding a Uncertain Amount of Parameters to a Function
timothyarden replied to timothyarden's topic in PHP Coding Help
Sorry, understood what you meant now (call_user_func_array()) will go check the manual -
Adding a Uncertain Amount of Parameters to a Function
timothyarden replied to timothyarden's topic in PHP Coding Help
call. user. func. array. Sorry? -
Adding a Uncertain Amount of Parameters to a Function
timothyarden replied to timothyarden's topic in PHP Coding Help
Okay, I could probably take an array in the first function (that has the second function within it) but then I would have to have each of the values in the array some how iterate themselves into the parenthesis of the second function as individual parameters. Reason being that the second function is the mysqli classes bind_param() Any ideas? Thanks -
Adding a Uncertain Amount of Parameters to a Function
timothyarden replied to timothyarden's topic in PHP Coding Help
Hi, Thanks for all the responses. My problem is I want to create a function that takes two mandatory parameters & then a unlimited amount of non-mandatory parameters function test($mand1,$mand2){ } When I call to this function I then want to put in the two mandatory values then have a unlimited amount of non-mandatory paramaters test($mand_param1,$mand_param2,$param3,$param4,$param5); After this I need to cycle through the parameters and be able to put them into another function after the test function validates them. (The test function will also put the params in order) //once validated foreach($parameters_for_test as $value){ // add value to the parameters for if(valid){ // add param to $valid array $valid[] = $value; } } foreach(in $valid){ // add a into the parameters for the next function } so for example the final foreach loop could construct a statment like next_function($a,$b,$c,$d); Thanks for the suggestion of using an array but it wont work to do an array, it must be individual parameters not a load of values bundled into one parameter. I realise that alot of the code above isnt correct but I have wrote it half coding half explaining what I mean. Thanks for everyone's help so far! (Also:The editor here wont allow me to indent the code, sorry) -
Adding a Uncertain Amount of Parameters to a Function
timothyarden replied to timothyarden's topic in PHP Coding Help
Hi Jessica, Thanks for the fast response. How would I then put some which have correct values those into another function if I used func_get_args()? -
Adding a Uncertain Amount of Parameters to a Function
timothyarden posted a topic in PHP Coding Help
Hi Everyone, I have a function for which I will always have at least two parameters; function myFunction($type,$value1){ // code } However I would like to be able to have $value 2 and more afterwards (unlimited amount) that I could then use a foreach loop to cucle through it. Is there any way of doing this. I know that the MySQLi classes function bind_param() can do this. If you know how to do this could you please advise me on how. Thanks for reading and for any help in advance, Timothy -
Perhaps put it into a zip file either before you upload it or use php to put it into a zip file and then echo '<a href="'.$filedir.$filename.'"/>'.$filename.'</a>';
-
I need help with an "include" script issue
timothyarden replied to Crowbar's topic in PHP Coding Help
Add <html> to the top of header.php + change the second <head> tag to </head> -
Right okay
-
Not entirely sure what you mean, could you please explain what you want a bit better (for example explain how the tables relate to what you want done) Yes, that would work - depends on what you want
-
For this if (isset($_POST['theLink']))$theurl = $_POST['theLink']; you need to change it to if(isset($_POST['theLink'])){ $theurl = $_POST['theLink']; }
-
PHP output is showing a blank page
timothyarden replied to borhan_safa's topic in Third Party Scripts
If you change that to include it will run without it but otherwise you need to either adjust the directory to the correct path or move / create files in those directories. If thats not possible perhaps you need to reinstall Joomla -
Also what is this doing in the else { } in the first lot of code? INSERT INTO reports (Stations,Title,Detail,Attach) VALUES('$_POST[stations]','$_POST[title]','$_POST[detail]','$_FILES[file]')"; You already have that in the mysql_query in the second file
-
To set error reporting to everything add this to the top of your code error_reporting(E_ALL); ini_set('display_errors',1);
-
Sorry, was there a question in there?
-
I need help with an "include" script issue
timothyarden replied to Crowbar's topic in PHP Coding Help
<body> </html> at the start of your html code you open your body before html and when you do the html markup it has a slash in front of it try reversing it to <html> (notice slash is not in front of it) <body> Also as Drongo_III said try the 'long hand' php tags Try including this after the <html> & <body> <?php include("inc/incfiles/headder.inc.php"); ?> -
What I meant was for all of these that he is giving individual variable names why not just use an array? In response to "is using the best available code" That was his code that was his code that I was suggesting he used an array for. Example array('EmailTo' => 'email value he had' .......
-
Warning: Cannot Modify Headers Error
timothyarden replied to timothyarden's topic in PHP Coding Help
Oh, 2 quick questions - is a comment counted as whitespace? And does session need to come before header() or the opposite way round? (or doesn't it matter) -
Warning: Cannot Modify Headers Error
timothyarden replied to timothyarden's topic in PHP Coding Help
Thanks for the help again Jessica and trq. Right again as always -
Warning: Cannot Modify Headers Error
timothyarden replied to timothyarden's topic in PHP Coding Help
I read that before but it doesn't have anything about whitespace so I thought I must have read the wrong thing. Okay, thanks. Ill try without white space and see how I go. -
Warning: Cannot Modify Headers Error
timothyarden replied to timothyarden's topic in PHP Coding Help
No, Could you please send a link to the sticky, when I searched this site before with the error it returned nothing. Thanks for the fast response -
Might also want to use an array for all of this stuff $EmailTo = "me@me.com"; $Subject = "Request Form"; $Name = Trim(stripslashes($_POST['name'])); $Company = Trim(stripslashes($_POST['company'])); $Tel = Trim(stripslashes($_POST['phone'])); $Email = Trim(stripslashes($_POST['email'])); $Website = Trim(stripslashes($_POST['website'])); $Meeting = $_POST['meeting']; $Services = Implode("\n", $_POST['services']); $Message = Trim(stripslashes($_POST['message'])); $mailheader .= "Reply-To: $Email \r\n";
-
Hi Everyone am having errors with this: Warning: Cannot modify header information - headers already sent by (output started at /------/--------/public_html/-------------------------.com/--------------------/classes/mobile.php:15) in /------/--------/public_html/-------------------------.com/--------------------/classes/mobile.php on line 6 Here is mobile.php <?php // line 1 // mobile.php // line 2 class mobile_redirection { // line 3 function __construct($pagename = NULL){ // line 4 if(preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $_SERVER['HTTP_USER_AGENT'])) { // line 5 if(isset($pagename)){ header('Location: http://www.----------------------------.com/mobile/'.$pagename); } else { header('Location: http://www.-------------------------------.com/mobile/'); } // line 6 } else { // line 7 return false; // line 8 } // line 9 } // line 10 } // line 11 ?> // line 13 I dont understand why there is an error on line fifteen as it doesn't exist and I dont know whats wrong on line 6. When someone goes to my domain it the index file the error comes up but what should happen is if they are a mobile they are redirected to a mobile sub directory or if they aren't a mobile they should be redirected to form.php. <?php // Login or Sign Up require('classes/mobile.php'); $mobile = new mobile_redirection('form.php'); if($mobile === false){ header('Location: form.php'); } ?> Any ideas why this isn't happening? Also, it isnt redirecting to form.php yet but if they get there and submit it will be using sessions: is it okay to use headers to redirect from 1.php to 2.php and then on 2.php start_session()? Thanks for reading and for any help in advance, Timothy