Jump to content

php_tom

Members
  • Posts

    264
  • Joined

  • Last visited

    Never

Everything posted by php_tom

  1. I don't think it's that important... most newbies use a remote host somewhere, not run their own server. And for development/testing, there's XAMPP which works out of the box. Besides, there's no way you would do this topic justice in three hours. Haha! Me too... w3schools is great. I still go there all the time for HTML and CSS reference. My notes: I would go over the general language syntax, spend a bit of time on variable types, casting, etc. and then do a couple examples. Maybe how to send an email from a form. Or how to deal with a file upload. But I would leave at least a bit of time at the end to tell them some of the things PHP can do, but not how to do it. Smart people can google it, the most important thing is to know if something is possible or not. I'm thinking just briefly mention things like GD image lib, ezPDF lib, writing text/excel/whatever files from PHP, making a secure login area w/$_SESSION, search scripts, etc. Finally, make sure you point them to the following websites: 1) THIS WEBSITE: http://www.phpfreaks.com/forums/ 2) http://www.php.net -- Lots of stuff here, I use it mainly for the PHP function reference. 3) http://www.w3schools.com -- help for every web programming language you can think of. 4) http://sourceforge.net -- every time you think of a more complicated task/project, look here; it may have been done before. Use their search function and put "PHP" in your query. 5) Last but not least: http://www.google.com for solving almost any problem you ever have. Ack, this got long. Sry.
  2. First of all you can't add 2 to a date object... And even if you tested the hour or something, it still wouldn't work, because [i != (i + 2)] [ever ] Please explain what exactly you're trying to do.
  3. Sure, you could do that... you could use regex functions, but I don't like regex. Try this instead: str_replace("'", "", $theText); Hope that helps.
  4. Right and if you call addslashes on it, this will become "... Torch\'s ..." which will fix your problem. And you can always do stripslashes again when you SELECT from the table...
  5. Some servers (especially free hosting servers) disable mail(). Check your host's service plan for this, usually the tell you somewhere.
  6. Not sure what to say... if you call addslashes() on all the input you're goin to put into the query, it shouldn't complain... can you make the script echo the INSERT SQL statement before trying to do it(e.g., echo $import;), the post what it echoed?
  7. If you have all th information in an array, just concatenate the info as a string (in an email newlines are '\n'). Like so: <?php $message = $data['user1email']."\n".$data['user1title1']."\n".$data['user1title2']."\n"; $message .= $data['user1title3']."\n".$data['user1title4']."\n\n"; $message .= $data['user2email']."\n".$data['user2title1']."\n".$data['user2title2']."\n\n"; $message .= $data['user3email']."\n".$data['user3title3']."\n".$data['user3title4']."\n\n"; $message .= $data['user4email']."\n".$data['user4title1']."\n".$data['user4title2']."\n"; $message .= $data['user4title3']."\n".$data['user4title4']."\n\n"; $subject = "Data extracted from database"; $to = "youname@yourdomain.com"; mail($to, $subject, $message); ?> Hope that helps.
  8. Try this: $column1=addslashes($_POST['column1']); $column2=addslashes($_POST['column2']); $column3=addslashes($_POST['column3']); $column4=addslashes($_POST['column4']); $column5=addslashes($_POST['column5']); Hope that helps.
  9. Use Sessions. Specify the operation in a Session variable.
  10. I just tested the HTML since I don't have access to your database. This code seems to work perfectly: <form name='myform'> <select name="optone" size="1" onchange="alert(document.myform.optone.options[document.myform.optone.selectedIndex].value);"> <option value=" " selected="selected">Select a match please</option> <option value="1">Week 1: joe vs steve</option> <option value="2">Week 2: joe vs max</option> <option value="3">Week 2: mark vs animal</option> </select> </form> Try replacing the 'alert()' with the function you're trying to call, and put your PHP while loop back in, then try it and if it still doesn't work I'm guessing your database query is wrong. Hope that helps.
  11. How about this: in your header function, <?php $imgdir = "../The/Directory/Where/Your/Images/Are"; // or $imgdir = imgsrc('path'); ?> Note that you only need this once per page... Then for the image tags: <img src="<?php echo $imgdir; ?>/img/name.jpg" /> Not sure if this is what you had in mind. Hope it helps.
  12. Maybe this is the problem? I don't think we defined $folder anywhere... Try changing it to $fullname="theFolderYouWantTheUploadsIn/".$filename;
  13. The really fancy dropdowns are done in flash... which for the most part people don't give away for free. But try googling for some free flash menus.
  14. You could also try SquirrelMail, a free webmail client. http://www.squirrelmail.org/
  15. Try replacing the function with function uploadFile($name,$folder) { $filename=$_FILES['userfile']['name']; $filesize=$_FILES['userfile']['size']; $tempname=$_FILES['userfile']['tmp_name']; $fullname=$folder."/".$filename; copy($tempname, $fullname) or die("Cannot upload file!"); return true; } Post back if that doesn't work...
  16. Try this (sorry its long but i think it's what you want): In "upload.html": <form enctype="multipart/form-data" action="upload_2.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="10000000" /> <!-- 10MB --> File: <input name="userfile" type="file" /><br /> <center><input type="submit" value="Upload" /></center> </form> Then in "upload2.php": <?php $name = $_FILES['userfile']['name']; $size = $_FILES['userfile']['size']; $type = $_FILES['userfile']['type']; if(!uploadFile($name,"theFolderYouWantTheFileIn")) die("The file couldn't be uploaded. Please contact your network administrator."); $filename = "theFolderYouWantTheFileIn/".$name; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); $test = $contents; echo strip_md5($test)." words available<hr>"; echo strip_md5($test)." words available<hr>"; function uploadFile($name,$folder) { $filename=$_FILES['userfile']['name']; $filesize=$_FILES['userfile']['size']; $tempname=$_FILES['userfile']['tmp_name']; $fullname=$folder."/".$filename; copy($tempname, $fullname) or return false; return true; } function strip_md5($str){ $words = 0; $str = eregi_replace(" +", " ", $str); $array = explode(" ", $str); for($i=0;$i < count($array);$i++) { if (eregi("[0-9A-Za-zÀ-ÖØ-öø-ÿ]", $array[$i])) $words++; $checklen = strlen($array[$i]); if($checklen == "32") { echo $array[$i]."<br>"; } } return $words; } ?> Hope that helps.
  17. Check out http://www.dynamicdrive.com/style/csslibrary/category/C1/ (this is what I use, plus my own CSS.) Hope that helps.
  18. I guess you mean that you want to post the MD5 stuff in a web form instead of needing to edit the text file... although sending even md5s of stuff over the web is not too secure, there are md5 crackers out there... but here's what I'd do: <?php if($_POST['text'] != "") { $contents = strip_tags($_POST['text']); $test = $contents; echo strip_md5($test)." words available<hr>"; echo strip_md5($test)." words available<hr>"; } else { // Print the form... echo "<form action='thisPage.php' method='post'><textarea rows='20' cols='30' name='text'>"; echo "</textarea><input type='submit' value='DO MD5 Stuff!' /></form>"; } // sunjester // - Email address removed from bots quote post to view - // www.hgsdomination.com function strip_md5($str){ $words = 0; $str = eregi_replace(" +", " ", $str); $array = explode(" ", $str); for($i=0;$i < count($array);$i++) { if (eregi("[0-9A-Za-zÀ-ÖØ-öø-ÿ]", $array[$i])) $words++; $checklen = strlen($array[$i]); if($checklen == "32") { echo $array[$i]."<br>"; } } return $words; } ?> Try this (and change the 'thisPage.php' to the name of your script...) Hope that helps.
  19. Sry, not too familiar with ajax type codes here... maybe you can teach me!
  20. I typed "swf mime type" into google, it says "application/x-Shockwave-Flash".
  21. I think you want a <br /> tag in between the link and the pic. like so: <?php echo "<table>"; // display the users in table $c = 0; while($row = mysql_fetch_array($result)) { $user2 = $row['user']; if($c%5 == 0) echo "<tr height=\"150px\">"; // If the counter has ticked 6 times, start a new row. echo "<td><a href='ViewProfile.php?view=$user2'>$user2</a><br />"; echo "<img src='DisplayPic_Tiny/".$row['user'].".jpg'/></td>"; // use the varaible row to display image DisplayPic_Tiny/user if($c%5 == 4) echo "</tr>"; // If we're drawing the 6th pic, end this row. $c++; } if($c%5 != 4) echo "</tr>"; // If there isn't a number of pics divisible by 6, end the row echo "</table>"; // end the table ?> Hope that helps.
  22. Try: <?php function getText(){ echo "This is the text"; } ?> <script type='text/javascript'> function getText_cb(getText) { document.getElementById("lblText").innerHTML = '<?php getText(); ?>'; } </script> I think the problem is that javascript interprets getText as a variable, which hasn't been defined in JS yet, so it's value is undefined. Hope that helps.
  23. Your code is too long, plus the classes you call are missing, I can't help you unless you narrow own the problem part of the code. Are you making a playlist somewhere? If so, give us the code for that only.
  24. if you're doing it in PHP i think you want Also, what kind of condition is ? I've never seen anything like that before, maybe check your SQL syntax on that.
  25. First of all you have If you havn't defined $useryear, this will be rendered by the PHP engine as ]and =userdata.year , obviously the wrong syntax. Try getting PHP to echo the query to the screen and verify that it says what you are expecting. Also, im not sure if you need parens when doing multistatment conditions, e.g., FROM metric_desc, userdata WHERE (metric_desc.met_key=userdata.met_key AND $useryear=userdata.year)";
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.