
waynew
Members-
Posts
2,405 -
Joined
-
Last visited
Everything posted by waynew
-
I'm using PHPMailer on various websites. Recently, the host decided to restrict a number of functions. popen() was one of them. Problem is, PHPMailer uses popen in one of its class functions: function SendmailSend($header, $body) { if ($this->Sender != "") $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender); else $sendmail = sprintf("%s -oi -t", $this->Sendmail); if(!@$mail = popen($sendmail, "w")) { $this->SetError($this->Lang("execute") . $this->Sendmail); return false; } fputs($mail, $header); fputs($mail, $body); $result = pclose($mail) >> 8 & 0xFF; if($result != 0) { $this->SetError($this->Lang("execute") . $this->Sendmail); return false; } return true; } Is there some sort of alternative way to restructure this function?
-
Please let me know that Why you should keep the brackets outside of PHP? Because if a non-coder wants to carry out work on a redesign, he/she doesn't want to/know how to mess around with PHP.
-
You should keep the brackets outside of PHP.
-
Website for Broadcasting Equipment Rental service
waynew replied to klimito's topic in Website Critique
I think the navigation could do with a better touch. It's a bit too bland and the font looks a bit blurry. -
Why not create a table called donations? Then, when a donation is successful, add the username/user_id, amount and date?
-
Holy crap! That never crossed my mind. I do indeed use a custom framework and it does have a piece of code that attempts to reverse the effects of magic quotes if they're detected. My local server doesn't have magic quotes enabled. The two servers that the code isn't working on does. I'm pretty positive that must be the problem. Thanks for the help. I was completely stumped on this.
-
I did a print on the POST variables. It shows like so: Array ( [username] => tester [platform] => 0 [gamertag] => testingthis [favourite_time_of_play] => Evening [timezone] => 3 [uses_mic] => 1 [password] => tester123 [password_repeat] => tester123 [games] => Array [gametypes] => Array [code] => P2KW [submit_gt] => Submit Details ) Note that my checkbox arrays are games and gametypes.
-
Would this have anything to do with the fact that I have an array called $games? Edit: No. Just changed the name of the checkbox array to something else. print_r is still just printing out Array
-
Your server has magic_quotes enabled. It's pretty annoying because it attempts to escape all sensitive characters with backslashes. If you can't get your host to disable the feature, you can always run this script. (I usually place it in a config file). if(get_magic_quotes_gpc ()){ foreach($_POST as $key => $val){ $_POST[$key] = stripslashes($val); } foreach($_GET as $key => $val){ $_GET[$key] = stripslashes($val); } foreach($_COOKIE as $key => $val){ $_COOKIE[$key] = stripslashes($val); } } Basically, the code checks to see if magic quotes is enabled. If it's enabled, it'll go through all of the POST, GET and COOKIE data and reverse the effects. Note: You should run the above code before you start using your POST data etc.
-
Thanks for the reply! The xhtml in my form looks like this (this is from the source): <input type="checkbox" name="games[]" value="1" />Call of Duty 2<br /> <input type="checkbox" name="games[]" value="2" />Call of Duty 3<br /> <input type="checkbox" name="games[]" value="0" />Call of Duty 4<br /> <input type="checkbox" name="games[]" value="4" />Call of Duty Black Ops<br /> <input type="checkbox" name="games[]" value="3" />Call of Duty MW2<br /> <input type="checkbox" name="games[]" value="6" />Call of Duty MW3 (Not released)<br /> <input type="checkbox" name="games[]" value="5" />Call of Duty WAW<br /> When the form is submitted, my page handles the POST data and sends it to a class function: if(isset($_POST['submit_gt'])){ $insert = $user->add_gamertag($_POST); if($insert){ $util->redirect('submit.php?m=gt_submitted'); } } Then, my class function basically checks to see if at least one checkbox has been checked: $chosen_games = array(); if(!isset($values['games']) || sizeof($values['games']) == 0 || !is_array($values['games'])){ $this->util->add_error("Please select what games you usually play."); } else{ foreach($values['games'] as $val){ if(array_key_exists($val, $games)){ $chosen_games[] = $val; } } } I keep getting the "Please select what games you usually play." error, regardless of how many checkboxes I check.
-
what would I have to learn to make a site like Odesk.com?
waynew replied to silverglade's topic in Miscellaneous
If you knew PHP, MySQL, JQuery, Ajax, HTML and CSS to a reasonable level, you'd be able to work something out. Although bear in mind that a lot of time and effort has gone into oDesk and your attempt to make something similar might not work out. -
Ok, I've never had this problem before. Everything is working perfectly on my local machine (PHP 5.3.0). I have a checkbox array that looks like this: <input type="checkbox" name="games[]" value="<?php echo $key; ?>" <?php echo $checked; ?>/><?php echo $val; ?><br /> It's printing out perfectly in the source on both my local machine and the two free servers I've just uploaded it to. However, on the two free servers I've uploaded my script to, they don't seem to be getting the array after the form is submitted. On my local machine, it's working perfectly and my script is recognizing the array. When I do a print_r on games, it simply just prints out Array, even if you've selected some of the boxes. On the two servers, it doesn't even print out as Array( ). In my script, I check to make sure that the user has checked at least one game. (Bear in mind that the $values array is simply just the $_POST array after being passed through a class function. if(!isset($values['games']) || sizeof($values['games']) == 0 || !is_array($values['games'])){ $this->util->add_error("Please select what games you usually play."); } No matter how many checkboxes I check, I still get the error above: "Please select what games you usually play." As I said, on my local machine, all of this is working fine and I don't get that error.
-
Just solved it! I'm a bit tired at the moment, so it looked as if it wasn't working. Turns out I had used DISTINCT incorrectly.
-
Even if I add DISTINCT, it still repeats
-
Hi. Thanks for the reply. Unfortunately, I'll still be in trouble, as a visitor may want to search for those who play multiple game modes. If a gamertag has more than one game mode attached to it, the same result will be repeated. For example: SELECT gamertags.*, games.*, game_type_preferences.* FROM gamertags LEFT JOIN games ON gamertags.user_id = games.user_id LEFT JOIN game_type_preferences ON gamertags.user_id = game_type_preferences.user_id WHERE game_type_preferences.gametype_id = 1 OR game_type_preferences.gametype_id = 2 returns my gamertag twice in the same resultset because I have both game modes attached to my gamertag.
-
I have three tables: gamertags games game_type_preferences When a new user signs up, his/her account info is inserted into the gamertags table. i.e. that is the main user table. On signup, a user can also check boxes on what games they play (games). They can also choose what multiplayer game modes they like to play (game_type_preferences). Obviously, because the user can choose more than one game and more than one game mode, I've had to setup two different tables. These two tables are linked to the gamertag table via a user_id. gamertags user_id games game_id user_id game_type_preferences gametype_pref_id user_id As you can see, the gamertags table is the parent table and the other two tables are child tables. The two child tables are not related to one another (even though to some, it would make sense if they were). For example, when I setup an account, my info is stored in the gamertags table. The games I play are stored in the games table (can be one or more). The game modes I like to play are stored in the game_type_preferences table. The problem I'm having is with the search utility. I want people to be able to search for users by games and game_type_preferences, however, I'm pretty sure that this is not going to work with the SQL I have, as info from the gamertags table will be repeated multiple times if the gamer in question has chosen more than one game / game mode. Here's what I have so far, and it's without the basic search conditions. Problem is: This query above will give me the same user twice if he/she has chosen two games or two game types.
-
Also, don't encapsulate your PHP classes in HTML.
-
Define a constant on the main page and check to see if that constant has been defined before running the upload script.
-
My wordpress theme (First design),Please reviews!
waynew replied to fishtoon's topic in Website Critique
I like the colour scheme. However, you should probably add a little bit of padding to the end of those posts. Looks a little squished. -
These are notices (that you should fix). Basically, you're trying to access an array element via an array index that hasn't been created yet. For example, if the array index 'name' hasn't been set yet and I try to do this: echo $myarray['name']; ... I'd also get a nasty notice message.
-
I misspelled isset on the else if. Retry my code.
-
You could change my code to: header('Location: index.php?sent=N'); if(isset($_GET['send']) && $_GET['send'] == "Y"){ echo 'Success'; } else if(isset($_GET['send']) && $_GET['send'] == "N"){ echo 'Error'; }
-
Ah! A fellow COD player
-
You can create a View very easily: CREATE VIEW viewname AS SELECT * FROM tablename; Views can then be used like tables. So... SELECT * FROM viewname; They're mostly used to cordon off what pieces of data certain users can see. For example, a department manager might get to see a view that has employee names and addresses, whereas a HR manager might get to see a view that has the name, address and salary.
-
Try: / Build SQL Query $query = "select * from FUNERAL where POSTCODE OR COUNTY like \"%$trimmed%\" AND CUSTOMER = 'Y' order by POSTCODE"; // EDIT HERE and specify your table and field names for the SQL query