
masgas
Members-
Posts
64 -
Joined
-
Last visited
Never
Everything posted by masgas
-
How to send Email in PHP5 using Apache Server
masgas replied to debajyoti123's topic in Apache HTTP Server
Hi, listen I am quite new to all this, but I configured my [color=blue]php.ini [/color] and got the mail () function working ok... So if you want to try this, go ahead: [mail function] ; For Win32 only. SMTP = smtp.onobox.com ([color=red]set here your SMTP[/color]) smtp_port = 25 ([color=red]This is the port I use, I guess nothing should be changed here[/color]) ; For Win32 only. sendmail_from = [email protected] ([color=red]here you place the "from" mail[/color]...) ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path = "\xampp\sendmail\sendmail.exe -t" ([color=red]here the path where your sendmail.exe file is installed"[/color]. ) -
Right! Thank you! I could use a Pentium IV 3.5 / 1 GB RAM / Apache 2.0 / PHP 5 My inet connection is of 4MB download (150 KB upload! ) though, and my IP is static. do you know what is the main difference between PCs and paid servers? I will take your advice for the moment and stay with my paid host, at least untill I learn a bit more about hosting...
-
Hi, I am considering removing my web from my paid host and hosting it in my own pc. I am not sure if this is an absolutely crazy idea, and shoul stick with my paid domain or change.... As you could tell I don't know much about web servers and their features. So, the questions are: Can you put a semi comercial web in a pc at home with apache, or is it a crazy idea? Do you know any articles to improve my knowledge about servers and their features? thank you in advance!
-
I divided: $result = (L_afiliados/22); echo $result; this brought an error! I also tried: ... @mysql_select_db('encuesta') or die ("no se selecciono bd"); $sql = "SELECT count(p2) FROM datos"; $total = mysql_query($sql); $totalrows = mysql_fetch_row($total); $res = $totalrows[0]; ... ... $res1 = ($res/22); but same result! how can I make a variable from the number of rows? or is it not possible with my query as it is?
-
Hi everyone! I'm doing a small survey among colleagues from work, and I want to show the results in numbers. The question is, how can I turn the result from my db into numbers and make variables of them so I can divide them, turn them into percentages, etc... I have got this code: <?php function L_afiliados () { $con1 = mysql_connect('','','') or die ("Imposible conectar"); @mysql_select_db('encuesta') or die ("no se selecciono bd"); $sql = "SELECT count(p2) FROM datos"; $total = mysql_query($sql); $totalrows = mysql_fetch_row($total); echo $totalrows[0]; } L_aifiliados (); ?> It prints correctly the amount of rows in the field, but if I want to divide it by another number it gives me an error message (divided by zero)... I wish I could have the amount of people who answered yes and dived it by the total amount of people for instance, but I am not sure how to... Thank you in advance!!
-
;) ;D :) heyyy Thanks I managed!! I qeueried again like this!!! $res1 = mysql_query("SELECT pregunta FROM question WHERE id = '$qid'"); $preg = mysql_result ($res1, 0); and after I printed $preg Thanks a million...
-
aha! that got something going!!! though it prints the id number of the answered question and not the question itself!! mmmm I will work from here on, to see if I manage to get it right! thanks a lot! meanwhile if you see why it doesn't do what it is suppoused to do, I'll appreciate your comments... ;D
-
hi! I've got a multiple choice test script in php. However, when it comes to correct the answers I'd like to show the original questions together with the option selected and the correct answer. The last two details I've already manage to get, but the original questions I can not make the script print them. I am not sure how to do that. The script is simple and it uses for and while loops. I wonder if anyone knows how to show the questions so people who make the test see it again when they are correcting it. Thanks in advance... ) Here goes the script: <?php function debug($var){ echo "<hr /><pre>"; print_r($var); echo "</pre><hr />"; } $con=mysql_connect('',','') or die ('no se puede conectar con servidor'); mysql_select_db('examenes') or die ('no puede conectar con bd'); if (!isset($_POST['submit'])) { $sql = "SELECT * FROM question ORDER BY RAND() LIMIT 2"; $display = mysql_query ($sql) or die ('la consulta no se ha podido realizar'); if (0== mysql_num_rows($display)){ print "no hay preguntas en question"; } else { echo "<form method='post' action='{$_SERVER['$PHP_SELF']}'>"; echo "<center><table border='0' width='500px' background='/webex/img/background.jpg'>"; while ($row = mysql_fetch_array($display)) { $id = $row["id"]; $pregunta = $row["pregunta"]; $imagen = $row["imagen"]; $ans1 = $row["ans1"]; $ans2 = $row["ans2"]; $ans3 = $row["ans3"]; $ans4 = $row["ans4"]; $corans = $row["corans"]; echo "<tr><td width='100%' colspan='2'><br><table border=1 bordercolor='#e0e0e0' width=100%><tr><td bordercolor='#e0e0e0'><b>$pregunta<br></td></tr></table></b><br>"; if (0 < strlen ($row[imagen])){ print "<img src='$imagen'>"; } echo "</td></tr>"; echo "<tr> <td width='5%'><input type='radio' name='q[$id]' value='$ans1'></td><td>$ans1</td> </tr> <tr> <td><input type='radio' name='q[$id]'value='$ans2'></td><td>$ans2</td> </tr> <tr> <td><input type='radio' name='q[$id]'value='$ans3'></td><td>$ans3</td> </tr> <tr> <td><input type='radio' name='q[$id]'value='$ans4'></td><td>$ans4</td> </tr> <tr><td></td></td><td></tr>"; } $horainicio = time (); echo "</table>"; echo "<input type='hidden' name='horainicio' value='$horainicio'>"; echo "<input type='submit' value='Corrija su examen' name='submit'>"; echo "</form></center>"; } } else { //debug($_POST); print "<table border=1 bordercolor='#2279be' bgcolor='white'>"; print "<tr><td>Pregunta</td><td bgcolor='white' border='0'>Has elegido la opción</td> <td bgcolor='white' border='0'>la opción correcta era</td></tr>"; $score = 0; foreach ($_POST['q'] as $qid => $ans) { $res = mysql_query("SELECT corans FROM question WHERE id = '$qid'"); $corans = mysql_result ($res, 0); echo "<tr><td>[b][color=red]HERE I WANT TO PRINT THE QUESTION[/color][/b]</td><td bgcolor='white' border='0'>$ans</td><td bgcolor='white' border='0'>$corans</td></tr>"; if ($ans == $corans) { ++$score; } else { //echo "En la pregunta número has elegido la respuesta número $ans y debería haber elegido la $corans <br> <br>"; } }
-
[!--quoteo(post=371380:date=May 4 2006, 11:08 PM:name=buddaman)--][div class=\'quotetop\']QUOTE(buddaman @ May 4 2006, 11:08 PM) [snapback]371380[/snapback][/div][div class=\'quotemain\'][!--quotec--] First, where are you doing the actual sql execute? The error looks to be permission related. Make sure the webserver has permissions to write to the location you are attempting to move,copy or rename. [/quote] Ok I solved the problem with: chmod("/PISOS/final/".$id.".gif", 0755); this works in local and with my paid server... the question now is: does it have any inconvenients to chmod a file, or is it normal to do so...? thanks!!!
-
Hi... I ma trying to rename a pic that I upload into a directory and I get this error message: [b]Warning: rename(,.jpg) [function.rename]: Permission denied in C:\xampp\htdocs\PISOS\final\gifup2.php on line 22[/b] the script I use is: $link = mysql_connect("", "", ""); mysql_select_db("pisos", $link); $sql = "SELECT id, user, email FROM articulos WHERE user = '$user' AND email = '$email'"; $id = $row["id"]; $user = $row["user"]; $email = $row["email"]; if(isset( $Submit )) { $ext=".jpg"; if ($_FILES['imagefile']['type'] == "image/pjpeg"){ @move_uploaded_file($_FILES['imagefile']['tmp_name'], "C:/xampp/htdocs/PISOS/final/".$_FILES['imagefile']['name']) or die ("Could not copy"); rename($name, $row["id"].$ext); echo ""; echo "Name: ".$_FILES['imagefile']['name'].""; echo "Size: ".$_FILES['imagefile']['size'].""; echo "Type: ".$_FILES['imagefile']['type'].""; echo "Copy Done...."; } I get the variables with mysql db and through the URL with: <a href='/scripts/final/picup2.php?user=$_REQUEST[user]&email=$_REQUEST[email]'>want to add a pic?</a>
-
Hi! I'm trying to resize picture in a new window! I get the image from the DB and I am able to display it in another window simply by doing this: echo "<img src='".$row["image"]."' width='60' height='42'><br><a href='enlarge.php?image=".$row["image"]."'>large</a></td> \n"; and in the new window: echo "<table width='50%'><tr><td><img src='$image' border='0'></td></tr></table>"; I would like to resize the picture in the new window because some of the originals are very big! Do you know what to do?
-
I don't know why it did so... but I assure you it did! Though I found the way round it like this... $sql = "SELECT DISTINCT *, id FROM questions ORDER BY RAND() LIMIT 20"; regards...
-
Hi I've got this code for selecting a number of questions from a db to make a test. It's random and sometimes it selects the same questions and they appear twice in the tests... how could I stop this from happening? $sql = "SELECT * FROM questions ORDER BY RAND() LIMIT 20"; thanks in advance!