Quantcast
Channel: PHP Freaks: PHP Help
Viewing all 13200 articles
Browse latest View live

Paginate according to current month and year?

$
0
0

How to acheive it friends? i want my current codes to show results accouding to current  month followed by year, the precious  month goes to the page two.

 

would really appreciate if someone could help me acheive it

 


 $tableName="records";        
    $targetpage = "sales.php";     
    $limit = 1000;
    $cur_month = date("Y-m");

         $query = "SELECT COUNT(*) as num FROM $tableName  WHERE Customer_Status = 'Sale' AND DATE_FORMAT(Date, '%Y-%m') = '$cur_month' ORDER BY id DESC";
    $total_pages = mysql_fetch_array(mysql_query($query));
    $total_pages = $total_pages[num];
    
    $stages = 1;
    $page = mysql_escape_string($_GET['page']);
    if($page){
        $start = ($page - 1) * $limit;
    }else{
        $start = 0;    
        }    
    
    // Get page data
    $query1 = "SELECT id, Date, User, Team, Transfer_Number, Agent_Name, Cell_Phone, Customer_Name, Customer_Status FROM $tableName WHERE Customer_Status = 'Sale' AND DATE_FORMAT(Date, '%Y-%m') = '$cur_month' ORDER BY id DESC LIMIT $start, $limit";
    $result = mysql_query($query1);
    
    // Initial page num setup
    if ($page == 0){$page = 1;}
    $prev = $page - 1;    
    $next = $page + 1;                            
    $lastpage = ceil($total_pages/$limit);        
    $LastPagem1 = $lastpage - 1;    
    
    $paginate = '';
    if($lastpage > 1)
    {    
    $paginate .= "<div class='paginate'>";
        // Previous
        if ($page > 1){
            $paginate.= "<a href='$targetpage?page=$prev'>previous</a>";
        }else{
            $paginate.= "<span class='disabled'>previous</span>";    }
                
        // Pages    
        if ($lastpage < 7 + ($stages * 2))    // Not enough pages to breaking it up
        {    
            for ($counter = 1; $counter <= $lastpage; $counter++)
            {
                if ($counter == $page){
                    $paginate.= "<span class='current'>$counter</span>";
                }else{
                    $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}                    
            }
        }
        elseif($lastpage > 5 + ($stages * 2))    // Enough pages to hide a few?
        {
            // Beginning only hide later pages
            if($page < 1 + ($stages * 2))        
            {
                for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
                {
                    if ($counter == $page){
                        $paginate.= "<span class='current'>$counter</span>";
                    }else{
                        $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}                    
                }
                $paginate.= "...";
                $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
                $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";        
            }
            // Middle hide some front and some back
            elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
            {
                $paginate.= "<a href='$targetpage?page=1'>1</a>";
                $paginate.= "<a href='$targetpage?page=2'>2</a>";
                $paginate.= "...";
                for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
                {
                    if ($counter == $page){
                        $paginate.= "<span class='current'>$counter</span>";
                    }else{
                        $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}                    
                }
                $paginate.= "...";
                $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
                $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";        
            }
            // End only hide early pages
            else
            {
                $paginate.= "<a href='$targetpage?page=1'>1</a>";
                $paginate.= "<a href='$targetpage?page=2'>2</a>";
                $paginate.= "...";
                for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
                {
                    if ($counter == $page){
                        $paginate.= "<span class='current'>$counter</span>";
                    }else{
                        $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}                    
                }
            }
        }
                    
                // Next
        if ($page < $counter - 1){
            $paginate.= "<a href='$targetpage?page=$next'>next</a>";
        }else{
            $paginate.= "<span class='disabled'>next</span>";
            }
            
        $paginate.= "</div>";        
        
}


echo "Total Records:".$total_pages;
echo '<br/><br/>';
 // pagination
 echo $paginate;

 }


php and mysql update

$
0
0
So i have this following code that doesn't work
 
<?php
$id = $_GET['id'];
$data = $_GET['data'];
$key = "Password";
mysql_query("update contest_data set '$key'='$data' where Contest_Data_ID='$id'")
?>
 
 
it doesn't work unless i put it like this 
<?php
$id = $_GET['id'];
$data = $_GET['data'];
$key = "Password";
mysql_query("update contest_data set `Password`='$data' where Contest_Data_ID='$id'")
 
?>

is there a way to put the `` when setting the $key value i even tired to put $key = "`Password`" and that doesn't work.

 

Also $key="password" is going to be $key= $_GET['key'] but for now i put it like this so i can test it out

I want to create images based on a background and user input ?

$
0
0

Hello,

I'm embarking on a pretty ambitious task and I need some bits of information here and there.

One of the functions I need to achieve is to build a query or array of photos based on a background image and user input. 

 

So imagine that I have a box  and within that box is a column of three rows. 

 

I need to have three different bits of data be placed into each of the subsequent rows and then an image is taken of these three pieces of data overlaying the background photo.

Then stored somewhere with an incremented identifier to be pulled later. 

 

I think I can already begin to imagine how it would work but what eludes me is a "screenshot" function to generate the images. I'm looking for .png or .jpg end result files with fixed width/height and item placement. 

 

Thank you for any help 

I need to delete a piece of data when a new piece of data is entered

$
0
0

Hello,

 

I'm working on a project that requires me to have stock / fake demo files that will be replaced with real files provided by users... I need something to take space and then when people actually start using the site and inputting data, then I can replace each file with new, unique files.

 

I have some idea of how this would work.

I would need incremented or non-matching identifiers and then a script that probably works on an if statement 

 

like

 

If new data, take first list of data, delete, replace with new data. Something like that. 

PHP and MySQL: Displaying something within a table

$
0
0

Greetings,

 

My current code logs into a database, opens a table named randomproverb, randomly selects 1 proverb phrase, and then SHOULD display the proverb in the footer of my web page.

As of right now, the best I can do is get it to display "Array", but not the text proverb... this code below actually causes my whole footer to not even show up.

Please help!

<?php

include("inc_connect.php"); //Connects to the database, does work properly, already tested

$Proverb = "randomproverb";
$SQLproverb = "SELECT * FROM $Proverb ORDER BY RAND() LIMIT 1";
$QueryResult = @mysql_query($SQLproverb, $DBConnect);
	while (($Row = mysql_fetch_assoc($QueryResult)) !== FALSE) {
	echo "<p style = 'text-align:center'>" . {$Row[proverb]} . "</p>\n";
	}
	$SQLString = "UPDATE randomproverb SET display_count = display_count + 1 WHERE proverb = $QueryResult[]";
	$QueryResult = @mysql_query($SQLstring, $DBConnect);
...
?>

Building simple chat windows

$
0
0

Hello,

 

I want to know first, how to start new pages or small windows 

 

Next, how to temporarily store data and then delete upon exit of chat so that memory can be saved 

 

How to embed objects like images (objects?) 

 

How to have resizable or set the size of input field for the message

 

Show a sign like "person is typing" when other person is inputting data 

 

I'll probably get yelled at, I'm trying to amass all the information I need

I'll research each subject as I accomplish a task 

 

Right now I could really use a download script that saves a photo, gets url of photo and searches the document for "By Name" and cuts out / stores the Name part and then renames the file with an increment of one, instead I have to do 300 clicks with my mouse. = ineptitude or ignorance 

 

That is theoretically the ideal case but I have to sift through photos, see which ones are good eg. face is covered by watermark 

 

Thanks for any help 

echo php page in iframe

$
0
0

Hello,

 
I'm finishing a content manager, but I have a little problem with a iframe.
 
Let me explain:
I have a url stored in a table in a database, which is the path to a page called "galeria.php", which is a dynamic gallery.
This gallery is loaded on the site when the user clicks on a submenu button called "portfolio". The iframe loads the gallery when clicked the "portfolio" button.
So far so good. Loads exactly when and how I want.
 
The problem is that when we are not on the "portfolio" page, the iframe keeps the occupation of space, even having no content.
This causes on the website, unnecessary scroll.
 
In practice what I ask, is how to do that when the iframe has no content, it becomes "hidden" or not take up space on the page.
 
Thank you

PHP Help Needed

$
0
0

Hello everyone,

 

I run a small url shorting service.

I have bought the script and everything which short long urls. And i want to use a php code in one of the pages.

 

Let me explain you in detail first.

 

My site is https://786.pw and user goes there and enter the long url and the short url becomes something like https://786.pw/shorturl ( for example)

 

Now when this short url which is https://786.pw/shorturl is hit the user is redirected to the original long url. And thats how it is supposed to work.

 

But in between i have the option to show a splash page which can be a advertisement or a timer or anything "

 

The code of splash.php is :-

<?php defined("APP") or die() // Media Page ?>
<?php include_once("analyticstracking.php") ?>
<section>
	<div class="container splash">
		<?php echo $this->ads(728,FALSE) ?>
		<div class="row">
			<div class="col-md-4 thumb">
				<div class="panel panel-dark panel-body">
					<img src="<?php echo $url->short ?>/i">
				</div>
			</div>
			<div class="col-md-8">
				<div class="panel panel-default panel-body">
					<h2>
						<?php if (!empty($url->meta_title)): ?>
							<?php echo $url->meta_title ?>
						<?php else: ?>
							<?php echo e("You are about to be redirected to another page.") ?>
						<?php endif ?>
					</h2>
					<p class="description">
						<?php if (!empty($url->meta_description)): ?>
							<?php echo $url->meta_description ?>
						<?php endif ?>
					</p>
					<br>
					<div class="row">
						<div class="col-sm-6">
							<a href="<?php echo $this->config["url"] ?>/?r=<?php echo base64_encode($url->url) ?>" class="btn btn-primary btn-block redirect" rel="nofollow"><?php echo e("Redirect me"); ?></a>
						</div>
						<div class="col-sm-6">
							<a href="<?php echo $this->config["url"] ?>" class="btn btn-default btn-block" rel="nofollow"><?php echo e("Take me to your homepage") ?></a></a>
						</div>
					</div>
					<hr>
					<p class="disclaimer">
						<?php echo e("You are about to be redirected to another page. We are not responsible for the content of that page or the consequences it may have on you.") ?>
					</p>
				</div>
			</div>
		</div>
	</div>
</section>

Now, I want to add solve media php script in it. Which means any user who is using our url shortner service needs to complete the captcha before he can be finally directed to the destination url.

 

The script supports solvemedia captcha solving. I spoke to the creator of this script and he told me this.

 

"You will need to have some basic php knowledge to achieve this. 
 
To add the catpcha you need to use <?php echo Main::captcha() ?> which will echo the captcha
 
To validate the result you need to use 
<?php 
if(Main::check_captcha($_POST) == "ok") {
 // If captcha is ok do something here
 
}else{
  // else do something here
}
?>

"

 

I dont have any php knoweldge., How can i enter this code in splash.php in order to show the captcha ?

 

 

Please suggest. And ask any question if you need


Accessibility for each file depending on position declared

$
0
0

Hello All,

 

I have designed a small php module Which has more than 80 .php files. I want to give the access level for all those files through a global access.php file. But i am not getting how it can be developed. I made a table in database which has all the scripts name. When those are checked value 1 it has to be visible for those users who come under a perticular position like MD, CEO, Sales Manager etc. Here is my table structure

 

script.JPG

 

and i tried doing like this 

 

if($_SESSION['pos']=='admin')
{
echo "<h1> SORRY YOU DONT HAVE ACCESS </h1>";
}
else
{
// file contents...
}
 
But this will become manual and also for single position ie 'admin'. 
 
Can somebody show me the path how it has to be structured and how these accessibility can be done.
 
Thanks 
 

Storing data from registration page to a 'login.dat' file

$
0
0

I have a user registration page that requires the user to input a Username, Password, Confirm Password, Email. If the user passes all the validation requirements for the new account, I then need to have the username, password, email fields saved to a file called 'login.dat'

Here is my code that I have so far, it runs perfectly.

<?php
include 'helpfulfunctions.inc';
include 'productsdata.inc';
$user_login_file = 'login.dat';
//var_dump($_POST);
// product data for photo, name, and price.


$alluserinfo = load_users_info($user_login_file);
//validate users info
$errors = array();
if (array_key_exists('register_submit', $_POST)) {

    //check to see if username is taken
    $username_entered = $_POST['username'];
    //check to see if username already exists
    if (array_key_exists($username_entered, $alluserinfo)) {
        $errors['username']['username_exists'] = "Username already exists.";
    }
    //validate username is 4-11 characters long using only a-z A-Z 0-9
    if(preg_match("/^[0-9a-zA-z]{4,11}$/",$_POST['username']) ===0){
        $errors['username']['invalid_username']= "Invalid username. Username must be 4-11 characters long and use only letters and numbers.";
    }
    //validate password "." means any character
    //.* allows numbers 0-9 to be inserted anywhere
    //?= positive lookahead: next text must be like this and follow these rules
    // must be at least 6 characters, contain 0-9, a-z, A-Z
    $pw_entered=$_POST['password'];
    if(preg_match("/^.*(?=.{6,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).*$/", $_POST["password"]) === 0){
        $errors['password']['invalid_password']="Password must be at least 6 characters and must contain at least one lower case letter, one upper case letter and one digit.";
    }
    //validate that "confirm password" matches password above
    $pw_repeat=$_POST['confirmpassword'];
    if($pw_repeat != $pw_entered){
        $errors['confirmpassword']['pw_no_match']="Passwords do not match. Try again.";
    }
    //validate email format
    $email_entered=($_POST['email']);
    if(!filter_var($email_entered, FILTER_VALIDATE_EMAIL)){
        $errors['email']['invalid_email']="Not a valid email. Please try again.";
    }
//no validation errors=>print invoice
    if (empty($errors)) {
        include 'invoice.inc';
        exit;
    }
}
//reprint if invalid entry. if no errors print invoice
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
    <h3>Please register to continue.</h3>
    <table>
        <tr>
            <td>
    *Username: 
            </td>
            <td>
    <input type="text" name="username"/>                
    <?php
    if (isset($errors['username'])) {
        print implode('<br>', $errors['username']);
    }
    ?>
            </td>
        </tr>
        <tr>
            <td>
    *Password:
            </td>
            <td>
    <input type="password" name="password"/>
    <?php
    if (isset($errors['password'])) {
        print implode('<br>', $errors['password']);
    }
    ?>
            </td>
        </tr>
        <tr>
            <td>
    *Confirm Password: 
            </td>
            <td>
    <input type="password" name="confirmpassword"/>
    <?php
    if (isset($errors['confirmpassword'])) {
        print implode('<br>', $errors['confirmpassword']);
    }
    ?>
            </td>
        </tr>
        <tr>
            <td>
    *Email: 
            </td>
            <td>
    <input type="text" name="email"/>
    <?php
    if (isset($errors['email'])) {
        print implode('<br>', $errors['email']);
    }
    ?>
            </td>
        </tr>
        <tr>
            <td>
    * required info <br>
    <input type="submit" value="Register" name="register_submit">
    <?php
    //print out hiddens with quantities
    save_hidden_qty($_POST['quantity']);
    ?>   
           
    
</form>
 </td>
        </tr>
</table>

In case it's needed, this is the 'helpfulfunctions.inc' file and the included functions:

<?php

if (!function_exists('load_users_info')) {

 function load_users_info($users_data_file) {
        $fp = fopen($users_data_file, 'r');
//read all lines of login.dat file and create user info arrays
        while (!feof($fp)) {
            $users_info_line = fgets($fp);
            $user_info_parts = explode(',', $users_info_line);
            $user_info_array = array('username' => $user_info_parts[0], 'password' => $user_info_parts[1], 'email' => $user_info_parts[2]);
            $complete_user_info_array[$user_info_array['username']] = $user_info_array;
        }

        fclose($fp);
        return $complete_user_info_array;
    }

}

// function to display products
if (!function_exists('display_products')) {

    function display_products($products_to_display, $quantities = array()) {
        global $errors;
        ?>
        <table border="1">
            <tbody>
                <tr>
                    <td style="text-align: center;"><b><big>Product</big></b></td>
                    <td style="text-align: center;"><b><big>Brand</big></b></td>
                    <td style="text-align: center;"><b><big>Price(each)</big></b></td>
                    <td style="text-align: center;"><b><big>Quantity Desired</big></b></td>
                </tr>
                <?php

                // quantities are 0 unless already inputted, if quantities previously were inputted, return the values. 
                // input boxes
                for ($i = 0; $i < count($products_to_display); $i++) {
                    if (empty($quantities)) {
                        $qty = isset($_POST['quantity'][$i]) ? $_POST['quantity'][$i] : 0;
                        $qty_str = "<input type=text size=3 maxlength=3 name='quantity[$i]' value='$qty'>";
                        if (isset($errors['quantity'][$i])) {
                            $qty_str .= "<span style='font-style:italic;font-size:8px;color:red;'>{$errors['quantity'][$i]}</span>";
                        }
                    } else {
                        $qty_str = $quantities[$i];
                    }
                    // loop to print out table of photo of board, name of the brand, price, and quantity selected
                    printf('
                <tr>
                    <td><img alt="Small" id="lightboxImage"
                             style="width: 119px; height: 88px; bgcolor="#cccccc;"
                             src="http://imgur.com/%s"
                             height="300" width="300"></td>
                    <td style="text-align: center;">%s</td> 
                    <td style="text-align: center;">$%.2f</td>
                    <td style="text-align: center;">' . $qty_str . '</td>
                </tr>
                        ', $products_to_display[$i]['item'], $products_to_display[$i]['board'], $products_to_display[$i]['price']);
                }
                ?>
                <tr><td colspan="4" style="text-align: right; border: none">
                        <input type="submit" value="Purchase"></td></tr>

            </tbody>
        </table>
    <?php

    }

}

if (!function_exists('save_hidden_qty')) {
    function save_hidden_qty($the_quantities){
        foreach ($the_quantities as $key=>$value){
            print "<input type='hidden' name='quantity[$key]' value='$value'>\n";
        }
    }
}

?> 

Can anyone help me out?

Php / json_encode NULL issues

$
0
0

Good morning,

 

I am trying to convert a mssql query into json format so that I can then later pass this through google's visualisation api. The query and encoding seems to be working but the encode returns NULL.

 

I have checked the normal gotcha's of making sure its utf8 encoded and that I have used a version of PHP that has the encode (using php 5.3.19).

 

Can any one help me with getting the encode to work.

 

PHP CODE:

 

 

<?php
//connection and database details (known to be working)
 
if( $conn ) {
     echo "Connection established.<br><br>";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
 
$query = "SELECT * FROM tblProducts";
$result = sqlsrv_query( $conn, $query);
while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_NUMERIC) );
 
 
$arr = array($result);
$encodedarray = array_map(utf8_encode, $arr);
 
echo json_encode($encodedarray);
 
sqlsrv_close( $conn);
?>
 
 
 
When I run this code on the server it comes back with:
 
Connection established.

[null]
 
Has anyone got any ideas of getting this to work?
 
Thanks
 
Kris 

Query in php not working for Danish characters

$
0
0

Hi, I'm using $clid = mysqli_real_escape_string ($dbcon, $_POST['clid']); but have come across an issue with certain characters, for example:

"bekæ" actually searches for "bekæ", hence no records. The records cannot be changed in the table, so is there a way to fix this?

 

PHP Command Line Interface - Adding Breaks / Readability Issue

$
0
0

44592c100a0c4de9e5ee4e8315aa718b.png

 

No idea how to add a new line so it's easier to read in the terminal. Debugging this way is absolutely horrible.

Email report -I have the report but I don't know where to start

$
0
0

I need to email this report but I don't know where to start

I have included the report code.

<html>
<head>
<title>Customer Load Report</title>
</head>
<body>
<h1>Customer Load Report</h1>

<?php
$custid=$_POST["Cust_ID"];
$connect =odbc_connect("removed");
if(!$connect) {
	exit("Connection Failed: " . $connect);
}

$sql="SELECT m1_DC.dbo.organizationlocations.cmlName
	,m1_DC.dbo.SalesOrders.OMPSHIPPINGMETHODID
	,m1_DC.dbo.SalesOrders.UOMPTRUCKNUMBER
	,m1_DC.dbo.SalesOrders.ompCustomerPO
	,m1_DC.dbo.SalesOrders.UOMPTOTALBOXCOUNT
	,m1_DC.dbo.SalesOrders.UOMPVOLUMETOTAL
	,m1_DC.dbo.organizationlocations.CMLADDRESSLINE1
	,m1_DC.dbo.organizationlocations.CMLADDRESSLINE2
	,m1_DC.dbo.organizationlocations.CMLCITY
	,m1_DC.dbo.organizationlocations.CMLSTATE
	 ,m1_DC.dbo.organizationlocations.CMLPOSTCODE
	,m1_DC.dbo.SalesOrders.OMPREQUESTEDSHIPDATE
	,m1_DC.dbo.SalesOrders.ompSalesOrderID
	,convert(varchar(10),m1_DC.dbo.SalesOrders.ompRequestedShipDate,110) as ShipDate
FROM m1_DC.dbo.SalesOrders
LEFT OUTER JOIN m1_DC.dbo.organizationlocations ON ompshiporganizationid = cmlorganizationid
	AND ompshiplocationid = cmllocationid
WHERE 
	m1_DC.dbo.SalesOrders.ompCustomerOrganizationID='$custid' and (ompOrderDate>=CONVERT(VARCHAR(10),DATEADD(day, -7, getdate()),110) or
	convert(varchar(10),m1_DC.dbo.SalesOrders.ompRequestedShipDate,110) >=getdate())";

	
	

$result =odbc_exec($connect,$sql);
if(!$result){
exit("Error in SQL");
}



$data= '';	

while (odbc_fetch_row($result)) {
		$cmlName=odbc_result($result,"cmlName");
	$ompCustomerPO=odbc_result($result,"ompCustomerPO");
	$UOMPTOTALBOXCOUNT=odbc_result($result,"UOMPTOTALBOXCOUNT");
	$UOMPVOLUMETOTAL=odbc_result($result,"UOMPVOLUMETOTAL");
	$CMLADDRESSLINE1=odbc_result($result,"CMLADDRESSLINE1");
	$CMLADDRESSLINE2=odbc_result($result,"CMLADDRESSLINE2");
	$CMLCITY=odbc_result($result,"CMLCITY");
	$CMLSTATE=odbc_result($result,"CMLSTATE");
	$CMLPOSTCODE=odbc_result($result,"CMLPOSTCODE");
	$ompSalesOrderID=odbc_result($result,"ompSalesOrderID");
	$ompRequestedShipDate=odbc_result($result,"ShipDate");

	





  	$data .=  "<td style='text-align:left' >     $ompCustomerPO</td>";
  	$data .=  "<td style='text-align:left'>     $UOMPTOTALBOXCOUNT</td>";
  	$data .=  "<td style='text-align:left'>	  $UOMPVOLUMETOTAL</td>";
  	$data .=  "<td style='text-align:left'>	  $CMLADDRESSLINE1</td>";
  	$data .=  "<td style='text-align:left'>	  $CMLADDRESSLINE2</td>";
  	$data .=  "<td style='text-align:left'>	  $CMLCITY</td>";
  	$data .=  "<td style='text-align:left'>	  $CMLSTATE</td>";
  	$data .=  "<td style='text-align:left'>	  $CMLPOSTCODE</td>";
  	$data .=  "<td style='text-align:left'>     $ompSalesOrderID</td>";
  		$data .=  "<td style='text-align:left'>    $ompRequestedShipDate</td></tr>";

	}
   echo "<table><tr>";
   echo "<th>PO</th>";
	echo "<th>Box_count</th>";
	echo "<th>Cubes</th>";
	echo "<th>ADDRESSLINE</th>";
	echo "<th>ADDRESS2</th>";
	echo "<th>CITY</th>";
	echo "<th>STATE</th>";
	echo "<th>ZIP</th>";
	echo "<th>Order_ID</th>";
	echo "<th>Ship Date</th></tr>";
	echo $data;
  

odbc_close($connect);
?>
</body>
</html>

Undefined index Error

$
0
0

I get this error 

Notice: Undefined index: loggedIn in C:\xampp\htdocs\Login\web_dir\index.php on line 6

The code for line 6 is 

if($_SESSION['loggedIn'] !== 1) {

server unable to resolve simple php-info - file. bug or feature

$
0
0

hello dear PHP-experts



have set up a server at localhost
with phpMyAdmin

i get back the site " it works " if i type in localhost

i get access to the phpMyAdmin if i  type localhost/phpMyAdmin


so  far so good

now i  wanted to go ahead: i ve uploaded a file called php_info.php to the htdocs folder.

i changed permissions accordingly. (see below)


linux-c5sz:/srv/www/htdocs # ls -l
insgesamt 28
-rwxrwxrwx 1 root   root   302 13. Mär 2006  favicon.ico
drwxrwxrwx 2 root   root  4096  6. Nov 2013  gif
-rwxrwxrwx 1 root   root    45 11. Jun 2007  index.html
-rwxrwxrwx 1 root   root  2356 28. Sep 2013  info2html.css
-rwxrwxrwx 1 martin users  188  3. Dez 19:07 php_info.php
drwxrwxrwx 6 root   root  4096  3. Nov 17:40 phpMyAdmin
-rwxrwxrwx 1 root   root    26 13. Okt 15:32 robots.txt
linux-c5sz:/srv/www/htdocs #

what makes me wonder is - i cannot see the content of the file of php_info.php - why is this so


see below




 

<?php

// Zeigt alle Informationen (Standardwert ist INFO_ALL)
phpinfo();

// Zeigt nur die Modul-Informationen.
// phpinfo(8) führt zum gleichen Ergebnis.
phpinfo(INFO_MODULES);

?>

well i wonder why i cannt see any information in thebrowser

 

is this a bug ?

How to incorporate Attack Speed with PHP + Websockets

$
0
0

Since I got my websocket PHP server running nicely with my MYSQL, I can now have some fun :)

 

Attack speed is very simple, but I need your help with the unixtimestamp.

 

For example, There is a field name called "last_attack" and each time a user attacks a mob and a skill was performed; it will be updated with:

time();

Then I disable the attack button for 2 seconds client side, but I also check that value against time() serverside as well.

 

Now let's say the user's attack speed is 1.30%

 

I want to make that Attack Speed check, to check it dynamically.

 

It should now check only if the attack was less than 1.7 seconds ago instead of 2 seconds. How do I split up the unixtimestamp to work with percents?

while is only showing one record

$
0
0

Hi guys

 

I am using the code below to show distinct months using one query then for each month I am trying to show a list of fixtures for the month, the problem I have is only one month is showing.

 

where am i going wrong?

 

<?php
//find distinct months
$sql="SELECT DISTINCT MONTH( match_date ) AS
MONTH FROM tbl_fixtures
WHERE season_id =$current_season
UNION SELECT DISTINCT MONTH( match_date ) AS
MONTH FROM tbl_gp
WHERE season_id =$current_season";
$result=mysqli_query($dbConn, $sql);
if(mysqli_num_rows($result)>0){
    while($row=mysqli_fetch_assoc($result)){
        $month=$row['MONTH'];
        echo '<div class="fixtureMonth">
              <h2>'.$months[$month].'</h2>
              </div>
              <div class="fixtures">';
              //find fixtures for month
        $sql="SELECT Opposition, match_date, competition, tbl_clubs.club_name AS club, image, HomeAway, team, opposition_points, points
        FROM tbl_fixtures
        INNER JOIN tbl_clubs ON tbl_fixtures.club = tbl_clubs.club_id
        WHERE season_id =$current_season and MONTH(match_date)=$month
        UNION SELECT Opposition, match_date, \"SGP\" AS competition, \"SGP\" AS club, \"sgp.png\" AS image,  \"\" as HomeAway, \"\" as team, \"\" as opposition_points, points
        FROM tbl_gp
        WHERE season_id =$current_season and MONTH(match_date)=$month
        ORDER BY match_date";
        $result=mysqli_query($dbConn,$sql)or die(mysqli_error($dbConn));
        if(mysqli_num_rows($result)==0){
            echo no_fixtures_found;
        }
        else{
            echo '<table class="fixturesTable">';
            while($row=mysqli_fetch_assoc($result)){
                echo'<tr>
    <td>'.date("d-M-Y",strtotime($row['match_date'])).'</td>
          <td><img src="'.$shopConfig['url'].'images/'.$row['image'].'"/></td>
          <td>'.$row['Opposition'].'</td>
          <td>'.$row['HomeAway'].'</td>
          <td><b>'.$row['team'].'</b>-'.$row['opposition_points'].'</td>
          <td>'.$row['team'].'</td>
          </tr>';
            }
            echo '</table>';
        }
        echo '</div>';
    }
    
}
?>

Can you read in an image from a file into html without refreshing a webpage?

$
0
0

I am using a photo scrolling css animation technique

I'm not sure as far as CPU usage (on server)/(on client) and bandwith usage if loading one picture at a time to scroll versus having a line up "pre-exist" which even then, I would only have five images at a time but what if that is multiplied by 10000 users 

 

Anyway, the current knowledge I have, I have a css animation property that takes in a photo and animates from 0% to 100% keyframe based on margins to make the scrolling happen 

 

In the HTML section there is a list of photos, I would like there to be one line of code that is like a receiver that takes in or reads in arbitrary photo locations and puts that next to be scrolled without interrupting the main animation sequence which I'm not sure if there would be interruption. Anyway I don't know if that is possible. If someone can point out that this idea is obviously flawed then that would be great.

 

This isn't my ultimate solution, I have yet to see others, I'm just trying to minimize loading and lag 

 

The other problem I have that is interesting is that I want the scrolling to stop when a person hovers over an image, and then resume... I have gotten this to work but only on one image... this is probably a matter of listing out all the key parts of the problem and seeing the solution but 

 

When I had a list of photos that were scrolling together, I could get the whole animation to stop when hovering over the first photo and then take me somewhere (all the photos have working href's) but the animation would not stop if I hovered over  any photos after the first. The animation would keep going 

 

So I tried to animate each picture independently and that was just a cluster **** 

 

Still working on that 

 

If someone could point me in the right direction on the main problem of reading in photos live to work with css animation, that would be great. 

plz help with json decoded object.

$
0
0
$m=json_decode($html);
print_r($m);
stdClass Object ( [requestGuid] => [orderId] => [statusCode] => SUCCESS [statusMessage] => SUCCESS [response] => stdClass Object ( [amount] => 100 [currencyCode] => INR [status] => 1 [message] => ACTIVE [ownerGuid] => 7898980 [walletType] => USER [ssoId] => 9op09 [txnPinRequired] => [otpPinRequired] => ) [metadata] => ) 

this is json decoded object   and want to get property of  amount .plz help me

Viewing all 13200 articles
Browse latest View live