MarkT
-
Posts
168 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by MarkT
-
-
PHP problems
in PHP
mail() returns false if there was a mistake from PHP's part, so for one you can have your program send the mail first and write in the database later if there were no problems. Though as the manual said, mail() can't tell for sure if the SMTP server sent it, it just knows that the mail was accepted by the server for delivery.
$test = mail($to,$subject,$message,$headers);if(!$test) { echo '( ! ) MAIL ERROR'; // Do something here}
yes but it simultaneously executes an SQL query, which wasn't inserted properly, although it's inserted 10 already.
-
PHP problems
in PHP
have you done any logging or tried breaking the problem down line by line? Do you make sure your code gets through a few lines ok first? Comment everything out, then uncomment a few related lines at a time and see how it goes. I would pay specific attention to your queries and your mail call. You aren't checking for any errors at any of those points. Also, I never see you call session_start()
This is only part of the code, the bit that sends the mail. This works most times, but stops sometimes.
-
The opacity property makes the entire element transparent, as a result the text inside it also has opacity. If you just want the background transparent rather than the element itself you can use rgba() color codes. http://www.w3schools.com/cssref/css_colors_legal.asp
You could use
<div style="opacity: 0.3;">Opacity Bit here <div style="opacity: 1;">Normal</div></div> should work, i think.
-
yap...I just don't know how to make one
I'm not 100%,
but if you use a normal log in form, with a checkbox, you need to check that the log in is valid, the checkbox for remember me has been ticked, then you need to use $_COOKIE['auto'] == "true";
then on your website, use <?PHP if($_COOKIE['auto'] == "true") { if logged in stuff here } else { } ?>
I think this is right. You might want to check it first though.
-
hey there ive got a website that sells webhosting i got it setup using a free template the reseller provides all was well i changed all the clour schemes and what not but i didn't like the template so i bought a template called MyVPS and obviously the pages on this templates are all different but when i try to register im really stuck and getting confused how i get registration form to send to my re seller CP if you like? so it activates an account with my site. heres the registration code. from the original website that worked
and heres the new template form that dont work
What cpanel do you use as a reseller cp?
Does your form use PHP variables? if you have access to the database for your reseller cp, you need to use PHP to get values from the form, and insert them into the database.
-
Thanks, looks very much like what i am trying to achieve is not possible with HTML alone
I would use PHP if i were you in this situation, it has more flexibility and you could use HTML mail, to style the email, using values from the PHP form.
Let me know if you need examples of code for your solution. I'll be sure to help.
-
I can get div to work i just dont understand what it does. ive read into it but i cant seem to get a good answer.
I think of Div as a container.
I normally use CSS (#divName) and specify the styling options such as width, height, position and other variables.
Then use it in my HTML, <div id="divName">Hello</div>
I hope this helps.
-
I want to make a semantic html of a bulletin board (forum)
I wonder if the <section> tag is good for categories and I also wonder if <article> tag is good for topics
Is it good for me to do that ?
You can see my html code at http://jsfiddle.net/terryds/yW85T/
Personally I dont' see anything wrong with that. It's up to you and the way you want to use it, you could use normal divs, but I would be likely to use section and article.
-
PHP problems
in PHP
Can anyone help? I've logged out and logged back in, and after a few times of logging in/out it works, but it's long winded and would prefer a better resolution.
Thanks.
-
PHP problems
in PHP
Not sure if I can help, but regardless, what's your code?
if($_GET['action'] == "send") {$send = $_POST['to'];if($_POST['to'] == "ALL") {$send = $_POST['to'];$subject = $_POST['subject'];$from2 = $_POST['email'];$content = $_POST['content'];$team = $_POST['to'];$emails = mysqli_query($con,"SELECT * FROM parents WHERE global = '1'");$date = date("d-m-Y");$time = time();$user = $_SESSION['fname'];$user2 = $_SESSION['lname'];mysqli_query($con,"INSERT into email_logs (user, send_to, content, date_sent, time_sent) VALUES ('{$user} {$user2}','{$send}','{$content}','{$date}','{$time}')");while($results = mysqli_fetch_array($emails)) {$toemail = "{$results['email_address']}";$subject = "{$subject}";$message = "<html><head> <title>{$subject}</title></head><body>{$content}<br /><font color='red'><strong><h2>Regards</font> <br>Ditton Minors FC</h2></strong></body></html>";$from2 = $_POST['email'];$from = "{$from2}";$headers = 'MIME-Version: 1.0' . "rn";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";$headers .= "Bcc: ".$toemail."rn";$headers .= "From: admin@dittonminorsfc.co.ukrn";mail($to,$subject,$message,$headers);echo "<h1 style='color: #00FF00;'>Email Sent Successfully</h1><meta http-equiv='refresh' content='2;url=adminemail.php'>";}} else {$send = $_POST['to'];$subject = $_POST['subject'];$from2 = $_POST['email'];$content = $_POST['content'];$team = $_POST['to'];$emails2 = mysqli_query($con,"SELECT * FROM parents WHERE team = '{$team}'");$date = date("d-m-Y");$time = time();$user = $_SESSION['fname'];$user2 = $_SESSION['lname'];mysqli_query($con,"INSERT into email_logs (user, send_to, content, date_sent, time_sent) VALUES ('{$user} {$user2}','{$send}','{$content}','{$date}','{$time}')");while($results2 = mysqli_fetch_array($emails2)) {$toemail = "{$results2['email_address']}";$subject = "{$subject}";$message = "<html><head> <title>{$subject}</title></head><body>{$content}<br /><font color='red'><strong><h2>Regards</font> <br>Ditton Minors FC</h2></strong></body></html>";$from2 = $_POST['email'];$from = "{$from2}";$headers = 'MIME-Version: 1.0' . "rn";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";$headers .= "Bcc: ".$toemail."rn";$headers .= "From: admin@dittonminorsfc.co.ukrn";mail($to,$subject,$message,$headers);echo "<h1 style='color: #00FF00;'>Email Sent Successfully</h1><meta http-equiv='refresh' content='2;url=adminemail.php'>";}}}?>
-
PHP problems
in PHP
Hello,
I have a script in my website, which is used to send emails, however it's not working.
You log in with sessions, and then you go to a form, which then echos: Send successful,
but it doesn't actually send or complete t he SQL query to log it, it sometimes works, sometimes doesn't.
Thanks in advance.
-
I would recommend reading the thread more thoroughly before trying to answer.
My target="_blank" works in a new tab, but I don't see why you need a new window.
If I'm honest.
-
You can do it in HTML.
It's using the target attribute.
For example; <a href="#" target="_blank"> does a new tab or window.
-
Here's an example, but it would be more convenient for your career as a PHP programmer if you tried to piece things together on your own.
$sentence = 'I hate you';// Turn the sentence into an array of words$words = explode(' ', $sentence);// in_array() will tell you if a value was found in the array// Using the ! (NOT) operator we can tell if the value was NOT found in the arrayif( !in_array('hate', $words) ) { // Execute the SQL query because the word was not found}
Is there a way to use multiple values for the in_array bit?
-
you can also use explode() to take out the sentence in seperate word splited by space. Make another array of your stop words and then you can sue in_array() to check if stop words exist in exploded words or not. if it is in array dont execute the sql.
Can you show me an example please, using the word; "hate" for example.
-
You can use strpos() to see if the word exists in the string, though it doesn't take spaces into account.
if(strpos($value, 'word') === false) { // If the word wasn't found then execute the SQL query}
Other solutions would be more complex.
Thanks
-
Hello,
I want to create a posting system for my website, where if the post contains a certain word, then it stops the SQL query that puts it into the database, or at least stops it.
Thanks
-
It shows the right thing on every page, until you load the team page, then it overwrites it.
-
All it's doing is writing out the value. If the problem is which value is in $_SESSION['team'], then where do you set that?
That is set on the login script, from a value set by the database.
-
Here's the other navigation code where the problem occurs:
<?PHP if(isset($_SESSION['loggedin'])) {echo "<div id='membermenu'><ul> <li class='active'><a href='myprofile.php'><span>My Profile</span></a></li>"; if($_SESSION['ismanager'] == "1") { echo " <li><a href='playerprofiles.php?team={$_SESSION['team']}'><span>Player Profiles</span></a></li> <li class='has-sub'><a href='#'><span>Team Management({$_SESSION['team']})</span></a> <ul> <li><a href='editteam.php'><span>Edit Team</span></a></li> <li><a href='viewparents.php?team={$_SESSION['team']}'><span>View Parents</span></a></li> <li><a href='adminemail.php'><span>Send Emails</span></a></li> </ul> </li>"; } else {}; if($_SESSION['reporter'] == "1") { echo " <li><a href='writereport.php'><span>Write Match Report</span></a></li>"; } else {}; if($_SESSION['isadmin'] == "1") { echo " <li class='has-sub'><a href='#'><span>Shop Management</span></a> <ul> "; echo "<li><a href='shop.php?action=add'><span>Add Product</span></a></li>"; echo " <li><a href='pricerequests.php'><span>View Orders</span></a></li> </ul> </li>"; } if($_SESSION['isadmin'] == "1") { echo " <li><a href='playerprofiles.php'><span>Player Profiles</span></a></li> <li class='has-sub'><a href='#'><span>Administrator Tools</span></a> <ul> <li><a href='mass.php'><span>Mass Alert</span></a></li> <li><a href='writearticle.php'><span>Write News Article</span></a></li> <li><a href='adminemail.php'><span>Send Email</span></a></li> <li><a href='playerprofiles.php'><span>Player Profiles</span></a></li> </ul> </li>"; } echo " <li><a href='logout.php'><span>Logout</span></a></li></ul></div>";} else {}?>
Probably not the neatest code, but it's good enough for me. The team management ($_SESSION['team']) is where it goes wrong.
-
You'll have to show us the code for the navigation, then.
<div id='cssmenu'><ul> <li class='active'><a href='index.php'><span><img src="./images/home.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC :: The Future's Bright!" alt="Ditton Minors FC :: The Future's Bright!">Home</span></a></li> <li class='has-sub'><a href='#'><span><img src="./images/about.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="About Ditton Minors FC" alt="About Ditton Minors FC"><span>About Us</span></a> <ul> <li class='has-sub'><a href='#'><span>Staff</span></a> <ul> <li><a href='committee.php'><span>Committee</span></a></li> <li class='last'><a href='officials.php'><span>Officials</span></a></li> </ul> </li> <li><a href='trophies.php'><span>Trophy Cabinet</span></a></li> <!-- <li><a href='history.php'><span>Club History</span></a></li> --> <li><a href='sponsors.php'><span>Sponsors</span></a></li> <li><a href='gallery.php'><span>Our Gallery</span></a></li> </ul> </li> <li class='has-sub'><a href='#'><span><img src="./images/calendar.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC Soccer Schools!" alt="Ditton Minors FC Soccer Schools!">Events</span></a> <ul> <li><a href='millwall.php'><span>Millwall Soccer School</span></a></li> <li><a href='soccerschool.php'><span>Summer Soccer School</span></a></li> <li><a href='tournament.php'><span>Ditton Minors Annual Tournament</span></a></li> </ul> </li> <li class='has-sub'><a href='#'><span><img src="./images/team.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC :: Meet The Teams!" alt="Ditton Minors FC :: Meet The Teams!">The Teams</span></a> <ul> <li><a href='team.php?team=MINI'><span>Mini Minors</span></a></li> <li><a href='team.php?team=U7'><span>Under 7's</span></a></li> <li><a href='team.php?team=U8'><span>Under 8's</span></a></li> <li><a href='team.php?team=U9'><span>Under 9's</span></a></li> <li><a href='team.php?team=U10'><span>Under 10's</span></a></li> <li><a href='team.php?team=U11'><span>Under 11's</span></a></li> <li><a href='team.php?team=U12'><span>Under 12's</span></a></li> <li><a href='team.php?team=U13'><span>Under 13's</span></a></li> <li><a href='team.php?team=U14'><span>Under 14's</span></a></li> <li><a href='team.php?team=U16'><span>Under 16's</span></a></li> <li><a href='team.php?team=U18'><span>Under 18's</span></a></li> <li><a href='team.php?team=MENS'><span>Senior Mens</span></a></li> </ul> </li> <li><a href='player.php'><span><img src="./images/player.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC :: Meet The Players!" alt="Ditton Minors FC :: Meet The Players!">Players</span></a></li> <li><a href='shop.php'><span><img src="./images/shoppingcart.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors Merchandise Store!" alt="Ditton Minors Merchandise Store"><strong>Shop</strong></span></a></li><!-- <li class='last'><a href='#'><span><img src="./images/contact.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Contact Ditton Minors FC" alt="Contact Ditton Minors FC">Contact Us</span></a></li> --> <li class='has-sub'><a href='#'><span><img src="./images/member.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Contact Ditton Minors FC" alt="Contact Ditton Minors FC">Member's Area</span></a> <ul> <li><a href='login.php'><span>Login</span></a></li> <li><a href='register.php'><span>Register</span></a></li> </ul> </li></ul></div>
Navigation ^^
-
You could look at using Ajax PHP, possibly.
Take a look; http://www.w3schools.com/php/php_ajax_php.asp
-
It's used in the navigation, and the navigation says Team Management (U11) but when I load the team.php?team=U7, it overwrites it to say Team Management (U7) which then affects the rest of the site.
-
You are targeting apostrophes, those characters are right and left single quotes ’ ‘ (characters dont show up here), this usually results from copying and pasting from MS word, these characters are causing the problem.
So you're saying they should be typed in>?
PHP problems
in PHP
Posted
Problem fixed,
Basically, I was trying to send a HTML email with a link, but the SQL query uses ', and the PHP uses " which meant it wasn't logging it properly, but still sent the emails, I ended up sending 10 emails without realising it, then I figured out the problem.