Jump to content

Very Buggy Code


23.12.2012
 Share

Recommended Posts

Hi! I'm working on this system in PHP, following a book. Here's the script I've written so far. Apparently, it does not ECHO the information. Any help? Apache from MAMP (Mac Apache MySQL & PHP) is working, and a phpinfo.php was generated by MAMP after installation. Thanks in advance!

<fieldset><legend>Adaugă Client</legend><br /><form action="add_user.php" method="post"><label for="name" style="padding-left: 43px">Nume:</label><input type="text" name="name" class="form_customization" id="name" /><label for="prenume" style="padding-left: 42px">Preume:</label><input type="text" name="prenume" class="form_customization" id="prenume" /><label for="phone" style="padding-left: 92px">Telefon:</label><input type="text" name="phone" class="form_customization" id="phone" /><br /><br /><label for="address" style="padding-left: 37px">Adresă:</label><input type="text" name="address" class="form_customization" id="address" /><label for="cnp" style="padding-left: 60px">CNP:</label><input type="text" name="cnp" class="form_customization" id="cnp" /><label for="registration" style="padding-left: 43px">Nr. Înregistrare:</label><input type="text" name="registration" class="form_customization" id="registration" /><br /><br /><label for="other">Mențiuni:</label><textarea id="other" name="other" class="form_customization"></textarea><br /><br /><select name="memberships"><option value="ms1" selected="selected">Membership 1</option><option value="ms2">Membership 2</option><option value="ms3">Membership 3</option><option value="ms4">Membership 3</option></select><br /><br /><input type="submit" value="Creează Abonament !" name="add_user" /></select></form><br /></fieldset>

<body><p>Client Adăugat !</p><?php$name = $_POST['name'];$prenume = $_POST['prenume'];$phone = $_POST['phone'];$address = $_POST['address'];$cnp = $_POST['cnp'];$registration = $_POST['registration'];$membership = $_POST['memberships'];echo "Client Adaugat cu succes!";echo 'Nume: ' . $name;echo 'Prenume: ' . $prenume;echo 'Telefon: ' . $phone;echo 'Adresa: ' . $address;echo 'CNP: ' . $cnp;echo 'Nr. Inregistrare: ' . $registration;echo 'Membership: ' . $membership;?></body>

Link to comment
Share on other sites

Yes, the PHP was not activated, actually. Anyway, I've come across other problem: I've written an emailing script, but the email won't show up. I can send emails even if I'm local, can't I?I've written the variables $to, $msg and $subject, and placed them like this: mail($to, $subject, $msg); The email won't show up...

Edited by 23.12.2012
Link to comment
Share on other sites

Yes, the PHP was not activated, actually. Anyway, I've come across other problem: I've written an emailing script, but the email won't show up. I can send emails even if I'm local, can't I?I've written the variables $to, $msg and $subject, and placed them like this: mail($to, $subject, $msg); The email won't show up...
No, if it's local you can't send emails. Most free subdomains don't even have it enabled.But you can get one for free for your local computer. You can install one from burrotech.com. It's the one I use. Edited by RahXephon
Link to comment
Share on other sites

Ww---what?!? I don't quite get it. So I've written the script, I've used one of my email addresses to send the mail, and another one to receive the mail. So I can't do this without a PAID domain?!? I'm also on OS X, and I wouldn't like to install Windows just for trying this out (the main purpose is not sending mail). Is there a way I can do this thing without having a domain?

Link to comment
Share on other sites

Ww---what?!? I don't quite get it. So I've written the script, I've used one of my email addresses to send the mail, and another one to receive the mail. So I can't do this without a PAID domain?!? I'm also on OS X, and I wouldn't like to install Windows just for trying this out (the main purpose is not sending mail). Is there a way I can do this thing without having a domain?
Perhaps a Google search for "mail servers" will pull some results for your OS. Also, I said "most free subdomains", who knows, you might get lucky and find that one that will let you.
Link to comment
Share on other sites

Ok, so I won't be able to do it without one. This is completely stupid, if you ask me. At least some simulation methods, I was really trying to learn PHP and had some great plans.The next chapter is about moving the storage of the messages from mail to SQL. Would it help if I skipped the mail part and went to the SQL storage, coming back to mail when I'm f***ing bored?By the way, the book I'm reading says nothing about this. It says "Go on, fill the info and check your Inbox.". Nothing AT ALL about this thing. And the troubleshooting consists of a "you haven't configured mail the way you should have."Thanks in advance!

Edited by 23.12.2012
Link to comment
Share on other sites

No, you don't need any kind of domain to send E-mails, you just need an SMTP server installed on your computer if you want to send E-mails with PHP.

Link to comment
Share on other sites

OS X has got one pre-installed, apparently. Postfix. But now, I might have killed my Apache...Later Edit: I've finally got it working, but yesterday I f**ked Apache up, PHP too, I think. I've installed MAMP, written the settings, and got the mail sent. Damn, and it was so easy :) Thanks a lot for your assistance!By the way, isn't this a little bit insecure? For example, I can replace my email address from where the email was sent with the one of a friend's and send a resignation to his boss, can't I?

Edited by 23.12.2012
Link to comment
Share on other sites

By the way, isn't this a little bit insecure? For example, I can replace my email address from where the email was sent with the one of a friend's and send a resignation to his boss, can't I?
That's right, without a form of authentication a SMTP server is very insecure. However, many how implement authentication through TLS or the AUTH handshake.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...