-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
I assume this is a double post.. however.. Would mean you get little help, as this is a FREE service, if you want private work done then check out the freelance section, and pay for it.
-
just update the XY's for the type you want to change $x = array('28', '80', '135', '188', '240'); $y = array('8', '29', '52', '77', '100'); header("Content-type: image/png");
-
Yes you can do it, the part saying "includes an existing page." it kinda strange, but lets say you want you send a HTML email, and your newsletter was newsletter.php, here's a big start (I used Example #4 from mail as a basis), <?php // multiple recipients $to = 'recp1@example.com' . ', '; // note the comma $to .= 'recp2@example.com'; // subject $subject = 'News Letter'; $message = 'Hello below is the newsletter<br>'; //cheating -- okay what this does it loads up newsletter.php but // captures it into a variable instead of outputting it ob_start(); include "newsletter.php"; // message $message .= ob_get_clean(); // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: Example Newsletter <Newsletter@example.com>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?> untested but you should get the idea
-
apache stopped working while adding data data into a table
MadTechie replied to sarathy_1116's topic in PHP Coding Help
nothing wrong with that code.. i assume the next command is mysqli_query(); What exactly says Apache is not running ? sounds like a server issue instead of a coding one, but your being too vague -
Help using looping array insert values into different array
MadTechie replied to msaz87's topic in PHP Coding Help
I'm not sure why you have all those details packing into the "<select" what parts do you want to update ? (what's updatable by the user?) If I am looking at it correctly then I would probably do something like this <form > <!-- loop thought schedules --> 6 PM <br> <input type="hidden" name="slot[]" value="<?php echo $sid;?>"> <input type="text" name="field[<?php echo $sid;?>]" value="Field #1"> <input type="text" name="TeamA[<?php echo $sid;?>]" value="Team 1"> vs. <input type="text" name="TeamB[<?php echo $sid;?>]" value="Team 2"><br> <!-- 6:30 PM <br> details pulled from the database etc etc etc --> <!-- end loop --> </form> foreach($_POST['slot'] as $sid){ echo "Field ".$_POST['field'][$sid]; echo "Team1 ".$_POST['TeamA'][$sid]; echo "Team2 ".$_POST['TeamB'][$sid]; } Note this is just a basic version and the hidden field isn't really needed but i kept it to make it simpler -
Update message to $message = "$todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n Name on the Graphic : $name \n Image on the Graphic : $image \n Size of Graphic (Leave this blank if you want me to pick a size out for you.) : $size \n Font (Leave this blank if you want me to pick one out. If you want to pick one out get it from. <a href=\"http://www.dafont.com/\">Dafont</a>) : $font \n";
-
you need to escape the double quotes, in your $message variable ie $message = "this \" is a escaped quote"; NOT $message = "this " is will not work";
-
change mail("hunter@superiorgfx.site11.com", $subject, $message, $from); to if(mail("hunter@superiorgfx.site11.com", $subject, $message, $from)) { echo "Sent"; }else{ echo "Failed to send"; } if you get the 'Failed to send' check your SMTP server
-
And the problem is ? As a guess its not sending.. okay any more info ? have you setup the SMTP server in the php.ini ?
-
shouldn't <input type="submit" name="Search" value="Search"> be <input type="submit" name="do" value="Search"> OR switch (@$_POST['do']) { be switch (@$_POST['Search']) { As $_POST['do'] isn't in the form
-
Why don't use just use date ie $time = 12086; date_default_timezone_set('UTC'); echo date("H:i:s",$time);
-
Nope.. But we can help you with your code.. theirs a lot of code out their see google
-
[SOLVED] grab name of file with most recent date in it
MadTechie replied to jasonc's topic in PHP Coding Help
your need to get the key, IE $sortfile = array_keys($sortfile); echo $sortfile[0]; -
Notices that cags has too much free time, nice job as a side note, not sure about the use of non-captures ie (??:01)|(?:03)|(?:05)|(?:07)|(?:08)|(?:10)|(?:12)) wouldn't this work just as well ? (?:01|03|05|07|08|10|12)
-
Well the query should be a simple one, the only way i can think of would be to setup a cache, so for example User 1: Ajax requests update System: looks at cache file and checks the modified time, if its over 5 seconds then query database and update file, return results User 2: Ajax requests update (1 second later) System: looks at cache file and checks the modified time, and its under 5 seconds get results from file return results. etc etc but either way if you get "a lot of traffic" (depends what you mean by a lot) and are hitting the server every few seconds then its going to use some resource, memory/bandwidth/a service/disc so it really depends on your server.
-
Technically if your page is dynamically build it will be "real time" but I assume you mean without the user needing to refresh the page to get the new data, in that case your need to (as jonsjava stated) look at ajax (recommened) or an iframe..
-
[SOLVED] grab name of file with most recent date in it
MadTechie replied to jasonc's topic in PHP Coding Help
I would probably take this approach $sortfile = array(); foreach($files as $file){ //Extract date if (preg_match('/(\d+)-(\d+)-(\d+)[^.]*?\.pdf/', $file, $reg)) { //add date to array (file as key) $sortfile[$file] = mktime(0,0,0,$reg[2],$reg[1],$reg[3]); } } asort($sortfile); //Sort an array (the dates) and maintain index association (file names) //echo files foreach($sortfile as $file => $fdate){ echo "$file<br>"; } EDIT: updated regex and changed strtotime to mkdate please note this is untested, but the last file should be the one you want, or use arsort and it will be the first one -
Use $i as a counter ie $i=0; foreach($list as $key => $value) { $i++;
-
Okay the array you are using is an associated array, this means the keys are words not numbers here is a quick example //associated Array $list = array('Cat'=> 'Dog','Mad'=> 'Techie'); echo $list['Cat']; //indexed Array $list = array('Cat','Dog','Mad','Techie'); echo $list[0]; echo $list[1]; echo $list[2];
-
This is one of those things where is it quicker to check yourself.. May I ask why you would think it wouldn't ?
-
Why do I get this stupid furecking error? (Misspelled on purpose!)
MadTechie replied to 3raser's topic in PHP Coding Help
I said HERE meaning on MY PC. Code is fine, check server logs (also you may want to turn error reporting on.. during testing) -
If you want someone to write the code for you then we have a section for that.. its called the freelance section,
-
Why do I get this stupid furecking error? (Misspelled on purpose!)
MadTechie replied to 3raser's topic in PHP Coding Help
works here! -
[SOLVED] Posting Serialized Data Not Working
MadTechie replied to civil777's topic in PHP Coding Help
Why are you adding slashes ? use htmlentities instead sample code (untested) <?php if(!empty($_POST)){ $X = unserialize(($_POST['data'])); echo $X->name; die; } $x = new test; $x->name = "MadTechie"; ?> <form method="POST"> <input type="hidden" name="data" value="<?php echo htmlentities(serialize($x));?>"> <input type="submit"> </form> <?php class test{ public $name; public $age; } ?> -
Why do I get this stupid furecking error? (Misspelled on purpose!)
MadTechie replied to 3raser's topic in PHP Coding Help
Define working.. it does exactly what you asked it to do.. what where you expecting ?