I'm storing IPv4 addresses in a "int unsigned" column type with inet_aton. [Am I doing this right? And is using "unsigned" necessary?] This particular column is indexed as well. Since there will be millions of rows and multiple rows containing the same IP throughout the entire table what will be the fastest way to search for these rows?
...
I have a while loop of a mysql call but I also am trying to run another mysql query inside of the while loop but it is only doing it once. I can not figure it out.
Here is my code:
$sql = "SELECT * FROM widget_layout WHERE module_id=".mysql_real_escape_string($id)." AND state='".mysql_real_escape_string($page)."' AND position=".mysql_r...
I'm using XAMPP for Mac, and it seems that the mail function doesn't work. I've tried changing from using sendmail to use SMTP (gmail) without luck. Now my php.ini looks like:
[mail function]
SMTP = smtp.gmail.com
smtp_port = 465
smtp_ssl=auto
auth_username=[user]@gmail.com
auth_password=[pass]
sendmail_from=[user]@gmail.com
If I do "...
I have an array with configuration tree:
$cfg = array('global' => array(
'project' => 'foo',
'base_url' => '/path/',
'charset' => 'utf-8',
'timezone' => 'Europe/Lisbon',
'environment' => 'development'),
//...
);
I need to insert an element into the tree (or possibly change it) given stri...
I'm trying to build a basic "status" page using php that will tell my users if various services (webpages we use) are at least serving up pages (which isn't 100% guarantee of working but its pretty good indicator)
what i would like to do is something like
www.domainname.com/mediawiki/index.php and make sure that returns the page or not...
PHP:
function generate_uid() {
$uid = mt_rand();
$sql = "SELECT user_id
FROM user_registration";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
$result = mysql_query($sql);
$availability = TRUE;
while($row = mysql_fetch_array($result)) {
if($row['user_id'] == $u...
How can I send a file in django to a different server without user being redirected to the server ? So all goes to rewriting this simple php function in django :
$filename = 'C:/tmp/myphoto.jpg';
$handler = 'http://www.example.com/upload.php';
$field = 'image';
$res = send_file($filename, $handler, $field);
if ($res) {
echo 'do...
I am trying to load multiple files using HTML5.
This is my code I found on some site.
In the PHP code it doesn't recognize it as an array.
Am I doing something wrong? Can someone show me a working solution?
Thanks.
index.html
<form action='save.php' method='post' enctype='multipart/form-data'>
<input name="uploads" type="file" multip...
I'm developing in NetBeans a CakePHP application and finally managed to get it connecting to XAMPP debugging sessions (PHP 5.3.1 w/ Xdebug v2.0.6-dev).
It perfectly works when launching, it does pause the application on the first line.
However any further breakpoint I set is completely ignored. It does not break nor pause; it just runs...
After upgrading from PHP 5.2.8 to 5.3.3, the new libxml_disable_entity_loader(false) function does not seem to work on Windows via command line to a PHP file on a network share. More specifically, DOMDocument::schemaValidate() fails with XSD files that contain multiple levels of nested include()'s to other XSD files on a network share.
...
Hi,
I have a web portal on Cricket News India.
I have built my own customised CMS to update the news in the website.
My questions are
Since the data is in the database, will it be a good practice to genarate the html pages out and save it in our server. Advantages that I observe,
next time if a user comes server gets the generated h...
Hi,
I would like to start a upload and download website for huge files (up to 1gb). I thought that it would be better to download the files using FTP (with PHP), because this protocol is especially used for these types of transfers.
The cliënt gets an email, including a download link to download the file (like yousendit.com). When the...
If I know I have n records, and I want to do something to a group of r records at a time (basically do stuff to n in batches because n is really large), what is the algorithm for that? Any language is OK (though I'm using PHP).
The algorithm should keep in mind that in the final iteration, there may not be enough records to create a co...
Since I need to create a dynamically updated navigation menu, css requires me to structure the data this way:
<li>Projects (Menu Level 1)
<ul>
<li>Project 1 (Menu Level 2)</li>
<li>Project 2 (Menu Level 2)</li>
<li>Project 3 (Menu Level 2)</li>
</ul>
</li>
<li>News (Menu Level 1)</li>
<li>Contact (Menu Le...
Hi, i have this question. My website is build whereby a user can only be in the member's page if he has login. therefore every page has this,
if (!$_SESSION['userid']) header index.php
Problem is that if i ban the user and the user did not end the session, he will still be allowed to use the site until he end the session and try to log...
I'm trying to write a class that calls back certain functions for different browsers. What I want to do is create a switch statement that accepts either (CHROME, SAFARI, FIREFOX, MSIE, etc) that is pulled from a regular expression.
I'm stumped on the regex part. I created named groups, but I can't figure out how to get the named group t...
I have a situation where a user fills out 1 of 2 forms on a registration page and is sent to a software download page. If they sign up as a new user, form is processed inserted into a MySQL database and they go to the page no problem.
Here is my issue. If they are a returning user and enter a license key, the processor script checks to ...
I have a password being passed from my iPhone app to the database via a php script, user.php.
The variable $pass is populated by the following:
$pass = str_replace("'", "", $_REQUEST['pass']);
How can I encrypt this before it's inserted into my database? I've read a little about the different techniques, but looking for the best way ...
I have a site under drupal (using mysql) but need it to read from a external sql database and make quires/reports, maybe using views2?
Is is at all possible? I been looking for a solution to just read (not import, its thousands of entries...) from an external database for hours and not sure if its even possible.
...
Okay,
I' not an expert in PHP (I'm really just beginning to grasp the thing) and I need a little help to customized a script for extracting titles from Tumblr's post (and I insist, it's a small problem, I'm not asking for the whole script to be written for me).
For those who doesn't know: Tumblr is a microblogging platform with the ch...