Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Try this <?php // 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 .= "To: peter <$to>\r\n"; $headers .= "From: john <john@example.com>\r\n"; $to = "x@x.com"; $sub = "test"; $msg = "<b>hello<b><br />this is a test \n mail!!<p>paragraph</p>"; $msg= nl2br($msg); //convert /n to <br> mail($to,$sub,$msg,$headers); ?>
  2. what about a table thats contains the UsersID's IE 2 fields VisitorID, UserID Now if my ID was 10 and i visited Users 9,11 & 45, the system add 3 records IE VisitorID, UserID 10, 9 10, 9 10, 45
  3. print $out['original'];
  4. Gets go into CURLOPT_URL full example <?php $iputthegetfieldshere = "?test1=one&testtwo=2"; $iputthepostfieldshere = "test3=three&testfour=4"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL, "https://thesite.com/folder/file".$iputthegetfieldshere); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 10); // times out after 10s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, $iputthepostfieldshere); // add POST fields curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($ch, CURLOPT_FTPAPPEND, 1); $result = curl_exec($ch); // run the whole process curl_close($ch); echo $result; ?>
  5. if you have written a script to create the folders why do you need another script to update the permissions ? <?php $folder = "somedir"; mkdir($folder,0777);//0777 should be default! chmod($folder, 0777); //Just to double check ?>
  6. code looks ok except $iputthepostfieldshere isn't set! which is the post field!
  7. So whats the problem your having? what code do you have so far ?
  8. your not echoing it at all! try <?php // Fetch and Display the Results from the Database $result = mysql_query("select name, email, v_comment from guest_book ORDER BY id",$dbi); while ($myrow = mysql_fetch_array($result)) { echo "<b>name:</b> $myrow[0]<br> <b>email: </b>$myrow[1]<br> <b>message:</b> $myrow[3] <br><br><hr><br><br>"; } echo '<form name="form1" method="post" action="store_comment.php"> Your Name: <input name="name" type="text" size="15"><br> Your Email ID: <input name="email" type="text" size="15"> Comments : <textarea name="comments" cols="15" rows="3"></textarea> <input type="submit" name="Submit" value="Submit"></form>'; ?> or <?php // Fetch and Display the Results from the Database $result = mysql_query("select name, email, v_comment from guest_book ORDER BY id",$dbi); while ($myrow = mysql_fetch_array($result)) { echo "<b>name:</b> $myrow[0]<br> <b>email: </b>$myrow[1]<br> <b>message:</b> $myrow[3] <br><br><hr><br><br>"; } echo "<form name=\"form1\" method=\"post\" action=\"store_comment.php\"> Your Name: <input name=\"name\" type=\"text\" size=\"15\"><br> Your Email ID: <input name=\"email\" type=\"text\" size=\"15\"> Comments : <textarea name=\"comments\" cols=\"15\" rows=\"3\"></textarea> <input type=\"submit\" name=\"Submit\" value=\"Submit\"></form>"; ?> or <?php // Fetch and Display the Results from the Database $result = mysql_query("select name, email, v_comment from guest_book ORDER BY id",$dbi); while ($myrow = mysql_fetch_array($result)) { echo "<b>name:</b> $myrow[0]<br> <b>email: </b>$myrow[1]<br> <b>message:</b> $myrow[3] <br><br><hr><br><br>"; } ?> <form name="form1" method="post" action="store_comment.php"> Your Name: <input name="name" type="text" size="15"><br> Your Email ID: <input name="email" type="text" size="15"> Comments : <textarea name="comments" cols="15" rows="3"></textarea> <input type="submit" name="Submit" value="Submit"></form> <?php //....other code ?>
  9. Okay.. try this create a new file containing ONLY the below.. <?php session_start(); $_SESSION['logged_in'] = 0; setcookie('login_cookie', "", time() - 60, '/', '.yoursite.com'); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_unset(); session_destroy(); header("Location: http://www.mysite/demo"); ?> now load this file directly from the URL.. and then try the private section
  10. i have had the same problem.. my solution (workaround) was to set the sessions to nulls ie <?php session_start(); $_SESSION['logged_in'] = null; unset($_SESSION['logged_in']); //i know the manual said not to but it side effect works ?> whats the conditions to allow you in the private area ? also check your NOT sending any output before this is called.. (ie echo "logging out" Oh yeah add this (to remove the session cookie) <?php if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } ?>
  11. The basic Idea is to use mysql_num_rows() to count the rows, if their over 16, then use "Limit 0,16" (for page 1) then "Limit 16,32" for page 2 etc, just search here or google for pagination
  12. No, 1. Index is a reserved word 2. No , needed
  13. you need to use session_start(); with try <?php session_start(); //<--you need this session_unset(); session_destroy(); ?>
  14. your need a while loop with the DB, try this (again untested) <?php $query = "SELECT * FROM images WHERE club_id = '$id'"; $result = mysql_query($query); //$dbitems = array("img1.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img5.jpg"); $maxcol = 4; echo "<table>"; $c = $maxcol; //foreach($dbitems as $img) while($img = mysql_fetch_assoc($result)) { $imgName= $img['picture_name']; $caption = $img['caption']; if($c==0) echo "<tr>"; echo "<td>"; echo "$imgName<br>";//debugging echo "$caption <br>";//debugging echo "<img src=\"$imgName\">"; echo "</td>"; if($c==0) { echo "</tr>"; $c = $maxcol; }else{ $c--; } } echo "</table>"; ?>
  15. While i 101% agreee with kenrbnsn, i just think its worth adding the functions your need to use are Insert (to add a record and update to update an existing record(s), if this sounds confusing them your need to readup on it.
  16. for the 16 images your need to readup on pagination, as for the displaying them in a grid you could to something like this <?php $dbitems = array("img1.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img5.jpg"); $maxcol = 4; echo "<table>"; $c = $maxcol; foreach($dbitems as $img) { if($c==0) echo "<tr>"; echo "<td>"; echo "<img src=\"$img\">"; echo "</td>"; if($c==0) { echo "</tr>"; $c = $maxcol; }else{ $c--; } } echo "</table>"; ?> untested (used a array to same me typing the sql stuff)
  17. erm.. maybe <?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past $array = array('img1.png', 'img2.png'); $rand = array_rand($array); header("Location: othersite.com/".$array[$rand]."?Rand=".time()); ?> depends how your calling that page itself..
  18. No POST is used from a form via the submit button but on the PHP side its the same idea $_POST['Page'] EDIT:typo
  19. okay lets see if i can explain this:~ before we get into the MySQL side of things lets look at $_GET, when you URL contains a ? your passing parameters, ie index.php?page=about so if you create a page called index.php containing the following script <?php echo $_GET['page']; ?> you can load up the page like this index.php?page=Anything index.php?page=you index.php?page=want Now when it comes to MySQL.. Just say you have a table called `MyTable` and 2 fields `Title` and `contents` your use a query like this $query = "SELECT contents FROM MyTable WHERE Title = '".$_GET['page']."';" <?php $conn = mysql_connect("localhost", "mysql_user", "mysql_password"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("mydbname")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $query = "SELECT contents FROM MyTable WHERE Title = '".$_GET['page']."';" $result = mysql_query($query); if (mysql_num_rows($result) == 0) { echo "Title Not Found"; exit; } $row = mysql_fetch_assoc($result) echo $row['contents']; ?> Please note this is untested EDIT: opps updated SQL
  20. i think desc is reserved EDIT: to slow!
  21. this should work.. <?php $array = array('img1.png', 'img2.png'); $rand = array_rand($array); header("Location: othersite.com/".$array[$rand]); ?> but then again yours looks fine as well...
  22. okay.. how are you planning to display the confirmation page?
  23. i'm 99.9% sure its that one but i get it from here http://sourceforge.net/projects/phpmailer
  24. to sum up all your questions into one.. how do i send an email via php.. maybe you should try the class called phpmailer
  25. would probably be better off asking these questioins in the correct section EDIT: but it looks like your missing a bunch of code..! i assume ddajaxtabs is part of a external js file you are not including
×
×
  • 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.