jonsjava
-
Posts
1,579 -
Joined
-
Last visited
Posts posted by jonsjava
-
-
does your header get called by your index? if so, you need it in your index, at the top. It must be called before anything else.
-
you must have session_start() at the top of your page.
-
Personally, I like having each page have the same template. That means the body will be the only thing to change. OK, maybe the menu bar will be context-sensitive, but a simple switch will handle all that:
header.inc.php
<?php function cleanInput($input){ if (is_array($input)){ foreach ($input as $key=>$val){ $out[$key] = mysql_real_escape_string($val); } } else{ $out = mysql_real_escape_string($input); } return $out; } if (isset($_GET['page']) && strlen($_GET['page']) >= 0){ $page = cleanInput($_GET['page']); switch ($page){ case "home": $title = "Welcome Home!"; brak; case "edit": $title = "Editing something."; break; case "cheeseburger": $title = "Mmmmm...cheeseburger....*drool*"; break; default: $title = "I don't know what page you are on, but I bet you're having a good time!"; } } else{ $title = "I don't know what page you are on, but you shouldn't be here!"; } //some HTML echo "<title>$title</title>"; //the rest of your code ?>
-
as mentioned in my PM to you, you need the PHP-LDAP extension installed, and apache restarted.
-
You need an .htaccess file first. A basic .htaccess file, for testing purposes:
.htaccess
AuthName "restricted stuff" AuthType Basic AuthUserFile /etc/.htpasswd require valid-user
Place that file in the folder that you are wanting protected (or the root of the site, if you want ALL things protected)
next, run this:
htpasswd -c /etc/.htpasswd user1
it will ask for a password for user1 (change the user to the username you want to use)
for all other users, do this:
htpasswd /etc/.htpasswd user2 htpasswd /etc/.htpasswd user3 etc...
-
I hate to be the jerk, but you could do some of the coding. This is the "Help forum", not the "free labor" forum. If you give us bad code, we will help you fix it -- gladly. If you tell us to do all the work, you should be in the freelance section.
edit Just noticed the freelance section is gone. Smeh. PM someone, and offer to pay them.
-
It should key off the primary key, and go by ORDER ASC on that. You do have a Primary key, right (you set id to Primary)?
-
<snark>
But mjdamato, your code should be perfect!
</snark>
Sorry, had to say it.
-
we need to see the variables. Preferably the whole class, if possible.
-
try changing it from
$field=$this->$this_field;
to
$field=$this->this_field;
I'm sure there are other issues at play, so code would be a good thing to post if you want further help.
-
this doesn't make an EXE. It is a batch file. A script that windows will execute line-by-line. You will still need the PHP files, but if this isn't going to be a packaged-up deal, it should work just fine.
-
I would recommend you use SimpleXML for handling XML.
-
I would do something like this
function genURL($id,$uname){ $salt = rand(0,94821); return base_convert($id.$uname.$salt,34,16); }
Then, store the result in your database as verification key.
-
I know the basics of mod_rewrite. I would recommend that you read up on the topic, or ask the proper forum. We won't do everything for you.
-
change your base to
RewriteBase /members.php
-
You cannot do it with pure php. You must set up a mod_rewrite rule. That is the only way to re-write the file name.
-
I re-worked the logic a bit. Let me know if my assumptions were correct.
<?php function cleanInput($POST){ $out = array(); foreach ($POST as $key=>$val){ $out[$key] = mysql_real_escape_string($val); } return $out; } function sendmail(){ $cPOST = cleanInput($_POST); $cname = $cPOST['cname']; $sname = $cPOST['sname']; $fname = $cPOST['fname']; $contact = $cPOST['contact']; // If I understand your code, it looks like you are only pulling the contactflag for all the students. Why? $contactstudents = "SELECT contact_flag FROM student"; $runcontact = mysql_query($contactstudents); $Name = "Student Course Registration"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = $_POST['email']; //recipient $mail_body = "Congratulations $fname $sname. You have successfully registered for the following course: $cname "; //mail body $subject = "Course registration successful!"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields //!!!!!!!!!!!!!!!!!!!Assuming $contact is a checkbox on the form !!!!!!!!!!!!!!!!!!!!!!! if (!isset($contact) || is_null($contact)){ mail($recipient,$subject,$mail_body,$header); } else{ $query = "SELECT sname,fname,email FROM student WHERE $contact = $runcontact"; $run = mysql_query($query) or die(mysql_error()); $contact_info = ""; while ($found = mysql_fetch_assoc($run)) { $contactemail=$found['email']; $contactsname=$found['sname']; $contactfname=$found['fname']; $contact_info .= "$contactsname, $contactfname, $contactemail\r\n"; } $mail_body2 = "Congratulations $fname $sname. You have successfully registered for the following course: $cname. Here is a list of all the students who you may be in contact with: $contactsname, $contactfname, $contactemail"; //mail body for contact flag mail($recipient, $subject, $mail_body2, $header); } } ?>
-
You can have it set so members.php?username=user shows up as /user
You can even have it set so members.php?username=user shows up as /hidden_files/users/u/user
how ever you like. Just ask for help in the topic I linked to.
-
-
try this (debugging code)
<?php function sendmail(){ $cname = mysql_real_escape_string($_POST['cname']); $sname = mysql_real_escape_string($_POST['sname']); $fname = mysql_real_escape_string($_POST['fname']); $contact = mysql_real_escape_string($_POST['contact']); $contactstudents = "SELECT contact_flag FROM student"; $runcontact = mysql_query($contactstudents); $Name = "Student Course Registration"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = ($_POST['email']); //recipient $mail_body = "Congratulations $fname $sname. You have successfully registered for the following course: $cname "; //mail body $subject = "Course registration successful!"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields if ($contact=="y"){ echo "Sending you mail_body2 because contact=y"; $query = "SELECT sname,fname,email FROM student WHERE $contact = $runcontact"; $run = mysql_query($query) or die(mysql_error()); while ($found = mysql_fetch_array($run)) { $contactemail=$found['email']; $contactsname=$found['sname']; $contactfname=$found['fname']; $mail_body2 = "Congradulations $fname $sname. You have successfully registered for the following course: $cname. Here is a list of all the students who you may be in contact with: $contactsname, $contactfname, $contactemail"; //mail body for contact flag mail($recipient, $subject, $mail_body2, $header); } } else { echo "sending you \$mail_body because \$contact=$contact"; mail($recipient, $subject, $mail_body, $header); } } ?>
-
Posted to wrong thread. sry.
-
actually, to make it modular:
run_php.bat
@echo off set PATH=%PATH%;"C:\Path to PHP" set runme=%1 start php -q %runme%
USAGE:
change the "C:\Path to PHP" to the path to your PHP install
then run it as such:
run_php.bat some_php_file.php
-
try batch:
@echo off set PATH=%PATH%;"C:\PATH_TO_PHP_EXEC" start php -q some_file.php
-
_GET is a Superglobal, which means it is always available in all scopes.
What's wrong with my code?
in PHP Coding Help
Posted
You aren't executing the code. Nowhere do you actually call $events, which would then have PHP execute the query that resides in the variable. Also, you do nothing with the data it may return.
Try this: