Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=gokiyono;42073667][IMG]http://saming.free.fr/icons/folder.gif[/IMG][IMG]http://saming.free.fr/icons/image2.gif[/IMG]
These are the only icons I see?[/QUOTE]
Sorry. [URL="http://saming.free.fr/old/home/8/"]Here?[/URL]
[QUOTE=saming;42074398]Sorry. [URL="http://saming.free.fr/old/home/8/"]Here?[/URL][/QUOTE]
I suppose you could just add it to the font with some program
I think you can use something like fontlab
[editline]4th September 2013[/editline]
So I have a value that exists in either of three tables in a database.
How figure if it does or not?
[QUOTE=Dorkslayz;42044292]Use Nginx, it's probably the best web server in terms of performance.[/QUOTE]
Switched from Apache to nginx and from MySQL to MariaDB and the site became fast as hell even with all the requests that normally slowed the site down.
[IMG_THUMB]http://i.imgur.com/g68ca0z.png[/IMG_THUMB]
The only problem is that the memory usage is almost constantly near the top, with about 1000k-5000k left at any given time. It appears to be stable despite that, but should I worry? To me it looks like nginx is spawning just enough php-fpm instances to fit in RAM at any given time.
[IMG]http://i.imgur.com/vAcVLvm.png[/IMG]
[QUOTE=Matoking;42075824]Switched from Apache to nginx and from MySQL to MariaDB and the site became fast as hell even with all the requests that normally slowed the site down.
[IMG_THUMB]http://i.imgur.com/g68ca0z.png[/IMG_THUMB]
The only problem is that the memory usage is almost constantly near the top, with about 1000k-5000k left at any given time. It appears to be stable despite that, but should I worry? To me it looks like nginx is spawning just enough php-fpm instances to fit in RAM at any given time.
[IMG]http://i.imgur.com/vAcVLvm.png[/IMG][/QUOTE]
Monitor it, if it becomes any worse then you might want to upgrade your system.
I'm working on fixing up some code I wrote that broke for some reason when I brought it over to a different server.
The main problem is my validation is causing some sort of error, and i wind up with a blank screen (no error returned, mysql or php).
Here is what my code looks like:
[CODE]
elseif ($input['Reference'] == 'province' && isset($_POST[$input['InputID']]))
{
$val['province'] = strip_tags($_POST[$input['InputID']]);
$aom = array('Ontario'=>'18',
'Alberta'=>'18',
'British Columbia'=>'19',
'Manitoba'=>'18',
'New Brunswick'=>'19',
'Newfoundland'=>'19',
'Northwest Territories'=>'19',
'Nova Scotia'=>'19',
'Nunavut'=>'19',
'Prince Edward Island'=>'18',
'Quebec'=>'18',
'Saskatchewan'=>'18',
'Yukon'=>'19');
echo("Province: " . $val['province'] . "<br />"); // THIS OUTPUTS PROPERLY
$bday = new DateTime($val['bday']);
$today = new DateTime(date('Y-m-d'));
echo($today->format('Y-m-d') . "<br />" . $bday->format('Y-m-d') . "<br />"); // THIS OUTPUTS PROPERLY
$change = $today->diff($bday);
echo($change->format('%R%a days')); // THIS DOES NOT OUTPUT!
foreach ($aom as $prov => $age)
{
if ($val['province'] == $prov)
{
if ($change->y < $age)
{
include('form.php');
exit("<div id = 'error'><b>Verification Error #2</b> - You must be at least the age of majority in your province to enter this contest.</div></div> <!-- /wrapper --></div><!-- /content --></div> <!-- /center --><div id = 'footer'><ul><li>Contest Rules & Regulations</li><li>InsuranceHunter.ca</li><li>Privacy Policy</li><li>Terms & Conditions</li></ul></div></body></html>");
}
}
}
}
[/CODE]
This is a section of part of a bigger validation 'if statement'. I have been troubleshooting for a while and narrowed the issue down to this block of code.
It seems to get right into where I find out the age of the user, and then randomly just stops outputting anything. None of my 'else' statements seem to have any effect, and the only way I can output anything to the screen is if I echo it out [B]before [/B]that one line '$change = $today->diff($bday)'.
It's strange because it worked perfectly on my other server and on WAMP so I'm not too sure what's breaking here!
If anyone has any idea what is going on here, it would be very much appreciated if you could help me out, because I'm stuck!
As always, thanks in advance! If you need any more info, please let me know and I'll get on it ASAP!
add this to the top of the code
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
I'd say you have a missing php extension or a short/missing php tag somewhere in another script.
Probably DateTime.
[QUOTE=01271;42077671]add this to the top of the code
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
I'd say you have a missing php extension or a short/missing php tag somewhere in another script.
Probably DateTime.[/QUOTE]
Thanks so much for the response, I'm getting somewhere now...
I checked my PHP Info for the server and it says Date/Time is enabled. I then checked the PHP documentation and it says that DateTime is part of the PHP core. I'm running PHP 5.2.10.
When I enable the error reporting like you said, I get this error:
[B]Fatal error: Call to undefined method DateTime::diff()[/B]
Not sure why it's not letting me call diff(), since it is a default method of DateTime.
Any ideas?
Are you able to install things on the server?
If yes you should look up how to install DateTime on your server and then restart php / apache
[QUOTE=01271;42078217]Are you able to install things on the server?
If yes you should look up how to install DateTime on your server and then restart php / apache[/QUOTE]
I'm looking at this page:
[url]http://www.php.net/manual/en/datetime.installation.php[/url]
And it seems like there is no installation for it - it should just be there.
[editline]4th September 2013[/editline]
Just found [url="http://stackoverflow.com/questions/4033224/what-can-use-for-datetimediff-for-php-5-2"]this[/url] thread and it seems like 5.2 doesn't have the diff() method?? What the hell?!
In that case, I have no idea, never used datetime before.
Found [URL="http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php"] this workaround[/URL].
Thanks so much for your help 01271. I would've been still stuck if it wasn't for you!
Mucho Gracias!
- snip -
Any security tips when it comes to storing passwords?
-snip-
[QUOTE=gokiyono;42085550]Any security tips when it comes to storing passwords?[/QUOTE]
Hash passwords using a secure algo, do not encrypt them. Don't try to be clever, use tried and tested methods/tools.
If you're using PHP, look into the password_compat library.
[QUOTE=StinkyJoe;42085717]Hash passwords using a secure algo, do not encrypt them. Don't try to be clever, use tried and tested methods/tools.
If you're using PHP, look into the password_compat library.[/QUOTE]
Thank you
password_compat looks interesting
[editline]5th September 2013[/editline]
[QUOTE=CBastard;42085706]-snip-[/QUOTE]
Just curious
Why did you snip it?
[QUOTE=gokiyono;42085774]
Just curious
Why did you snip it?[/QUOTE]
Because I misread your post and wrote about creating strong passwords not storing them.
Generally speaking you should not store the actual passwords, not even an encyrpted version, only a hash of the password. Use something like SHA-2 with PHP's hash function, also salt the password string using something derived from the individual's data. Also look at bcrypt if you do need encryption which allows you to set a computational overhead that makes brute forcing much less practical.
What exactly do I do for making my website display correctly on different screen sizes? In school we don't have a widescreen, so when I work at home and I transfer my code and display it on my widescreen it looks so weird and misplaced? And I don't know what to do about it :v:
how do you use your own font on a website that isn't on the google fonts domain? i would google it but i don't know how to word it for search terms so i get unrelated results.
[QUOTE=thejjokerr;42087613]So now that I'm getting into Ruby on Rails, I was wondering, is it worth using Ruby on Rails to build my API? Or should I use PHP for that instead.
I imagine there's a lot of stuff in Ruby on Rails that I won't need for an API that simply gets database information and displays it in json.[/QUOTE]
Yes, use Rails. Really the only thing you won't need for an API is the view layer (although you could still use that to some degree depending on how you're turning things into JSON data). There are enough things Rails does that will save you lots of time/work that it's still worth using.
[editline]5th September 2013[/editline]
[QUOTE=xianlee;42087401]how do you use your own font on a website that isn't on the google fonts domain? i would google it but i don't know how to word it for search terms so i get unrelated results.[/QUOTE]
Google "@font-face" for tutorials on how to do this.
[QUOTE=Cowabanga;41964224]Is there a way to just make emails that work with gmail without installing a mail server? I use gmail and currently I have a mail server installed and I forward all emails to gmail, pretty redundant.[/QUOTE]
Here's a bump.
[QUOTE=Cowabanga;42089855]Here's a bump.[/QUOTE]
[url]http://www.zenddeveloper.com/how-to-send-emails-from-localhost-apachephp-server/[/url]
You don't need sendmail if you're running it on a linux server.
[QUOTE=CBastard;42089980][url]http://www.zenddeveloper.com/how-to-send-emails-from-localhost-apachephp-server/[/url]
You don't need sendmail if you're running it on a linux server.[/QUOTE]
What if I am running an ubuntu server? Does it have an out of the box smtp server that I can configure?
[editline]5th September 2013[/editline]
I looked it up, and I don't think this is what I'm looking for. I'm looking for a way to forward all emails sent to a certain email under my domain, let's say [email]hi@vintagecowa.com[/email]. I just want something simple that sends it all to my gmail inbox.
[QUOTE=Cowabanga;42090067]What if I am running an ubuntu server? Does it have an out of the box smtp server that I can configure?
[editline]5th September 2013[/editline]
I looked it up, and I don't think this is what I'm looking for. I'm looking for a way to forward all emails sent to a certain email under my domain, let's say [email]hi@vintagecowa.com[/email]. I just want something simple that sends it all to my gmail inbox.[/QUOTE]
Who's your domain registrar? Sometimes they provide email addresses and auto-forwarding services.
[QUOTE=KmartSqrl;42090250]Who's your domain registrar? Sometimes they provide email addresses and auto-forwarding services.[/QUOTE]
Namecheap. The thing is I would also like to send mail through the email.
[QUOTE=Cowabanga;42090260]Namecheap. The thing is I would also like to send mail through the email.[/QUOTE]
If you just want all your email to show up in your gmail account, just use POP or IMAP (can't remember if gmail can connect other accounts via IMAP yet or not) to pull your emails into your gmail account then.
Anyone want to help me translate some english into german? I've come upon a Paypal phishing email, where they want you to "open this document and fill in this information" (looked like a paypal website). I looked at the source code, and it looks like this phisher is taking advantage of a feedback.php file hosted on a website in germany (It's a technology website, no less!). I feel like emailing them with the information, but I am not sure that Google Translate will get the message across. Any assistance in this matter? I feel like being an internet good guy for the day.
Does anyone know of hosting providers that accept bitcoin?
Can anyone tell me why my this is doing this? (the snoop dogg leaf is too low, i want it centered with the paragraph
[url=http://www.zimagez.com/zimage/screenshot-13-09-05-060352pm.php][img]http://www.zimagez.com/miniature/screenshot-13-09-05-060352pm.php[/img][/url]
Here's mah surrsse
[code]<p class="main">
<img class="left" src="images/weedleaf.png" alt="weedleaf" height="100" width="100"/>
This is where supporting things would go if i was to provide support but I won't so here we go here is some random text that MAYBE would provide you support but you never know it couldn't!
</p>
[/code]
The img.left is float:left; in the css file.
- snip -
Sorry, you need to Log In to post a reply to this thread.